aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/pubkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-07-15 08:16:46 +0000
committerWerner Koch <[email protected]>1999-07-15 08:16:46 +0000
commita316550579f16fba4200e6deeb5905f549a5fcc3 (patch)
tree54dcf4ec1609638eee69c0099b19d851c7f98087 /cipher/pubkey.c
parentSee ChangeLog: Wed Jul 14 19:42:08 CEST 1999 Werner Koch (diff)
downloadgnupg-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.c21
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() );