diff options
author | Werner Koch <[email protected]> | 1999-07-15 08:16:46 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-07-15 08:16:46 +0000 |
commit | a316550579f16fba4200e6deeb5905f549a5fcc3 (patch) | |
tree | 54dcf4ec1609638eee69c0099b19d851c7f98087 /cipher/pubkey.c | |
parent | See ChangeLog: Wed Jul 14 19:42:08 CEST 1999 Werner Koch (diff) | |
download | gnupg-a316550579f16fba4200e6deeb5905f549a5fcc3.tar.gz gnupg-a316550579f16fba4200e6deeb5905f549a5fcc3.zip |
See ChangeLog: Thu Jul 15 10:15:35 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | cipher/pubkey.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cipher/pubkey.c b/cipher/pubkey.c index 81574dbd9..548d2e819 100644 --- a/cipher/pubkey.c +++ b/cipher/pubkey.c @@ -54,7 +54,7 @@ struct pubkey_table_s { }; static struct pubkey_table_s pubkey_table[TABLE_SIZE]; - +static int disabled_algos[TABLE_SIZE]; static int @@ -267,6 +267,20 @@ pubkey_algo_to_string( int algo ) } +void +disable_pubkey_algo( int algo ) +{ + int i; + + for(i=0; i < DIM(disabled_algos); i++ ) { + if( !disabled_algos[i] || disabled_algos[i] == algo ) { + disabled_algos[i] = algo; + return; + } + } + log_fatal("can't disable pubkey algo %d: table full\n"); +} + int check_pubkey_algo( int algo ) @@ -291,6 +305,11 @@ check_pubkey_algo2( int algo, unsigned use ) if( (use & PUBKEY_USAGE_ENC) && !(pubkey_table[i].use & PUBKEY_USAGE_ENC) ) return G10ERR_WR_PUBKEY_ALGO; + + for(i=0; i < DIM(disabled_algos); i++ ) { + if( disabled_algos[i] == algo ) + return G10ERR_PUBKEY_ALGO; + } return 0; /* okay */ } } while( load_pubkey_modules() ); |