Skip to content

Commit 1289ea8

Browse files
committed
fixes
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
1 parent 7ccee7d commit 1289ea8

File tree

5 files changed

+283
-191
lines changed

5 files changed

+283
-191
lines changed

doc/dox_comments/header_files/cryptocb.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@
5454
#endif
5555
#if defined(WC_RSA_PSS) && !defined(NO_RSA)
5656
if (info->pk.type == WC_PK_TYPE_RSA_PSS) {
57-
/* RSA-PSS sign/verify (e.g. PKCS#7 SignedData, X.509).
58-
* Uses info->pk.rsa (in/inLen = digest, out/outLen = signature,
59-
* key, rng). With WOLF_CRYPTO_CB_RSA_PAD, info->pk.rsa.padding
60-
* supplies hash and salt length. */
61-
ret = wc_RsaFunction(info->pk.rsa.in, info->pk.rsa.inLen,
62-
info->pk.rsa.out, info->pk.rsa.outLen, info->pk.rsa.type,
57+
// RSA-PSS sign/verify
58+
ret = wc_RsaPSS_Sign_ex(
59+
info->pk.rsa.in, info->pk.rsa.inLen,
60+
info->pk.rsa.out, *info->pk.rsa.outLen,
61+
WC_HASH_TYPE_SHA256, WC_MGF1SHA256,
62+
RSA_PSS_SALT_LEN_DEFAULT,
6363
info->pk.rsa.key, info->pk.rsa.rng);
64-
break;
6564
}
6665
#endif
6766
#ifdef HAVE_ECC

tests/api/test_pkcs7.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,19 +975,20 @@ int test_wc_PKCS7_EncodeSignedData_RSA_PSS(void)
975975

976976
ExpectIntEQ(wc_InitRng(&rng), 0);
977977
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
978-
ExpectIntEQ(wc_PKCS7_Init(pkcs7, HEAP_HINT, INVALID_DEVID), 0);
979978

980979
ExpectTrue((fp = XFOPEN("./certs/rsapss/client-rsapss.der", "rb")) != XBADFILE);
981-
ExpectIntGT(certSz = (word32)XFREAD(cert, 1, sizeof(cert), fp), 0);
982980
if (fp != XBADFILE) {
981+
ExpectIntGT(certSz = (word32)XFREAD(cert, 1, sizeof(cert), fp), 0);
983982
XFCLOSE(fp);
984983
fp = XBADFILE;
985984
}
986985

987986
ExpectTrue((fp = XFOPEN("./certs/rsapss/client-rsapss-priv.der", "rb")) != XBADFILE);
988-
ExpectIntGT(keySz = (word32)XFREAD(key, 1, sizeof(key), fp), 0);
989-
if (fp != XBADFILE)
987+
if (fp != XBADFILE) {
988+
ExpectIntGT(keySz = (word32)XFREAD(key, 1, sizeof(key), fp), 0);
990989
XFCLOSE(fp);
990+
fp = XBADFILE;
991+
}
991992

992993
ExpectIntEQ(wc_PKCS7_InitWithCert(pkcs7, cert, certSz), 0);
993994

0 commit comments

Comments
 (0)