--- pgp/src/pgp.h 2018/04/24 16:38:18 1.1.1.2 +++ pgp/src/pgp.h 2018/04/24 16:43:21 1.1.1.7 @@ -9,7 +9,13 @@ */ +#ifndef PGP_H +#define PGP_H + #include "usuals.h" +#include "more.h" +#include "armor.h" + #define KEYFRAGSIZE 8 /* # of bytes in key ID modulus fragment */ #define SIZEOF_TIMESTAMP 4 /* 32-bit timestamp */ @@ -45,7 +51,8 @@ #define is_ctb_type(ctb,type) (((ctb) & CTB_TYPE_MASK)==(4*type)) #define CTB_BYTE(type,llen) (CTB_DESIGNATOR + (4*type) + llen) -#define CTB_PKE_TYPE 1 /* packet encrypted with RSA public key */ +#define CTB_PKE_TYPE 1 /* packet encrypted with RSA public + key */ #define CTB_SKE_TYPE 2 /* packet signed with RSA secret key */ #define CTB_MD_TYPE 3 /* message digest packet */ #define CTB_CERT_SECKEY_TYPE 5 /* secret key certificate */ @@ -70,7 +77,8 @@ #define CTB_MD CTB_BYTE(CTB_MD_TYPE,0) /* CTB_MD len8 algorithm MD timestamp */ #define CTB_CERT_SECKEY CTB_BYTE(CTB_CERT_SECKEY_TYPE,1) - /* CTB_CERT_SECKEY len16 timestamp userID mpi(n) mpi(e) mpi(d) mpi(p) mpi(q) mpi(u) crc16 */ + /* CTB_CERT_SECKEY len16 timestamp userID mpi(n) mpi(e) mpi(d) + mpi(p) mpi(q) mpi(u) crc16 */ #define CTB_CERT_PUBKEY CTB_BYTE(CTB_CERT_PUBKEY_TYPE,1) /* CTB_CERT_PUBKEY len16 timestamp userID mpi(n) mpi(e) crc16 */ @@ -108,49 +116,48 @@ #define K3_SIGNATURE_BYTE 0x13 /* Key certification, positive ID */ #define KC_SIGNATURE_BYTE 0x20 /* Key compromise */ #define KR_SIGNATURE_BYTE 0x30 /* Key revocation */ -#define TS_SIGNATURE_BYTE 0x40 /* Timestamp someone else's signature */ +#define TS_SIGNATURE_BYTE 0x40 /* Timestamp someone else's + signature */ /* Public key encrypted data classification bytes. */ #define MD_ENCRYPTED_BYTE 1 /* Message digest is encrypted */ #define CK_ENCRYPTED_BYTE 2 /* Conventional key is encrypted */ /* Version byte for data structures created by this version of PGP */ -#define VERSION_BYTE 2 /* PGP2 */ +#define VERSION_BYTE_OLD 2 /* PGP2 */ +#define VERSION_BYTE_KLUDGE 3 /* Values for trust bits in keycntrl packet after key packet */ -#define KC_OWNERTRUST_MASK 0x07 /* Trust bits for key owner */ +#define KC_OWNERTRUST_MASK 0x07 /* Trust bits for key owner */ #define KC_OWNERTRUST_UNDEFINED 0x00 #define KC_OWNERTRUST_UNKNOWN 0x01 -#define KC_OWNERTRUST_NEVER 0x02 +#define KC_OWNERTRUST_NEVER 0x02 /* 2 levels reserved */ #define KC_OWNERTRUST_USUALLY 0x05 #define KC_OWNERTRUST_ALWAYS 0x06 #define KC_OWNERTRUST_ULTIMATE 0x07 /* Only for keys in secret ring */ -#define KC_BUCKSTOP 0x80 /* This key is in secret ring */ -#define KC_VISITED 0x40 +#define KC_BUCKSTOP 0x80 /* This key is in secret ring */ +#define KC_DISABLED 0x20 /* key is disabled */ /* Values for trust bits in keycntrl packet after userid packet */ -#define KC_LEGIT_MASK 0x03 /* Key legit bits for key */ -#define KC_LEGIT_UNKNOWN 0x00 -#define KC_LEGIT_UNTRUSTED 0x01 -#define KC_LEGIT_MARGINAL 0x02 -#define KC_LEGIT_COMPLETE 0x03 -#define KC_WARNONLY 0x80 +#define KC_LEGIT_MASK 0x03 /* Key legit bits for key */ +#define KC_LEGIT_UNKNOWN 0x00 +#define KC_LEGIT_UNTRUSTED 0x01 +#define KC_LEGIT_MARGINAL 0x02 +#define KC_LEGIT_COMPLETE 0x03 +#define KC_WARNONLY 0x80 /* Values for trust bits in keycntrl packet after signature packet */ -#define KC_SIGTRUST_MASK 0x07 /* Trust bits for key owner */ +#define KC_SIGTRUST_MASK 0x07 /* Trust bits for key owner */ #define KC_SIGTRUST_UNDEFINED 0x00 -#define KC_SIGTRUST_UNKNOWN 0x01 +#define KC_SIGTRUST_UNKNOWN 0x01 #define KC_SIGTRUST_UNTRUSTED 0x02 /* 2 levels reserved */ #define KC_SIGTRUST_MARGINAL 0x05 #define KC_SIGTRUST_COMPLETE 0x06 #define KC_SIGTRUST_ULTIMATE 0x07 -#define KC_CONTIG 0x80 /* This sig is on a cert. path */ - -#define MAINT_CHECK 0x01 -#define MAINT_VERBOSE 0x02 -#define MAINT_SILENT 0x04 +#define KC_SIG_CHECKED 0x40 /* This sig has been checked */ +#define KC_CONTIG 0x80 /* This sig is on a cert. path */ #define is_secret_key(ctb) is_ctb_type(ctb,CTB_CERT_SECKEY_TYPE) @@ -181,50 +188,70 @@ boolean is_armor_file(char *infile, long int armor_file(char *infile, char *outfile, char *filename, char *clearname); int de_armor_file(char *infile, char *outfile, long *curline); -void exitPGP(int); -void user_error(); +void user_error(void); /* Global filenames and system-wide file extensions... */ -extern char CTX_EXTENSION[]; extern char PGP_EXTENSION[]; extern char ASC_EXTENSION[]; extern char SIG_EXTENSION[]; extern char BAK_EXTENSION[]; extern char CONSOLE_FILENAME[]; extern char rel_version[]; -extern char rel_date[]; /* These files use the environmental variable PGPPATH as a default path: */ -extern char PUBLIC_KEYRING_FILENAME[32]; -extern char SECRET_KEYRING_FILENAME[32]; -extern char RANDSEED_FILENAME[32]; +extern char globalPubringName[MAX_PATH]; +extern char globalSecringName[MAX_PATH]; +extern char globalRandseedName[MAX_PATH]; +extern char globalCommentString[128]; /* Variables which are global across the driver code */ extern boolean filter_mode; +extern boolean moreflag; extern FILE *pgpout; /* FILE structure for routine output */ /* Variables settable by config.pgp and referenced in config.c ... */ -extern char language[]; /* foreign language prefix code for language.pgp file */ +extern char language[]; /* foreign language prefix code for language.pgp + file */ extern char charset[]; /* my_name is substring of default userid for secret key to make signatures */ extern char my_name[]; extern char floppyring[]; /* for comparing secret keys with backup on floppy */ -extern char lit_mode; /* text or binary mode for literal packet */ +extern char literal_mode; /* text or binary mode for literal packet */ extern boolean emit_radix_64; extern boolean showpass; extern boolean keepctx; extern boolean verbose; /* display maximum information */ -extern boolean compress_enabled; /* attempt compression before encryption */ +extern boolean compress_enabled; /* attempt compression before encryption */ extern boolean clear_signatures; +extern boolean encrypt_to_self; /* Should I encrypt to myself? */ +extern boolean batchmode; /* for batch processing */ +extern boolean quietmode; /* less verbose */ +extern boolean force_flag; /* overwrite existing file without asking */ +extern boolean pkcs_compat; /* Use PKCS format messages */ +/* Ask for each key separately if it should be added to the keyring */ +extern boolean interactive_add; extern long timeshift; /* seconds from GMT timezone */ +extern boolean signature_checked; extern int pem_lines; extern int marg_min; /* number of marginally trusted signatures needed to make a key fully-legit */ extern int compl_min; /* number of fully trusted signatures needed */ extern int max_cert_depth; extern char pager[]; /* file lister command */ +extern boolean legal_kludge; +extern int version_byte; +extern boolean nomanual; + +/* These lists store hashed passwords for future use. */ +/* passwds are passwords of as-yet-unknown purpose; keypasswds + are passwords used to decrypt keys. */ +struct hashedpw { + struct hashedpw *next; + byte hash[16]; +}; +extern struct hashedpw *keypasswds, *passwds; -extern char trust_lst[8][16]; +extern boolean strip_spaces; #ifdef VMS /* @@ -232,7 +259,11 @@ extern char trust_lst[8][16]; */ int fdl_generate(char *in_file, char **fdl, short *len); -void *fdl_create( char *fdl, short len, char *outfile, char *preserved_name); -int fdl_copyfile2bin(FILE *f, void *rab, word32 longcount); -void fdl_close( void *rab); +VOID *fdl_create( char *fdl, short len, char *outfile, char *preserved_name); +int fdl_copyfile2bin(FILE *f, VOID *rab, word32 longcount); +void fdl_close( VOID *rab); #endif /* VMS */ + +extern int compressSignature(byte *header); + +#endif /* PGP_H */