Skip to content

Commit 008b548

Browse files
committed
Fix incorrect logic in issuer_or_subject_length function
The else clause was attached to the 'if common:' statement instead of checking the total length. This change ensures the TypeError is raised when no certificate information is provided, regardless of which parameter is missing. Fixes #30
1 parent a903056 commit 008b548

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_atecc/adafruit_atecc_asn1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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:
271+
272+
if not tot_len:
272273
raise TypeError("Provided length must be > 0")
273274
return tot_len

0 commit comments

Comments
 (0)