Skip to content

Commit 559b207

Browse files
committed
linuxkm/lkcapi_*.c and linuxkm/module_hooks.c: add missing linefeed characters in format args to pr_*(), for proper line flushing.
1 parent b7ed413 commit 559b207

6 files changed

Lines changed: 106 additions & 106 deletions

File tree

linuxkm/lkcapi_dh_glue.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static int km_dh_decode_secret(const u8 * buf, unsigned int len,
347347

348348
if (secret.len != expected_len) {
349349
#ifdef WOLFKM_DEBUG_DH
350-
pr_err("%s: km_dh_decode_secret: got %d, expected %zu",
350+
pr_err("%s: km_dh_decode_secret: got %d, expected %zu\n",
351351
WOLFKM_DH_DRIVER, secret.len, expected_len);
352352
#endif /* WOLFKM_DEBUG_DH */
353353
return -EINVAL;
@@ -413,7 +413,7 @@ static int km_dh_alloc_keys(struct km_dh_ctx * ctx)
413413
alloc_keys_end:
414414
if (err) {
415415
#ifdef WOLFKM_DEBUG_DH
416-
pr_err("%s: km_dh_alloc_keys failed: %d",
416+
pr_err("%s: km_dh_alloc_keys failed: %d\n",
417417
WOLFKM_DH_DRIVER, err);
418418
#endif
419419
km_dh_clear_keys(ctx);
@@ -478,7 +478,7 @@ static int km_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
478478

479479
if (km_dh_decode_secret(buf, len, &params) < 0) {
480480
#ifdef WOLFKM_DEBUG_DH
481-
pr_err("%s: dh_set_secret: decode secret failed: %d",
481+
pr_err("%s: dh_set_secret: decode secret failed: %d\n",
482482
WOLFKM_DH_DRIVER, params.key_size);
483483
#endif /* WOLFKM_DEBUG_DH */
484484
err = -EINVAL;
@@ -488,15 +488,15 @@ static int km_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
488488
/* the key, p, and g, must all be provided for normal dh. */
489489
if (!params.key || !params.key_size || !params.p_size || !params.g_size) {
490490
#ifdef WOLFKM_DEBUG_DH
491-
pr_err("%s: dh_set_secret: empty params", WOLFKM_DH_DRIVER);
491+
pr_err("%s: dh_set_secret: empty params\n", WOLFKM_DH_DRIVER);
492492
#endif
493493
err = -EINVAL;
494494
goto dh_secret_end;
495495
}
496496

497497
if (params.key_size > params.p_size || params.g_size > params.p_size) {
498498
#ifdef WOLFKM_DEBUG_DH
499-
pr_err("%s: dh_set_secret: invalid params", WOLFKM_DH_DRIVER);
499+
pr_err("%s: dh_set_secret: invalid params\n", WOLFKM_DH_DRIVER);
500500
#endif
501501
err = -EINVAL;
502502
goto dh_secret_end;
@@ -518,7 +518,7 @@ static int km_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
518518

519519
if (err) {
520520
#ifdef WOLFKM_DEBUG_DH
521-
pr_err("%s: wc_DhSetKey failed: %d", WOLFKM_DH_DRIVER, err);
521+
pr_err("%s: wc_DhSetKey failed: %d\n", WOLFKM_DH_DRIVER, err);
522522
#endif
523523
err = -EINVAL;
524524
goto dh_secret_end;
@@ -530,7 +530,7 @@ static int km_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
530530

531531
if (err) {
532532
#ifdef WOLFKM_DEBUG_DH
533-
pr_err("%s: wc_DhImportKeyPair failed: %d", WOLFKM_DH_DRIVER, err);
533+
pr_err("%s: wc_DhImportKeyPair failed: %d\n", WOLFKM_DH_DRIVER, err);
534534
#endif
535535
err = -EINVAL;
536536
goto dh_secret_end;
@@ -585,7 +585,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
585585

586586
if (err) {
587587
#ifdef WOLFKM_DEBUG_DH
588-
pr_err("%s: ffdhe_set_secret: decode secret failed: %d",
588+
pr_err("%s: ffdhe_set_secret: decode secret failed: %d\n",
589589
WOLFKM_DH_DRIVER, params.key_size);
590590
#endif /* WOLFKM_DEBUG_DH */
591591
err = -EINVAL;
@@ -595,7 +595,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
595595
/* p_size and g_size should be 0 for ffdhe. */
596596
if (params.p_size || params.g_size) {
597597
#ifdef WOLFKM_DEBUG_DH
598-
pr_err("%s: ffdhe_set_secret: unexpected p, g params: %d, %d",
598+
pr_err("%s: ffdhe_set_secret: unexpected p, g params: %d, %d\n",
599599
WOLFKM_DH_DRIVER, params.p_size, params.g_size);
600600
#endif /* WOLFKM_DEBUG_DH */
601601
err = -EINVAL;
@@ -616,7 +616,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
616616
if (!params.key_size) {
617617
/* generate the ffdhe key pair*/
618618
#ifdef WOLFKM_DEBUG_DH
619-
pr_info("ffdhe gen key pair");
619+
pr_info("ffdhe gen key pair\n");
620620
#endif
621621
PRIVATE_KEY_UNLOCK();
622622
err = wc_DhGenerateKeyPair(ctx->key, &ctx->rng,
@@ -626,7 +626,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
626626

627627
if (err) {
628628
#ifdef WOLFKM_DEBUG_DH
629-
pr_err("%s: wc_DhGenerateKeyPair failed: %d",
629+
pr_err("%s: wc_DhGenerateKeyPair failed: %d\n",
630630
WOLFKM_DH_DRIVER, err);
631631
#endif
632632
err = -EINVAL;
@@ -641,7 +641,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
641641
if (ctx->pub_len < (ctx->nbits / WOLFSSL_BIT_SIZE)) {
642642
word32 pad_len = ctx->nbits / WOLFSSL_BIT_SIZE - ctx->pub_len;
643643
#ifdef WOLFKM_DEBUG_DH
644-
pr_info("info: km_ffdhe_set_secret: pub key padding %d", pad_len);
644+
pr_info("info: km_ffdhe_set_secret: pub key padding %d\n", pad_len);
645645
#endif
646646

647647
memmove(ctx->pub_key + pad_len, ctx->pub_key, ctx->pub_len);
@@ -660,7 +660,7 @@ static int km_ffdhe_set_secret(struct crypto_kpp *tfm, const void *buf,
660660

661661
if (err) {
662662
#ifdef WOLFKM_DEBUG_DH
663-
pr_err("%s: wc_DhImportKeyPair failed: %d",
663+
pr_err("%s: wc_DhImportKeyPair failed: %d\n",
664664
WOLFKM_DH_DRIVER, err);
665665
#endif
666666
err = -EINVAL;
@@ -783,7 +783,7 @@ static int km_ffdhe_init(struct crypto_kpp *tfm, int name, word32 nbits)
783783
}
784784

785785
#ifdef WOLFKM_DEBUG_DH
786-
pr_info("info: exiting km_dh_init: name %d, nbits %d",
786+
pr_info("info: exiting km_dh_init: name %d, nbits %d\n",
787787
ctx->name, ctx->nbits);
788788
#endif /* WOLFKM_DEBUG_DH */
789789
return 0;
@@ -874,7 +874,7 @@ static int km_dh_gen_pub(struct kpp_request *req)
874874

875875
if (ctx->pub_len > req->dst_len) {
876876
#ifdef WOLFKM_DEBUG_DH
877-
pr_err("error: dst_len too small: %d", req->dst_len);
877+
pr_err("error: dst_len too small: %d\n", req->dst_len);
878878
#endif /* WOLFKM_DEBUG_DH */
879879
req->dst_len = ctx->pub_len;
880880
return -EOVERFLOW;
@@ -885,7 +885,7 @@ static int km_dh_gen_pub(struct kpp_request *req)
885885
err = 0;
886886

887887
#ifdef WOLFKM_DEBUG_DH
888-
pr_info("info: exiting km_dh_gen_pub: %d", ctx->pub_len);
888+
pr_info("info: exiting km_dh_gen_pub: %d\n", ctx->pub_len);
889889
#endif /* WOLFKM_DEBUG_DH */
890890
return err;
891891
}
@@ -921,7 +921,7 @@ static int km_dh_compute_shared_secret(struct kpp_request *req)
921921

922922
if (req->src_len <= 0 || req->src_len > (ctx->nbits / WOLFSSL_BIT_SIZE)) {
923923
#ifdef WOLFKM_DEBUG_DH
924-
pr_err("error: got src_len %d, expected %d", req->src_len,
924+
pr_err("error: got src_len %d, expected %d\n", req->src_len,
925925
(ctx->nbits / WOLFSSL_BIT_SIZE));
926926
#endif /* WOLFKM_DEBUG_DH */
927927
err = -EINVAL;
@@ -2903,7 +2903,7 @@ static int linuxkm_test_kpp_driver(const char * driver,
29032903

29042904
dst_buf = malloc(dst_len);
29052905
if (dst_buf == NULL) {
2906-
pr_err("error: allocating out buf failed");
2906+
pr_err("error: allocating out buf failed\n");
29072907
test_rc = MEMORY_E;
29082908
goto test_kpp_end;
29092909
}
@@ -2917,20 +2917,20 @@ static int linuxkm_test_kpp_driver(const char * driver,
29172917

29182918
err = crypto_kpp_generate_public_key(req);
29192919
if (err) {
2920-
pr_err("error: crypto_kpp_generate_public_key returned: %d", err);
2920+
pr_err("error: crypto_kpp_generate_public_key returned: %d\n", err);
29212921
test_rc = BAD_FUNC_ARG;
29222922
goto test_kpp_end;
29232923
}
29242924

29252925
if (memcmp(expected_a_pub, sg_virt(req->dst), pub_len)) {
2926-
pr_err("error: crypto_kpp_generate_public_key: wrong output");
2926+
pr_err("error: crypto_kpp_generate_public_key: wrong output\n");
29272927
test_rc = WC_KEY_MISMATCH_E;
29282928
goto test_kpp_end;
29292929
}
29302930

29312931
src_buf = malloc(src_len);
29322932
if (src_buf == NULL) {
2933-
pr_err("error: allocating in buf failed");
2933+
pr_err("error: allocating in buf failed\n");
29342934
test_rc = MEMORY_E;
29352935
goto test_kpp_end;
29362936
}
@@ -2945,13 +2945,13 @@ static int linuxkm_test_kpp_driver(const char * driver,
29452945

29462946
err = crypto_kpp_compute_shared_secret(req);
29472947
if (err) {
2948-
pr_err("error: crypto_kpp_compute_shared_secret returned: %d", err);
2948+
pr_err("error: crypto_kpp_compute_shared_secret returned: %d\n", err);
29492949
test_rc = BAD_FUNC_ARG;
29502950
goto test_kpp_end;
29512951
}
29522952

29532953
if (memcmp(shared_secret, sg_virt(req->dst), shared_s_len)) {
2954-
pr_err("error: shared secret does not match");
2954+
pr_err("error: shared secret does not match\n");
29552955
test_rc = BAD_FUNC_ARG;
29562956
goto test_kpp_end;
29572957
}

linuxkm/lkcapi_ecdh_glue.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int km_ecdh_decode_secret(const u8 * buf, unsigned int len,
199199

200200
if (secret.len != expected_len) {
201201
#ifdef WOLFKM_DEBUG_ECDH
202-
pr_err("%s: km_ecdh_decode_secret: got %d, expected %zu",
202+
pr_err("%s: km_ecdh_decode_secret: got %d, expected %zu\n",
203203
WOLFKM_ECDH_DRIVER, secret.len, expected_len);
204204
#endif /* WOLFKM_DEBUG_ECDH */
205205
return -EINVAL;
@@ -249,7 +249,7 @@ static int km_ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
249249

250250
if (km_ecdh_decode_secret(buf, len, &params) < 0) {
251251
#ifdef WOLFKM_DEBUG_ECDH
252-
pr_err("%s: ecdh_set_secret: decode secret failed: %d",
252+
pr_err("%s: ecdh_set_secret: decode secret failed: %d\n",
253253
WOLFKM_ECDH_DRIVER, params.key_size);
254254
#endif /* WOLFKM_DEBUG_ECDH */
255255
return -EINVAL;
@@ -417,7 +417,7 @@ static int km_ecdh_init(struct crypto_kpp *tfm, int curve_id)
417417
#endif /* ECC_TIMING_RESISTANT */
418418

419419
#ifdef WOLFKM_DEBUG_ECDH
420-
pr_info("info: exiting km_ecdh_init: curve_id %d, curve_len %d",
420+
pr_info("info: exiting km_ecdh_init: curve_id %d, curve_len %d\n",
421421
ctx->curve_id, ctx->curve_len);
422422
#endif /* WOLFKM_DEBUG_ECDH */
423423
return 0;
@@ -484,7 +484,7 @@ static int km_ecdh_gen_pub(struct kpp_request *req)
484484

485485
if (raw_pub_len > req->dst_len) {
486486
#ifdef WOLFKM_DEBUG_ECDH
487-
pr_err("error: dst_len too small: %d", req->dst_len);
487+
pr_err("error: dst_len too small: %d\n", req->dst_len);
488488
#endif /* WOLFKM_DEBUG_ECDH */
489489
err = -EOVERFLOW;
490490
goto ecdh_gen_pub_end;
@@ -504,7 +504,7 @@ static int km_ecdh_gen_pub(struct kpp_request *req)
504504
err = wc_ecc_make_pub(ctx->key, NULL);
505505
if (err) {
506506
#ifdef WOLFKM_DEBUG_ECDH
507-
pr_err("error: ecc_make_pub returned: %d", err);
507+
pr_err("error: ecc_make_pub returned: %d\n", err);
508508
#endif /* WOLFKM_DEBUG_ECDH */
509509
goto ecdh_gen_pub_end;
510510
}
@@ -522,7 +522,7 @@ static int km_ecdh_gen_pub(struct kpp_request *req)
522522

523523
if (err || pub_x_len != ctx->curve_len || pub_y_len != ctx->curve_len) {
524524
#ifdef WOLFKM_DEBUG_ECDH
525-
pr_err("error: ecc export pub returned: err=%d, x=%d, y=%d", err,
525+
pr_err("error: ecc export pub returned: err=%d, x=%d, y=%d\n", err,
526526
pub_x_len, pub_y_len);
527527
#endif /* WOLFKM_DEBUG_ECDH */
528528
err = -EINVAL;
@@ -537,7 +537,7 @@ static int km_ecdh_gen_pub(struct kpp_request *req)
537537
if (pub) { free(pub); pub = NULL; }
538538

539539
#ifdef WOLFKM_DEBUG_ECDH
540-
pr_info("info: exiting km_ecdh_gen_pub: %d", err);
540+
pr_info("info: exiting km_ecdh_gen_pub: %d\n", err);
541541
#endif /* WOLFKM_DEBUG_ECDH */
542542
return err;
543543
}
@@ -584,7 +584,7 @@ static int km_ecdh_compute_shared_secret(struct kpp_request *req)
584584

585585
if (req->src_len != raw_pub_len) {
586586
#ifdef WOLFKM_DEBUG_ECDH
587-
pr_err("error: got src_len %d, expected %d", req->src_len, raw_pub_len);
587+
pr_err("error: got src_len %d, expected %d\n", req->src_len, raw_pub_len);
588588
#endif /* WOLFKM_DEBUG_ECDH */
589589
err = -EINVAL;
590590
goto ecdh_shared_secret_end;
@@ -928,7 +928,7 @@ static int linuxkm_test_ecdh_nist_driver(const char * driver,
928928

929929
dst_buf = malloc(dst_len);
930930
if (dst_buf == NULL) {
931-
pr_err("error: allocating out buf failed");
931+
pr_err("error: allocating out buf failed\n");
932932
test_rc = BAD_FUNC_ARG;
933933
goto test_ecdh_nist_end;
934934
}
@@ -942,20 +942,20 @@ static int linuxkm_test_ecdh_nist_driver(const char * driver,
942942

943943
err = crypto_kpp_generate_public_key(req);
944944
if (err) {
945-
pr_err("error: crypto_kpp_generate_public_key returned: %d", err);
945+
pr_err("error: crypto_kpp_generate_public_key returned: %d\n", err);
946946
test_rc = BAD_FUNC_ARG;
947947
goto test_ecdh_nist_end;
948948
}
949949

950950
if (memcmp(expected_a_pub, sg_virt(req->dst), pub_len)) {
951-
pr_err("error: crypto_kpp_generate_public_key: wrong output");
951+
pr_err("error: crypto_kpp_generate_public_key: wrong output\n");
952952
test_rc = BAD_FUNC_ARG;
953953
goto test_ecdh_nist_end;
954954
}
955955

956956
src_buf = malloc(src_len);
957957
if (src_buf == NULL) {
958-
pr_err("error: allocating in buf failed");
958+
pr_err("error: allocating in buf failed\n");
959959
test_rc = MEMORY_E;
960960
goto test_ecdh_nist_end;
961961
}
@@ -970,13 +970,13 @@ static int linuxkm_test_ecdh_nist_driver(const char * driver,
970970

971971
err = crypto_kpp_compute_shared_secret(req);
972972
if (err) {
973-
pr_err("error: crypto_kpp_compute_shared_secret returned: %d", err);
973+
pr_err("error: crypto_kpp_compute_shared_secret returned: %d\n", err);
974974
test_rc = BAD_FUNC_ARG;
975975
goto test_ecdh_nist_end;
976976
}
977977

978978
if (memcmp(shared_secret, sg_virt(req->dst), shared_s_len)) {
979-
pr_err("error: shared secret does not match");
979+
pr_err("error: shared secret does not match\n");
980980
test_rc = BAD_FUNC_ARG;
981981
goto test_ecdh_nist_end;
982982
}

0 commit comments

Comments
 (0)