summaryrefslogtreecommitdiffstats
path: root/gnupgparse.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-06-16 11:18:51 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-06-16 11:18:51 +0000
commit2db1975e94f9bff331f2dde78ea2837b28a3b816 (patch)
tree9fef091c8d7ac857e167d7a489a5a8ac5c74177d /gnupgparse.c
parent1a7ec5c051d1d9ba5c9b5d28b0420d3878a54c26 (diff)
Removing some duplicate code from gnupgparse.c and
pgppubring.c.
Diffstat (limited to 'gnupgparse.c')
-rw-r--r--gnupgparse.c64
1 files changed, 4 insertions, 60 deletions
diff --git a/gnupgparse.c b/gnupgparse.c
index 6f928e88..a82093ed 100644
--- a/gnupgparse.c
+++ b/gnupgparse.c
@@ -26,60 +26,6 @@
#include "mutt.h"
#include "pgp.h"
-static const char *
-pkalgbytype(unsigned char type)
-{
- switch(type)
- {
- case 1:
- case 2:
- case 3: return "RSA";
- case 16: /* encrypt only */
- case 20: return "ElG";
- case 17: return "DSA";
- default: return "unk";
- }
-}
-
-static short canencrypt(unsigned char type)
-{
- switch(type)
- {
- case 1:
- case 2:
- case 16:
- case 20:
- return 1;
- default:
- return 0;
- }
-}
-
-static short cansign(unsigned char type)
-{
- switch(type)
- {
- case 1:
- case 3:
- case 16: /* hmmm: this one can only sign if used in a v3 packet */
- case 17:
- case 20:
- return 1;
- default:
- return 0;
- }
-}
-/* return values:
- *
- * 1 = sign only
- * 2 = encrypt only
- * 3 = both
- */
-
-static short get_abilities(unsigned char type)
-{
- return (canencrypt(type) << 1) | cansign(type);
-}
/****************
* Read the GNUPG keys. For now we read the complete keyring by
@@ -98,8 +44,7 @@ static short get_abilities(unsigned char type)
* - signature class
*/
-static KEYINFO *
-parse_pub_line( char *buf, int *is_subkey )
+static KEYINFO *parse_pub_line( char *buf, int *is_subkey )
{
KEYINFO *k=NULL;
PGPUID *uid = NULL;
@@ -146,8 +91,8 @@ parse_pub_line( char *buf, int *is_subkey )
k->keylen = atoi(p); /* fixme: add validation checks */
break;
case 4: /* pubkey algo */
- k->algorithm = pkalgbytype(atoi(p));
- k->flags |= get_abilities(atoi(p));
+ k->algorithm = pgp_pkalgbytype(atoi(p));
+ k->flags |= pgp_get_abilities(atoi(p));
break;
case 5: /* 16 hex digits with the long keyid. */
/* We really should do a check here */
@@ -206,8 +151,7 @@ static pid_t gpg_invoke_list_keys(struct pgp_vinfo *pgp,
pgpinfd, pgpoutfd, pgperrfd);
}
-static KEYINFO *
-read_ring(struct pgp_vinfo *pgp, int secret )
+static KEYINFO *read_ring(struct pgp_vinfo *pgp, int secret )
{
FILE *fp;
pid_t thepid;