summaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-07-06 12:23:57 +0200
committerWerner Koch <wk@gnupg.org>1998-07-06 12:23:57 +0200
commita9ec668cbe5b3335f5db0f05b8e9e88e29ada52c (patch)
treee159c79b615fcdcb65f31ee5d1d0a2b1ba84e9aa /cipher
parentpartly added creation of OP partial length headers (diff)
downloadgnupg2-a9ec668cbe5b3335f5db0f05b8e9e88e29ada52c.tar.xz
gnupg2-a9ec668cbe5b3335f5db0f05b8e9e88e29ada52c.zip
intermediate release
Diffstat (limited to 'cipher')
-rw-r--r--cipher/dsa.c2
-rw-r--r--cipher/elgamal.c12
-rw-r--r--cipher/pubkey.c6
3 files changed, 13 insertions, 7 deletions
diff --git a/cipher/dsa.c b/cipher/dsa.c
index 46484c1e9..107ed71c2 100644
--- a/cipher/dsa.c
+++ b/cipher/dsa.c
@@ -405,7 +405,7 @@ dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
*nsig = 2;
switch( algo ) {
- case PUBKEY_ALGO_DSA: *usage = 1; return "DSA";
+ case PUBKEY_ALGO_DSA: *usage = PUBKEY_USAGE_SIG; return "DSA";
default: *usage = 0; return NULL;
}
}
diff --git a/cipher/elgamal.c b/cipher/elgamal.c
index bcaaa20ba..9b9981da1 100644
--- a/cipher/elgamal.c
+++ b/cipher/elgamal.c
@@ -510,8 +510,8 @@ elg_get_nbits( int algo, MPI *pkey )
* the ALGO is invalid.
* Usage: Bit 0 set : allows signing
* 1 set : allows encryption
- * NOTE: This function allows signing also for ELG-E, chich is not
- * okay but a bad hack to allow to work with olf gpg keys. The real check
+ * NOTE: This function allows signing also for ELG-E, which is not
+ * okay but a bad hack to allow to work with old gpg keys. The real check
* is done in the gnupg ocde depending on the packet version.
*/
const char *
@@ -524,8 +524,12 @@ elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
*nsig = 2;
switch( algo ) {
- case PUBKEY_ALGO_ELGAMAL: *usage = 2|1; return "ELG";
- case PUBKEY_ALGO_ELGAMAL_E: *usage = 2|1; return "ELG-E";
+ case PUBKEY_ALGO_ELGAMAL:
+ *usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC;
+ return "ELG";
+ case PUBKEY_ALGO_ELGAMAL_E:
+ *usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC;
+ return "ELG-E";
default: *usage = 0; return NULL;
}
}
diff --git a/cipher/pubkey.c b/cipher/pubkey.c
index f59996c4d..a78f788c0 100644
--- a/cipher/pubkey.c
+++ b/cipher/pubkey.c
@@ -282,9 +282,11 @@ check_pubkey_algo2( int algo, unsigned usage )
do {
for(i=0; pubkey_table[i].name; i++ )
if( pubkey_table[i].algo == algo ) {
- if( (usage & 1) && !(pubkey_table[i].usage & 1) )
+ if( (usage & PUBKEY_USAGE_SIG)
+ && !(pubkey_table[i].usage & PUBKEY_USAGE_SIG) )
return G10ERR_WR_PUBKEY_ALGO;
- if( (usage & 2) && !(pubkey_table[i].usage & 2) )
+ if( (usage & PUBKEY_USAGE_ENC)
+ && !(pubkey_table[i].usage & PUBKEY_USAGE_ENC) )
return G10ERR_WR_PUBKEY_ALGO;
return 0; /* okay */
}