From 2db1975e94f9bff331f2dde78ea2837b28a3b816 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 16 Jun 1998 11:18:51 +0000 Subject: Removing some duplicate code from gnupgparse.c and pgppubring.c. --- gnupgparse.c | 64 ++++-------------------------------------------------------- 1 file changed, 4 insertions(+), 60 deletions(-) (limited to 'gnupgparse.c') 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; -- cgit v1.2.3