aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-04-08 19:49:02 +0000
committerWerner Koch <[email protected]>1998-04-08 19:49:02 +0000
commit8b10a87908f4d382735a046e7d043ebc250d8d67 (patch)
tree9c4255d5cd84df663f9a7001b7b6277e53cf6e6e /cipher/misc.c
parentNew tests (diff)
downloadgnupg-8b10a87908f4d382735a046e7d043ebc250d8d67.tar.gz
gnupg-8b10a87908f4d382735a046e7d043ebc250d8d67.zip
test release
Diffstat (limited to 'cipher/misc.c')
-rw-r--r--cipher/misc.c21
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;
}