Skip to contentSkip to conversation

crypto/asymmetric_keys/asym_tpm.c:657:8-14: ERROR: referenc

PATCH Denis Kenzior 2 participants 3 messages Aug 4, 2018 – Aug 8, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Julia, David,

Quoted 3 lines · Julia Lawall

I can't guess what was intended here, but the kfree on line 652 followed by the memcpy on line 657 looks like a problem.

Right. Somehow I missed a goto here. This should look like this:

- if (r)

+       if (r) {
                 kfree(digest);

- else if (out_digest_len)
+ goto error_free_req;
+ } else if (out_digest_len)

I can fix this in the next version, or if David wants to silently amend that is fine as well.

However, I'd really like to get some feedback on this first regarding whether the hash OIDs are desired to be shared somehow and whether there's a problem in pkcs1pad_sign.

Regards,
-Denis

maintainer
#1 lore raw
Quoted 2 lines · Denis Kenzior

I can fix this in the next version, or if David wants to silently amend that is fine as well.

Is the attached change right?

David
---

crypto/asymmetric_keys/asym_tpm.c +5 -3
index a8cc8fc7e3fb..3753c2f1c4e9 100644
@@ -647,10 +647,12 @@ static uint8_t *get_digest(const void *in, size_t in_len,
 				   crypto_req_done, &cwait);
 
 	r = crypto_wait_req(crypto_ahash_digest(req), &cwait);
-
-	if (r)
+	if (r) {
 		kfree(digest);
-	else if (out_digest_len)
+		goto error_free_req;
+	}
+
+	if (out_digest_len)
 		*out_digest_len = digest_len;
 
 	/* Copy the ASN.1 template before the digest */
#2 lore raw
In reply to Denis Kenzior

Hi David,

Quoted 7 lines · David Howells
Quoted 2 lines · Denis Kenzior

I can fix this in the next version, or if David wants to silently amend that is fine as well.

Is the attached change right?

Looks good to me.

Regards,
-Denis