Fix typos and style issues.

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk 2021-06-22 11:12:28 +02:00
parent 469c9f35f6
commit 939a54cda3
2 changed files with 7 additions and 7 deletions

View file

@ -281,7 +281,7 @@ int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
GCM_VALIDATE_RET( ctx != NULL );
GCM_VALIDATE_RET( iv != NULL );
/* IV is are limited to 2^64 bits, so 2^61 bytes */
/* IV is limited to 2^64 bits, so 2^61 bytes */
/* IV is not allowed to be zero length */
if( iv_len == 0 || (uint64_t) iv_len >> 61 != 0 )
return( MBEDTLS_ERR_GCM_BAD_INPUT );
@ -335,8 +335,8 @@ int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
/**
* mbedtls_gcm_context::buf contains the partial state of the computation of
* the authentication tag.
* mbedtls_gcm_context::::add_len and mbedtls_gcm_context::len indicate
* differenet stages of the computation:
* mbedtls_gcm_context::add_len and mbedtls_gcm_context::len indicate
* different stages of the computation:
* * len == 0 && add_len == 0: initial state
* * len == 0 && add_len % 16 != 0: the first `add_len % 16` bytes have
* a partial block of AD that has been
@ -357,7 +357,7 @@ int mbedtls_gcm_update_ad( mbedtls_gcm_context *ctx,
GCM_VALIDATE_RET( add_len == 0 || add != NULL );
/* IV is are limited to 2^64 bits, so 2^61 bytes */
/* IV is limited to 2^64 bits, so 2^61 bytes */
if( (uint64_t) add_len >> 61 != 0 )
return( MBEDTLS_ERR_GCM_BAD_INPUT );
@ -370,7 +370,7 @@ int mbedtls_gcm_update_ad( mbedtls_gcm_context *ctx,
if( use_len > add_len )
use_len = add_len;
for ( i = 0; i < use_len; i++ )
for( i = 0; i < use_len; i++ )
ctx->buf[i+offset] ^= p[i];
if( offset + use_len == 16 )

View file

@ -79,7 +79,7 @@ static void check_cipher_with_empty_ad( mbedtls_gcm_context *ctx,
TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode,
iv->x, iv->len ) );
for( n = 0; n < ad_update_count; n += 1 )
for( n = 0; n < ad_update_count; n++ )
{
TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, NULL, 0 ) );
}
@ -117,7 +117,7 @@ static void check_empty_cipher_with_ad( mbedtls_gcm_context *ctx,
TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode, iv->x, iv->len ) );
TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x, add->len ) );
for( n = 0; n < cipher_update_count; n += 1 )
for( n = 0; n < cipher_update_count; n++ )
{
olen = 0xdeadbeef;
TEST_EQUAL( 0, mbedtls_gcm_update( ctx, NULL, 0, NULL, 0, &olen ) );