aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/md.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-02-04 19:28:40 +0000
committerDavid Shaw <[email protected]>2003-02-04 19:28:40 +0000
commitcef8bbd91f5048a87321ee5202c400eac7a013a5 (patch)
tree326ede0e9b2dcd6f2e488c9f21a9af30aba63816 /cipher/md.c
parent* cipher.h: Add constants for new SHAs. (diff)
downloadgnupg-cef8bbd91f5048a87321ee5202c400eac7a013a5.tar.gz
gnupg-cef8bbd91f5048a87321ee5202c400eac7a013a5.zip
* sha256.c, sha512.c: New.
* Makefile.am, algorithms.h, md.c (load_digest_module, string_to_digest_algo): Add read-only support for the new SHAs.
Diffstat (limited to '')
-rw-r--r--cipher/md.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/cipher/md.c b/cipher/md.c
index 098c83be6..c92390672 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -28,6 +28,7 @@
#include "cipher.h"
#include "errors.h"
#include "algorithms.h"
+#include "i18n.h"
/****************
* This structure is used for the list of available algorithms
@@ -97,6 +98,12 @@ load_digest_module (void)
frequently used are the first in the list. */
if (!new_list_item (DIGEST_ALGO_TIGER, tiger_get_info))
BUG();
+ if (!new_list_item (DIGEST_ALGO_SHA512, sha512_get_info))
+ BUG ();
+ if (!new_list_item (DIGEST_ALGO_SHA384, sha384_get_info))
+ BUG ();
+ if (!new_list_item (DIGEST_ALGO_SHA256, sha256_get_info))
+ BUG ();
if (!new_list_item (DIGEST_ALGO_MD5, md5_get_info))
BUG ();
if (!new_list_item (DIGEST_ALGO_RMD160, rmd160_get_info))
@@ -115,6 +122,22 @@ string_to_digest_algo( const char *string )
{
struct md_digest_list_s *r;
+ /* Hi there. I see you changing that code so you can use the new
+ SHA hashes. Before you do it, please think about it. There
+ are no official releases of any OpenPGP programs that generate
+ these hashes, and we're trying to get a code base that can
+ understand the hashes before we release one that generates
+ them. - dshaw */
+
+ if(!ascii_strcasecmp("sha256",string)
+ || !ascii_strcasecmp("sha384",string)
+ || !ascii_strcasecmp("sha512",string))
+ {
+ log_info(_("digest algorithm `%s' is read-only in this release\n"),
+ string);
+ return 0;
+ }
+
do {
for(r = digest_list; r; r = r->next )
if( !ascii_strcasecmp( r->name, string ) )