From 6520f340bbb3088a686d712697b6bfdb5d10baf0 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sun, 12 Feb 2017 20:15:22 +0800 Subject: [PATCH] Fix #1240 --- src/aead.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/aead.c b/src/aead.c index 938760c7..f1c837c8 100644 --- a/src/aead.c +++ b/src/aead.c @@ -313,6 +313,11 @@ aead_cipher_ctx_set_key(cipher_ctx_t *cipher_ctx, int enc) memset(cipher_ctx->nonce, 0, cipher_ctx->cipher->nonce_len); + /* cipher that don't use mbed TLS, just return */ + if (cipher_ctx->cipher->method >= CHACHA20POLY1305IETF) { + return; + } + if (mbedtls_cipher_setkey(cipher_ctx->evp, cipher_ctx->skey, cipher_ctx->cipher->key_len * 8, enc) != 0) { FATAL("Cannot set mbed TLS cipher key");