diff options
author | Vitaly Lavrov <vel21ripn@gmail.com> | 2022-03-05 13:44:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-05 11:44:21 +0100 |
commit | 438f04066bb6333dcb219205a09501ee50fdd993 (patch) | |
tree | c1d37aacd98f439e3e6b86303c117a1fdeb33472 /src/lib/third_party | |
parent | a173d3e98f78a09db6df503ed853212319d29d45 (diff) |
Fixed a bug for BE architectures (#1478)
Fixed a bug in the internal implementation of libgcrypt for bigendian architectures
Diffstat (limited to 'src/lib/third_party')
-rw-r--r-- | src/lib/third_party/include/gcrypt/common.h | 4 | ||||
-rw-r--r-- | src/lib/third_party/src/gcrypt/cipher_wrap.c | 18 |
2 files changed, 2 insertions, 20 deletions
diff --git a/src/lib/third_party/include/gcrypt/common.h b/src/lib/third_party/include/gcrypt/common.h index d25031bb5..ba6a654ab 100644 --- a/src/lib/third_party/include/gcrypt/common.h +++ b/src/lib/third_party/include/gcrypt/common.h @@ -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 diff --git a/src/lib/third_party/src/gcrypt/cipher_wrap.c b/src/lib/third_party/src/gcrypt/cipher_wrap.c index 6db209cba..5e3e679aa 100644 --- a/src/lib/third_party/src/gcrypt/cipher_wrap.c +++ b/src/lib/third_party/src/gcrypt/cipher_wrap.c @@ -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 ); |