Merge "Release the memory allocated in the algorithm to prevent memory leaks"
diff --git a/identity/aidl/default/EicOpsImpl.cc b/identity/aidl/default/EicOpsImpl.cc
index 3fd9f1d..b6d324f 100644
--- a/identity/aidl/default/EicOpsImpl.cc
+++ b/identity/aidl/default/EicOpsImpl.cc
@@ -100,6 +100,7 @@
if (size != EIC_SHA256_DIGEST_SIZE) {
LOG(ERROR) << "Expected 32 bytes from HMAC_Final, got " << size;
}
+ HMAC_CTX_cleanup(realCtx);
}
void eicOpsSha256Init(EicSha256Ctx* ctx) {
@@ -394,14 +395,17 @@
}
if (BN_bn2binpad(sig->r, signature, 32) != 32) {
+ ECDSA_SIG_free(sig);
eicDebug("Error encoding r");
return false;
}
if (BN_bn2binpad(sig->s, signature + 32, 32) != 32) {
+ ECDSA_SIG_free(sig);
eicDebug("Error encoding s");
return false;
}
+ ECDSA_SIG_free(sig);
return true;
}