Do not return True from MAC verify function on success.
This commit is contained in:
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis128l Python submodule.
|
"""AEGIS-128L"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis128l.py by tools/gen_modules.py!
|
# All modules are generated from aegis128l.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis128l_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis128l_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis128x2 Python submodule.
|
"""AEGIS-128X2"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis128x2.py by tools/gen_modules.py!
|
# All modules are generated from aegis128x2.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis128x2_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis128x2_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis128x4 Python submodule.
|
"""AEGIS-128X4"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis128x4.py by tools/gen_modules.py!
|
# All modules are generated from aegis128x4.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis128x4_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis128x4_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis256 Python submodule.
|
"""AEGIS-256"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis256.py by tools/gen_modules.py!
|
# All modules are generated from aegis256.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis256_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis256_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis256x2 Python submodule.
|
"""AEGIS-256X2"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis256x2.py by tools/gen_modules.py!
|
# All modules are generated from aegis256x2.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis256x2_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis256x2_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
+3
-11
@@ -1,11 +1,4 @@
|
|||||||
"""aegis256x4 Python submodule.
|
"""AEGIS-256X4"""
|
||||||
|
|
||||||
Simplified API: single functions can return newly allocated buffers or write
|
|
||||||
into user-provided buffers via optional `into=` (and `mac_into=` for detached).
|
|
||||||
|
|
||||||
Error return codes from the C library raise ValueError.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# All modules are generated from aegis256x4.py by tools/gen_modules.py!
|
# All modules are generated from aegis256x4.py by tools/gen_modules.py!
|
||||||
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
# DO NOT EDIT OTHER ALGORITHM FILES MANUALLY!
|
||||||
|
|
||||||
@@ -529,14 +522,14 @@ class Mac:
|
|||||||
raise RuntimeError(f"mac final failed: {err_name}")
|
raise RuntimeError(f"mac final failed: {err_name}")
|
||||||
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
return out if into is None else memoryview(out)[:maclen] # type: ignore
|
||||||
|
|
||||||
def verify(self, mac: Buffer) -> bool:
|
def verify(self, mac: Buffer):
|
||||||
"""Verify a tag for the current MAC state.
|
"""Verify a tag for the current MAC state.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mac: The tag to verify (16 or 32 bytes).
|
mac: The tag to verify (16 or 32 bytes).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if verification succeeds.
|
Only if verification succeeds.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If tag length is invalid.
|
TypeError: If tag length is invalid.
|
||||||
@@ -548,7 +541,6 @@ class Mac:
|
|||||||
rc = _lib.aegis256x4_mac_verify(self._st, _ptr(mac), maclen)
|
rc = _lib.aegis256x4_mac_verify(self._st, _ptr(mac), maclen)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise ValueError("mac verification failed")
|
raise ValueError("mac verification failed")
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class Encryptor:
|
class Encryptor:
|
||||||
|
|||||||
Reference in New Issue
Block a user