summaryrefslogtreecommitdiffstats
path: root/aclk/aclk_otp.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-14 19:20:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-14 19:20:33 +0000
commit6cf8f2d5174a53f582e61d715edbb88d6e3367cc (patch)
tree78cec0fd8d09c4a6a052461d42f4b2be3af6d396 /aclk/aclk_otp.c
parentAdding upstream version 1.39.1. (diff)
downloadnetdata-6cf8f2d5174a53f582e61d715edbb88d6e3367cc.tar.xz
netdata-6cf8f2d5174a53f582e61d715edbb88d6e3367cc.zip
Adding upstream version 1.40.0.upstream/1.40.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'aclk/aclk_otp.c')
-rw-r--r--aclk/aclk_otp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c
index 391313ff..66d751be 100644
--- a/aclk/aclk_otp.c
+++ b/aclk/aclk_otp.c
@@ -444,11 +444,15 @@ static int private_decrypt(RSA *p_key, unsigned char * enc_data, int data_len, u
if (!ctx)
return 1;
- if (EVP_PKEY_decrypt_init(ctx) <= 0)
+ if (EVP_PKEY_decrypt_init(ctx) <= 0) {
+ EVP_PKEY_CTX_free(ctx);
return 1;
+ }
- if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0)
+ if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0) {
+ EVP_PKEY_CTX_free(ctx);
return 1;
+ }
*decrypted = mallocz(outlen);
@@ -456,6 +460,8 @@ static int private_decrypt(RSA *p_key, unsigned char * enc_data, int data_len, u
result = (int) outlen;
else
result = -1;
+
+ EVP_PKEY_CTX_free(ctx);
#else
*decrypted = mallocz(RSA_size(p_key));
result = RSA_private_decrypt(data_len, enc_data, *decrypted, p_key, RSA_PKCS1_OAEP_PADDING);