Browse Source

Fix a compilation issue for GCC < 5.0

pull/2181/head
Max Lv 6 years ago
parent
commit
ed7c1e64af
1 changed files with 5 additions and 3 deletions
  1. 8
      src/aead.c

8
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;

Loading…
Cancel
Save