Skip to content

Commit 2534d61

Browse files
committed
Check wc_AesInit return value
1 parent 16bb8f6 commit 2534d61

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

wolfcrypt/ciphers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,9 @@ def __init__(self, key, IV, tag_bytes=16):
408408
raise ValueError("key must be %s in length, not %d" %
409409
(self._key_sizes, len(key)))
410410
self._native_object = _ffi.new(self._native_type)
411-
_lib.wc_AesInit(self._native_object, _ffi.NULL, -2)
411+
ret = _lib.wc_AesInit(self._native_object, _ffi.NULL, -2)
412+
if ret < 0:
413+
raise WolfCryptError("AES init error (%d)" % ret)
412414
ret = _lib.wc_AesGcmInit(self._native_object, key, len(key), IV, len(IV))
413415
if ret < 0:
414416
raise WolfCryptError("Init error (%d)" % ret)

0 commit comments

Comments
 (0)