From ed7c1e64af90994f09a8d6a18c2c606f0d6b0454 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Thu, 13 Sep 2018 14:20:07 -0700 Subject: [PATCH] Fix a compilation issue for GCC < 5.0 --- src/aead.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/aead.c b/src/aead.c index bc6f71ad..8473010a 100644 --- a/src/aead.c +++ b/src/aead.c @@ -169,7 +169,8 @@ aead_cipher_encrypt(cipher_ctx_t *cipher_ctx, case AES256GCM: // Only AES-256-GCM is supported by libsodium. if (cipher_ctx->aes256gcm_ctx != NULL) { // Use it if availble err = crypto_aead_aes256gcm_encrypt_afternm(c, &long_clen, m, mlen, - ad, adlen, NULL, n, cipher_ctx->aes256gcm_ctx); + ad, adlen, NULL, n, + (const aes256gcm_ctx *)cipher_ctx->aes256gcm_ctx); *clen = (size_t)long_clen; // it's safe to cast 64bit to 32bit length here break; } @@ -217,7 +218,8 @@ aead_cipher_decrypt(cipher_ctx_t *cipher_ctx, case AES256GCM: // Only AES-256-GCM is supported by libsodium. if (cipher_ctx->aes256gcm_ctx != NULL) { // Use it if availble err = crypto_aead_aes256gcm_decrypt_afternm(p, &long_plen, NULL, m, mlen, - ad, adlen, n, cipher_ctx->aes256gcm_ctx); + ad, adlen, n, + (const aes256gcm_ctx *)cipher_ctx->aes256gcm_ctx); *plen = (size_t)long_plen; // it's safe to cast 64bit to 32bit length here break; } @@ -378,7 +380,7 @@ aead_ctx_release(cipher_ctx_t *cipher_ctx) if (cipher_ctx->cipher->method >= CHACHA20POLY1305IETF) { return; } - + if (cipher_ctx->aes256gcm_ctx != NULL) { ss_free(cipher_ctx->aes256gcm_ctx); return;