mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Make gcm counter increment more efficient
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
174eeff235
commit
46697da5b3
@ -401,12 +401,9 @@ int mbedtls_gcm_update_ad(mbedtls_gcm_context *ctx,
|
|||||||
/* Increment the counter. */
|
/* Increment the counter. */
|
||||||
static void gcm_incr(unsigned char y[16])
|
static void gcm_incr(unsigned char y[16])
|
||||||
{
|
{
|
||||||
size_t i;
|
uint32_t x = MBEDTLS_GET_UINT32_BE(y, 12);
|
||||||
for (i = 16; i > 12; i--) {
|
x++;
|
||||||
if (++y[i - 1] != 0) {
|
MBEDTLS_PUT_UINT32_BE(x, y, 12);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate and apply the encryption mask. Process use_len bytes of data,
|
/* Calculate and apply the encryption mask. Process use_len bytes of data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user