Skip to content

Commit 43c8370

Browse files
committed
fix README command and output logs
1 parent 03afee6 commit 43c8370

File tree

2 files changed

+6
-56
lines changed

2 files changed

+6
-56
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ The following steps demonstrate how to generate keys and certificates for A, B,
169169

170170
1. Create private ECC and ML-DSA keys for A, B, and C
171171
```
172-
wolfssl genkey -ecc -name secp521r1 -out ecc-key-A -output priv -outform PEM
173-
wolfssl genkey -ecc -name secp384r1 -out ecc-key-B -output priv -outform PEM
174-
wolfssl genkey -ecc -name secp256r1 -out ecc-key-C -output priv -outform PEM
175-
wolfssl genkey -ml-dsa -level 5 -out ml-dsa-key-A -output keypair -outform PEM
176-
wolfssl genkey -ml-dsa -level 3 -out ml-dsa-key-B -output keypair -outform PEM
177-
wolfssl genkey -ml-dsa -level 2 -out ml-dsa-key-C -output keypair -outform PEM
172+
wolfssl genkey ecc -name secp521r1 -out ecc-key-A -output priv -outform PEM
173+
wolfssl genkey ecc -name secp384r1 -out ecc-key-B -output priv -outform PEM
174+
wolfssl genkey ecc -name secp256r1 -out ecc-key-C -output priv -outform PEM
175+
wolfssl genkey ml-dsa -level 5 -out ml-dsa-key-A -output keypair -outform PEM
176+
wolfssl genkey ml-dsa -level 3 -out ml-dsa-key-B -output keypair -outform PEM
177+
wolfssl genkey ml-dsa -level 2 -out ml-dsa-key-C -output keypair -outform PEM
178178
```
179179

180180
2. Create a self-signed conventional certificate for A, root CA certificate.

src/x509/clu_x509_sign.c

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,9 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
295295
}
296296
else if (bioSubjKey == NULL && caCert == NULL) {
297297
isCA = 1;
298-
WOLFCLU_LOG(WOLFCLU_L0, "Generating Chimera CA certificate\n");
299298
}
300299
else if (bioSubjKey != NULL && caCert != NULL) {
301300
isCA = 0;
302-
WOLFCLU_LOG(WOLFCLU_L0, "Generating Chimera server certificate\n");
303301
}
304302
else {
305303
wolfCLU_LogError("Error invalid argument wolfCLU_GenChimeraCertSign");
@@ -338,7 +336,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
338336
}
339337
else {
340338
XMEMCPY(caCertBuf, tmpBuf, caCertSz);
341-
WOLFCLU_LOG(WOLFCLU_L0, "Read %d bytes from CA cert", caCertSz);
342339
ret = WOLFCLU_SUCCESS;
343340
}
344341
}
@@ -359,8 +356,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
359356
}
360357
else {
361358
caKeySz = ret;
362-
WOLFCLU_LOG(WOLFCLU_L0, "Read %d bytes from CA key file",
363-
caKeySz);
364359
ret = WOLFCLU_SUCCESS;
365360
}
366361
}
@@ -382,8 +377,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
382377
}
383378
else {
384379
serverKeySz = ret;
385-
WOLFCLU_LOG(WOLFCLU_L0, "Read %d bytes from server key file",
386-
serverKeySz);
387380
ret = WOLFCLU_SUCCESS;
388381
}
389382
}
@@ -395,26 +388,20 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
395388
ret = wc_PemToDer(caKeyBuf, caKeySz, ECC_PRIVATEKEY_TYPE,
396389
&derObj, HEAP_HINT, NULL, NULL);
397390
if (ret < 0) {
398-
WOLFCLU_LOG(WOLFCLU_L0, "Failed to convert EC PRIVATE KEY format, trying PRIVATE KEY format");
399391
/* Try PRIVATE KEY format (PKCS#8) */
400392
ret = wc_PemToDer(caKeyBuf, caKeySz, PRIVATEKEY_TYPE,
401393
&derObj, HEAP_HINT, NULL, NULL);
402394
if (ret != 0) {
403395
wolfCLU_LogError("Error convert pem to der");
404396
ret = WOLFCLU_FATAL_ERROR;
405397
}
406-
else {
407-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully converted CA key to DER format");
408-
}
409398
}
410399

411400
if (ret == 0) {
412401
XMEMSET(caKeyBuf, 0, caKeySz); /* clear original buffer */
413402
caKeySz = derObj->length;
414403
XMEMCPY(caKeyBuf, derObj->buffer, caKeySz);
415404
wc_FreeDer(&derObj);
416-
WOLFCLU_LOG(WOLFCLU_L0, "Converted CA key to DER format; %d bytes",
417-
caKeySz);
418405
ret = WOLFCLU_SUCCESS;
419406
}
420407
}
@@ -439,7 +426,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
439426
ret = WOLFCLU_FATAL_ERROR;
440427
}
441428
else {
442-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully decoded CA private key");
443429
ret = WOLFCLU_SUCCESS;
444430
}
445431
}
@@ -449,27 +435,20 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
449435
ret = wc_PemToDer(serverKeyBuf, serverKeySz, ECC_PRIVATEKEY_TYPE,
450436
&derObj, HEAP_HINT, NULL, NULL);
451437
if (ret < 0) {
452-
WOLFCLU_LOG(WOLFCLU_L0, "Failed to convert EC PRIVATE KEY format, trying PRIVATE KEY format");
453438
/* Try PRIVATE KEY format (PKCS#8) */
454439
ret = wc_PemToDer(serverKeyBuf, serverKeySz, PRIVATEKEY_TYPE,
455440
&derObj, HEAP_HINT, NULL, NULL);
456441
if (ret < 0) {
457442
wolfCLU_LogError("Error convert pem to der");
458443
ret = WOLFCLU_FATAL_ERROR;
459444
}
460-
else {
461-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully converted server key to DER format");
462-
}
463445
}
464446

