[PATCH 3/3] Add PBKDF2 tests for Stribog512

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Mon Jun 30 02:04:29 CEST 2014


* tests/t-kdf.c (check_pbkdf2): Add Stribog512 test cases.
--
TC26 published a draft of PKCS#5 GOST extension containing test vectors
for using Stribog512 in PBKDF2 scheme.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
---
 tests/t-kdf.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/tests/t-kdf.c b/tests/t-kdf.c
index 8e728d5..f5610cf 100644
--- a/tests/t-kdf.c
+++ b/tests/t-kdf.c
@@ -989,11 +989,80 @@ check_pbkdf2 (void)
       20,
       "\x43\xe0\x6c\x55\x90\xb0\x8c\x02\x25\x24"
       "\x23\x73\x12\x7e\xdf\x9c\x8e\x9c\x32\x91"
+    },
+    {
+      "password", 8,
+      "salt", 4,
+      GCRY_MD_STRIBOG512,
+      1,
+      64,
+      "\xbc\xd1\x9a\x1c\x42\x3a\x63\xe7\x2e\x47\xef\x0f\x56\x56\x6c\x72"
+      "\x67\x45\xd9\x6a\xc1\xa1\xc1\x27\xb2\xed\xad\xb4\x5f\xb4\x5b\x30"
+      "\x7a\xca\x15\x99\x9e\x91\xf6\x40\xf4\x81\x8f\x68\xaf\x71\x6e\x30"
+      "\xfd\x54\x3c\x52\x02\x6b\xbb\x29\x5d\x10\x0e\xb4\x71\x33\x9f\x46"
+    },
+    {
+      "password", 8,
+      "salt", 4,
+      GCRY_MD_STRIBOG512,
+      2,
+      64,
+      "\x08\x8f\xec\x3b\x0f\x1f\xfa\xf0\x61\x5e\xb2\x67\xde\x92\x90\x7f"
+      "\xd4\xe0\xbb\x89\xd2\xf5\xef\x9d\x41\x11\xa8\x0e\x3c\xbf\x23\x1a"
+      "\xf0\x7b\xa3\xce\x96\x06\x53\x95\xf8\xf1\xa7\x50\x5f\x97\x81\xf9"
+      "\x7e\x99\xa2\x6b\x83\x14\x90\x7d\xbf\x35\x10\xbc\x3c\xa2\x00\x0c"
+    },
+    {
+      "password", 8,
+      "salt", 4,
+      GCRY_MD_STRIBOG512,
+      4096,
+      64,
+      "\x59\x6f\x63\x97\x1e\xae\x97\x0a\x4e\xac\x9c\x18\xbf\xf4\x2e\xc5"
+      "\x2b\x93\x6c\x1c\xca\xc6\xd1\x7c\xaa\x30\x8a\xfe\x12\xd4\xff\x31"
+      "\x94\x31\x80\xce\x02\xe4\x29\x56\x52\x4e\x99\x13\x92\xc4\xbd\xde"
+      "\xb7\x07\x7e\xdc\x1d\x2a\xbf\x52\xea\xf7\x2b\x9e\x32\xa8\xc6\x05"
+    },
+    /* { -- takes toooo long
+      "password", 8,
+      "salt", 4,
+      GCRY_MD_STRIBOG512,
+      16777216,
+      64,
+      "\xeb\xf5\x12\xe4\xfe\x87\x51\x55\x21\x3d\x38\x81\x73\x8e\x10\x80"
+      "\x11\x6e\xfc\x12\xe0\x7e\xc6\x5c\xb7\x07\x20\x9d\x5e\xe8\x90\xd2"
+      "\x5b\xd4\xd9\x86\xca\xd5\xe1\x52\xaf\x23\x30\xf7\xfc\x29\x40\xeb"
+      "\x41\xf9\xbe\x0b\x1b\xae\xad\xfd\x43\x6e\xfb\x8c\x77\xd1\xc9\x13"
+    }, */
+    {
+      "passwordPASSWORDpassword", 24,
+      "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36,
+      GCRY_MD_STRIBOG512,
+      4096,
+      100,
+      "\xe4\x57\xee\x61\x26\xf0\x7c\x09\xbe\x00\x4b\xa5\x12\xad\xc9\x0c"
+      "\x61\x1c\x2b\x3f\xa1\x11\x41\xc2\x11\x96\xda\xe5\xa4\x8a\x50\xd8"
+      "\x3c\xcf\x16\x32\x33\xf0\x14\xfb\x6a\xde\x71\x69\x5b\xf3\x71\x59"
+      "\xe9\x06\x24\x43\xb7\x5d\xac\x91\x1f\xa7\xa1\x81\xd2\x4c\x4e\xd2"
+      "\xa9\x10\x49\x9d\x72\xab\xa9\x32\x84\xc7\x8d\xbc\x1a\xcb\xa2\x78"
+      "\x9b\xd8\xef\x50\xb5\x05\x2f\x33\xec\x6e\x24\x91\xf4\xf7\x4e\xda"
+      "\x05\x72\x38\x64"
+    },
+    {
+      "pass\0word", 9,
+      "sa\0lt", 5,
+      GCRY_MD_STRIBOG512,
+      4096,
+      64,
+      "\xee\xd9\x2e\x8d\x76\xe1\x8d\x6a\x63\x2f\x2d\xa6\x5c\x9b\x28\x59"
+      "\xaf\x55\x5c\x33\x35\xea\x30\x09\x59\x89\xde\xa1\x4d\x9d\x09\x31"
+      "\x14\x66\x8e\x32\x9d\xeb\x03\x4c\xc1\x56\x5c\x3d\x73\x1d\xe0\xb5"
+      "\xca\x11\xac\xbd\xf8\x5a\xb9\xea\xab\x15\x29\x5d\xf0\x5b\x98\x05"
     }
   };
   int tvidx;
   gpg_error_t err;
-  unsigned char outbuf[40];
+  unsigned char outbuf[100];
   int i;
 
   for (tvidx=0; tvidx < DIM(tv); tvidx++)
-- 
2.0.0




More information about the Gcrypt-devel mailing list