From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 6/8] rsa: Add pr_fmt and use pr_debug
Date: Wed, 4 May 2022 15:14:14 +0200 [thread overview]
Message-ID: <20220504131416.3869736-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220504131416.3869736-1-s.hauer@pengutronix.de>
Add pr_fmt to print more context and use pr_debug consistently.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
crypto/rsa.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/crypto/rsa.c b/crypto/rsa.c
index 2eeb9984b1..6d23ecb11c 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -5,6 +5,7 @@
*
* SPDX-License-Identifier: GPL-2.0+
*/
+#define pr_fmt(fmt) "rsa: " fmt
#include <common.h>
#include <malloc.h>
@@ -184,8 +185,8 @@ static int pow_mod(const struct rsa_public_key *key, void *__inout)
/* Sanity check for stack size - key->len is in 32-bit words */
if (key->len > RSA_MAX_KEY_BITS / 32) {
- debug("RSA key words %u exceeds maximum %d\n", key->len,
- RSA_MAX_KEY_BITS / 32);
+ pr_debug("RSA key words %u exceeds maximum %d\n", key->len,
+ RSA_MAX_KEY_BITS / 32);
return -EINVAL;
}
@@ -199,13 +200,13 @@ static int pow_mod(const struct rsa_public_key *key, void *__inout)
return -EINVAL;
if (k < 2) {
- debug("Public exponent is too short (%d bits, minimum 2)\n",
- k);
+ pr_debug("Public exponent is too short (%d bits, minimum 2)\n",
+ k);
return -EINVAL;
}
if (!is_public_exponent_bit_set(key, 0)) {
- debug("LSB of RSA public exponent must be set.\n");
+ pr_debug("LSB of RSA public exponent must be set.\n");
return -EINVAL;
}
@@ -317,7 +318,7 @@ int rsa_verify(const struct rsa_public_key *key, const uint8_t *sig,
return -EOPNOTSUPP;
if (sig_len != (key->len * sizeof(uint32_t))) {
- debug("Signature is of incorrect length %u, should be %zu\n", sig_len,
+ pr_debug("Signature is of incorrect length %u, should be %zu\n", sig_len,
key->len * sizeof(uint32_t));
ret = -EINVAL;
goto out_free_digest;
@@ -325,8 +326,8 @@ int rsa_verify(const struct rsa_public_key *key, const uint8_t *sig,
/* Sanity check for stack size */
if (sig_len > RSA_MAX_SIG_BITS / 8) {
- debug("Signature length %u exceeds maximum %d\n", sig_len,
- RSA_MAX_SIG_BITS / 8);
+ pr_debug("Signature length %u exceeds maximum %d\n", sig_len,
+ RSA_MAX_SIG_BITS / 8);
ret = -EINVAL;
goto out_free_digest;
}
@@ -408,15 +409,15 @@ struct rsa_public_key *rsa_of_read_key(struct device_node *node)
rr = of_get_property(node, "rsa,r-squared", NULL);
if (!key->len || !modulus || !rr) {
- debug("%s: Missing RSA key info", __func__);
+ pr_debug("%s: Missing RSA key info", __func__);
err = -EFAULT;
goto out;
}
/* Sanity check for stack size */
if (key->len > RSA_MAX_KEY_BITS || key->len < RSA_MIN_KEY_BITS) {
- debug("RSA key bits %u outside allowed range %d..%d\n",
- key->len, RSA_MIN_KEY_BITS, RSA_MAX_KEY_BITS);
+ pr_debug("RSA key bits %u outside allowed range %d..%d\n",
+ key->len, RSA_MIN_KEY_BITS, RSA_MAX_KEY_BITS);
err = -EFAULT;
goto out;
}
--
2.30.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2022-05-04 13:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 13:14 [PATCH 1/8] rsatoc: fix compiler warnings Sascha Hauer
2022-05-04 13:14 ` [PATCH 2/8] rsatoc: Add option to print dts output Sascha Hauer
2022-05-04 13:14 ` [PATCH 3/8] crypto: simplify $(srctree)/ handling and remove config_filename macro Sascha Hauer
2022-05-04 13:14 ` [PATCH 4/8] rsa: Collect keys on list Sascha Hauer
2022-05-04 13:14 ` [PATCH 5/8] rsa: Add iterator for rsa keys Sascha Hauer
2022-05-04 13:14 ` Sascha Hauer [this message]
2022-05-04 13:14 ` [PATCH 7/8] rsa: Turn error messages into debug messages Sascha Hauer
2022-05-04 13:14 ` [PATCH 8/8] fit: try other keys as fallback Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220504131416.3869736-6-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox