LCOV - code coverage report
Current view: top level - tests - dsa-rfc6979.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 55 99 55.6 %
Date: 2016-09-12 12:56:58 Functions: 4 8 50.0 %

          Line data    Source code
       1             : /* dsa-rfc6979.c - Test for Deterministic DSA
       2             :  * Copyright (C) 2008 Free Software Foundation, Inc.
       3             :  * Copyright (C) 2013 g10 Code GmbH
       4             :  *
       5             :  * This file is part of Libgcrypt.
       6             :  *
       7             :  * Libgcrypt is free software; you can redistribute it and/or modify
       8             :  * it under the terms of the GNU Lesser General Public License as
       9             :  * published by the Free Software Foundation; either version 2.1 of
      10             :  * the License, or (at your option) any later version.
      11             :  *
      12             :  * Libgcrypt is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :  * GNU Lesser General Public License for more details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public
      18             :  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
      19             :  */
      20             : 
      21             : #ifdef HAVE_CONFIG_H
      22             : # include <config.h>
      23             : #endif
      24             : #include <stdio.h>
      25             : #include <stdlib.h>
      26             : #include <string.h>
      27             : #include <stdarg.h>
      28             : 
      29             : #ifdef _GCRYPT_IN_LIBGCRYPT
      30             : # include "../src/gcrypt-int.h"
      31             : #else
      32             : # include <gcrypt.h>
      33             : #endif
      34             : 
      35             : 
      36             : #define my_isascii(c) (!((c) & 0x80))
      37             : #define digitp(p)   (*(p) >= '0' && *(p) <= '9')
      38             : #define hexdigitp(a) (digitp (a)                     \
      39             :                       || (*(a) >= 'A' && *(a) <= 'F')  \
      40             :                       || (*(a) >= 'a' && *(a) <= 'f'))
      41             : #define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
      42             :                      *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
      43             : #define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
      44             : #define DIM(v)               (sizeof(v)/sizeof((v)[0]))
      45             : #define DIMof(type,member)   DIM(((type *)0)->member)
      46             : 
      47             : static int verbose;
      48             : static int error_count;
      49             : 
      50             : static void
      51           0 : info (const char *format, ...)
      52             : {
      53             :   va_list arg_ptr;
      54             : 
      55           0 :   va_start (arg_ptr, format);
      56           0 :   vfprintf (stderr, format, arg_ptr);
      57           0 :   va_end (arg_ptr);
      58           0 : }
      59             : 
      60             : static void
      61           0 : fail (const char *format, ...)
      62             : {
      63             :   va_list arg_ptr;
      64             : 
      65           0 :   va_start (arg_ptr, format);
      66           0 :   vfprintf (stderr, format, arg_ptr);
      67           0 :   va_end (arg_ptr);
      68           0 :   error_count++;
      69           0 : }
      70             : 
      71             : static void
      72           0 : die (const char *format, ...)
      73             : {
      74             :   va_list arg_ptr;
      75             : 
      76           0 :   va_start (arg_ptr, format);
      77           0 :   vfprintf (stderr, format, arg_ptr);
      78           0 :   va_end (arg_ptr);
      79           0 :   exit (1);
      80             : }
      81             : 
      82             : static void
      83           0 : show_sexp (const char *prefix, gcry_sexp_t a)
      84             : {
      85             :   char *buf;
      86             :   size_t size;
      87             : 
      88           0 :   if (prefix)
      89           0 :     fputs (prefix, stderr);
      90           0 :   size = gcry_sexp_sprint (a, GCRYSEXP_FMT_ADVANCED, NULL, 0);
      91           0 :   buf = gcry_xmalloc (size);
      92             : 
      93           0 :   gcry_sexp_sprint (a, GCRYSEXP_FMT_ADVANCED, buf, size);
      94           0 :   fprintf (stderr, "%.*s", (int)size, buf);
      95           0 :   gcry_free (buf);
      96           0 : }
      97             : 
      98             : 
      99             : /* Convert STRING consisting of hex characters into its binary
     100             :    representation and return it as an allocated buffer. The valid
     101             :    length of the buffer is returned at R_LENGTH.  The string is
     102             :    delimited by end of string.  The function returns NULL on
     103             :    error.  */
     104             : static void *
     105         140 : data_from_hex (const char *string, size_t *r_length)
     106             : {
     107             :   const char *s;
     108             :   unsigned char *buffer;
     109             :   size_t length;
     110             : 
     111         140 :   buffer = gcry_xmalloc (strlen(string)/2+1);
     112         140 :   length = 0;
     113        5132 :   for (s=string; *s; s +=2 )
     114             :     {
     115        4992 :       if (!hexdigitp (s) || !hexdigitp (s+1))
     116           0 :         die ("error parsing hex string `%s'\n", string);
     117        4992 :       ((unsigned char*)buffer)[length++] = xtoi_2 (s);
     118             :     }
     119         140 :   *r_length = length;
     120         140 :   return buffer;
     121             : }
     122             : 
     123             : 
     124             : static void
     125         140 : extract_cmp_data (gcry_sexp_t sexp, const char *name, const char *expected)
     126             : {
     127             :   gcry_sexp_t l1;
     128             :   const void *a;
     129             :   size_t alen;
     130             :   void *b;
     131             :   size_t blen;
     132             : 
     133         140 :   l1 = gcry_sexp_find_token (sexp, name, 0);
     134         140 :   a = gcry_sexp_nth_data (l1, 1, &alen);
     135         140 :   b = data_from_hex (expected, &blen);
     136         140 :   if (!a)
     137           0 :     fail ("parameter \"%s\" missing in key\n", name);
     138         140 :   else if ( alen != blen || memcmp (a, b, alen) )
     139             :     {
     140           0 :       fail ("parameter \"%s\" does not match expected value\n", name);
     141           0 :       if (verbose)
     142             :         {
     143           0 :           info ("expected: %s\n", expected);
     144           0 :           show_sexp ("sexp: ", sexp);
     145             :         }
     146             :     }
     147         140 :   gcry_free (b);
     148         140 :   gcry_sexp_release (l1);
     149         140 : }
     150             : 
     151             : 
     152             : /* These test vectors are from RFC 6979.  */
     153             : static void
     154           1 : check_dsa_rfc6979 (void)
     155             : {
     156             :   static struct {
     157             :     const char *name;
     158             :     const char *key;
     159             :   } keys[] = {
     160             :     {
     161             :       "DSA, 1024 bits",
     162             :       "(private-key"
     163             :       " (DSA"
     164             :       " (p #86F5CA03DCFEB225063FF830A0C769B9DD9D6153AD91D7CE27F787C43278B447"
     165             :       "     E6533B86B18BED6E8A48B784A14C252C5BE0DBF60B86D6385BD2F12FB763ED88"
     166             :       "     73ABFD3F5BA2E0A8C0A59082EAC056935E529DAF7C610467899C77ADEDFC846C"
     167             :       "     881870B7B19B2B58F9BE0521A17002E3BDD6B86685EE90B3D9A1B02B782B1779#)"
     168             :       " (q #996F967F6C8E388D9E28D01E205FBA957A5698B1#)"
     169             :       " (g #07B0F92546150B62514BB771E2A0C0CE387F03BDA6C56B505209FF25FD3C133D"
     170             :       "     89BBCD97E904E09114D9A7DEFDEADFC9078EA544D2E401AEECC40BB9FBBF78FD"
     171             :       "     87995A10A1C27CB7789B594BA7EFB5C4326A9FE59A070E136DB77175464ADCA4"
     172             :       "     17BE5DCE2F40D10A46A3A3943F26AB7FD9C0398FF8C76EE0A56826A8A88F1DBD#)"
     173             :       " (x #411602CB19A6CCC34494D79D98EF1E7ED5AF25F7#)"
     174             :       " (y #5DF5E01DED31D0297E274E1691C192FE5868FEF9E19A84776454B100CF16F653"
     175             :       "     92195A38B90523E2542EE61871C0440CB87C322FC4B4D2EC5E1E7EC766E1BE8D"
     176             :       "     4CE935437DC11C3C8FD426338933EBFE739CB3465F4D3668C5E473508253B1E6"
     177             :       "     82F65CBDC4FAE93C2EA212390E54905A86E2223170B44EAA7DA5DD9FFCFB7F3B#)"
     178             :       " ))"
     179             :     },
     180             :     {
     181             :       "DSA, 2048 bits",
     182             :       "(private-key"
     183             :       " (DSA"
     184             :       " (p #9DB6FB5951B66BB6FE1E140F1D2CE5502374161FD6538DF1648218642F0B5C48"
     185             :       "     C8F7A41AADFA187324B87674FA1822B00F1ECF8136943D7C55757264E5A1A44F"
     186             :       "     FE012E9936E00C1D3E9310B01C7D179805D3058B2A9F4BB6F9716BFE6117C6B5"
     187             :       "     B3CC4D9BE341104AD4A80AD6C94E005F4B993E14F091EB51743BF33050C38DE2"
     188             :       "     35567E1B34C3D6A5C0CEAA1A0F368213C3D19843D0B4B09DCB9FC72D39C8DE41"
     189             :       "     F1BF14D4BB4563CA28371621CAD3324B6A2D392145BEBFAC748805236F5CA2FE"
     190             :       "     92B871CD8F9C36D3292B5509CA8CAA77A2ADFC7BFD77DDA6F71125A7456FEA15"
     191             :       "     3E433256A2261C6A06ED3693797E7995FAD5AABBCFBE3EDA2741E375404AE25B#)"
     192             :       " (q #F2C3119374CE76C9356990B465374A17F23F9ED35089BD969F61C6DDE9998C1F#)"
     193             :       " (g #5C7FF6B06F8F143FE8288433493E4769C4D988ACE5BE25A0E24809670716C613"
     194             :       "     D7B0CEE6932F8FAA7C44D2CB24523DA53FBE4F6EC3595892D1AA58C4328A06C4"
     195             :       "     6A15662E7EAA703A1DECF8BBB2D05DBE2EB956C142A338661D10461C0D135472"
     196             :       "     085057F3494309FFA73C611F78B32ADBB5740C361C9F35BE90997DB2014E2EF5"
     197             :       "     AA61782F52ABEB8BD6432C4DD097BC5423B285DAFB60DC364E8161F4A2A35ACA"
     198             :       "     3A10B1C4D203CC76A470A33AFDCBDD92959859ABD8B56E1725252D78EAC66E71"
     199             :       "     BA9AE3F1DD2487199874393CD4D832186800654760E1E34C09E4D155179F9EC0"
     200             :       "     DC4473F996BDCE6EED1CABED8B6F116F7AD9CF505DF0F998E34AB27514B0FFE7#)"
     201             :       " (x #69C7548C21D0DFEA6B9A51C9EAD4E27C33D3B3F180316E5BCAB92C933F0E4DBC#)"
     202             :       " (y #667098C654426C78D7F8201EAC6C203EF030D43605032C2F1FA937E5237DBD94"
     203             :       "     9F34A0A2564FE126DC8B715C5141802CE0979C8246463C40E6B6BDAA2513FA61"
     204             :       "     1728716C2E4FD53BC95B89E69949D96512E873B9C8F8DFD499CC312882561ADE"
     205             :       "     CB31F658E934C0C197F2C4D96B05CBAD67381E7B768891E4DA3843D24D94CDFB"
     206             :       "     5126E9B8BF21E8358EE0E0A30EF13FD6A664C0DCE3731F7FB49A4845A4FD8254"
     207             :       "     687972A2D382599C9BAC4E0ED7998193078913032558134976410B89D2C171D1"
     208             :       "     23AC35FD977219597AA7D15C1A9A428E59194F75C721EBCBCFAE44696A499AFA"
     209             :       "     74E04299F132026601638CB87AB79190D4A0986315DA8EEC6561C938996BEADF#)"
     210             :       " ))"
     211             :     },
     212             :     {
     213             :       "ECDSA, 192 bits (prime field)",
     214             :       "(private-key"
     215             :       " (ecdsa"
     216             :       " (curve \"NIST P-192\")"
     217             :       " (q #04AC2C77F529F91689FEA0EA5EFEC7F210D8EEA0B9E047ED56"
     218             :       "       3BC723E57670BD4887EBC732C523063D0A7C957BC97C1C43#)"
     219             :       " (d #6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4#)"
     220             :       " ))"
     221             :     },
     222             :     {
     223             :       "ECDSA, 224 bits (prime field)",
     224             :       "(private-key"
     225             :       " (ecdsa"
     226             :       " (curve \"NIST P-224\")"
     227             :       " (q #04"
     228             :       "     00CF08DA5AD719E42707FA431292DEA11244D64FC51610D94B130D6C"
     229             :       "     EEAB6F3DEBE455E3DBF85416F7030CBD94F34F2D6F232C69F3C1385A#)"
     230             :       " (d #F220266E1105BFE3083E03EC7A3A654651F45E37167E88600BF257C1#)"
     231             :       " ))"
     232             :     },
     233             :     {
     234             :       "ECDSA, 256 bits (prime field)",
     235             :       "(private-key"
     236             :       " (ecdsa"
     237             :       " (curve \"NIST P-256\")"
     238             :       " (q #04"
     239             :       "     60FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB6"
     240             :       "     7903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299#)"
     241             :       " (d #C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721#)"
     242             :       " ))"
     243             :     },
     244             :     {
     245             :       "ECDSA, 384 bits (prime field)",
     246             :       "(private-key"
     247             :       " (ecdsa"
     248             :       " (curve \"NIST P-384\")"
     249             :       " (q #04"
     250             :       "     EC3A4E415B4E19A4568618029F427FA5DA9A8BC4AE92E02E06AAE5286B300C64"
     251             :       "     DEF8F0EA9055866064A254515480BC13"
     252             :       "     8015D9B72D7D57244EA8EF9AC0C621896708A59367F9DFB9F54CA84B3F1C9DB1"
     253             :       "     288B231C3AE0D4FE7344FD2533264720#)"
     254             :       " (d #6B9D3DAD2E1B8C1C05B19875B6659F4DE23C3B667BF297BA9AA47740787137D8"
     255             :       "     96D5724E4C70A825F872C9EA60D2EDF5#)"
     256             :       " ))"
     257             :     },
     258             :     {
     259             :       "ECDSA, 521 bits (prime field)",
     260             :       "(private-key"
     261             :       " (ecdsa"
     262             :       " (curve \"NIST P-521\")"
     263             :       " (q #04"
     264             :       "     01894550D0785932E00EAA23B694F213F8C3121F86DC97A04E5A7167DB4E5BCD"
     265             :       "     371123D46E45DB6B5D5370A7F20FB633155D38FFA16D2BD761DCAC474B9A2F50"
     266             :       "     23A4"
     267             :       "     00493101C962CD4D2FDDF782285E64584139C2F91B47F87FF82354D6630F746A"
     268             :       "     28A0DB25741B5B34A828008B22ACC23F924FAAFBD4D33F81EA66956DFEAA2BFD"
     269             :       "     FCF5#)"
     270             :       " (d #FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75"
     271             :       "     CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B8"
     272             :       "     3538#)"
     273             :       " ))"
     274             :     },
     275             :     { NULL }
     276             :   };
     277             : 
     278             :   static struct {
     279             :     const char *keyname;
     280             :     const char *name;
     281             :     const char *hashname;
     282             :     const char *message;
     283             :     const char *k, *r, *s;
     284             :   } tests[] = {
     285             :     {
     286             :       "DSA, 1024 bits",
     287             :       "With SHA-1, message = \"sample\"",
     288             :       "sha1", "sample",
     289             :       "7BDB6B0FF756E1BB5D53583EF979082F9AD5BD5B",
     290             :       "2E1A0C2562B2912CAAF89186FB0F42001585DA55",
     291             :       "29EFB6B0AFF2D7A68EB70CA313022253B9A88DF5"
     292             :     },
     293             :     {
     294             :       "DSA, 1024 bits",
     295             :       "With SHA-224, message = \"sample\"",
     296             :       "sha224", "sample",
     297             :       "562097C06782D60C3037BA7BE104774344687649",
     298             :       "4BC3B686AEA70145856814A6F1BB53346F02101E",
     299             :       "410697B92295D994D21EDD2F4ADA85566F6F94C1"
     300             :     },
     301             :     {
     302             :       "DSA, 1024 bits",
     303             :       "With SHA-256, message = \"sample\"",
     304             :       "sha256", "sample",
     305             :       "519BA0546D0C39202A7D34D7DFA5E760B318BCFB",
     306             :       "81F2F5850BE5BC123C43F71A3033E9384611C545",
     307             :       "4CDD914B65EB6C66A8AAAD27299BEE6B035F5E89"
     308             :     },
     309             :     {
     310             :       "DSA, 1024 bits",
     311             :       "With SHA-384, message = \"sample\"",
     312             :       "sha384", "sample",
     313             :       "95897CD7BBB944AA932DBC579C1C09EB6FCFC595",
     314             :       "07F2108557EE0E3921BC1774F1CA9B410B4CE65A",
     315             :       "54DF70456C86FAC10FAB47C1949AB83F2C6F7595"
     316             :     },
     317             :     {
     318             :       "DSA, 1024 bits",
     319             :       "With SHA-512, message = \"sample\"",
     320             :       "sha512", "sample",
     321             :       "09ECE7CA27D0F5A4DD4E556C9DF1D21D28104F8B",
     322             :       "16C3491F9B8C3FBBDD5E7A7B667057F0D8EE8E1B",
     323             :       "02C36A127A7B89EDBB72E4FFBC71DABC7D4FC69C"
     324             :     },
     325             :     {
     326             :       "DSA, 1024 bits",
     327             :       "With SHA-1, message = \"test\"",
     328             :       "sha1", "test",
     329             :       "5C842DF4F9E344EE09F056838B42C7A17F4A6433",
     330             :       "42AB2052FD43E123F0607F115052A67DCD9C5C77",
     331             :       "183916B0230D45B9931491D4C6B0BD2FB4AAF088"
     332             :     },
     333             :     {
     334             :       "DSA, 1024 bits",
     335             :       "With SHA-224, message = \"test\"",
     336             :       "sha224", "test",
     337             :       "4598B8EFC1A53BC8AECD58D1ABBB0C0C71E67297",
     338             :       "6868E9964E36C1689F6037F91F28D5F2C30610F2",
     339             :       "49CEC3ACDC83018C5BD2674ECAAD35B8CD22940F"
     340             :     },
     341             :     {
     342             :       "DSA, 1024 bits",
     343             :       "With SHA-256, message = \"test\"",
     344             :       "sha256", "test",
     345             :       "5A67592E8128E03A417B0484410FB72C0B630E1A",
     346             :       "22518C127299B0F6FDC9872B282B9E70D0790812",
     347             :       "6837EC18F150D55DE95B5E29BE7AF5D01E4FE160"
     348             :     },
     349             :     {
     350             :       "DSA, 1024 bits",
     351             :       "With SHA-384, message = \"test\"",
     352             :       "sha384", "test",
     353             :       "220156B761F6CA5E6C9F1B9CF9C24BE25F98CD89",
     354             :       "854CF929B58D73C3CBFDC421E8D5430CD6DB5E66",
     355             :       "91D0E0F53E22F898D158380676A871A157CDA622"
     356             :     },
     357             :     {
     358             :       "DSA, 1024 bits",
     359             :       "With SHA-512, message = \"test\"",
     360             :       "sha512", "test",
     361             :       "65D2C2EEB175E370F28C75BFCDC028D22C7DBE9C",
     362             :       "8EA47E475BA8AC6F2D821DA3BD212D11A3DEB9A0",
     363             :       "7C670C7AD72B6C050C109E1790008097125433E8"
     364             :     },
     365             :     {
     366             :       "DSA, 2048 bits",
     367             :       "With SHA-1, message = \"sample\"",
     368             :       "sha1", "sample",
     369             :       "888FA6F7738A41BDC9846466ABDB8174C0338250AE50CE955CA16230F9CBD53E",
     370             :       "3A1B2DBD7489D6ED7E608FD036C83AF396E290DBD602408E8677DAABD6E7445A",
     371             :       "D26FCBA19FA3E3058FFC02CA1596CDBB6E0D20CB37B06054F7E36DED0CDBBCCF"
     372             :     },
     373             :     {
     374             :       "DSA, 2048 bits",
     375             :       "With SHA-224, message = \"sample\"",
     376             :       "sha224", "sample",
     377             :       "BC372967702082E1AA4FCE892209F71AE4AD25A6DFD869334E6F153BD0C4D806",
     378             :       "DC9F4DEADA8D8FF588E98FED0AB690FFCE858DC8C79376450EB6B76C24537E2C",
     379             :       "A65A9C3BC7BABE286B195D5DA68616DA8D47FA0097F36DD19F517327DC848CEC"
     380             :     },
     381             :     {
     382             :       "DSA, 2048 bits",
     383             :       "With SHA-256, message = \"sample\"",
     384             :       "sha256", "sample",
     385             :       "8926A27C40484216F052F4427CFD5647338B7B3939BC6573AF4333569D597C52",
     386             :       "EACE8BDBBE353C432A795D9EC556C6D021F7A03F42C36E9BC87E4AC7932CC809",
     387             :       "7081E175455F9247B812B74583E9E94F9EA79BD640DC962533B0680793A38D53"
     388             :     },
     389             :     {
     390             :       "DSA, 2048 bits",
     391             :       "With SHA-384, message = \"sample\"",
     392             :       "sha384", "sample",
     393             :       "C345D5AB3DA0A5BCB7EC8F8FB7A7E96069E03B206371EF7D83E39068EC564920",
     394             :       "B2DA945E91858834FD9BF616EBAC151EDBC4B45D27D0DD4A7F6A22739F45C00B",
     395             :       "19048B63D9FD6BCA1D9BAE3664E1BCB97F7276C306130969F63F38FA8319021B"
     396             :     },
     397             :     {
     398             :       "DSA, 2048 bits",
     399             :       "With SHA-512, message = \"sample\"",
     400             :       "sha512", "sample",
     401             :       "5A12994431785485B3F5F067221517791B85A597B7A9436995C89ED0374668FC",
     402             :       "2016ED092DC5FB669B8EFB3D1F31A91EECB199879BE0CF78F02BA062CB4C942E",
     403             :       "D0C76F84B5F091E141572A639A4FB8C230807EEA7D55C8A154A224400AFF2351"
     404             :     },
     405             :     {
     406             :       "DSA, 2048 bits",
     407             :       "With SHA-1, message = \"test\"",
     408             :       "sha1", "test",
     409             :       "6EEA486F9D41A037B2C640BC5645694FF8FF4B98D066A25F76BE641CCB24BA4F",
     410             :       "C18270A93CFC6063F57A4DFA86024F700D980E4CF4E2CB65A504397273D98EA0",
     411             :       "414F22E5F31A8B6D33295C7539C1C1BA3A6160D7D68D50AC0D3A5BEAC2884FAA"
     412             :     },
     413             :     {
     414             :       "DSA, 2048 bits",
     415             :       "With SHA-224, message = \"test\"",
     416             :       "sha224", "test",
     417             :       "06BD4C05ED74719106223BE33F2D95DA6B3B541DAD7BFBD7AC508213B6DA6670",
     418             :       "272ABA31572F6CC55E30BF616B7A265312018DD325BE031BE0CC82AA17870EA3",
     419             :       "E9CC286A52CCE201586722D36D1E917EB96A4EBDB47932F9576AC645B3A60806"
     420             :     },
     421             :     {
     422             :       "DSA, 2048 bits",
     423             :       "With SHA-256, message = \"test\"",
     424             :       "sha256", "test",
     425             :       "1D6CE6DDA1C5D37307839CD03AB0A5CBB18E60D800937D67DFB4479AAC8DEAD7",
     426             :       "8190012A1969F9957D56FCCAAD223186F423398D58EF5B3CEFD5A4146A4476F0",
     427             :       "7452A53F7075D417B4B013B278D1BB8BBD21863F5E7B1CEE679CF2188E1AB19E"
     428             :     },
     429             :     {
     430             :       "DSA, 2048 bits",
     431             :       "With SHA-384, message = \"test\"",
     432             :       "sha384", "test",
     433             :       "206E61F73DBE1B2DC8BE736B22B079E9DACD974DB00EEBBC5B64CAD39CF9F91C",
     434             :       "239E66DDBE8F8C230A3D071D601B6FFBDFB5901F94D444C6AF56F732BEB954BE",
     435             :       "6BD737513D5E72FE85D1C750E0F73921FE299B945AAD1C802F15C26A43D34961"
     436             :     },
     437             :     {
     438             :       "DSA, 2048 bits",
     439             :       "With SHA-512, message = \"test\"",
     440             :       "sha512", "test",
     441             :       "AFF1651E4CD6036D57AA8B2A05CCF1A9D5A40166340ECBBDC55BE10B568AA0AA",
     442             :       "89EC4BB1400ECCFF8E7D9AA515CD1DE7803F2DAFF09693EE7FD1353E90A68307",
     443             :       "C9F0BDABCC0D880BB137A994CC7F3980CE91CC10FAF529FC46565B15CEA854E1"
     444             :     },
     445             :     {
     446             :       "ECDSA, 192 bits (prime field)",
     447             :       "With SHA-1, message = \"sample\"",
     448             :       "sha1", "sample",
     449             :       "37D7CA00D2C7B0E5E412AC03BD44BA837FDD5B28CD3B0021",
     450             :       "98C6BD12B23EAF5E2A2045132086BE3EB8EBD62ABF6698FF",
     451             :       "57A22B07DEA9530F8DE9471B1DC6624472E8E2844BC25B64"
     452             :     },
     453             :     {
     454             :       "ECDSA, 192 bits (prime field)",
     455             :       "With SHA-224, message = \"sample\"",
     456             :       "sha224", "sample",
     457             :       "4381526B3FC1E7128F202E194505592F01D5FF4C5AF015D8",
     458             :       "A1F00DAD97AEEC91C95585F36200C65F3C01812AA60378F5",
     459             :       "E07EC1304C7C6C9DEBBE980B9692668F81D4DE7922A0F97A"
     460             :     },
     461             :     {
     462             :       "ECDSA, 192 bits (prime field)",
     463             :       "With SHA-256, message = \"sample\"",
     464             :       "sha256", "sample",
     465             :       "32B1B6D7D42A05CB449065727A84804FB1A3E34D8F261496",
     466             :       "4B0B8CE98A92866A2820E20AA6B75B56382E0F9BFD5ECB55",
     467             :       "CCDB006926EA9565CBADC840829D8C384E06DE1F1E381B85"
     468             :     },
     469             :     {
     470             :       "ECDSA, 192 bits (prime field)",
     471             :       "With SHA-384, message = \"sample\"",
     472             :       "sha384", "sample",
     473             :       "4730005C4FCB01834C063A7B6760096DBE284B8252EF4311",
     474             :       "DA63BF0B9ABCF948FBB1E9167F136145F7A20426DCC287D5",
     475             :       "C3AA2C960972BD7A2003A57E1C4C77F0578F8AE95E31EC5E"
     476             :     },
     477             :     {
     478             :       "ECDSA, 192 bits (prime field)",
     479             :       "With SHA-512, message = \"sample\"",
     480             :       "sha512", "sample",
     481             :       "A2AC7AB055E4F20692D49209544C203A7D1F2C0BFBC75DB1",
     482             :       "4D60C5AB1996BD848343B31C00850205E2EA6922DAC2E4B8",
     483             :       "3F6E837448F027A1BF4B34E796E32A811CBB4050908D8F67"
     484             :     },
     485             :     {
     486             :       "ECDSA, 192 bits (prime field)",
     487             :       "With SHA-1, message = \"test\"",
     488             :       "sha1", "test",
     489             :       "D9CF9C3D3297D3260773A1DA7418DB5537AB8DD93DE7FA25",
     490             :       "0F2141A0EBBC44D2E1AF90A50EBCFCE5E197B3B7D4DE036D",
     491             :       "EB18BC9E1F3D7387500CB99CF5F7C157070A8961E38700B7"
     492             :     },
     493             :     {
     494             :       "ECDSA, 192 bits (prime field)",
     495             :       "With SHA-224, message = \"test\"",
     496             :       "sha224", "test",
     497             :       "F5DC805F76EF851800700CCE82E7B98D8911B7D510059FBE",
     498             :       "6945A1C1D1B2206B8145548F633BB61CEF04891BAF26ED34",
     499             :       "B7FB7FDFC339C0B9BD61A9F5A8EAF9BE58FC5CBA2CB15293"
     500             :     },
     501             :     {
     502             :       "ECDSA, 192 bits (prime field)",
     503             :       "With SHA-256, message = \"test\"",
     504             :       "sha256", "test",
     505             :       "5C4CE89CF56D9E7C77C8585339B006B97B5F0680B4306C6C",
     506             :       "3A718BD8B4926C3B52EE6BBE67EF79B18CB6EB62B1AD97AE",
     507             :       "5662E6848A4A19B1F1AE2F72ACD4B8BBE50F1EAC65D9124F"
     508             :     },
     509             :     {
     510             :       "ECDSA, 192 bits (prime field)",
     511             :       "With SHA-384, message = \"test\"",
     512             :       "sha384", "test",
     513             :       "5AFEFB5D3393261B828DB6C91FBC68C230727B030C975693",
     514             :       "B234B60B4DB75A733E19280A7A6034BD6B1EE88AF5332367",
     515             :       "7994090B2D59BB782BE57E74A44C9A1C700413F8ABEFE77A"
     516             :     },
     517             :     {
     518             :       "ECDSA, 192 bits (prime field)",
     519             :       "With SHA-512, message = \"test\"",
     520             :       "sha512", "test",
     521             :       "0758753A5254759C7CFBAD2E2D9B0792EEE44136C9480527",
     522             :       "FE4F4AE86A58B6507946715934FE2D8FF9D95B6B098FE739",
     523             :       "74CF5605C98FBA0E1EF34D4B5A1577A7DCF59457CAE52290"
     524             :     },
     525             : 
     526             : 
     527             : 
     528             :     {
     529             :       "ECDSA, 224 bits (prime field)",
     530             :       "With SHA-1, message = \"sample\"",
     531             :       "sha1", "sample",
     532             :       "7EEFADD91110D8DE6C2C470831387C50D3357F7F4D477054B8B426BC",
     533             :       "22226F9D40A96E19C4A301CE5B74B115303C0F3A4FD30FC257FB57AC",
     534             :       "66D1CDD83E3AF75605DD6E2FEFF196D30AA7ED7A2EDF7AF475403D69"
     535             :     },
     536             :     {
     537             :       "ECDSA, 224 bits (prime field)",
     538             :       "With SHA-224, message = \"sample\"",
     539             :       "sha224", "sample",
     540             :       "C1D1F2F10881088301880506805FEB4825FE09ACB6816C36991AA06D",
     541             :       "1CDFE6662DDE1E4A1EC4CDEDF6A1F5A2FB7FBD9145C12113E6ABFD3E",
     542             :       "A6694FD7718A21053F225D3F46197CA699D45006C06F871808F43EBC"
     543             :     },
     544             :     {
     545             :       "ECDSA, 224 bits (prime field)",
     546             :       "With SHA-256, message = \"sample\"",
     547             :       "sha256", "sample",
     548             :       "AD3029E0278F80643DE33917CE6908C70A8FF50A411F06E41DEDFCDC",
     549             :       "61AA3DA010E8E8406C656BC477A7A7189895E7E840CDFE8FF42307BA",
     550             :       "BC814050DAB5D23770879494F9E0A680DC1AF7161991BDE692B10101"
     551             :     },
     552             :     {
     553             :       "ECDSA, 224 bits (prime field)",
     554             :       "With SHA-384, message = \"sample\"",
     555             :       "sha384", "sample",
     556             :       "52B40F5A9D3D13040F494E83D3906C6079F29981035C7BD51E5CAC40",
     557             :       "0B115E5E36F0F9EC81F1325A5952878D745E19D7BB3EABFABA77E953",
     558             :       "830F34CCDFE826CCFDC81EB4129772E20E122348A2BBD889A1B1AF1D"
     559             :     },
     560             :     {
     561             :       "ECDSA, 224 bits (prime field)",
     562             :       "With SHA-512, message = \"sample\"",
     563             :       "sha512", "sample",
     564             :       "9DB103FFEDEDF9CFDBA05184F925400C1653B8501BAB89CEA0FBEC14",
     565             :       "074BD1D979D5F32BF958DDC61E4FB4872ADCAFEB2256497CDAC30397",
     566             :       "A4CECA196C3D5A1FF31027B33185DC8EE43F288B21AB342E5D8EB084"
     567             :     },
     568             :     {
     569             :       "ECDSA, 224 bits (prime field)",
     570             :       "With SHA-1, message = \"test\"",
     571             :       "sha1", "test",
     572             :       "2519178F82C3F0E4F87ED5883A4E114E5B7A6E374043D8EFD329C253",
     573             :       "DEAA646EC2AF2EA8AD53ED66B2E2DDAA49A12EFD8356561451F3E21C",
     574             :       "95987796F6CF2062AB8135271DE56AE55366C045F6D9593F53787BD2"
     575             :     },
     576             :     {
     577             :       "ECDSA, 224 bits (prime field)",
     578             :       "With SHA-224, message = \"test\"",
     579             :       "sha224", "test",
     580             :       "DF8B38D40DCA3E077D0AC520BF56B6D565134D9B5F2EAE0D34900524",
     581             :       "C441CE8E261DED634E4CF84910E4C5D1D22C5CF3B732BB204DBEF019",
     582             :       "902F42847A63BDC5F6046ADA114953120F99442D76510150F372A3F4"
     583             :     },
     584             :     {
     585             :       "ECDSA, 224 bits (prime field)",
     586             :       "With SHA-256, message = \"test\"",
     587             :       "sha256", "test",
     588             :       "FF86F57924DA248D6E44E8154EB69F0AE2AEBAEE9931D0B5A969F904",
     589             :       "AD04DDE87B84747A243A631EA47A1BA6D1FAA059149AD2440DE6FBA6",
     590             :       "178D49B1AE90E3D8B629BE3DB5683915F4E8C99FDF6E666CF37ADCFD"
     591             :     },
     592             :     {
     593             :       "ECDSA, 224 bits (prime field)",
     594             :       "With SHA-384, message = \"test\"",
     595             :       "sha384", "test",
     596             :       "7046742B839478C1B5BD31DB2E862AD868E1A45C863585B5F22BDC2D",
     597             :       "389B92682E399B26518A95506B52C03BC9379A9DADF3391A21FB0EA4",
     598             :       "414A718ED3249FF6DBC5B50C27F71F01F070944DA22AB1F78F559AAB"
     599             :     },
     600             :     {
     601             :       "ECDSA, 224 bits (prime field)",
     602             :       "With SHA-512, message = \"test\"",
     603             :       "sha512", "test",
     604             :       "E39C2AA4EA6BE2306C72126D40ED77BF9739BB4D6EF2BBB1DCB6169D",
     605             :       "049F050477C5ADD858CAC56208394B5A55BAEBBE887FDF765047C17C",
     606             :       "077EB13E7005929CEFA3CD0403C7CDCC077ADF4E44F3C41B2F60ECFF"
     607             :     },
     608             :     {
     609             :       "ECDSA, 256 bits (prime field)",
     610             :       "With SHA-1, message = \"sample\"",
     611             :       "sha1", "sample",
     612             :       "882905F1227FD620FBF2ABF21244F0BA83D0DC3A9103DBBEE43A1FB858109DB4",
     613             :       "61340C88C3AAEBEB4F6D667F672CA9759A6CCAA9FA8811313039EE4A35471D32",
     614             :       "6D7F147DAC089441BB2E2FE8F7A3FA264B9C475098FDCF6E00D7C996E1B8B7EB"
     615             :     },
     616             :     {
     617             :       "ECDSA, 256 bits (prime field)",
     618             :       "With SHA-224, message = \"sample\"",
     619             :       "sha224", "sample",
     620             :       "103F90EE9DC52E5E7FB5132B7033C63066D194321491862059967C715985D473",
     621             :       "53B2FFF5D1752B2C689DF257C04C40A587FABABB3F6FC2702F1343AF7CA9AA3F",
     622             :       "B9AFB64FDC03DC1A131C7D2386D11E349F070AA432A4ACC918BEA988BF75C74C"
     623             :     },
     624             :     {
     625             :       "ECDSA, 256 bits (prime field)",
     626             :       "With SHA-256, message = \"sample\"",
     627             :       "sha256", "sample",
     628             :       "A6E3C57DD01ABE90086538398355DD4C3B17AA873382B0F24D6129493D8AAD60",
     629             :       "EFD48B2AACB6A8FD1140DD9CD45E81D69D2C877B56AAF991C34D0EA84EAF3716",
     630             :       "F7CB1C942D657C41D436C7A1B6E29F65F3E900DBB9AFF4064DC4AB2F843ACDA8"
     631             :     },
     632             :     {
     633             :       "ECDSA, 256 bits (prime field)",
     634             :       "With SHA-384, message = \"sample\"",
     635             :       "sha384", "sample",
     636             :       "09F634B188CEFD98E7EC88B1AA9852D734D0BC272F7D2A47DECC6EBEB375AAD4",
     637             :       "0EAFEA039B20E9B42309FB1D89E213057CBF973DC0CFC8F129EDDDC800EF7719",
     638             :       "4861F0491E6998B9455193E34E7B0D284DDD7149A74B95B9261F13ABDE940954"
     639             :     },
     640             :     {
     641             :       "ECDSA, 256 bits (prime field)",
     642             :       "With SHA-512, message = \"sample\"",
     643             :       "sha512", "sample",
     644             :       "5FA81C63109BADB88C1F367B47DA606DA28CAD69AA22C4FE6AD7DF73A7173AA5",
     645             :       "8496A60B5E9B47C825488827E0495B0E3FA109EC4568FD3F8D1097678EB97F00",
     646             :       "2362AB1ADBE2B8ADF9CB9EDAB740EA6049C028114F2460F96554F61FAE3302FE"
     647             :     },
     648             :     {
     649             :       "ECDSA, 256 bits (prime field)",
     650             :       "With SHA-1, message = \"test\"",
     651             :       "sha1", "test",
     652             :       "8C9520267C55D6B980DF741E56B4ADEE114D84FBFA2E62137954164028632A2E",
     653             :       "0CBCC86FD6ABD1D99E703E1EC50069EE5C0B4BA4B9AC60E409E8EC5910D81A89",
     654             :       "01B9D7B73DFAA60D5651EC4591A0136F87653E0FD780C3B1BC872FFDEAE479B1"
     655             :     },
     656             :     {
     657             :       "ECDSA, 256 bits (prime field)",
     658             :       "With SHA-224, message = \"test\"",
     659             :       "sha224", "test",
     660             :       "669F4426F2688B8BE0DB3A6BD1989BDAEFFF84B649EEB84F3DD26080F667FAA7",
     661             :       "C37EDB6F0AE79D47C3C27E962FA269BB4F441770357E114EE511F662EC34A692",
     662             :       "C820053A05791E521FCAAD6042D40AEA1D6B1A540138558F47D0719800E18F2D"
     663             :     },
     664             :     {
     665             :       "ECDSA, 256 bits (prime field)",
     666             :       "With SHA-256, message = \"test\"",
     667             :       "sha256", "test",
     668             :       "D16B6AE827F17175E040871A1C7EC3500192C4C92677336EC2537ACAEE0008E0",
     669             :       "F1ABB023518351CD71D881567B1EA663ED3EFCF6C5132B354F28D3B0B7D38367",
     670             :       "019F4113742A2B14BD25926B49C649155F267E60D3814B4C0CC84250E46F0083"
     671             :     },
     672             :     {
     673             :       "ECDSA, 256 bits (prime field)",
     674             :       "With SHA-384, message = \"test\"",
     675             :       "sha384", "test",
     676             :       "16AEFFA357260B04B1DD199693960740066C1A8F3E8EDD79070AA914D361B3B8",
     677             :       "83910E8B48BB0C74244EBDF7F07A1C5413D61472BD941EF3920E623FBCCEBEB6",
     678             :       "8DDBEC54CF8CD5874883841D712142A56A8D0F218F5003CB0296B6B509619F2C"
     679             :     },
     680             :     {
     681             :       "ECDSA, 256 bits (prime field)",
     682             :       "With SHA-512, message = \"test\"",
     683             :       "sha512", "test",
     684             :       "6915D11632ACA3C40D5D51C08DAF9C555933819548784480E93499000D9F0B7F",
     685             :       "461D93F31B6540894788FD206C07CFA0CC35F46FA3C91816FFF1040AD1581A04",
     686             :       "39AF9F15DE0DB8D97E72719C74820D304CE5226E32DEDAE67519E840D1194E55"
     687             :     },
     688             :     {
     689             :       "ECDSA, 384 bits (prime field)",
     690             :       "With SHA-1, message = \"sample\"",
     691             :       "sha1", "sample",
     692             :       "4471EF7518BB2C7C20F62EAE1C387AD0C5E8E470995DB4ACF694466E6AB09663"
     693             :       "0F29E5938D25106C3C340045A2DB01A7",
     694             :       "EC748D839243D6FBEF4FC5C4859A7DFFD7F3ABDDF72014540C16D73309834FA3"
     695             :       "7B9BA002899F6FDA3A4A9386790D4EB2",
     696             :       "A3BCFA947BEEF4732BF247AC17F71676CB31A847B9FF0CBC9C9ED4C1A5B3FACF"
     697             :       "26F49CA031D4857570CCB5CA4424A443"
     698             :     },
     699             :     {
     700             :       "ECDSA, 384 bits (prime field)",
     701             :       "With SHA-224, message = \"sample\"",
     702             :       "sha224", "sample",
     703             :       "A4E4D2F0E729EB786B31FC20AD5D849E304450E0AE8E3E341134A5C1AFA03CAB"
     704             :       "8083EE4E3C45B06A5899EA56C51B5879",
     705             :       "42356E76B55A6D9B4631C865445DBE54E056D3B3431766D0509244793C3F9366"
     706             :       "450F76EE3DE43F5A125333A6BE060122",
     707             :       "9DA0C81787064021E78DF658F2FBB0B042BF304665DB721F077A4298B095E483"
     708             :       "4C082C03D83028EFBF93A3C23940CA8D"
     709             :     },
     710             :     {
     711             :       "ECDSA, 384 bits (prime field)",
     712             :       "With SHA-256, message = \"sample\"",
     713             :       "sha256", "sample",
     714             :       "180AE9F9AEC5438A44BC159A1FCB277C7BE54FA20E7CF404B490650A8ACC414E"
     715             :       "375572342863C899F9F2EDF9747A9B60",
     716             :       "21B13D1E013C7FA1392D03C5F99AF8B30C570C6F98D4EA8E354B63A21D3DAA33"
     717             :       "BDE1E888E63355D92FA2B3C36D8FB2CD",
     718             :       "F3AA443FB107745BF4BD77CB3891674632068A10CA67E3D45DB2266FA7D1FEEB"
     719             :       "EFDC63ECCD1AC42EC0CB8668A4FA0AB0"
     720             :     },
     721             :     {
     722             :       "ECDSA, 384 bits (prime field)",
     723             :       "With SHA-384, message = \"sample\"",
     724             :       "sha384", "sample",
     725             :       "94ED910D1A099DAD3254E9242AE85ABDE4BA15168EAF0CA87A555FD56D10FBCA"
     726             :       "2907E3E83BA95368623B8C4686915CF9",
     727             :       "94EDBB92A5ECB8AAD4736E56C691916B3F88140666CE9FA73D64C4EA95AD133C"
     728             :       "81A648152E44ACF96E36DD1E80FABE46",
     729             :       "99EF4AEB15F178CEA1FE40DB2603138F130E740A19624526203B6351D0A3A94F"
     730             :       "A329C145786E679E7B82C71A38628AC8"
     731             :     },
     732             :     {
     733             :       "ECDSA, 384 bits (prime field)",
     734             :       "With SHA-512, message = \"sample\"",
     735             :       "sha512", "sample",
     736             :       "92FC3C7183A883E24216D1141F1A8976C5B0DD797DFA597E3D7B32198BD35331"
     737             :       "A4E966532593A52980D0E3AAA5E10EC3",
     738             :       "ED0959D5880AB2D869AE7F6C2915C6D60F96507F9CB3E047C0046861DA4A799C"
     739             :       "FE30F35CC900056D7C99CD7882433709",
     740             :       "512C8CCEEE3890A84058CE1E22DBC2198F42323CE8ACA9135329F03C068E5112"
     741             :       "DC7CC3EF3446DEFCEB01A45C2667FDD5"
     742             :     },
     743             :     {
     744             :       "ECDSA, 384 bits (prime field)",
     745             :       "With SHA-1, message = \"test\"",
     746             :       "sha1", "test",
     747             :       "66CC2C8F4D303FC962E5FF6A27BD79F84EC812DDAE58CF5243B64A4AD8094D47"
     748             :       "EC3727F3A3C186C15054492E30698497",
     749             :       "4BC35D3A50EF4E30576F58CD96CE6BF638025EE624004A1F7789A8B8E43D0678"
     750             :       "ACD9D29876DAF46638645F7F404B11C7",
     751             :       "D5A6326C494ED3FF614703878961C0FDE7B2C278F9A65FD8C4B7186201A29916"
     752             :       "95BA1C84541327E966FA7B50F7382282"
     753             :     },
     754             :     {
     755             :       "ECDSA, 384 bits (prime field)",
     756             :       "With SHA-224, message = \"test\"",
     757             :       "sha224", "test",
     758             :       "18FA39DB95AA5F561F30FA3591DC59C0FA3653A80DAFFA0B48D1A4C6DFCBFF6E"
     759             :       "3D33BE4DC5EB8886A8ECD093F2935726",
     760             :       "E8C9D0B6EA72A0E7837FEA1D14A1A9557F29FAA45D3E7EE888FC5BF954B5E624"
     761             :       "64A9A817C47FF78B8C11066B24080E72",
     762             :       "07041D4A7A0379AC7232FF72E6F77B6DDB8F09B16CCE0EC3286B2BD43FA8C614"
     763             :       "1C53EA5ABEF0D8231077A04540A96B66"
     764             :     },
     765             :     {
     766             :       "ECDSA, 384 bits (prime field)",
     767             :       "With SHA-256, message = \"test\"",
     768             :       "sha256", "test",
     769             :       "0CFAC37587532347DC3389FDC98286BBA8C73807285B184C83E62E26C401C0FA"
     770             :       "A48DD070BA79921A3457ABFF2D630AD7",
     771             :       "6D6DEFAC9AB64DABAFE36C6BF510352A4CC27001263638E5B16D9BB51D451559"
     772             :       "F918EEDAF2293BE5B475CC8F0188636B",
     773             :       "2D46F3BECBCC523D5F1A1256BF0C9B024D879BA9E838144C8BA6BAEB4B53B47D"
     774             :       "51AB373F9845C0514EEFB14024787265"
     775             :     },
     776             :     {
     777             :       "ECDSA, 384 bits (prime field)",
     778             :       "With SHA-384, message = \"test\"",
     779             :       "sha384", "test",
     780             :       "015EE46A5BF88773ED9123A5AB0807962D193719503C527B031B4C2D225092AD"
     781             :       "A71F4A459BC0DA98ADB95837DB8312EA",
     782             :       "8203B63D3C853E8D77227FB377BCF7B7B772E97892A80F36AB775D509D7A5FEB"
     783             :       "0542A7F0812998DA8F1DD3CA3CF023DB",
     784             :       "DDD0760448D42D8A43AF45AF836FCE4DE8BE06B485E9B61B827C2F13173923E0"
     785             :       "6A739F040649A667BF3B828246BAA5A5"
     786             :     },
     787             :     {
     788             :       "ECDSA, 384 bits (prime field)",
     789             :       "With SHA-512, message = \"test\"",
     790             :       "sha512", "test",
     791             :       "3780C4F67CB15518B6ACAE34C9F83568D2E12E47DEAB6C50A4E4EE5319D1E8CE"
     792             :       "0E2CC8A136036DC4B9C00E6888F66B6C",
     793             :       "A0D5D090C9980FAF3C2CE57B7AE951D31977DD11C775D314AF55F76C676447D0"
     794             :       "6FB6495CD21B4B6E340FC236584FB277",
     795             :       "976984E59B4C77B0E8E4460DCA3D9F20E07B9BB1F63BEEFAF576F6B2E8B22463"
     796             :       "4A2092CD3792E0159AD9CEE37659C736"
     797             :     },
     798             :     {
     799             :       "ECDSA, 521 bits (prime field)",
     800             :       "With SHA-1, message = \"sample\"",
     801             :       "sha1", "sample",
     802             :       "0089C071B419E1C2820962321787258469511958E80582E95D8378E0C2CCDB3CB"
     803             :       "42BEDE42F50E3FA3C71F5A76724281D31D9C89F0F91FC1BE4918DB1C03A5838D"
     804             :       "0F9",
     805             :       "343B6EC45728975EA5CBA6659BBB6062A5FF89EEA58BE3C80B619F322C87910"
     806             :       "FE092F7D45BB0F8EEE01ED3F20BABEC079D202AE677B243AB40B5431D497C55D"
     807             :       "75D",
     808             :       "E7B0E675A9B24413D448B8CC119D2BF7B2D2DF032741C096634D6D65D0DBE3D"
     809             :       "5694625FB9E8104D3B842C1B0E2D0B98BEA19341E8676AEF66AE4EBA3D5475D5"
     810             :       "D16"
     811             :     },
     812             :     {
     813             :       "ECDSA, 521 bits (prime field)",
     814             :       "With SHA-224, message = \"sample\"",
     815             :       "sha224", "sample",
     816             :       "121415EC2CD7726330A61F7F3FA5DE14BE9436019C4DB8CB4041F3B54CF31BE0"
     817             :       "493EE3F427FB906393D895A19C9523F3A1D54BB8702BD4AA9C99DAB2597B9211"
     818             :       "3F3",
     819             :       "01776331CFCDF927D666E032E00CF776187BC9FDD8E69D0DABB4109FFE1B5E2A3"
     820             :       "0715F4CC923A4A5E94D2503E9ACFED92857B7F31D7152E0F8C00C15FF3D87E2E"
     821             :       "D2E",
     822             :       "50CB5265417FE2320BBB5A122B8E1A32BD699089851128E360E620A30C7E17B"
     823             :       "A41A666AF126CE100E5799B153B60528D5300D08489CA9178FB610A2006C254B"
     824             :       "41F"
     825             :     },
     826             :     {
     827             :       "ECDSA, 521 bits (prime field)",
     828             :       "With SHA-256, message = \"sample\"",
     829             :       "sha256", "sample",
     830             :       "0EDF38AFCAAECAB4383358B34D67C9F2216C8382AAEA44A3DAD5FDC9C3257576"
     831             :       "1793FEF24EB0FC276DFC4F6E3EC476752F043CF01415387470BCBD8678ED2C7E"
     832             :       "1A0",
     833             :       "01511BB4D675114FE266FC4372B87682BAECC01D3CC62CF2303C92B3526012659"
     834             :       "D16876E25C7C1E57648F23B73564D67F61C6F14D527D54972810421E7D87589E"
     835             :       "1A7",
     836             :       "4A171143A83163D6DF460AAF61522695F207A58B95C0644D87E52AA1A347916"
     837             :       "E4F7A72930B1BC06DBE22CE3F58264AFD23704CBB63B29B931F7DE6C9D949A7E"
     838             :       "CFC"
     839             :     },
     840             :     {
     841             :       "ECDSA, 521 bits (prime field)",
     842             :       "With SHA-384, message = \"sample\"",
     843             :       "sha384", "sample",
     844             :       "1546A108BC23A15D6F21872F7DED661FA8431DDBD922D0DCDB77CC878C8553FF"
     845             :       "AD064C95A920A750AC9137E527390D2D92F153E66196966EA554D9ADFCB109C4"
     846             :       "211",
     847             :       "01EA842A0E17D2DE4F92C15315C63DDF72685C18195C2BB95E572B9C5136CA4B4"
     848             :       "B576AD712A52BE9730627D16054BA40CC0B8D3FF035B12AE75168397F5D50C67"
     849             :       "451",
     850             :       "01F21A3CEE066E1961025FB048BD5FE2B7924D0CD797BABE0A83B66F1E35EEAF5"
     851             :       "FDE143FA85DC394A7DEE766523393784484BDF3E00114A1C857CDE1AA203DB65"
     852             :       "D61"
     853             :     },
     854             :     {
     855             :       "ECDSA, 521 bits (prime field)",
     856             :       "With SHA-512, message = \"sample\"",
     857             :       "sha512", "sample",
     858             :       "1DAE2EA071F8110DC26882D4D5EAE0621A3256FC8847FB9022E2B7D28E6F1019"
     859             :       "8B1574FDD03A9053C08A1854A168AA5A57470EC97DD5CE090124EF52A2F7ECBF"
     860             :       "FD3",
     861             :       "C328FAFCBD79DD77850370C46325D987CB525569FB63C5D3BC53950E6D4C5F1"
     862             :       "74E25A1EE9017B5D450606ADD152B534931D7D4E8455CC91F9B15BF05EC36E37"
     863             :       "7FA",
     864             :       "617CCE7CF5064806C467F678D3B4080D6F1CC50AF26CA209417308281B68AF2"
     865             :       "82623EAA63E5B5C0723D8B8C37FF0777B1A20F8CCB1DCCC43997F1EE0E44DA4A"
     866             :       "67A"
     867             :     },
     868             :     {
     869             :       "ECDSA, 521 bits (prime field)",
     870             :       "With SHA-1, message = \"test\"",
     871             :       "sha1", "test",
     872             :       "0BB9F2BF4FE1038CCF4DABD7139A56F6FD8BB1386561BD3C6A4FC818B20DF5DD"
     873             :       "BA80795A947107A1AB9D12DAA615B1ADE4F7A9DC05E8E6311150F47F5C57CE8B"
     874             :       "222",
     875             :       "013BAD9F29ABE20DE37EBEB823C252CA0F63361284015A3BF430A46AAA80B87B0"
     876             :       "693F0694BD88AFE4E661FC33B094CD3B7963BED5A727ED8BD6A3A202ABE009D0"
     877             :       "367",
     878             :       "01E9BB81FF7944CA409AD138DBBEE228E1AFCC0C890FC78EC8604639CB0DBDC90"
     879             :       "F717A99EAD9D272855D00162EE9527567DD6A92CBD629805C0445282BBC91679"
     880             :       "7FF"
     881             :     },
     882             :     {
     883             :       "ECDSA, 521 bits (prime field)",
     884             :       "With SHA-224, message = \"test\"",
     885             :       "sha224", "test",
     886             :       "040D09FCF3C8A5F62CF4FB223CBBB2B9937F6B0577C27020A99602C25A011369"
     887             :       "87E452988781484EDBBCF1C47E554E7FC901BC3085E5206D9F619CFF07E73D6F"
     888             :       "706",
     889             :       "01C7ED902E123E6815546065A2C4AF977B22AA8EADDB68B2C1110E7EA44D42086"
     890             :       "BFE4A34B67DDC0E17E96536E358219B23A706C6A6E16BA77B65E1C595D43CAE1"
     891             :       "7FB",
     892             :       "0177336676304FCB343CE028B38E7B4FBA76C1C1B277DA18CAD2A8478B2A9A9F5"
     893             :       "BEC0F3BA04F35DB3E4263569EC6AADE8C92746E4C82F8299AE1B8F1739F8FD51"
     894             :       "9A4"
     895             :     },
     896             :     {
     897             :       "ECDSA, 521 bits (prime field)",
     898             :       "With SHA-256, message = \"test\"",
     899             :       "sha256", "test",
     900             :       "01DE74955EFAABC4C4F17F8E84D881D1310B5392D7700275F82F145C61E84384"
     901             :       "1AF09035BF7A6210F5A431A6A9E81C9323354A9E69135D44EBD2FCAA7731B909"
     902             :       "258",
     903             :       "0E871C4A14F993C6C7369501900C4BC1E9C7B0B4BA44E04868B30B41D807104"
     904             :       "2EB28C4C250411D0CE08CD197E4188EA4876F279F90B3D8D74A3C76E6F1E4656"
     905             :       "AA8",
     906             :       "CD52DBAA33B063C3A6CD8058A1FB0A46A4754B034FCC644766CA14DA8CA5CA9"
     907             :       "FDE00E88C1AD60CCBA759025299079D7A427EC3CC5B619BFBC828E7769BCD694"
     908             :       "E86"
     909             :     },
     910             :     {
     911             :       "ECDSA, 521 bits (prime field)",
     912             :       "With SHA-384, message = \"test\"",
     913             :       "sha384", "test",
     914             :       "1F1FC4A349A7DA9A9E116BFDD055DC08E78252FF8E23AC276AC88B1770AE0B5D"
     915             :       "CEB1ED14A4916B769A523CE1E90BA22846AF11DF8B300C38818F713DADD85DE0"
     916             :       "C88",
     917             :       "014BEE21A18B6D8B3C93FAB08D43E739707953244FDBE924FA926D76669E7AC8C"
     918             :       "89DF62ED8975C2D8397A65A49DCC09F6B0AC62272741924D479354D74FF60755"
     919             :       "78C",
     920             :       "0133330865C067A0EAF72362A65E2D7BC4E461E8C8995C3B6226A21BD1AA78F0E"
     921             :       "D94FE536A0DCA35534F0CD1510C41525D163FE9D74D134881E35141ED5E8E95B"
     922             :       "979"
     923             :     },
     924             :     {
     925             :       "ECDSA, 521 bits (prime field)",
     926             :       "With SHA-512, message = \"test\"",
     927             :       "sha512", "test",
     928             :       "16200813020EC986863BEDFC1B121F605C1215645018AEA1A7B215A564DE9EB1"
     929             :       "B38A67AA1128B80CE391C4FB71187654AAA3431027BFC7F395766CA988C964DC"
     930             :       "56D",
     931             :       "013E99020ABF5CEE7525D16B69B229652AB6BDF2AFFCAEF38773B4B7D08725F10"
     932             :       "CDB93482FDCC54EDCEE91ECA4166B2A7C6265EF0CE2BD7051B7CEF945BABD47E"
     933             :       "E6D",
     934             :       "01FBD0013C674AA79CB39849527916CE301C66EA7CE8B80682786AD60F98F7E78"
     935             :       "A19CA69EFF5C57400E3B3A0AD66CE0978214D13BAF4E9AC60752F7B155E2DE4D"
     936             :       "CE3"
     937             :     },
     938             :     { NULL }
     939             :   };
     940             : 
     941             :   gpg_error_t err;
     942             :   int tno, i, hashalgo;
     943             :   gcry_sexp_t seckey, data, sig;
     944             :   unsigned char digest[64];
     945             :   int digestlen;
     946             : 
     947          71 :   for (tno = 0; tests[tno].keyname; tno++)
     948             :     {
     949          70 :       if (verbose)
     950           0 :         info ("Test %d: %s. %s.\n", tno, tests[tno].keyname, tests[tno].name);
     951             : 
     952             :       {
     953         280 :         for (i=0; keys[i].name; i++)
     954         280 :           if (!strcmp (tests[tno].keyname, keys[i].name))
     955          70 :             break;
     956          70 :         if (!keys[i].name)
     957           0 :           die ("Key '%s' used by test '%s' not found\n",
     958             :                tests[tno].keyname, tests[tno].name);
     959             : 
     960          70 :         err = gcry_sexp_new (&seckey, keys[i].key, 0, 1);
     961          70 :         if (err)
     962           0 :           die ("reading key failed: %s\n", gpg_strerror (err));
     963             :       }
     964             : 
     965          70 :       hashalgo = gcry_md_map_name (tests[tno].hashname);
     966          70 :       if (!hashalgo)
     967           0 :         die ("hash with name '%s' is not supported\n", tests[tno].hashname);
     968             : 
     969          70 :       digestlen = gcry_md_get_algo_dlen (hashalgo);
     970          70 :       if (digestlen > sizeof digest)
     971           0 :         die ("internal error: digest does not fit into our buffer\n");
     972             : 
     973         140 :       gcry_md_hash_buffer (hashalgo, digest,
     974          70 :                            tests[tno].message, strlen (tests[tno].message));
     975             : 
     976          70 :       err = gcry_sexp_build (&data, NULL,
     977             :                              "(data "
     978             :                              " (flags rfc6979)"
     979             :                              " (hash %s %b))",
     980             :                              tests[tno].hashname, digestlen, digest);
     981          70 :       if (err)
     982           0 :         die ("building data sexp failed: %s\n", gpg_strerror (err));
     983             : 
     984          70 :       err = gcry_pk_sign (&sig, data, seckey);
     985          70 :       if (err)
     986           0 :         fail ("signing failed: %s\n", gpg_strerror (err));
     987             : 
     988          70 :       extract_cmp_data (sig, "r", tests[tno].r);
     989          70 :       extract_cmp_data (sig, "s", tests[tno].s);
     990             : 
     991          70 :       err = gcry_pk_verify (sig, data, seckey);
     992          70 :       if (err)
     993           0 :         fail ("verification failed: %s\n", gpg_strerror (err));
     994             : 
     995          70 :       gcry_sexp_release (sig);
     996          70 :       gcry_sexp_release (data);
     997          70 :       gcry_sexp_release (seckey);
     998             :     }
     999           1 : }
    1000             : 
    1001             : 
    1002             : 
    1003             : int
    1004           1 : main (int argc, char **argv)
    1005             : {
    1006           1 :   int debug = 0;
    1007             : 
    1008           1 :   if (argc > 1 && !strcmp (argv[1], "--verbose"))
    1009           0 :     verbose = 1;
    1010           1 :   else if (argc > 1 && !strcmp (argv[1], "--debug"))
    1011             :     {
    1012           0 :       verbose = 2;
    1013           0 :       debug = 1;
    1014             :     }
    1015             : 
    1016           1 :   gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
    1017             :   /* Check that we test exactly our version - including the patchlevel.  */
    1018           1 :   if (strcmp (GCRYPT_VERSION, gcry_check_version (NULL)))
    1019           0 :     die ("version mismatch; pgm=%s, library=%s\n",
    1020             :          GCRYPT_VERSION,gcry_check_version (NULL));
    1021           1 :   gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
    1022           1 :   if (debug)
    1023           0 :     gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
    1024             :   /* No valuable keys are create, so we can speed up our RNG. */
    1025           1 :   gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
    1026             : 
    1027           1 :   check_dsa_rfc6979 ();
    1028             : 
    1029           1 :   return error_count ? 1 : 0;
    1030             : }

Generated by: LCOV version 1.11