1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-21 14:47:03 +01:00

gpg: Replace a hash algo test function.

* g10/gpg.c (print_mds): Replace openpgp_md_test_algo.
--

This is actually not required because as of now the used OpenPGP and
Gcrypt hash algorithm numbers are identical.  But that might change in
the future.

This changes the behavior of GnuPG in case it has been build with
some algorithms disabled: If those algorithms are available in
Libgcrypt, their results will be used printed anyway.
This commit is contained in:
Werner Koch 2014-09-18 14:56:39 +02:00
parent 0af533abd3
commit 327134934d

View File

@ -4386,18 +4386,18 @@ print_mds( const char *fname, int algo )
gcry_md_enable (md, algo); gcry_md_enable (md, algo);
else else
{ {
if (!openpgp_md_test_algo (GCRY_MD_MD5)) if (!gcry_md_test_algo (GCRY_MD_MD5))
gcry_md_enable (md, GCRY_MD_MD5); gcry_md_enable (md, GCRY_MD_MD5);
gcry_md_enable (md, GCRY_MD_SHA1); gcry_md_enable (md, GCRY_MD_SHA1);
if (!openpgp_md_test_algo (GCRY_MD_RMD160)) if (!gcry_md_test_algo (GCRY_MD_RMD160))
gcry_md_enable (md, GCRY_MD_RMD160); gcry_md_enable (md, GCRY_MD_RMD160);
if (!openpgp_md_test_algo (GCRY_MD_SHA224)) if (!gcry_md_test_algo (GCRY_MD_SHA224))
gcry_md_enable (md, GCRY_MD_SHA224); gcry_md_enable (md, GCRY_MD_SHA224);
if (!openpgp_md_test_algo (GCRY_MD_SHA256)) if (!gcry_md_test_algo (GCRY_MD_SHA256))
gcry_md_enable (md, GCRY_MD_SHA256); gcry_md_enable (md, GCRY_MD_SHA256);
if (!openpgp_md_test_algo (GCRY_MD_SHA384)) if (!gcry_md_test_algo (GCRY_MD_SHA384))
gcry_md_enable (md, GCRY_MD_SHA384); gcry_md_enable (md, GCRY_MD_SHA384);
if (!openpgp_md_test_algo (GCRY_MD_SHA512)) if (!gcry_md_test_algo (GCRY_MD_SHA512))
gcry_md_enable (md, GCRY_MD_SHA512); gcry_md_enable (md, GCRY_MD_SHA512);
} }
@ -4415,18 +4415,18 @@ print_mds( const char *fname, int algo )
print_hashline (md, algo, fname); print_hashline (md, algo, fname);
else else
{ {
if (!openpgp_md_test_algo (GCRY_MD_MD5)) if (!gcry_md_test_algo (GCRY_MD_MD5))
print_hashline( md, GCRY_MD_MD5, fname ); print_hashline( md, GCRY_MD_MD5, fname );
print_hashline( md, GCRY_MD_SHA1, fname ); print_hashline( md, GCRY_MD_SHA1, fname );
if (!openpgp_md_test_algo (GCRY_MD_RMD160)) if (!gcry_md_test_algo (GCRY_MD_RMD160))
print_hashline( md, GCRY_MD_RMD160, fname ); print_hashline( md, GCRY_MD_RMD160, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA224)) if (!gcry_md_test_algo (GCRY_MD_SHA224))
print_hashline (md, GCRY_MD_SHA224, fname); print_hashline (md, GCRY_MD_SHA224, fname);
if (!openpgp_md_test_algo (GCRY_MD_SHA256)) if (!gcry_md_test_algo (GCRY_MD_SHA256))
print_hashline( md, GCRY_MD_SHA256, fname ); print_hashline( md, GCRY_MD_SHA256, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA384)) if (!gcry_md_test_algo (GCRY_MD_SHA384))
print_hashline ( md, GCRY_MD_SHA384, fname ); print_hashline ( md, GCRY_MD_SHA384, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA512)) if (!gcry_md_test_algo (GCRY_MD_SHA512))
print_hashline ( md, GCRY_MD_SHA512, fname ); print_hashline ( md, GCRY_MD_SHA512, fname );
} }
} }
@ -4436,18 +4436,18 @@ print_mds( const char *fname, int algo )
print_hex (md, -algo, fname); print_hex (md, -algo, fname);
else else
{ {
if (!openpgp_md_test_algo (GCRY_MD_MD5)) if (!gcry_md_test_algo (GCRY_MD_MD5))
print_hex (md, GCRY_MD_MD5, fname); print_hex (md, GCRY_MD_MD5, fname);
print_hex (md, GCRY_MD_SHA1, fname ); print_hex (md, GCRY_MD_SHA1, fname );
if (!openpgp_md_test_algo (GCRY_MD_RMD160)) if (!gcry_md_test_algo (GCRY_MD_RMD160))
print_hex (md, GCRY_MD_RMD160, fname ); print_hex (md, GCRY_MD_RMD160, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA224)) if (!gcry_md_test_algo (GCRY_MD_SHA224))
print_hex (md, GCRY_MD_SHA224, fname); print_hex (md, GCRY_MD_SHA224, fname);
if (!openpgp_md_test_algo (GCRY_MD_SHA256)) if (!gcry_md_test_algo (GCRY_MD_SHA256))
print_hex (md, GCRY_MD_SHA256, fname ); print_hex (md, GCRY_MD_SHA256, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA384)) if (!gcry_md_test_algo (GCRY_MD_SHA384))
print_hex (md, GCRY_MD_SHA384, fname ); print_hex (md, GCRY_MD_SHA384, fname );
if (!openpgp_md_test_algo (GCRY_MD_SHA512)) if (!gcry_md_test_algo (GCRY_MD_SHA512))
print_hex (md, GCRY_MD_SHA512, fname ); print_hex (md, GCRY_MD_SHA512, fname );
} }
} }