mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 21:25:06 -05:00
siv: add more assertions
Make sure the returned tag and key lengths are sane.
This commit is contained in:
@@ -69,6 +69,8 @@ SIV_DestroyInstance(SIV_Instance instance)
|
||||
int
|
||||
SIV_GetKeyLength(SIV_Algorithm algorithm)
|
||||
{
|
||||
assert(32 <= SIV_MAX_KEY_LENGTH);
|
||||
|
||||
if (algorithm == AEAD_AES_SIV_CMAC_256)
|
||||
return 32;
|
||||
return 0;
|
||||
@@ -92,6 +94,8 @@ SIV_SetKey(SIV_Instance instance, const unsigned char *key, int length)
|
||||
int
|
||||
SIV_GetTagLength(SIV_Instance instance)
|
||||
{
|
||||
assert(SIV_DIGEST_SIZE <= SIV_MAX_TAG_LENGTH);
|
||||
|
||||
return SIV_DIGEST_SIZE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user