Browse Source

Fix #2215

pull/2218/head
Max Lv 6 years ago
parent
commit
569570cfa9
2 changed files with 2 additions and 1 deletions
  1. 2
      src/aead.c
  2. 1
      src/utils.c

2
src/aead.c

@ -331,7 +331,7 @@ aead_cipher_ctx_init(cipher_ctx_t *cipher_ctx, int method, int enc)
const cipher_kt_t *cipher = aead_get_cipher_type(method); const cipher_kt_t *cipher = aead_get_cipher_type(method);
if (method == AES256GCM && crypto_aead_aes256gcm_is_available()) { if (method == AES256GCM && crypto_aead_aes256gcm_is_available()) {
cipher_ctx->aes256gcm_ctx = ss_malloc(sizeof(aes256gcm_ctx));
cipher_ctx->aes256gcm_ctx = ss_align(sizeof(aes256gcm_ctx));
memset(cipher_ctx->aes256gcm_ctx, 0, sizeof(aes256gcm_ctx)); memset(cipher_ctx->aes256gcm_ctx, 0, sizeof(aes256gcm_ctx));
} else { } else {
cipher_ctx->aes256gcm_ctx = NULL; cipher_ctx->aes256gcm_ctx = NULL;

1
src/utils.c

@ -246,6 +246,7 @@ ss_align(size_t size)
int err; int err;
void *tmp = NULL; void *tmp = NULL;
#ifdef HAVE_POSIX_MEMALIGN #ifdef HAVE_POSIX_MEMALIGN
/* ensure 16 byte alignment */
err = posix_memalign(&tmp, sizeof(void *), size); err = posix_memalign(&tmp, sizeof(void *), size);
#else #else
err = -1; err = -1;

Loading…
Cancel
Save