diff mbox

[8/8] crypto: testmgr: Use the xxx_zero_message_hash from headers

Message ID 1444668826-6531-9-git-send-email-clabbe.montjoie@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show

Commit Message

Corentin Labbe Oct. 12, 2015, 4:53 p.m. UTC
Since md5/shaxxx headers have hash for zero message length, just use them.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 crypto/testmgr.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

kernel test robot Oct. 12, 2015, 7:24 p.m. UTC | #1
Hi LABBE,

[auto build test ERROR on crypto/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/LABBE-Corentin/crypto-hash-add-zero-length-message-hash-for-shax-and-md5/20151013-005943
config: arm-mmp (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   In file included from crypto/testmgr.c:48:0:
>> crypto/testmgr.h:370:13: error: 'md5_zero_message_hash' undeclared here (not in a function)
      .digest = md5_zero_message_hash,
                ^
>> crypto/testmgr.h:715:13: error: 'sha1_zero_message_hash' undeclared here (not in a function)
      .digest = sha1_zero_message_hash,
                ^
>> crypto/testmgr.h:715:3: error: initializer element is not constant
      .digest = sha1_zero_message_hash,
      ^
   crypto/testmgr.h:715:3: error: (near initialization for 'sha1_tv_template[0].digest')
>> crypto/testmgr.h:906:13: error: 'sha224_zero_message_hash' undeclared here (not in a function)
      .digest = sha224_zero_message_hash,
                ^
   crypto/testmgr.h:906:3: error: initializer element is not constant
      .digest = sha224_zero_message_hash,
      ^
   crypto/testmgr.h:906:3: error: (near initialization for 'sha224_tv_template[0].digest')
>> crypto/testmgr.h:1077:13: error: 'sha256_zero_message_hash' undeclared here (not in a function)
      .digest = sha256_zero_message_hash,
                ^
   crypto/testmgr.h:1077:3: error: initializer element is not constant
      .digest = sha256_zero_message_hash,
      ^
   crypto/testmgr.h:1077:3: error: (near initialization for 'sha256_tv_template[0].digest')

vim +/md5_zero_message_hash +370 crypto/testmgr.h

   364	 * MD5 test vectors from RFC1321
   365	 */
   366	#define MD5_TEST_VECTORS	7
   367	
   368	static struct hash_testvec md5_tv_template[] = {
   369		{
 > 370			.digest	= md5_zero_message_hash,
   371		}, {
   372			.plaintext = "a",
   373			.psize	= 1,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Corentin Labbe Oct. 12, 2015, 7:31 p.m. UTC | #2
Le 12/10/2015 21:24, kbuild test robot a écrit :
> Hi LABBE,
> 
> [auto build test ERROR on crypto/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> 
> url:    https://github.com/0day-ci/linux/commits/LABBE-Corentin/crypto-hash-add-zero-length-message-hash-for-shax-and-md5/20151013-005943
> config: arm-mmp (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=arm 
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from crypto/testmgr.c:48:0:
>>> crypto/testmgr.h:370:13: error: 'md5_zero_message_hash' undeclared here (not in a function)
>       .digest = md5_zero_message_hash,
>                 ^
>>> crypto/testmgr.h:715:13: error: 'sha1_zero_message_hash' undeclared here (not in a function)
>       .digest = sha1_zero_message_hash,
>                 ^
>>> crypto/testmgr.h:715:3: error: initializer element is not constant
>       .digest = sha1_zero_message_hash,
>       ^
>    crypto/testmgr.h:715:3: error: (near initialization for 'sha1_tv_template[0].digest')
>>> crypto/testmgr.h:906:13: error: 'sha224_zero_message_hash' undeclared here (not in a function)
>       .digest = sha224_zero_message_hash,
>                 ^
>    crypto/testmgr.h:906:3: error: initializer element is not constant
>       .digest = sha224_zero_message_hash,
>       ^
>    crypto/testmgr.h:906:3: error: (near initialization for 'sha224_tv_template[0].digest')
>>> crypto/testmgr.h:1077:13: error: 'sha256_zero_message_hash' undeclared here (not in a function)
>       .digest = sha256_zero_message_hash,
>                 ^
>    crypto/testmgr.h:1077:3: error: initializer element is not constant
>       .digest = sha256_zero_message_hash,
>       ^
>    crypto/testmgr.h:1077:3: error: (near initialization for 'sha256_tv_template[0].digest')
> 
> vim +/md5_zero_message_hash +370 crypto/testmgr.h
> 
>    364	 * MD5 test vectors from RFC1321
>    365	 */
>    366	#define MD5_TEST_VECTORS	7
>    367	
>    368	static struct hash_testvec md5_tv_template[] = {
>    369		{
>  > 370			.digest	= md5_zero_message_hash,
>    371		}, {
>    372			.plaintext = "a",
>    373			.psize	= 1,
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 

Oups I forgot to add sha and md5 header, I will resend tomorow.

Regards

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 03b2f19..9585854 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -367,8 +367,7 @@  static struct hash_testvec md4_tv_template [] = {
 
 static struct hash_testvec md5_tv_template[] = {
 	{
-		.digest	= "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04"
-			  "\xe9\x80\x09\x98\xec\xf8\x42\x7e",
+		.digest	= md5_zero_message_hash,
 	}, {
 		.plaintext = "a",
 		.psize	= 1,
@@ -713,8 +712,7 @@  static struct hash_testvec sha1_tv_template[] = {
 	{
 		.plaintext = "",
 		.psize	= 0,
-		.digest	= "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55"
-			  "\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
+		.digest	= sha1_zero_message_hash,
 	}, {
 		.plaintext = "abc",
 		.psize	= 3,
@@ -905,10 +903,7 @@  static struct hash_testvec sha224_tv_template[] = {
 	{
 		.plaintext = "",
 		.psize	= 0,
-		.digest	= "\xd1\x4a\x02\x8c\x2a\x3a\x2b\xc9"
-			  "\x47\x61\x02\xbb\x28\x82\x34\xc4"
-			  "\x15\xa2\xb0\x1f\x82\x8e\xa6\x2a"
-			  "\xc5\xb3\xe4\x2f",
+		.digest	= sha224_zero_message_hash,
 	}, {
 		.plaintext = "abc",
 		.psize  = 3,
@@ -1079,10 +1074,7 @@  static struct hash_testvec sha256_tv_template[] = {
 	{
 		.plaintext = "",
 		.psize	= 0,
-		.digest	= "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14"
-			  "\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24"
-			  "\x27\xae\x41\xe4\x64\x9b\x93\x4c"
-			  "\xa4\x95\x99\x1b\x78\x52\xb8\x55",
+		.digest	= sha256_zero_message_hash,
 	}, {
 		.plaintext = "abc",
 		.psize	= 3,