Re: [PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-07-02 Thread Herbert Xu
On Fri, Jul 01, 2016 at 11:16:54AM +0530, Raveendra Padasalagi wrote:
> This patch adds HMAC-SHA3 test modes in tcrypt module
> and related test vectors.
> 
> Signed-off-by: Raveendra Padasalagi 

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


Re: [PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-07-02 Thread Herbert Xu
On Fri, Jul 01, 2016 at 11:16:54AM +0530, Raveendra Padasalagi wrote:
> This patch adds HMAC-SHA3 test modes in tcrypt module
> and related test vectors.
> 
> Signed-off-by: Raveendra Padasalagi 

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


[PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-06-30 Thread Raveendra Padasalagi
This patch adds HMAC-SHA3 test modes in tcrypt module
and related test vectors.

Signed-off-by: Raveendra Padasalagi 
---
 crypto/tcrypt.c  |  16 +++
 crypto/testmgr.c |  40 ++
 crypto/testmgr.h | 388 +++
 3 files changed, 444 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 579dce0..1ad7ffe 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1328,6 +1328,22 @@ static int do_test(const char *alg, u32 type, u32 mask, 
int m)
ret += tcrypt_test("hmac(crc32)");
break;
 
+   case 111:
+   ret += tcrypt_test("hmac(sha3-224)");
+   break;
+
+   case 112:
+   ret += tcrypt_test("hmac(sha3-256)");
+   break;
+
+   case 113:
+   ret += tcrypt_test("hmac(sha3-384)");
+   break;
+
+   case 114:
+   ret += tcrypt_test("hmac(sha3-512)");
+   break;
+
case 150:
ret += tcrypt_test("ansi_cprng");
break;
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index c727fb0..0f93036 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3249,6 +3249,46 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "hmac(sha3-224)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_224_tv_template,
+   .count = HMAC_SHA3_224_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-256)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_256_tv_template,
+   .count = HMAC_SHA3_256_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-384)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_384_tv_template,
+   .count = HMAC_SHA3_384_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-512)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_512_tv_template,
+   .count = HMAC_SHA3_512_TEST_VECTORS
+   }
+   }
+   }, {
.alg = "hmac(sha384)",
.test = alg_test_hash,
.fips_allowed = 1,
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 487ec88..0cee15c 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -3246,6 +3246,394 @@ static struct hash_testvec hmac_sha512_tv_template[] = {
},
 };
 
+#define HMAC_SHA3_224_TEST_VECTORS 4
+
+static struct hash_testvec hmac_sha3_224_tv_template[] = {
+   {
+   .key= "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
+ "\x0b\x0b\x0b\x0b",
+   .ksize  = 20,
+   .plaintext = "Hi There",
+   .psize  = 8,
+   .digest = "\x3b\x16\x54\x6b\xbc\x7b\xe2\x70"
+ "\x6a\x03\x1d\xca\xfd\x56\x37\x3d"
+ "\x98\x84\x36\x76\x41\xd8\xc5\x9a"
+ "\xf3\xc8\x60\xf7",
+   }, {
+   .key= "Jefe",
+   .ksize  = 4,
+   .plaintext = "what do ya want for nothing?",
+   .psize  = 28,
+   .digest = "\x7f\xdb\x8d\xd8\x8b\xd2\xf6\x0d"
+ "\x1b\x79\x86\x34\xad\x38\x68\x11"
+ "\xc2\xcf\xc8\x5b\xfa\xf5\xd5\x2b"
+ "\xba\xce\x5e\x66",
+   .np = 4,
+   .tap= { 7, 7, 7, 7 }
+   }, {
+   .key= "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+

[PATCH] Crypto:Add HMAC-SHA3 test modes and test vectors

2016-06-30 Thread Raveendra Padasalagi
This patch adds HMAC-SHA3 test modes in tcrypt module
and related test vectors.

Signed-off-by: Raveendra Padasalagi 
---
 crypto/tcrypt.c  |  16 +++
 crypto/testmgr.c |  40 ++
 crypto/testmgr.h | 388 +++
 3 files changed, 444 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 579dce0..1ad7ffe 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1328,6 +1328,22 @@ static int do_test(const char *alg, u32 type, u32 mask, 
int m)
ret += tcrypt_test("hmac(crc32)");
break;
 
+   case 111:
+   ret += tcrypt_test("hmac(sha3-224)");
+   break;
+
+   case 112:
+   ret += tcrypt_test("hmac(sha3-256)");
+   break;
+
+   case 113:
+   ret += tcrypt_test("hmac(sha3-384)");
+   break;
+
+   case 114:
+   ret += tcrypt_test("hmac(sha3-512)");
+   break;
+
case 150:
ret += tcrypt_test("ansi_cprng");
break;
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index c727fb0..0f93036 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -3249,6 +3249,46 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "hmac(sha3-224)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_224_tv_template,
+   .count = HMAC_SHA3_224_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-256)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_256_tv_template,
+   .count = HMAC_SHA3_256_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-384)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_384_tv_template,
+   .count = HMAC_SHA3_384_TEST_VECTORS
+   }
+   }
+   }, {
+   .alg = "hmac(sha3-512)",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = hmac_sha3_512_tv_template,
+   .count = HMAC_SHA3_512_TEST_VECTORS
+   }
+   }
+   }, {
.alg = "hmac(sha384)",
.test = alg_test_hash,
.fips_allowed = 1,
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 487ec88..0cee15c 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -3246,6 +3246,394 @@ static struct hash_testvec hmac_sha512_tv_template[] = {
},
 };
 
+#define HMAC_SHA3_224_TEST_VECTORS 4
+
+static struct hash_testvec hmac_sha3_224_tv_template[] = {
+   {
+   .key= "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
+ "\x0b\x0b\x0b\x0b",
+   .ksize  = 20,
+   .plaintext = "Hi There",
+   .psize  = 8,
+   .digest = "\x3b\x16\x54\x6b\xbc\x7b\xe2\x70"
+ "\x6a\x03\x1d\xca\xfd\x56\x37\x3d"
+ "\x98\x84\x36\x76\x41\xd8\xc5\x9a"
+ "\xf3\xc8\x60\xf7",
+   }, {
+   .key= "Jefe",
+   .ksize  = 4,
+   .plaintext = "what do ya want for nothing?",
+   .psize  = 28,
+   .digest = "\x7f\xdb\x8d\xd8\x8b\xd2\xf6\x0d"
+ "\x1b\x79\x86\x34\xad\x38\x68\x11"
+ "\xc2\xcf\xc8\x5b\xfa\xf5\xd5\x2b"
+ "\xba\xce\x5e\x66",
+   .np = 4,
+   .tap= { 7, 7, 7, 7 }
+   }, {
+   .key= "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+ "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
+