diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2023-05-19 09:31:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 09:31:07 +0300 |
commit | 7e2430cb0217eeb3a1d442b0709174ab54738dac (patch) | |
tree | 13d8ec6259865594cdbb748c94c93f826fbfb92a | |
parent | 79d1cba59e00947974f0a41cc18a8b9c16dfcf1f (diff) |
Free context when establishing ACLK connection (#15073)
Free context
-rw-r--r-- | aclk/aclk_otp.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c index 391313ffe7..66d751be6c 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); |