commit ce6fd38f9bdb241e3bec9e4bc00946ebb45f8184
parent 450370aa2e1a5950a93c423c38002ee40cd1a645
Author: sin <sin@2f30.org>
Date: Tue, 29 Mar 2016 11:45:13 +0100
check EVP_* for errors
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/stun.c b/stun.c
@@ -218,7 +218,8 @@ aesenc(EVP_CIPHER_CTX *ectx, unsigned char *ciphertext,
{
int clen;
- EVP_EncryptUpdate(ectx, ciphertext, &clen, plaintext, len);
+ if (EVP_EncryptUpdate(ectx, ciphertext, &clen, plaintext, len) != 1)
+ logerr("EVP_EncryptUpdate failed");
return clen;
}
@@ -228,7 +229,8 @@ aesdec(EVP_CIPHER_CTX *dctx, unsigned char *plaintext,
{
int plen;
- EVP_DecryptUpdate(dctx, plaintext, &plen, ciphertext, len);
+ if (EVP_DecryptUpdate(dctx, plaintext, &plen, ciphertext, len) != 1)
+ logerr("EVP_DecryptUpdate failed");
return plen;
}