Skip to content

Commit cf1dcdf

Browse files
committed
Fix for adding signature where OID is not found. Currently our AddSignature function will add without OID, which is invalid. For example RSA is disabled and CSR tries to use CTC_SHA256wRSA. The wc_SignCert_ex will succeed and report success, but the CSR/Cert will be invalid (missing sigType OID).
1 parent 6887281 commit cf1dcdf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29007,6 +29007,12 @@ int AddSignature(byte* buf, int bodySz, const byte* sig, int sigSz,
2900729007
/* Set signature OID and signature data. */
2900829008
SetASN_OID(&dataASN[SIGASN_IDX_SIGALGO_OID], (word32)sigAlgoType,
2900929009
oidSigType);
29010+
if (dataASN[SIGASN_IDX_SIGALGO_OID].data.buffer.data == NULL) {
29011+
/* The OID was not found or compiled in! */
29012+
ret = ASN_UNKNOWN_OID_E;
29013+
}
29014+
}
29015+
if (ret == 0) {
2901029016
if (IsSigAlgoECC((word32)sigAlgoType)) {
2901129017
/* ECDSA and EdDSA doesn't have NULL tagged item. */
2901229018
dataASN[SIGASN_IDX_SIGALGO_NULL].noOut = 1;

0 commit comments

Comments
 (0)