465447
if (ret == 0) {
466448
XMEMSET(serverKeyBuf, 0, serverKeySz); /* clear original buffer */
467449
serverKeySz = derObj->length;
468450
XMEMCPY(serverKeyBuf, derObj->buffer, serverKeySz);
469451
wc_FreeDer(&derObj);
470-
WOLFCLU_LOG(WOLFCLU_L0,
471-
"Converted server key to DER format; %d bytes",
472-
serverKeySz);
473452
ret = WOLFCLU_SUCCESS;
474453
}
475454
}
@@ -495,7 +474,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
495474
ret = WOLFCLU_FATAL_ERROR;
496475
}
497476
else {
498-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully decoded server private key");
499477
ret = WOLFCLU_SUCCESS;
500478
}
501479
}
@@ -516,8 +494,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
516494
}
517495
else {
518496
sapkiSz = ret;
519-
WOLFCLU_LOG(WOLFCLU_L0, "Read %d bytes from "
520-
"alternative CA public key file", sapkiSz);
521497
ret = WOLFCLU_SUCCESS;
522498
}
523499
}
@@ -535,8 +511,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
535511
sapkiSz = derObj->length;
536512
XMEMCPY(sapkiBuf, derObj->buffer, sapkiSz);
537513
wc_FreeDer(&derObj);
538-
WOLFCLU_LOG(WOLFCLU_L0, "Converted alternative CA public key "
539-
"to DER format; %d bytes", sapkiSz);
540514
ret = WOLFCLU_SUCCESS;
541515
}
542516
}
@@ -569,8 +543,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
569543
}
570544
else {
571545
altCaKeySz = ret;
572-
WOLFCLU_LOG(WOLFCLU_L0, "Read %d bytes from "
573-
"alternative CA key file", altCaKeySz);
574546
ret = WOLFCLU_SUCCESS;
575547
}
576548
}
@@ -588,8 +560,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
588560
altCaKeySz = derObj->length;
589561
XMEMCPY(altCaKeyBuf, derObj->buffer, altCaKeySz);
590562
wc_FreeDer(&derObj);
591-
WOLFCLU_LOG(WOLFCLU_L0, "Converted alternative CA key "
592-
"to DER format; %d bytes", altCaKeySz);
593563
ret = WOLFCLU_SUCCESS;
594564
}
595565
}
@@ -603,10 +573,7 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
603573
ret = WOLFCLU_FATAL_ERROR;
604574
}
605575
else {
606-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully decoded "
607-
"CA alt private key");
608576
wc_MlDsaKey_GetParams(&altCaKey, &level);
609-
WOLFCLU_LOG(WOLFCLU_L0, "ML-DSA level: %d", level);
610577
ret = WOLFCLU_SUCCESS;
611578
}
612579
}
@@ -636,10 +603,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
636603
level, altSigAlgSz);
637604
ret = WOLFCLU_FATAL_ERROR;
638605
}
639-
else {
640-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully generated "
641-
"alternative signature algorithm; %d bytes", altSigAlgSz);
642-
}
643606
}
644607

645608
if (ret == WOLFCLU_SUCCESS) {
@@ -868,8 +831,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
868831
else {
869832
derSz = ret;
870833
ret = WOLFCLU_SUCCESS;
871-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully created "
872-
"Chimera CA certificate; %d bytes\n", derSz);
873834
}
874835
}
875836
}
@@ -889,8 +850,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
889850
else {
890851
derSz = ret;
891852
ret = WOLFCLU_SUCCESS;
892-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully created "
893-
"Chimera certificate; %d bytes\n", derSz);
894853
}
895854
}
896855
}
@@ -904,15 +863,11 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
904863
else {
905864
outSz = ret;
906865
ret = WOLFCLU_SUCCESS;
907-
WOLFCLU_LOG(WOLFCLU_L0,
908-
"Converted certificate to PEM format; %d bytes",
909-
outSz);
910866
}
911867
}
912868
else if (ret == WOLFCLU_SUCCESS && outForm == DER_FORM) {
913869
outSz = derSz;
914870
XMEMCPY(outBuf, derBuf, outSz);
915-
WOLFCLU_LOG(WOLFCLU_L0, "Using DER format; %d bytes", outSz);
916871
}
917872

918873
if (ret == WOLFCLU_SUCCESS) {
@@ -923,7 +878,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
923878
}
924879
else {
925880
wolfSSL_BIO_write(out, outBuf, outSz);
926-
WOLFCLU_LOG(WOLFCLU_L0, "output %d bytes", outSz);
927881
}
928882
}
929883

@@ -949,10 +903,6 @@ int wolfCLU_GenChimeraCertSign(WOLFSSL_BIO *bioCaKey, WOLFSSL_BIO *bioAltCaKey,
949903
if (ret != WOLFCLU_SUCCESS) {
950904
wolfCLU_LogError("Error in wolfCLU_ChimeraCertSignSetCA: %d", ret);
951905
}
952-
else {
953-
WOLFCLU_LOG(WOLFCLU_L0, "Successfully created "
954-
"Chimera certificate: %s", outFileName);
955-
}
956906

957907
return ret;
958908

0 commit comments

Comments
 (0)