linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: tcrypt - Add debug prints
@ 2017-01-18 13:54 Rabin Vincent
  2017-01-23 14:59 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Rabin Vincent @ 2017-01-18 13:54 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, Rabin Vincent

From: Rabin Vincent <rabinv@axis.com>

tcrypt is very tight-lipped when it succeeds, but a bit more feedback
would be useful when developing or debugging crypto drivers, especially
since even a successful run ends with the module failing to insert. Add
a couple of debug prints, which can be enabled with dynamic debug:

Before:

 # insmod tcrypt.ko mode=10
 insmod: can't insert 'tcrypt.ko': Resource temporarily unavailable

After:

 # insmod tcrypt.ko mode=10 dyndbg
 tcrypt: testing ecb(aes)
 tcrypt: testing cbc(aes)
 tcrypt: testing lrw(aes)
 tcrypt: testing xts(aes)
 tcrypt: testing ctr(aes)
 tcrypt: testing rfc3686(ctr(aes))
 tcrypt: all tests passed
 insmod: can't insert 'tcrypt.ko': Resource temporarily unavailable

Signed-off-by: Rabin Vincent <rabinv@axis.com>
---
 crypto/tcrypt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index ae22f05..9a11f3c 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -22,6 +22,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <crypto/aead.h>
 #include <crypto/hash.h>
 #include <crypto/skcipher.h>
@@ -1010,6 +1012,8 @@ static inline int tcrypt_test(const char *alg)
 {
 	int ret;
 
+	pr_debug("testing %s\n", alg);
+
 	ret = alg_test(alg, alg, 0, 0);
 	/* non-fips algs return -EINVAL in fips mode */
 	if (fips_enabled && ret == -EINVAL)
@@ -2059,6 +2063,8 @@ static int __init tcrypt_mod_init(void)
 	if (err) {
 		printk(KERN_ERR "tcrypt: one or more tests failed!\n");
 		goto err_free_tv;
+	} else {
+		pr_debug("all tests passed\n");
 	}
 
 	/* We intentionaly return -EAGAIN to prevent keeping the module,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: tcrypt - Add debug prints
  2017-01-18 13:54 [PATCH] crypto: tcrypt - Add debug prints Rabin Vincent
@ 2017-01-23 14:59 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-01-23 14:59 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: linux-crypto, Rabin Vincent

On Wed, Jan 18, 2017 at 02:54:05PM +0100, Rabin Vincent wrote:
> From: Rabin Vincent <rabinv@axis.com>
> 
> tcrypt is very tight-lipped when it succeeds, but a bit more feedback
> would be useful when developing or debugging crypto drivers, especially
> since even a successful run ends with the module failing to insert. Add
> a couple of debug prints, which can be enabled with dynamic debug:
> 
> Before:
> 
>  # insmod tcrypt.ko mode=10
>  insmod: can't insert 'tcrypt.ko': Resource temporarily unavailable
> 
> After:
> 
>  # insmod tcrypt.ko mode=10 dyndbg
>  tcrypt: testing ecb(aes)
>  tcrypt: testing cbc(aes)
>  tcrypt: testing lrw(aes)
>  tcrypt: testing xts(aes)
>  tcrypt: testing ctr(aes)
>  tcrypt: testing rfc3686(ctr(aes))
>  tcrypt: all tests passed
>  insmod: can't insert 'tcrypt.ko': Resource temporarily unavailable
> 
> Signed-off-by: Rabin Vincent <rabinv@axis.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-23 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18 13:54 [PATCH] crypto: tcrypt - Add debug prints Rabin Vincent
2017-01-23 14:59 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).