mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 10:48:46 +00:00
chachapoly: adjust parameter order
This module used (len, pointer) while (pointer, len) is more common in the rest of the library, in particular it's what's used in the GCM API that very comparable to it, so switch to (pointer, len) for consistency. Note that the crypt_and_tag() and auth_decrypt() functions were already using the same convention as GCM, so this also increases intra-module consistency.
This commit is contained in:
parent
b1ac5e7842
commit
5ef92d309a
3 changed files with 6 additions and 6 deletions
|
@ -183,8 +183,8 @@ int mbedtls_chachapoly_starts( mbedtls_chachapoly_context *ctx,
|
||||||
* finished, or if the AAD has been finished.
|
* finished, or if the AAD has been finished.
|
||||||
*/
|
*/
|
||||||
int mbedtls_chachapoly_update_aad( mbedtls_chachapoly_context *ctx,
|
int mbedtls_chachapoly_update_aad( mbedtls_chachapoly_context *ctx,
|
||||||
size_t aad_len,
|
const unsigned char *aad,
|
||||||
const unsigned char *aad );
|
size_t aad_len );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Thus function feeds data to be encrypted or decrypted
|
* \brief Thus function feeds data to be encrypted or decrypted
|
||||||
|
|
|
@ -175,8 +175,8 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_chachapoly_update_aad( mbedtls_chachapoly_context *ctx,
|
int mbedtls_chachapoly_update_aad( mbedtls_chachapoly_context *ctx,
|
||||||
size_t aad_len,
|
const unsigned char *aad,
|
||||||
const unsigned char *aad )
|
size_t aad_len )
|
||||||
{
|
{
|
||||||
if ( ctx == NULL )
|
if ( ctx == NULL )
|
||||||
{
|
{
|
||||||
|
@ -311,7 +311,7 @@ int mbedtls_chachapoly_crypt_and_tag( mbedtls_chachapoly_context *ctx,
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
result = mbedtls_chachapoly_update_aad( ctx, aad_len, aad );
|
result = mbedtls_chachapoly_update_aad( ctx, aad, aad_len );
|
||||||
if ( result != 0 )
|
if ( result != 0 )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
|
||||||
return( result );
|
return( result );
|
||||||
|
|
||||||
return mbedtls_chachapoly_update_aad( (mbedtls_chachapoly_context*) ctx->cipher_ctx,
|
return mbedtls_chachapoly_update_aad( (mbedtls_chachapoly_context*) ctx->cipher_ctx,
|
||||||
ad_len, ad );
|
ad, ad_len );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue