diff options
author | David Shaw <[email protected]> | 2002-11-02 21:39:37 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2002-11-02 21:39:37 +0000 |
commit | d6693c144c19e0f29114d7e121c549a6e2079798 (patch) | |
tree | af3e124b449ceeb83e576a6393c7b4c1d1297a4c | |
parent | * g10.c (main): Add --no-throw-keyid. (diff) | |
download | gnupg-d6693c144c19e0f29114d7e121c549a6e2079798.tar.gz gnupg-d6693c144c19e0f29114d7e121c549a6e2079798.zip |
* cipher.c (string_to_cipher_algo), md.c (string_to_digest_algo): Allow
the Sxxx and Hxxx format for cipher and digest names.
-rw-r--r-- | cipher/ChangeLog | 5 | ||||
-rw-r--r-- | cipher/cipher.c | 21 | ||||
-rw-r--r-- | cipher/md.c | 15 |
3 files changed, 33 insertions, 8 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index cdfe05e8e..ce644011e 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,8 @@ +2002-11-02 David Shaw <[email protected]> + + * cipher.c (string_to_cipher_algo), md.c (string_to_digest_algo): + Allow the Sxxx and Hxxx format for cipher and digest names. + 2002-10-31 Stefan Bellon <[email protected]> * rndriscos.c (rndriscos_gather_random): Use riscos_load_module() diff --git a/cipher/cipher.c b/cipher/cipher.c index 9a774cf85..4bbef9377 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -211,12 +211,6 @@ load_cipher_modules(void) return 0; } - - - - - - /**************** * Map a string to the cipher algo */ @@ -245,6 +239,20 @@ string_to_cipher_algo( const char *string ) return cipher_table[i].algo; } } while( load_cipher_modules() ); + + /* Didn't find it, so try the Sx format */ + if(string[0]=='S' || string[0]=='s') + { + long val; + char *endptr; + + string++; + + val=strtol(string,&endptr,10); + if(*string!='\0' && *endptr=='\0' && check_cipher_algo(val)==0) + return val; + } + return 0; } @@ -675,4 +683,3 @@ cipher_sync( CIPHER_HANDLE c ) c->unused = 0; } } - diff --git a/cipher/md.c b/cipher/md.c index d0811e254..098c83be6 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -120,10 +120,23 @@ string_to_digest_algo( const char *string ) if( !ascii_strcasecmp( r->name, string ) ) return r->algo; } while( !r && load_digest_module () ); + + /* Didn't find it, so try the Hx format */ + if(string[0]=='H' || string[0]=='h') + { + long val; + char *endptr; + + string++; + + val=strtol(string,&endptr,10); + if(*string!='\0' && *endptr=='\0' && check_digest_algo(val)==0) + return val; + } + return 0; } - /**************** * Map a digest algo to a string */ |