Skip to content

Commit 290a5a9

Browse files
committed
Formatting fixes
1 parent 235bf85 commit 290a5a9

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

tests/api.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19625,7 +19625,7 @@ static int mockSignCb(const byte* in, word32 inLen, byte* out, word32* outLen,
1962519625
int ret = 0;
1962619626
MockSignCtx* signCtx = (MockSignCtx*)ctx;
1962719627

19628-
if (signCtx == NULL || signCtx->key == NULL || in == NULL ||
19628+
if (signCtx == NULL || signCtx->key == NULL || in == NULL ||
1962919629
out == NULL || outLen == NULL) {
1963019630
return BAD_FUNC_ARG;
1963119631
}
@@ -19636,7 +19636,7 @@ static int mockSignCb(const byte* in, word32 inLen, byte* out, word32* outLen,
1963619636
if (keyType == RSA_TYPE) {
1963719637
RsaKey* rsaKey = (RsaKey*)signCtx->key;
1963819638
word32 outSz = *outLen;
19639-
19639+
1964019640
/* For RSA, input is DER-encoded digest (DigestInfo structure) */
1964119641
ret = wc_RsaSSL_Sign(in, inLen, out, outSz, rsaKey, signCtx->rng);
1964219642
if (ret > 0) {
@@ -19650,7 +19650,7 @@ static int mockSignCb(const byte* in, word32 inLen, byte* out, word32* outLen,
1965019650
if (keyType == ECC_TYPE) {
1965119651
ecc_key* eccKey = (ecc_key*)signCtx->key;
1965219652
word32 outSz = *outLen;
19653-
19653+
1965419654
/* For ECC, input is raw hash, sign it (RNG required for ECDSA k value) */
1965519655
ret = wc_ecc_sign_hash(in, inLen, out, &outSz, signCtx->rng, eccKey);
1965619656
if (ret == 0) {
@@ -19705,11 +19705,11 @@ static int test_wc_SignCert_cb(void)
1970519705

1970619706
/* Make cert body */
1970719707
ExpectIntGT(wc_MakeCert(&cert, der, FOURK_BUF, NULL, &key, &rng), 0);
19708-
19708+
1970919709
/* Setup signing context with key and RNG */
1971019710
signCtx.key = &key;
1971119711
signCtx.rng = &rng;
19712-
19712+
1971319713
/* Sign using callback API */
1971419714
ExpectIntGT(derSize = wc_SignCert_cb(cert.bodySz, cert.sigType, der,
1971519715
FOURK_BUF, ECC_TYPE, mockSignCb, &signCtx, &rng), 0);

wolfssl/wolfcrypt/asn_public.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ typedef int (wc_pem_password_cb)(char* passwd, int sz, int rw, void* userdata);
235235

236236
#ifdef WOLFSSL_CERT_SIGN_CB
237237
/*!
238-
\ingroup CertManager
238+
\ingroup CertManager
239239
\brief Callback function type for certificate/CSR signing.
240-
240+
241241
This callback allows external signing implementations (e.g., TPM, HSM)
242242
to sign certificates and CSRs without requiring the crypto callback
243243
infrastructure. This is particularly useful for FIPS compliance where
244244
offloading wolfCrypt operations is not acceptable.
245-
245+
246246
\param in Data to sign. For RSA, this is the DER-encoded digest
247247
(DigestInfo structure with algorithm identifier). For ECC,
248248
this is the raw hash to sign.
@@ -253,20 +253,20 @@ typedef int (wc_pem_password_cb)(char* passwd, int sz, int rw, void* userdata);
253253
CTC_SHA256wECDSA).
254254
\param keyType Key type (RSA_TYPE, ECC_TYPE, etc.).
255255
\param ctx User-provided context pointer for callback state.
256-
256+
257257
\return 0 on success.
258258
\return Negative error code on failure (BAD_FUNC_ARG, MEMORY_E, etc.).
259-
259+
260260
\sa wc_SignCert_cb
261261
\sa wc_SignCert_ex
262-
262+
263263
_Example_
264264
\code
265-
int mySignCallback(const byte* in, word32 inLen, byte* out,
265+
int mySignCallback(const byte* in, word32 inLen, byte* out,
266266
word32* outLen, int sigAlgo, int keyType, void* ctx)
267267
{
268268
MySignCtx* myCtx = (MySignCtx*)ctx;
269-
// Perform signing using external device/HSM
269+
/* Perform signing using external device/HSM */
270270
return myDevice_Sign(myCtx->device, in, inLen, out, outLen);
271271
}
272272
\endcode
@@ -555,20 +555,20 @@ WOLFSSL_API int wc_SignCert_ex(int requestSz, int sType, byte* buf,
555555
WOLFSSL_API int wc_SignCert(int requestSz, int sType, byte* buf, word32 buffSz,
556556
RsaKey* rsaKey, ecc_key* eccKey, WC_RNG* rng);
557557
/*!
558-
\ingroup CertManager
558+
\ingroup CertManager
559559
\brief Sign a certificate or CSR using a callback function.
560-
561-
This function signs a certificate or Certificate Signing Request (CSR)
560+
561+
This function signs a certificate or Certificate Signing Request (CSR)
562562
using a user-provided signing callback. This allows external signing
563563
implementations (e.g., TPM, HSM) without requiring the crypto callback
564564
infrastructure, making it suitable for FIPS-compliant applications.
565-
565+
566566
The function performs the following:
567567
1. Hashes the certificate/CSR body according to the signature algorithm
568568
2. Encodes the hash (RSA) or prepares it for signing (ECC)
569569
3. Calls the user-provided callback to perform the actual signing
570570
4. Encodes the signature into the certificate/CSR DER structure
571-
571+
572572
\param requestSz Size of the certificate body to sign (from Cert.bodySz).
573573
\param sType Signature algorithm type (e.g., CTC_SHA256wRSA,
574574
CTC_SHA256wECDSA).
@@ -578,34 +578,34 @@ WOLFSSL_API int wc_SignCert(int requestSz, int sType, byte* buf, word32 buffSz,
578578
\param signCb User-provided signing callback function.
579579
\param signCtx Context pointer passed to the signing callback.
580580
\param rng Random number generator (may be NULL if not needed).
581-
581+
582582
\return Size of the signed certificate/CSR on success.
583583
\return BAD_FUNC_ARG if signCb is NULL or other parameters are invalid.
584584
\return BUFFER_E if the buffer is too small for the signed certificate.
585585
\return MEMORY_E if memory allocation fails.
586586
\return Negative error code on other failures.
587-
587+
588588
\sa wc_SignCertCb
589589
\sa wc_SignCert
590590
\sa wc_SignCert_ex
591591
\sa wc_MakeCert
592592
\sa wc_MakeCertReq
593-
593+
594594
_Example_
595595
\code
596596
Cert cert;
597597
byte derBuf[4096];
598598
int derSz;
599599
MySignCtx myCtx;
600-
601-
// Initialize cert and set subject, etc.
600+
601+
/* Initialize cert and set subject, etc. */
602602
wc_InitCert(&cert);
603-
// ... set cert fields ...
604-
605-
// Make certificate body
603+
/* ... set cert fields ... */
604+
605+
/* Make certificate body */
606606
derSz = wc_MakeCert(&cert, derBuf, sizeof(derBuf), NULL, NULL, &rng);
607-
608-
// Sign using callback
607+
608+
/* Sign using callback */
609609
derSz = wc_SignCert_cb(cert.bodySz, cert.sigType, derBuf, sizeof(derBuf),
610610
RSA_TYPE, mySignCallback, &myCtx, &rng);
611611
if (derSz > 0) {

0 commit comments

Comments
 (0)