Fixed a bug for BE architectures (#1478)

Fixed a bug in the internal implementation of libgcrypt for bigendian architectures
This commit is contained in:
Vitaly Lavrov
2022-03-05 11:44:21 +01:00
committed by GitHub
parent a173d3e98f
commit 438f04066b
3 changed files with 3 additions and 20 deletions
+2 -2
View File
@@ -94,9 +94,9 @@
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN)
#define MBEDTLS_GET_UINT32_LE(b,i) htonl(*(uint32_t *) (&(b)[(i)]))
#define MBEDTLS_GET_UINT32_LE(b,i) bswap_32(*(uint32_t *) (&(b)[(i)]))
#define MBEDTLS_GET_UINT32_BE(b,i) (*(uint32_t *) (&(b)[(i)]))
#define MBEDTLS_PUT_UINT32_LE(n,b,i) *(uint32_t *) (&(b)[(i)]) = htonl(n);
#define MBEDTLS_PUT_UINT32_LE(n,b,i) *(uint32_t *) (&(b)[(i)]) = bswap_32(n);
#define MBEDTLS_PUT_UINT64_BE(n,b,i) *(uint64_t *) (&(b)[(i)]) = (n);
#else
-18
View File
@@ -42,24 +42,6 @@ static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key,
return mbedtls_aes_setkey_enc( (mbedtls_aes_context *) ctx, key, key_bitlen );
}
static void * aes_ctx_alloc( void )
{
mbedtls_aes_context *aes = mbedtls_calloc( 1, sizeof( mbedtls_aes_context ) );
if( aes == NULL )
return( NULL );
mbedtls_aes_init( aes );
return( aes );
}
static void aes_ctx_free( void *ctx )
{
mbedtls_aes_free( (mbedtls_aes_context *) ctx );
mbedtls_free( ctx );
}
static void aes_ctx_zero( void *ctx )
{
mbedtls_aes_init( (mbedtls_aes_context *) ctx );
+1
View File
@@ -145,6 +145,7 @@ do {
static void single_encryption2(void) {
gcry_cipher_hd_t handle2;
uint8_t de2_out[sizeof de2_src];
gcry_error_t err;
do {
err = gcry_cipher_open (&handle2, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_GCM,0);