[PATCH] lib: Fix free in key derivation

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Mon, 5 Aug 2019 02:15:50 +0200

The wrong pointer was being free'd in case of a derivation error.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/lib/crypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/crypt.c b/src/lib/crypt.c
index 94f1b50..c9129a6 100644
--- a/src/lib/crypt.c
+++ b/src/lib/crypt.c
@@ -83,7 +83,7 @@ static int __openssl_ecdh_derive_secret(EVP_PKEY * kp,
         return 0;
 
  fail_derive:
-        OPENSSL_free(s);
+        OPENSSL_free(secret);
  fail_ctx:
         EVP_PKEY_CTX_free(ctx);
  fail_new:
-- 
2.22.0


Other related posts:

  • » [PATCH] lib: Fix free in key derivation - Dimitri Staessens