383
static gpg_err_code_t
384
selftests_sha1 (int extended, selftest_report_func_t report)
389
what = "short string";
390
errtxt = _gcry_hash_selftest_check_one
393
"\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E"
394
"\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D", 20);
400
what = "long string";
401
errtxt = _gcry_hash_selftest_check_one
403
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56,
404
"\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE"
405
"\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1", 20);
409
what = "one million \"a\"";
410
errtxt = _gcry_hash_selftest_check_one
413
"\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E"
414
"\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F", 20);
419
return 0; /* Succeeded. */
423
report ("digest", GCRY_MD_SHA1, what, errtxt);
424
return GPG_ERR_SELFTEST_FAILED;
428
/* Run a full self-test for ALGO and return 0 on success. */
429
static gpg_err_code_t
430
run_selftests (int algo, int extended, selftest_report_func_t report)
437
ec = selftests_sha1 (extended, report);
440
ec = GPG_ERR_DIGEST_ALGO;
376
450
static unsigned char asn[15] = /* Object ID is 1.3.14.3.2.26 */
377
451
{ 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03,
378
452
0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 };