Skip to content

Commit e0eb6ed

Browse files
committed
Fix asn.c and asn_public.h style issues from PR review
1 parent c9357de commit e0eb6ed

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

wolfcrypt/src/asn.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32013,7 +32013,7 @@ static int InternalSignCb(const byte* in, word32 inLen,
3201332013
byte* out, word32* outLen, int sigAlgo, int keyType, void* ctx)
3201432014
{
3201532015
InternalSignCtx* signCtx = (InternalSignCtx*)ctx;
32016-
int ret = ALGO_ID_E;
32016+
int ret = WC_NO_ERR_TRACE(ALGO_ID_E);
3201732017

3201832018
(void)sigAlgo; /* Algorithm determined by key type */
3201932019

@@ -32086,7 +32086,7 @@ static int InternalSignCb(const byte* in, word32 inLen,
3208632086
#endif /* WOLFSSL_CERT_GEN || WOLFSSL_CERT_REQ */
3208732087

3208832088

32089-
/* Make signature from buffer (sz), write to sig (sigSz)
32089+
/* Make signature from buffer (sz), write to sig (sigSz)
3209032090
* This function now uses MakeSignatureCb internally for RSA and ECC,
3209132091
* eliminating code duplication. Ed25519, Ed448, and post-quantum algorithms
3209232092
* still use direct signing since they sign messages, not hashes. */
@@ -32097,7 +32097,7 @@ static int MakeSignature(CertSignCtx* certSignCtx, const byte* buf, word32 sz,
3209732097
word32 sigAlgoType, void* heap)
3209832098
{
3209932099
int ret = 0;
32100-
32100+
3210132101
(void)buf;
3210232102
(void)sz;
3210332103
(void)sig;
@@ -32116,13 +32116,13 @@ static int MakeSignature(CertSignCtx* certSignCtx, const byte* buf, word32 sz,
3211632116
if (rsaKey || eccKey) {
3211732117
InternalSignCtx signCtx;
3211832118
int keyType;
32119-
32119+
3212032120
/* Setup internal signing context */
3212132121
XMEMSET(&signCtx, 0, sizeof(signCtx));
3212232122
signCtx.rsaKey = rsaKey;
3212332123
signCtx.eccKey = eccKey;
3212432124
signCtx.rng = rng;
32125-
32125+
3212632126
/* Determine key type */
3212732127
if (rsaKey) {
3212832128
keyType = RSA_TYPE;
@@ -32134,7 +32134,7 @@ static int MakeSignature(CertSignCtx* certSignCtx, const byte* buf, word32 sz,
3213432134
ret = BAD_FUNC_ARG;
3213532135
goto exit_ms;
3213632136
}
32137-
32137+
3213832138
/* Use unified callback path */
3213932139
ret = MakeSignatureCb(certSignCtx, buf, sz, sig, sigSz,
3214032140
(int)sigAlgoType, keyType,

wolfssl/wolfcrypt/asn_public.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ typedef int (wc_pem_password_cb)(char* passwd, int sz, int rw, void* userdata);
266266
word32* outLen, int sigAlgo, int keyType, void* ctx)
267267
{
268268
MySignCtx* myCtx = (MySignCtx*)ctx;
269-
// Perform signing using external device/HSM
270269
return myDevice_Sign(myCtx->device, in, inLen, out, outLen);
271270
}
272271
\endcode
@@ -598,14 +597,10 @@ WOLFSSL_API int wc_SignCert(int requestSz, int sType, byte* buf, word32 buffSz,
598597
int derSz;
599598
MySignCtx myCtx;
600599
601-
// Initialize cert and set subject, etc.
602600
wc_InitCert(&cert);
603-
// ... set cert fields ...
604601
605-
// Make certificate body
606602
derSz = wc_MakeCert(&cert, derBuf, sizeof(derBuf), NULL, NULL, &rng);
607603
608-
// Sign using callback
609604
derSz = wc_SignCert_cb(cert.bodySz, cert.sigType, derBuf, sizeof(derBuf),
610605
RSA_TYPE, mySignCallback, &myCtx, &rng);
611606
if (derSz > 0) {

0 commit comments

Comments
 (0)