Skip to content

Commit 4868c34

Browse files
csrisoontornjyao1
authored andcommitted
Update OpenSSL ECC wrapper to support SHA3
Signed-off-by: csrisoontorn <[email protected]>
1 parent 883147e commit 4868c34

File tree

1 file changed

+54
-0
lines changed
  • os_stub/cryptlib_openssl/pk

1 file changed

+54
-0
lines changed

os_stub/cryptlib_openssl/pk/ec.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,24 @@ bool libspdm_ecdsa_sign(void *ec_context, size_t hash_nid,
705705
}
706706
break;
707707

708+
case LIBSPDM_CRYPTO_NID_SHA3_256:
709+
if (hash_size != LIBSPDM_SHA3_256_DIGEST_SIZE) {
710+
return false;
711+
}
712+
break;
713+
714+
case LIBSPDM_CRYPTO_NID_SHA3_384:
715+
if (hash_size != LIBSPDM_SHA3_384_DIGEST_SIZE) {
716+
return false;
717+
}
718+
break;
719+
720+
case LIBSPDM_CRYPTO_NID_SHA3_512:
721+
if (hash_size != LIBSPDM_SHA3_512_DIGEST_SIZE) {
722+
return false;
723+
}
724+
break;
725+
708726
default:
709727
return false;
710728
}
@@ -815,6 +833,24 @@ bool libspdm_ecdsa_verify(void *ec_context, size_t hash_nid,
815833
}
816834
break;
817835

836+
case LIBSPDM_CRYPTO_NID_SHA3_256:
837+
if (hash_size != LIBSPDM_SHA3_256_DIGEST_SIZE) {
838+
return false;
839+
}
840+
break;
841+
842+
case LIBSPDM_CRYPTO_NID_SHA3_384:
843+
if (hash_size != LIBSPDM_SHA3_384_DIGEST_SIZE) {
844+
return false;
845+
}
846+
break;
847+
848+
case LIBSPDM_CRYPTO_NID_SHA3_512:
849+
if (hash_size != LIBSPDM_SHA3_512_DIGEST_SIZE) {
850+
return false;
851+
}
852+
break;
853+
818854
default:
819855
return false;
820856
}
@@ -1048,6 +1084,24 @@ bool libspdm_ecdsa_sign_ex(void *ec_context, size_t hash_nid,
10481084
}
10491085
break;
10501086

1087+
case LIBSPDM_CRYPTO_NID_SHA3_256:
1088+
if (hash_size != LIBSPDM_SHA3_256_DIGEST_SIZE) {
1089+
return false;
1090+
}
1091+
break;
1092+
1093+
case LIBSPDM_CRYPTO_NID_SHA3_384:
1094+
if (hash_size != LIBSPDM_SHA3_384_DIGEST_SIZE) {
1095+
return false;
1096+
}
1097+
break;
1098+
1099+
case LIBSPDM_CRYPTO_NID_SHA3_512:
1100+
if (hash_size != LIBSPDM_SHA3_512_DIGEST_SIZE) {
1101+
return false;
1102+
}
1103+
break;
1104+
10511105
default:
10521106
return false;
10531107
}

0 commit comments

Comments
 (0)