commit 36d736adf16ec63c3703ec02915e0cf77e168691
parent 89e9737ae3c83768237e160f9b753f107f3192f0
Author: sin <sin@2f30.org>
Date: Thu, 31 Mar 2016 17:55:13 +0100
no need to do this in two steps
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/stun.c b/stun.c
@@ -268,10 +268,7 @@ aesenc(EVP_CIPHER_CTX *ctx, unsigned char *ct, unsigned char *pt, int ptlen,
{
int len, flen;
- if (EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL) != 1)
- logerr("EVP_EncryptInit_ex failed");
-
- if (EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv) != 1)
+ if (EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, key, iv) != 1)
logerr("EVP_EncryptInit_ex failed");
if (EVP_EncryptUpdate(ctx, NULL, &len, aad, aadlen) != 1)
@@ -296,10 +293,7 @@ aesdec(EVP_CIPHER_CTX *ctx, unsigned char *pt, unsigned char *ct, int ctlen,
{
int len, flen;
- if (EVP_DecryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, NULL, NULL) != 1)
- logerr("EVP_DecryptInit_ex failed");
-
- if (EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv) != 1)
+ if (EVP_DecryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, key, iv) != 1)
logerr("EVP_DecryptInit_ex failed");
if (EVP_DecryptUpdate(ctx, NULL, &len, aad, aadlen) != 1)