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.pull/110/head
parent
0ac207d34a
commit
8d80db4914
|
|
@ -873,8 +873,8 @@ if _lib.RSA_ENABLED:
|
|||
|
||||
rsa.output_size = _lib.wc_RsaEncryptSize(rsa.native_object)
|
||||
rsa.size = size
|
||||
if rsa.output_size <= 0: # pragma: no cover
|
||||
raise WolfCryptApiError("Invalid key size error", ret)
|
||||
if rsa.output_size < 0: # pragma: no cover
|
||||
raise WolfCryptApiError("Invalid key size error", rsa.output_size)
|
||||
|
||||
# Retain RNG reference defensively.
|
||||
rsa._rng = rng
|
||||
|
|
|
|||
Loading…
Reference in New Issue