Skip to content

Commit 8d80db4

Browse files
Pass error return value to exception
If the size return value is negative, an error is detected. In that case raise an exception. Even though a zero is not a valid size value, it would indicate success in other cases. But a 0 return value would not make much sense as a return value for this function.
1 parent 0ac207d commit 8d80db4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wolfcrypt/ciphers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,8 @@ def make_key(cls, size, rng=None, hash_type=None):
873873

874874
rsa.output_size = _lib.wc_RsaEncryptSize(rsa.native_object)
875875
rsa.size = size
876-
if rsa.output_size <= 0: # pragma: no cover
877-
raise WolfCryptApiError("Invalid key size error", ret)
876+
if rsa.output_size < 0: # pragma: no cover
877+
raise WolfCryptApiError("Invalid key size error", rsa.output_size)
878878

879879
# Retain RNG reference defensively.
880880
rsa._rng = rng

0 commit comments

Comments
 (0)