mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:55:07 -05:00
siv: return error if key is not set
Avoid encryption or decryption using uninitialized data, or causing a crash, if a key was not set for the SIV instance.
This commit is contained in:
@@ -204,6 +204,9 @@ SIV_Encrypt(SIV_Instance instance,
|
||||
{
|
||||
size_t clen = ciphertext_length;
|
||||
|
||||
if (!instance->cipher)
|
||||
return 0;
|
||||
|
||||
if (nonce_length < 1 || assoc_length < 0 ||
|
||||
plaintext_length < 0 || ciphertext_length < 0)
|
||||
return 0;
|
||||
@@ -232,6 +235,9 @@ SIV_Decrypt(SIV_Instance instance,
|
||||
{
|
||||
size_t plen = plaintext_length;
|
||||
|
||||
if (!instance->cipher)
|
||||
return 0;
|
||||
|
||||
if (nonce_length < 1 || assoc_length < 0 ||
|
||||
plaintext_length < 0 || ciphertext_length < 0)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user