Fix GCM counter reuse
GCM should error out after processing (2^32)-1 blocks / (2^39)-256 bits
This commit is contained in:
parent
6ad5225268
commit
7d418b34b3
@ -49,6 +49,11 @@ int gcm_process(gcm_state *gcm,
|
||||
return err;
|
||||
}
|
||||
|
||||
/* 0xFFFFFFFE0 = ((2^39)-256)/8 */
|
||||
if (gcm->pttotlen / 8 + (ulong64)gcm->buflen + (ulong64)ptlen >= CONST64(0xFFFFFFFE0)) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* in AAD mode? */
|
||||
if (gcm->mode == LTC_GCM_MODE_AAD) {
|
||||
/* let's process the AAD */
|
||||
|
Loading…
Reference in New Issue
Block a user