Skip to content

Commit

Permalink
[FIO extras] drivers: crypto: se050: import ecc/rsa keys fix
Browse files Browse the repository at this point in the history
Fix a broken sanity check - the error could never trigger but still the
code was not correct as it could be writing to a null pointer.

Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
  • Loading branch information
ldts committed Jan 5, 2024
1 parent 33d9bf3 commit 9a951e8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/drivers/crypto/se050/adaptors/utils/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,20 @@ sss_status_t se050_oid_from_key(struct bignum **p, uint32_t *oid)
{
char label[12] = { '\0' };

if (!*p || !oid) {
*oid = 0;
if (!oid)
return kStatus_SSS_Success;

/* assume it is not an SE_ request */
*oid = 0;

if (!*p)
return kStatus_SSS_Success;
}

/* label is 11 bytes guaranteed by PKCS#11 TA */
memcpy(label, *p, 11);

if (memcmp(label, "SE_", 3)) {
/* not an SE_ request */
*oid = 0;
if (memcmp(label, "SE_", 3))
return kStatus_SSS_Success;
}

free(*p);

Expand Down

0 comments on commit 9a951e8

Please sign in to comment.