diff options
Diffstat (limited to 'cipher/misc.c')
-rw-r--r-- | cipher/misc.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cipher/misc.c b/cipher/misc.c index 35761e4f5..3016b8e56 100644 --- a/cipher/misc.c +++ b/cipher/misc.c @@ -114,18 +114,31 @@ digest_algo_to_string( int algo ) - - int check_pubkey_algo( int algo ) { + return check_pubkey_algo2( algo, 0 ); +} + +/**************** + * a usage of 0 means: don't care + */ +int +check_pubkey_algo2( int algo, unsigned usage ) +{ switch( algo ) { - case PUBKEY_ALGO_ELGAMAL: case PUBKEY_ALGO_DSA: + if( usage & 2 ) + return G10ERR_WR_PUBKEY_ALGO; + return 0; + + case PUBKEY_ALGO_ELGAMAL: + return 0; + #ifdef HAVE_RSA_CIPHER case PUBKEY_ALGO_RSA: - #endif return 0; + #endif default: return G10ERR_PUBKEY_ALGO; } |