Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions adafruit_atecc/adafruit_atecc_asn1.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def issuer_or_subject_length(
:param str org: Organization of certificate
:param str org_unit: Organization unit of certificate
:param str common: Common data of certificate
:raises: TypeError if return value is 0
:raises: ValueError if return value is <= 0
:return: Total length of provided certificate information.
"""
tot_len = 0
Expand All @@ -268,6 +268,7 @@ def issuer_or_subject_length(
tot_len += 11 + len(org_unit)
if common:
tot_len += 11 + len(common)
else:
raise TypeError("Provided length must be > 0")

if tot_len <= 0:
raise ValueError("Provided length must be > 0")
return tot_len