Skip to content

Commit 9eb8714

Browse files
authored
Merge pull request #40 from akgamerz790/fix-issuer-subject-length-bug
Fix incorrect check in issuer_or_subject_length function
2 parents a903056 + d12e6b1 commit 9eb8714

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adafruit_atecc/adafruit_atecc_asn1.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def issuer_or_subject_length(
252252
:param str org: Organization of certificate
253253
:param str org_unit: Organization unit of certificate
254254
:param str common: Common data of certificate
255-
:raises: TypeError if return value is 0
255+
:raises: ValueError if return value is <= 0
256256
:return: Total length of provided certificate information.
257257
"""
258258
tot_len = 0
@@ -268,6 +268,7 @@ def issuer_or_subject_length(
268268
tot_len += 11 + len(org_unit)
269269
if common:
270270
tot_len += 11 + len(common)
271-
else:
272-
raise TypeError("Provided length must be > 0")
271+
272+
if tot_len <= 0:
273+
raise ValueError("Provided length must be > 0")
273274
return tot_len

0 commit comments

Comments
 (0)