From: Richard Russon Date: Fri, 8 Jun 2018 15:09:21 +0000 (+0100) Subject: tidy headers X-Git-Tag: neomutt-20180622~20^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f33b7b0a91ec9f9002ed81af501fc092471dcd98;p=neomutt tidy headers --- diff --git a/ncrypt/crypt.h b/ncrypt/crypt.h index 40b8e3c54..a372c3f3a 100644 --- a/ncrypt/crypt.h +++ b/ncrypt/crypt.h @@ -28,11 +28,10 @@ struct Body; struct State; -void crypt_convert_to_7bit(struct Body *a); -void crypt_current_time(struct State *s, char *app_name); -int crypt_write_signed(struct Body *a, struct State *s, const char *tempfile); -const char *crypt_get_fingerprint_or_id(char *p, const char **pphint, - const char **ppl, const char **pps); -bool crypt_is_numerical_keyid(const char *s); +void crypt_convert_to_7bit(struct Body *a); +void crypt_current_time(struct State *s, char *app_name); +const char *crypt_get_fingerprint_or_id(char *p, const char **pphint, const char **ppl, const char **pps); +bool crypt_is_numerical_keyid(const char *s); +int crypt_write_signed(struct Body *a, struct State *s, const char *tempfile); #endif /* _NCRYPT_CRYPT_H */ diff --git a/ncrypt/crypt_gpgme.h b/ncrypt/crypt_gpgme.h index 1715a6b1e..33c6943aa 100644 --- a/ncrypt/crypt_gpgme.h +++ b/ncrypt/crypt_gpgme.h @@ -31,38 +31,29 @@ struct Body; struct Header; struct State; -void pgp_gpgme_init(void); -void smime_gpgme_init(void); - -char *pgp_gpgme_findkeys(struct Address *addrlist, bool oppenc_mode); -char *smime_gpgme_findkeys(struct Address *addrlist, bool oppenc_mode); +void mutt_gpgme_set_sender(const char *sender); +int pgp_gpgme_application_handler(struct Body *m, struct State *s); +int pgp_gpgme_check_traditional(FILE *fp, struct Body *b, int just_one); +int pgp_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); +int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s); struct Body *pgp_gpgme_encrypt_message(struct Body *a, char *keylist, int sign); -struct Body *smime_gpgme_build_smime_entity(struct Body *a, char *keylist); - -int pgp_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); -int smime_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); - -int pgp_gpgme_check_traditional (FILE *fp, struct Body *b, int just_one); -void pgp_gpgme_invoke_import(const char *fname); - -int pgp_gpgme_application_handler(struct Body *m, struct State *s); -int smime_gpgme_application_handler(struct Body *a, struct State *s); -int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s); - +char * pgp_gpgme_findkeys(struct Address *addrlist, bool oppenc_mode); +void pgp_gpgme_init(void); +void pgp_gpgme_invoke_import(const char *fname); struct Body *pgp_gpgme_make_key_attachment(char *tempf); - +int pgp_gpgme_send_menu(struct Header *msg); struct Body *pgp_gpgme_sign_message(struct Body *a); -struct Body *smime_gpgme_sign_message(struct Body *a); - -int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); -int smime_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); - -int pgp_gpgme_send_menu(struct Header *msg); -int smime_gpgme_send_menu(struct Header *msg); +int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); -int smime_gpgme_verify_sender(struct Header *h); - -void mutt_gpgme_set_sender(const char *sender); +int smime_gpgme_application_handler(struct Body *a, struct State *s); +struct Body *smime_gpgme_build_smime_entity(struct Body *a, char *keylist); +int smime_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); +char * smime_gpgme_findkeys(struct Address *addrlist, bool oppenc_mode); +void smime_gpgme_init(void); +int smime_gpgme_send_menu(struct Header *msg); +struct Body *smime_gpgme_sign_message(struct Body *a); +int smime_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); +int smime_gpgme_verify_sender(struct Header *h); #endif /* _NCRYPT_CRYPT_GPGME_H */ diff --git a/ncrypt/crypt_mod.h b/ncrypt/crypt_mod.h index 1ad8402f5..822cc8cf3 100644 --- a/ncrypt/crypt_mod.h +++ b/ncrypt/crypt_mod.h @@ -45,7 +45,7 @@ struct CryptModuleSpecs void (*init)(void); void (*void_passphrase)(void); int (*valid_passphrase)(void); - int (*decrypt_mime)(FILE *a, FILE **b, struct Body *c, struct Body **d); + int (*decrypt_mime)(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); int (*application_handler)(struct Body *m, struct State *s); int (*encrypted_handler)(struct Body *m, struct State *s); char * (*findkeys)(struct Address *addrlist, bool oppenc_mode); @@ -71,20 +71,7 @@ struct CryptModuleSpecs }; /* High Level crypto module interface */ - void crypto_module_register(struct CryptModuleSpecs *specs); struct CryptModuleSpecs *crypto_module_lookup(int identifier); -/* If the crypto module identifier by IDENTIFIER has been registered, - * call its function FUNC. Do nothing else. This may be used as an - * expression. */ -#define CRYPT_MOD_CALL_CHECK(identifier, func) \ - (crypto_module_lookup(APPLICATION_##identifier) && \ - (crypto_module_lookup(APPLICATION_##identifier))->func) - -/* Call the function FUNC in the crypto module identified by - * IDENTIFIER. This may be used as an expression. */ -#define CRYPT_MOD_CALL(identifier, func) \ - *(crypto_module_lookup(APPLICATION_##identifier))->func - #endif /* _NCRYPT_CRYPT_MOD_H */ diff --git a/ncrypt/cryptglue.c b/ncrypt/cryptglue.c index 8c0ab64f6..218cd7721 100644 --- a/ncrypt/cryptglue.c +++ b/ncrypt/cryptglue.c @@ -68,6 +68,18 @@ extern struct CryptModuleSpecs crypt_mod_pgp_gpgme; extern struct CryptModuleSpecs crypt_mod_smime_gpgme; #endif +/* If the crypto module identifier by IDENTIFIER has been registered, + * call its function FUNC. Do nothing else. This may be used as an + * expression. */ +#define CRYPT_MOD_CALL_CHECK(identifier, func) \ + (crypto_module_lookup(APPLICATION_##identifier) && \ + (crypto_module_lookup(APPLICATION_##identifier))->func) + +/* Call the function FUNC in the crypto module identified by + * IDENTIFIER. This may be used as an expression. */ +#define CRYPT_MOD_CALL(identifier, func) \ + *(crypto_module_lookup(APPLICATION_##identifier))->func + void crypt_init(void) { #ifdef CRYPT_BACKEND_CLASSIC_PGP diff --git a/ncrypt/cryptglue.h b/ncrypt/cryptglue.h index b26002f98..ba85b2c66 100644 --- a/ncrypt/cryptglue.h +++ b/ncrypt/cryptglue.h @@ -27,23 +27,23 @@ struct Address; struct Body; struct State; -void crypt_pgp_void_passphrase(void); -int crypt_pgp_valid_passphrase(void); -struct Body *crypt_pgp_traditional_encryptsign(struct Body *a, int flags, char *keylist); -char *crypt_pgp_findkeys(struct Address *addrlist, bool oppenc_mode); -struct Body *crypt_pgp_sign_message(struct Body *a); struct Body *crypt_pgp_encrypt_message(struct Body *a, char *keylist, int sign); -void crypt_pgp_invoke_import(const char *fname); -int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf); -void crypt_pgp_set_sender(const char *sender); +char * crypt_pgp_findkeys(struct Address *addrlist, bool oppenc_mode); +void crypt_pgp_invoke_import(const char *fname); +void crypt_pgp_set_sender(const char *sender); +struct Body *crypt_pgp_sign_message(struct Body *a); +struct Body *crypt_pgp_traditional_encryptsign(struct Body *a, int flags, char *keylist); +int crypt_pgp_valid_passphrase(void); +int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf); +void crypt_pgp_void_passphrase(void); -void crypt_smime_void_passphrase(void); -int crypt_smime_valid_passphrase(void); -char *crypt_smime_findkeys(struct Address *addrlist, bool oppenc_mode); -struct Body *crypt_smime_sign_message(struct Body *a); struct Body *crypt_smime_build_smime_entity(struct Body *a, char *certlist); -void crypt_smime_invoke_import(char *infile, char *mailbox); -void crypt_smime_set_sender(const char *sender); -int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf); +char * crypt_smime_findkeys(struct Address *addrlist, bool oppenc_mode); +void crypt_smime_invoke_import(char *infile, char *mailbox); +void crypt_smime_set_sender(const char *sender); +struct Body *crypt_smime_sign_message(struct Body *a); +int crypt_smime_valid_passphrase(void); +int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf); +void crypt_smime_void_passphrase(void); #endif /* _NCRYPT_CRYPTGLUE_H */ diff --git a/ncrypt/ncrypt.h b/ncrypt/ncrypt.h index a03bb256c..8153b18ef 100644 --- a/ncrypt/ncrypt.h +++ b/ncrypt/ncrypt.h @@ -89,11 +89,11 @@ struct State; #define SMIMEOPAQUE (APPLICATION_SMIME | SIGNOPAQUE) /* WITHCRYPTO actually replaces ifdefs so make the code more readable. - Because it is defined as a constant and known at compile time, the - compiler can do dead code elimination and thus it behaves - effectively as a conditional compile directive. It is set to false - if no crypto backend is configured or to a bit vector denoting the - configured backends. */ + * Because it is defined as a constant and known at compile time, the + * compiler can do dead code elimination and thus it behaves + * effectively as a conditional compile directive. It is set to false + * if no crypto backend is configured or to a bit vector denoting the + * configured backends. */ #if (defined(CRYPT_BACKEND_CLASSIC_PGP) && defined(CRYPT_BACKEND_CLASSIC_SMIME)) || \ defined(CRYPT_BACKEND_GPGME) #define WithCrypto (APPLICATION_PGP | APPLICATION_SMIME) @@ -122,43 +122,38 @@ struct State; #define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN | KEYFLAG_CANENCRYPT | KEYFLAG_PREFER_ENCRYPTION | KEYFLAG_PREFER_SIGNING) -/* Some prototypes -- old crypt.h. */ -int mutt_protect(struct Header *msg, char *keylist); -int mutt_is_multipart_encrypted(struct Body *b); -int mutt_is_valid_multipart_pgp_encrypted(struct Body *b); -int mutt_is_malformed_multipart_pgp_encrypted(struct Body *b); -int mutt_is_multipart_signed(struct Body *b); -int mutt_is_application_pgp(struct Body *m); -int mutt_is_application_smime(struct Body *m); -int mutt_signed_handler(struct Body *a, struct State *s); -int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app); - -/* -- crypt.c -- */ -int crypt_query(struct Body *m); -void crypt_extract_keys_from_messages(struct Header *h); -int crypt_get_keys(struct Header *msg, char **keylist, bool oppenc_mode); -void crypt_opportunistic_encrypt(struct Header *msg); -void crypt_forget_passphrase(void); -int crypt_valid_passphrase(int flags); - -/* -- cryptglue.c -- */ -void crypt_invoke_message(int type); -int crypt_pgp_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d); -int crypt_pgp_application_pgp_handler(struct Body *m, struct State *s); -int crypt_pgp_encrypted_handler(struct Body *a, struct State *s); -void crypt_pgp_invoke_getkeys(struct Address *addr); -int crypt_pgp_check_traditional (FILE *fp, struct Body *b, int just_one); +/* crypt.c */ +void crypt_extract_keys_from_messages(struct Header *h); +void crypt_forget_passphrase(void); +int crypt_get_keys(struct Header *msg, char **keylist, bool oppenc_mode); +void crypt_opportunistic_encrypt(struct Header *msg); +int crypt_query(struct Body *m); +int crypt_valid_passphrase(int flags); +int mutt_is_application_pgp(struct Body *m); +int mutt_is_application_smime(struct Body *m); +int mutt_is_malformed_multipart_pgp_encrypted(struct Body *b); +int mutt_is_multipart_encrypted(struct Body *b); +int mutt_is_multipart_signed(struct Body *b); +int mutt_is_valid_multipart_pgp_encrypted(struct Body *b); +int mutt_protect(struct Header *msg, char *keylist); +int mutt_signed_handler(struct Body *a, struct State *s); + +/* cryptglue.c */ +int crypt_has_module_backend(int type); +void crypt_init(void); +void crypt_invoke_message(int type); +int crypt_pgp_application_pgp_handler(struct Body *m, struct State *s); +int crypt_pgp_check_traditional(FILE *fp, struct Body *b, int just_one); +int crypt_pgp_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d); +int crypt_pgp_encrypted_handler(struct Body *a, struct State *s); +void crypt_pgp_extract_keys_from_attachment_list(FILE *fp, int tag, struct Body *top); +void crypt_pgp_invoke_getkeys(struct Address *addr); struct Body *crypt_pgp_make_key_attachment(char *tempf); -int crypt_pgp_send_menu(struct Header *msg); -void crypt_pgp_extract_keys_from_attachment_list(FILE *fp, int tag, struct Body *top); -int crypt_smime_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d); -int crypt_smime_application_smime_handler(struct Body *m, struct State *s); -void crypt_smime_getkeys(struct Envelope *env); -int crypt_smime_verify_sender(struct Header *h); -int crypt_smime_send_menu(struct Header *msg); -void crypt_init(void); - -/* Returns 1 if a module backend is registered for the type */ -int crypt_has_module_backend(int type); +int crypt_pgp_send_menu(struct Header *msg); +int crypt_smime_application_smime_handler(struct Body *m, struct State *s); +int crypt_smime_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d); +void crypt_smime_getkeys(struct Envelope *env); +int crypt_smime_send_menu(struct Header *msg); +int crypt_smime_verify_sender(struct Header *h); #endif /* _NCRYPT_NCRYPT_H */ diff --git a/ncrypt/pgpinvoke.h b/ncrypt/pgpinvoke.h index 8677b1fd3..7425bba60 100644 --- a/ncrypt/pgpinvoke.h +++ b/ncrypt/pgpinvoke.h @@ -35,26 +35,14 @@ struct ListHead; void pgp_invoke_import(const char *fname); void pgp_invoke_getkeys(struct Address *addr); -pid_t pgp_invoke_decode(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, - int pgperrfd, const char *fname, short need_passphrase); -pid_t pgp_invoke_verify(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, - int pgperrfd, const char *fname, const char *sig_fname); -pid_t pgp_invoke_decrypt(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, const char *fname); -pid_t pgp_invoke_sign(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, const char *fname); -pid_t pgp_invoke_encrypt(FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, - const char *fname, const char *uids, int sign); -pid_t pgp_invoke_export(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, const char *uids); -pid_t pgp_invoke_verify_key(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, const char *uids); -pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, - int pgpoutfd, int pgperrfd, enum PgpRing keyring, - struct ListHead *hints); -pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, - const char *fname, const char *uids, int flags); +pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, short need_passphrase); +pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname); +pid_t pgp_invoke_encrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *uids, int sign); +pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids); +pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, enum PgpRing keyring, struct ListHead *hints); +pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname); +pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *uids, int flags); +pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *sig_fname); +pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids); #endif /* _NCRYPT_PGPINVOKE_H */ diff --git a/ncrypt/pgpkey.h b/ncrypt/pgpkey.h index 64bd56cb9..852fa740d 100644 --- a/ncrypt/pgpkey.h +++ b/ncrypt/pgpkey.h @@ -38,8 +38,8 @@ enum PgpRing struct Body *pgp_make_key_attachment(char *tempf); -struct PgpKeyInfo * pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring); -struct PgpKeyInfo * pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, bool oppenc_mode); -struct PgpKeyInfo * pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring); +struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring); +struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, bool oppenc_mode); +struct PgpKeyInfo *pgp_getkeybystr(char *p, short abilities, enum PgpRing keyring); #endif /* _NCRYPT_PGPKEY_H */ diff --git a/ncrypt/pgplib.h b/ncrypt/pgplib.h index 40c41e2bc..f31331721 100644 --- a/ncrypt/pgplib.h +++ b/ncrypt/pgplib.h @@ -68,7 +68,7 @@ short pgp_get_abilities(unsigned char type); void pgp_free_key(struct PgpKeyInfo **kpp); -struct PgpKeyInfo * pgp_remove_key(struct PgpKeyInfo * *klist, struct PgpKeyInfo * key); +struct PgpKeyInfo *pgp_remove_key(struct PgpKeyInfo **klist, struct PgpKeyInfo *key); struct PgpKeyInfo *pgp_new_keyinfo(void); diff --git a/ncrypt/smime.h b/ncrypt/smime.h index c924f585d..3c1b7e153 100644 --- a/ncrypt/smime.h +++ b/ncrypt/smime.h @@ -48,18 +48,18 @@ struct SmimeKey struct SmimeKey *next; }; -void smime_void_passphrase(void); -int smime_valid_passphrase(void); -int smime_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); -int smime_application_smime_handler(struct Body *m, struct State *s); -struct Body *smime_sign_message(struct Body *a); +int smime_application_smime_handler(struct Body *m, struct State *s); struct Body *smime_build_smime_entity(struct Body *a, char *certlist); -int smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); -int smime_verify_sender(struct Header *h); -void smime_getkeys(struct Envelope *env); -char *smime_find_keys(struct Address *addrlist, bool oppenc_mode); -void smime_invoke_import(char *infile, char *mailbox); -int smime_send_menu(struct Header *msg); +int smime_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Body **cur); +char * smime_find_keys(struct Address *addrlist, bool oppenc_mode); +void smime_getkeys(struct Envelope *env); +void smime_invoke_import(char *infile, char *mailbox); +int smime_send_menu(struct Header *msg); +struct Body *smime_sign_message(struct Body *a); +int smime_valid_passphrase(void); +int smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile); +int smime_verify_sender(struct Header *h); +void smime_void_passphrase(void); #endif diff --git a/protos.h b/protos.h index 5e73a56ae..53b0c127b 100644 --- a/protos.h +++ b/protos.h @@ -270,6 +270,7 @@ int mutt_get_field_unbuffered(char *msg, char *buf, size_t buflen, int flags); #define mutt_get_password(A, B, C) mutt_get_field_unbuffered(A, B, C, MUTT_PASS) int mutt_get_postponed(struct Context *ctx, struct Header *hdr, struct Header **cur, char *fcc, size_t fcclen); +int mutt_parse_crypt_hdr(const char *p, int set_empty_signas, int crypt_app); int mutt_get_tmp_attachment(struct Body *a); int mutt_index_menu(void); int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Address *cc, struct Address *bcc,