Remove argument names from function prototypes in header files.

This commit is contained in:
agc 2009-02-07 07:00:01 +00:00
parent fd38df44a9
commit 00be53a929
21 changed files with 430 additions and 514 deletions

View File

@ -29,6 +29,4 @@
#include "keyring.h"
#include "packet-parse.h"
int
ops_parse_and_accumulate(ops_keyring_t * keyring,
ops_parse_info_t * parse_info);
int ops_parse_and_accumulate(ops_keyring_t *, ops_parse_info_t *);

View File

@ -25,16 +25,16 @@
#include "packet-parse.h"
#include "signature.h"
unsigned ops_crc24(unsigned checksum, unsigned char c);
unsigned ops_crc24(unsigned, unsigned char);
void ops_reader_push_dearmour(ops_parse_info_t * parse_info);
void ops_reader_push_dearmour(ops_parse_info_t *);
void ops_reader_pop_dearmour(ops_parse_info_t * parse_info);
void ops_reader_pop_dearmour(ops_parse_info_t *);
bool
ops_writer_push_clearsigned(ops_create_info_t * info,
ops_create_signature_t * sig);
void ops_writer_push_armoured_message(ops_create_info_t * info);
bool ops_writer_switch_to_armoured_signature(ops_create_info_t * info);
ops_writer_push_clearsigned(ops_create_info_t *,
ops_create_signature_t *);
void ops_writer_push_armoured_message(ops_create_info_t *);
bool ops_writer_switch_to_armoured_signature(ops_create_info_t *);
typedef enum {
OPS_PGP_MESSAGE = 1,
@ -45,10 +45,8 @@ typedef enum {
OPS_PGP_SIGNATURE
} ops_armor_type_t;
void ops_writer_push_armoured(ops_create_info_t * info, ops_armor_type_t type);
void ops_writer_push_armoured(ops_create_info_t *, ops_armor_type_t);
#define CRC24_INIT 0xb704ceL
#endif /* __OPS_ARMOUR_H__ */
//EOF

View File

@ -27,16 +27,6 @@
if(ops_parse_cb((pc),(cbinfo)) == OPS_RELEASE_MEMORY) \
ops_parser_content_free(pc); \
} while(/* CONSTCOND */0)
/*
* #define CB(cbinfo,t,pc) do { (pc)->tag=(t);
* if((cbinfo)->cb(pc,(cbinfo)) == OPS_RELEASE_MEMORY)
* ops_parser_content_free(pc); } while(0)
*/
/*
* #define CB(cbinfo,t,pc) do { (pc)->tag=(t);
* if((cbinfo)->cb(pc,(cbinfo)) == OPS_RELEASE_MEMORY)
* ops_parser_content_free(pc); } while(0)
*/
#define CBP(info,t,pc) CB(&(info)->cbinfo,t,pc)
@ -47,11 +37,6 @@
OPS_ERROR(errors,code,err); \
return -1; \
} while(/*CONSTCOND*/0)
/*
* #define ERR(err) do { content.content.error.error=err;
* content.tag=OPS_PARSER_ERROR; ops_parse_cb(&content,cbinfo); return -1; }
* while(0)
*/
#define ERRP(info,err) do { \
content.content.error.error=err; \

View File

@ -25,10 +25,8 @@
#include "packet-parse.h"
int
ops_decompress(ops_region_t * region, ops_parse_info_t * parse_info,
ops_compression_type_t type);
ops_decompress(ops_region_t *, ops_parse_info_t *, ops_compression_type_t);
bool
ops_write_compressed(const unsigned char *data,
const unsigned int len,
ops_create_info_t * cinfo);
ops_write_compressed(const unsigned char *, const unsigned int,
ops_create_info_t *);

View File

@ -43,46 +43,38 @@ struct ops_create_info {
};
ops_create_info_t *ops_create_info_new(void);
void ops_create_info_delete(ops_create_info_t * info);
void ops_create_info_delete(ops_create_info_t *);
ops_memory_t *ops_write_mem_from_file(const char *filename, int *errnum);
int ops_write_file_from_buf(const char *filename, const char *buf, const size_t len, const bool overwrite);
ops_memory_t *ops_write_mem_from_file(const char *, int *);
int ops_write_file_from_buf(const char *, const char *, const size_t, const bool);
bool ops_calc_session_key_checksum(ops_pk_session_key_t * session_key, unsigned char *cs);
void
ops_build_public_key(ops_memory_t * out, const ops_public_key_t * key,
bool make_packet);
bool
ops_write_struct_user_id(ops_user_id_t * id,
ops_create_info_t * info);
bool
ops_write_struct_public_key(const ops_public_key_t * key,
ops_create_info_t * info);
bool ops_calc_session_key_checksum(ops_pk_session_key_t *, unsigned char *);
void ops_build_public_key(ops_memory_t *, const ops_public_key_t *, bool);
bool ops_write_struct_user_id(ops_user_id_t *, ops_create_info_t *);
bool ops_write_struct_public_key(const ops_public_key_t *, ops_create_info_t *);
bool
ops_write_ss_header(unsigned length, ops_content_tag_t type,
ops_create_info_t * info);
ops_write_ss_header(unsigned, ops_content_tag_t, ops_create_info_t *);
bool
ops_write_struct_secret_key(const ops_secret_key_t * key,
const unsigned char *passphrase,
const size_t pplen,
ops_create_info_t * info);
ops_write_struct_secret_key(const ops_secret_key_t *,
const unsigned char *,
const size_t,
ops_create_info_t *);
bool
ops_write_one_pass_sig(const ops_secret_key_t * skey,
const ops_hash_algorithm_t hash_alg,
const ops_sig_type_t sig_type,
ops_create_info_t * info);
ops_write_one_pass_sig(const ops_secret_key_t *,
const ops_hash_algorithm_t,
const ops_sig_type_t,
ops_create_info_t *);
bool
ops_write_literal_data_from_buf(const unsigned char *data,
const int maxlen,
const ops_literal_data_type_t type,
ops_create_info_t * info);
ops_pk_session_key_t *ops_create_pk_session_key(const ops_keydata_t * key);
ops_write_literal_data_from_buf(const unsigned char *,
const int,
const ops_literal_data_type_t,
ops_create_info_t *);
ops_pk_session_key_t *ops_create_pk_session_key(const ops_keydata_t *);
bool
ops_write_pk_session_key(ops_create_info_t * info,
ops_pk_session_key_t * pksk);
bool ops_write_transferable_public_key(const ops_keydata_t * key, bool armoured, ops_create_info_t * info);
bool ops_write_transferable_secret_key(const ops_keydata_t * key, const unsigned char *passphrase, const size_t pplen, bool armoured, ops_create_info_t * info);
ops_write_pk_session_key(ops_create_info_t *, ops_pk_session_key_t *);
bool ops_write_transferable_public_key(const ops_keydata_t *, bool, ops_create_info_t *);
bool ops_write_transferable_secret_key(const ops_keydata_t *, const unsigned char *, const size_t, bool, ops_create_info_t *);
void ops_fast_create_user_id(ops_user_id_t *, unsigned char *);
bool ops_write_user_id(const unsigned char *, ops_create_info_t *);
@ -93,7 +85,4 @@ bool encode_m_buf(const unsigned char *, size_t, const ops_public_key_t *, uns
bool ops_write_literal_data_from_file(const char *, const ops_literal_data_type_t, ops_create_info_t *);
bool ops_write_symmetrically_encrypted_data(const unsigned char *, const int, ops_create_info_t *);
#endif /* OPS_CREATE_H */
//eof

View File

@ -33,11 +33,10 @@
#define OPS_MIN_HASH_SIZE 16
typedef void ops_hash_init_t(ops_hash_t * hash);
typedef void ops_hash_init_t(ops_hash_t *);
typedef void
ops_hash_add_t(ops_hash_t * hash, const unsigned char *data,
unsigned length);
typedef unsigned ops_hash_finish_t(ops_hash_t * hash, unsigned char *out);
ops_hash_add_t(ops_hash_t *, const unsigned char *, unsigned);
typedef unsigned ops_hash_finish_t(ops_hash_t *, unsigned char *);
/** _ops_hash_t */
struct _ops_hash_t {
@ -51,26 +50,20 @@ struct _ops_hash_t {
};
typedef void
ops_crypt_set_iv_t(ops_crypt_t * crypt,
const unsigned char *iv);
ops_crypt_set_iv_t(ops_crypt_t *, const unsigned char *);
typedef void
ops_crypt_set_key_t(ops_crypt_t * crypt,
const unsigned char *key);
typedef void ops_crypt_init_t(ops_crypt_t * crypt);
typedef void ops_crypt_resync_t(ops_crypt_t * crypt);
ops_crypt_set_key_t(ops_crypt_t *, const unsigned char *);
typedef void ops_crypt_init_t(ops_crypt_t *);
typedef void ops_crypt_resync_t(ops_crypt_t *);
typedef void
ops_crypt_block_encrypt_t(ops_crypt_t * crypt, void *out,
const void *in);
ops_crypt_block_encrypt_t(ops_crypt_t *, void *, const void *);
typedef void
ops_crypt_block_decrypt_t(ops_crypt_t * crypt, void *out,
const void *in);
ops_crypt_block_decrypt_t(ops_crypt_t *, void *, const void *);
typedef void
ops_crypt_cfb_encrypt_t(ops_crypt_t * crypt, void *out,
const void *in, size_t count);
ops_crypt_cfb_encrypt_t(ops_crypt_t *, void *, const void *, size_t);
typedef void
ops_crypt_cfb_decrypt_t(ops_crypt_t * crypt, void *out,
const void *in, size_t count);
typedef void ops_crypt_finish_t(ops_crypt_t * crypt);
ops_crypt_cfb_decrypt_t(ops_crypt_t *, void *, const void *, size_t);
typedef void ops_crypt_finish_t(ops_crypt_t *);
/** _ops_crypt_t */
struct _ops_crypt_t {
@ -102,96 +95,88 @@ struct _ops_crypt_t {
void ops_crypto_init(void);
void ops_crypto_finish(void);
void ops_hash_md5(ops_hash_t * hash);
void ops_hash_sha1(ops_hash_t * hash);
void ops_hash_sha256(ops_hash_t * hash);
void ops_hash_sha512(ops_hash_t * hash);
void ops_hash_sha384(ops_hash_t * hash);
void ops_hash_sha224(ops_hash_t * hash);
void ops_hash_any(ops_hash_t * hash, ops_hash_algorithm_t alg);
ops_hash_algorithm_t ops_hash_algorithm_from_text(const char *hash);
const char *ops_text_from_hash(ops_hash_t * hash);
unsigned ops_hash_size(ops_hash_algorithm_t alg);
void ops_hash_md5(ops_hash_t *);
void ops_hash_sha1(ops_hash_t *);
void ops_hash_sha256(ops_hash_t *);
void ops_hash_sha512(ops_hash_t *);
void ops_hash_sha384(ops_hash_t *);
void ops_hash_sha224(ops_hash_t *);
void ops_hash_any(ops_hash_t *, ops_hash_algorithm_t);
ops_hash_algorithm_t ops_hash_algorithm_from_text(const char *);
const char *ops_text_from_hash(ops_hash_t *);
unsigned ops_hash_size(ops_hash_algorithm_t);
unsigned
ops_hash(unsigned char *out, ops_hash_algorithm_t alg, const void *in,
size_t length);
ops_hash(unsigned char *, ops_hash_algorithm_t, const void *, size_t);
void ops_hash_add_int(ops_hash_t * hash, unsigned n, unsigned length);
void ops_hash_add_int(ops_hash_t *, unsigned, unsigned);
bool
ops_dsa_verify(const unsigned char *hash, size_t hash_length,
const ops_dsa_signature_t * sig,
const ops_dsa_public_key_t * dsa);
ops_dsa_verify(const unsigned char *, size_t,
const ops_dsa_signature_t *,
const ops_dsa_public_key_t *);
int
ops_rsa_public_decrypt(unsigned char *out, const unsigned char *in,
size_t length, const ops_rsa_public_key_t * rsa);
ops_rsa_public_decrypt(unsigned char *, const unsigned char *,
size_t, const ops_rsa_public_key_t *);
int
ops_rsa_public_encrypt(unsigned char *out, const unsigned char *in,
size_t length, const ops_rsa_public_key_t * rsa);
ops_rsa_public_encrypt(unsigned char *, const unsigned char *,
size_t, const ops_rsa_public_key_t *);
int
ops_rsa_private_encrypt(unsigned char *out, const unsigned char *in,
size_t length, const ops_rsa_secret_key_t * srsa,
const ops_rsa_public_key_t * rsa);
ops_rsa_private_encrypt(unsigned char *, const unsigned char *,
size_t, const ops_rsa_secret_key_t *,
const ops_rsa_public_key_t *);
int
ops_rsa_private_decrypt(unsigned char *out, const unsigned char *in,
size_t length, const ops_rsa_secret_key_t * srsa,
const ops_rsa_public_key_t * rsa);
ops_rsa_private_decrypt(unsigned char *, const unsigned char *,
size_t, const ops_rsa_secret_key_t *,
const ops_rsa_public_key_t *);
unsigned ops_block_size(ops_symmetric_algorithm_t alg);
unsigned ops_key_size(ops_symmetric_algorithm_t alg);
unsigned ops_block_size(ops_symmetric_algorithm_t);
unsigned ops_key_size(ops_symmetric_algorithm_t);
int
ops_decrypt_data(ops_content_tag_t tag, ops_region_t * region,
ops_parse_info_t * parse_info);
ops_decrypt_data(ops_content_tag_t, ops_region_t *, ops_parse_info_t *);
int ops_crypt_any(ops_crypt_t * decrypt, ops_symmetric_algorithm_t alg);
void ops_decrypt_init(ops_crypt_t * decrypt);
void ops_encrypt_init(ops_crypt_t * encrypt);
int ops_crypt_any(ops_crypt_t *, ops_symmetric_algorithm_t);
void ops_decrypt_init(ops_crypt_t *);
void ops_encrypt_init(ops_crypt_t *);
size_t
ops_decrypt_se(ops_crypt_t * decrypt, void *out, const void *in,
size_t count);
ops_decrypt_se(ops_crypt_t *, void *, const void *, size_t);
size_t
ops_encrypt_se(ops_crypt_t * encrypt, void *out, const void *in,
size_t count);
ops_encrypt_se(ops_crypt_t *, void *, const void *, size_t);
size_t
ops_decrypt_se_ip(ops_crypt_t * decrypt, void *out, const void *in,
size_t count);
ops_decrypt_se_ip(ops_crypt_t *, void *, const void *, size_t);
size_t
ops_encrypt_se_ip(ops_crypt_t * encrypt, void *out, const void *in,
size_t count);
bool ops_is_sa_supported(ops_symmetric_algorithm_t alg);
ops_encrypt_se_ip(ops_crypt_t *, void *, const void *, size_t );
bool ops_is_sa_supported(ops_symmetric_algorithm_t);
void
ops_reader_push_decrypt(ops_parse_info_t * pinfo, ops_crypt_t * decrypt,
ops_region_t * region);
void ops_reader_pop_decrypt(ops_parse_info_t * pinfo);
ops_reader_push_decrypt(ops_parse_info_t *, ops_crypt_t *, ops_region_t *);
void ops_reader_pop_decrypt(ops_parse_info_t *);
/* Hash everything that's read */
void ops_reader_push_hash(ops_parse_info_t * pinfo, ops_hash_t * hash);
void ops_reader_pop_hash(ops_parse_info_t * pinfo);
void ops_reader_push_hash(ops_parse_info_t *, ops_hash_t *);
void ops_reader_pop_hash(ops_parse_info_t *);
int
ops_decrypt_and_unencode_mpi(unsigned char *buf, unsigned buflen, const BIGNUM * encmpi,
const ops_secret_key_t * skey);
ops_decrypt_and_unencode_mpi(unsigned char *, unsigned, const BIGNUM *,
const ops_secret_key_t *);
bool
ops_rsa_encrypt_mpi(const unsigned char *buf, const size_t buflen,
const ops_public_key_t * pkey,
ops_pk_session_key_parameters_t * spk);
ops_rsa_encrypt_mpi(const unsigned char *, const size_t,
const ops_public_key_t *,
ops_pk_session_key_parameters_t *);
/* Encrypt everything that's written */
struct ops_key_data;
void
ops_writer_push_encrypt(ops_create_info_t * info,
const struct ops_key_data * key);
ops_writer_push_encrypt(ops_create_info_t *, const struct ops_key_data *);
bool ops_encrypt_file(const char *input_filename, const char *output_filename, const ops_keydata_t * pub_key, const bool use_armour, const bool allow_overwrite);
bool ops_decrypt_file(const char *input_filename, const char *output_filename, ops_keyring_t * keyring, const bool use_armour, const bool allow_overwrite, ops_parse_cb_t * cb_get_passphrase);
bool ops_encrypt_file(const char *, const char *, const ops_keydata_t *, const bool, const bool );
bool ops_decrypt_file(const char *, const char *, ops_keyring_t *, const bool , const bool, ops_parse_cb_t *);
/* Keys */
bool ops_rsa_generate_keypair(const int numbits, const unsigned long e, ops_keydata_t * keydata);
ops_keydata_t *ops_rsa_create_selfsigned_keypair(const int numbits, const unsigned long e, ops_user_id_t * userid);
bool ops_rsa_generate_keypair(const int , const unsigned long, ops_keydata_t *);
ops_keydata_t *ops_rsa_create_selfsigned_keypair(const int, const unsigned long, ops_user_id_t *);
int ops_dsa_size(const ops_dsa_public_key_t * dsa);
DSA_SIG *ops_dsa_sign(unsigned char *hashbuf, unsigned hashsize, const ops_dsa_secret_key_t * sdsa, const ops_dsa_public_key_t * dsa);
int ops_dsa_size(const ops_dsa_public_key_t * );
DSA_SIG *ops_dsa_sign(unsigned char *, unsigned, const ops_dsa_secret_key_t *, const ops_dsa_public_key_t *);
#endif

View File

@ -102,15 +102,15 @@ typedef struct ops_error {
struct ops_error *next;
} ops_error_t;
const char *ops_errcode(const ops_errcode_t errcode);
const char *ops_errcode(const ops_errcode_t);
void
ops_push_error(ops_error_t ** errstack, ops_errcode_t errcode, int sys_errno,
const char *file, int line, const char *comment,...);
void ops_print_error(ops_error_t * err);
void ops_print_errors(ops_error_t * errstack);
void ops_free_errors(ops_error_t * errstack);
int ops_has_error(ops_error_t * errstack, ops_errcode_t errcode);
ops_push_error(ops_error_t **, ops_errcode_t, int,
const char *, int, const char *, ...);
void ops_print_error(ops_error_t *);
void ops_print_errors(ops_error_t *);
void ops_free_errors(ops_error_t *);
int ops_has_error(ops_error_t *, ops_errcode_t);
#define OPS_SYSTEM_ERROR_1(err,code,syscall,fmt,arg) do { \
ops_push_error(err,OPS_E_SYSTEM_ERROR,errno,__FILE__,__LINE__,syscall);\

View File

@ -21,9 +21,10 @@
#ifndef __OPS_HASH_H__
#define __OPS_HASH_H__
#include "openpgpsdk/packet.h"
void ops_calc_mdc_hash(const unsigned char *preamble, const size_t sz_preamble, const unsigned char *plaintext, const unsigned int sz_plaintext, unsigned char *hashed);
bool ops_is_hash_alg_supported(const ops_hash_algorithm_t * hash_alg);
void ops_calc_mdc_hash(const unsigned char *, const size_t, const unsigned char *, const unsigned int, unsigned char *);
bool ops_is_hash_alg_supported(const ops_hash_algorithm_t *);
#endif /* __OPS_HASH_H__ */

View File

@ -42,51 +42,48 @@ typedef struct {
} ops_keyring_t;
const ops_keydata_t *
ops_keyring_find_key_by_id(const ops_keyring_t * keyring,
ops_keyring_find_key_by_id(const ops_keyring_t * ,
const unsigned char keyid[OPS_KEY_ID_SIZE]);
const ops_keydata_t *
ops_keyring_find_key_by_userid(const ops_keyring_t * keyring,
const char *userid);
void ops_keydata_free(ops_keydata_t * key);
void ops_keyring_free(ops_keyring_t * keyring);
void ops_dump_keyring(const ops_keyring_t * keyring);
const ops_public_key_t *
ops_get_public_key_from_data(const ops_keydata_t * data);
bool ops_is_key_secret(const ops_keydata_t * data);
const ops_secret_key_t *
ops_get_secret_key_from_data(const ops_keydata_t * data);
ops_secret_key_t *
ops_get_writable_secret_key_from_data(ops_keydata_t * data);
ops_secret_key_t *ops_decrypt_secret_key_from_data(const ops_keydata_t * key,
const char *pphrase);
const ops_keydata_t *ops_keyring_find_key_by_userid(const ops_keyring_t *,
const char *);
void ops_keydata_free(ops_keydata_t *);
void ops_keyring_free(ops_keyring_t *);
void ops_dump_keyring(const ops_keyring_t *);
const ops_public_key_t *
ops_get_public_key_from_data(const ops_keydata_t *);
bool ops_is_key_secret(const ops_keydata_t *);
const ops_secret_key_t *ops_get_secret_key_from_data(const ops_keydata_t *);
ops_secret_key_t *ops_get_writable_secret_key_from_data(ops_keydata_t *);
ops_secret_key_t *ops_decrypt_secret_key_from_data(const ops_keydata_t *,
const char *);
bool ops_keyring_read_from_file(ops_keyring_t * keyring, const bool armour, const char *filename);
bool ops_keyring_read_from_mem(ops_keyring_t * keyring, const bool armour, ops_memory_t * mem);
bool ops_keyring_read_from_file(ops_keyring_t *, const bool, const char *);
bool ops_keyring_read_from_mem(ops_keyring_t *, const bool, ops_memory_t *);
char *ops_malloc_passphrase(char *passphrase);
char *ops_get_passphrase(void);
char *ops_malloc_passphrase(char *);
char *ops_get_passphrase(void);
void ops_keyring_list(const ops_keyring_t * keyring);
void ops_keyring_list(const ops_keyring_t *);
void ops_set_secret_key(ops_parser_content_union_t * content, const ops_keydata_t * key);
void ops_set_secret_key(ops_parser_content_union_t *, const ops_keydata_t *);
const unsigned char *ops_get_key_id(const ops_keydata_t * key);
unsigned ops_get_user_id_count(const ops_keydata_t * key);
const unsigned char *ops_get_user_id(const ops_keydata_t * key, unsigned index);
bool ops_is_key_supported(const ops_keydata_t * key);
const ops_keydata_t *ops_keyring_get_key_by_index(const ops_keyring_t * keyring, int index);
const unsigned char *ops_get_key_id(const ops_keydata_t *);
unsigned ops_get_user_id_count(const ops_keydata_t *);
const unsigned char *ops_get_user_id(const ops_keydata_t *, unsigned);
bool ops_is_key_supported(const ops_keydata_t *);
const ops_keydata_t *ops_keyring_get_key_by_index(const ops_keyring_t *, int);
ops_user_id_t *ops_add_userid_to_keydata(ops_keydata_t * keydata, const ops_user_id_t * userid);
ops_packet_t *ops_add_packet_to_keydata(ops_keydata_t * keydata, const ops_packet_t * packet);
void ops_add_signed_userid_to_keydata(ops_keydata_t * keydata, const ops_user_id_t * userid, const ops_packet_t * packet);
ops_user_id_t *ops_add_userid_to_keydata(ops_keydata_t *, const ops_user_id_t *);
ops_packet_t *ops_add_packet_to_keydata(ops_keydata_t *, const ops_packet_t *);
void ops_add_signed_userid_to_keydata(ops_keydata_t *, const ops_user_id_t *, const ops_packet_t *);
bool ops_add_selfsigned_userid_to_keydata(ops_keydata_t * keydata, ops_user_id_t * userid);
bool ops_add_selfsigned_userid_to_keydata(ops_keydata_t *, ops_user_id_t *);
ops_keydata_t *ops_keydata_new(void);
void ops_keydata_init(ops_keydata_t * keydata, const ops_content_tag_t type);
ops_keydata_t *ops_keydata_new(void);
void ops_keydata_init(ops_keydata_t *, const ops_content_tag_t);
void ops_copy_userid(ops_user_id_t *, const ops_user_id_t *);
void ops_copy_packet(ops_packet_t *, const ops_packet_t *);
unsigned ops_get_keydata_content_type(const ops_keydata_t *);
void ops_copy_userid(ops_user_id_t *, const ops_user_id_t *);
void ops_copy_packet(ops_packet_t *, const ops_packet_t *);
unsigned ops_get_keydata_content_type(const ops_keydata_t *);
#endif

View File

@ -32,8 +32,8 @@ typedef struct {
unsigned long *ulongs;
} ops_ulong_list_t;
void ops_ulong_list_init(ops_ulong_list_t * list);
void ops_ulong_list_free(ops_ulong_list_t * list);
unsigned int ops_ulong_list_add(ops_ulong_list_t * list, unsigned long *ulong);
void ops_ulong_list_init(ops_ulong_list_t *);
void ops_ulong_list_free(ops_ulong_list_t *);
unsigned int ops_ulong_list_add(ops_ulong_list_t *, unsigned long *);
#endif /* OPS_LISTS_H */

View File

@ -39,20 +39,18 @@ typedef struct ops_memory_t {
ops_memory_t *ops_memory_new(void);
void ops_memory_free(ops_memory_t * mem);
void ops_memory_init(ops_memory_t * mem, size_t initial_size);
void ops_memory_pad(ops_memory_t * mem, size_t length);
void ops_memory_add(ops_memory_t * mem, const unsigned char *src, size_t length);
void
ops_memory_place_int(ops_memory_t * mem, unsigned offset, unsigned n,
size_t length);
void ops_memory_make_packet(ops_memory_t * out, ops_content_tag_t tag);
void ops_memory_clear(ops_memory_t * mem);
void ops_memory_release(ops_memory_t * mem);
void ops_memory_free(ops_memory_t *);
void ops_memory_init(ops_memory_t *, size_t);
void ops_memory_pad(ops_memory_t *, size_t);
void ops_memory_add(ops_memory_t *, const unsigned char *, size_t);
void ops_memory_place_int(ops_memory_t *, unsigned, unsigned, size_t);
void ops_memory_make_packet(ops_memory_t *, ops_content_tag_t);
void ops_memory_clear(ops_memory_t *);
void ops_memory_release(ops_memory_t *);
void ops_writer_set_memory(ops_create_info_t * info, ops_memory_t * mem);
void ops_writer_set_memory(ops_create_info_t *, ops_memory_t *);
size_t ops_memory_get_length(const ops_memory_t * mem);
void *ops_memory_get_data(ops_memory_t * mem);
size_t ops_memory_get_length(const ops_memory_t *);
void *ops_memory_get_data(ops_memory_t *);
#endif

View File

@ -40,7 +40,7 @@ typedef struct ops_region {
unsigned indeterminate:1;
} ops_region_t;
void ops_init_subregion(ops_region_t * subregion, ops_region_t * region);
void ops_init_subregion(ops_region_t *, ops_region_t *);
#if 0
/** Return values for reader functions e.g. ops_packet_reader_t() */
@ -69,8 +69,8 @@ typedef enum {
typedef struct ops_parse_cb_info ops_parse_cb_info_t;
typedef ops_parse_cb_return_t
ops_parse_cb_t(const ops_parser_content_t * content,
ops_parse_cb_info_t * cbinfo);
ops_parse_cb_t(const ops_parser_content_t *,
ops_parse_cb_info_t *);
typedef struct ops_parse_info ops_parse_info_t;
typedef struct ops_reader_info ops_reader_info_t;
@ -97,41 +97,39 @@ typedef struct ops_crypt_info ops_crypt_info_t;
*/
typedef int
ops_reader_t(void *dest, size_t length, ops_error_t ** errors,
ops_reader_info_t * rinfo, ops_parse_cb_info_t * cbinfo);
ops_reader_t(void *, size_t, ops_error_t **,
ops_reader_info_t *, ops_parse_cb_info_t *);
typedef void ops_reader_destroyer_t(ops_reader_info_t * rinfo);
typedef void ops_reader_destroyer_t(ops_reader_info_t *);
ops_parse_info_t *ops_parse_info_new(void);
void ops_parse_info_delete(ops_parse_info_t * pinfo);
ops_error_t *ops_parse_info_get_errors(ops_parse_info_t * pinfo);
ops_crypt_t *ops_parse_get_decrypt(ops_parse_info_t * pinfo);
void ops_parse_info_delete(ops_parse_info_t *);
ops_error_t *ops_parse_info_get_errors(ops_parse_info_t *);
ops_crypt_t *ops_parse_get_decrypt(ops_parse_info_t *);
void ops_parse_cb_set(ops_parse_info_t * pinfo, ops_parse_cb_t * cb, void *arg);
void ops_parse_cb_push(ops_parse_info_t * pinfo, ops_parse_cb_t * cb, void *arg);
void *ops_parse_cb_get_arg(ops_parse_cb_info_t * cbinfo);
void *ops_parse_cb_get_errors(ops_parse_cb_info_t * cbinfo);
void ops_reader_set(ops_parse_info_t * pinfo, ops_reader_t * reader, ops_reader_destroyer_t * destroyer, void *arg);
void ops_reader_push(ops_parse_info_t * pinfo, ops_reader_t * reader, ops_reader_destroyer_t * destroyer, void *arg);
void ops_reader_pop(ops_parse_info_t * pinfo);
void *ops_reader_get_arg_from_pinfo(ops_parse_info_t * pinfo);
void ops_parse_cb_set(ops_parse_info_t *, ops_parse_cb_t *, void *);
void ops_parse_cb_push(ops_parse_info_t *, ops_parse_cb_t *, void *);
void *ops_parse_cb_get_arg(ops_parse_cb_info_t *);
void *ops_parse_cb_get_errors(ops_parse_cb_info_t *);
void ops_reader_set(ops_parse_info_t *, ops_reader_t *, ops_reader_destroyer_t *, void *);
void ops_reader_push(ops_parse_info_t *, ops_reader_t *, ops_reader_destroyer_t *, void *);
void ops_reader_pop(ops_parse_info_t *);
void *ops_reader_get_arg_from_pinfo(ops_parse_info_t *);
void *ops_reader_get_arg(ops_reader_info_t * rinfo);
void *ops_reader_get_arg(ops_reader_info_t *);
ops_parse_cb_return_t
ops_parse_cb(const ops_parser_content_t * content,
ops_parse_cb_info_t * cbinfo);
ops_parse_cb(const ops_parser_content_t *, ops_parse_cb_info_t *);
ops_parse_cb_return_t
ops_parse_stacked_cb(const ops_parser_content_t * content,
ops_parse_cb_info_t * cbinfo);
ops_reader_info_t *ops_parse_get_rinfo(ops_parse_info_t * pinfo);
ops_parse_stacked_cb(const ops_parser_content_t *, ops_parse_cb_info_t *);
ops_reader_info_t *ops_parse_get_rinfo(ops_parse_info_t *);
int ops_parse(ops_parse_info_t * parse_info);
int ops_parse_and_print_errors(ops_parse_info_t * parse_info);
int ops_parse_and_save_errs(ops_parse_info_t * parse_info, ops_ulong_list_t * errs);
int ops_parse_errs(ops_parse_info_t * parse_info, ops_ulong_list_t * errs);
int ops_parse(ops_parse_info_t *);
int ops_parse_and_print_errors(ops_parse_info_t *);
int ops_parse_and_save_errs(ops_parse_info_t *, ops_ulong_list_t *);
int ops_parse_errs(ops_parse_info_t *, ops_ulong_list_t *);
void ops_parse_and_validate(ops_parse_info_t * parse_info);
void ops_parse_and_validate(ops_parse_info_t *);
/** Used to specify whether subpackets should be returned raw, parsed or ignored.
*/
@ -142,35 +140,29 @@ typedef enum {
} ops_parse_type_t;
void
ops_parse_options(ops_parse_info_t * pinfo, ops_content_tag_t tag,
ops_parse_type_t type);
ops_parse_options(ops_parse_info_t *, ops_content_tag_t, ops_parse_type_t);
bool
ops_limited_read(unsigned char *dest, size_t length,
ops_region_t * region, ops_error_t ** errors,
ops_reader_info_t * rinfo,
ops_parse_cb_info_t * cbinfo);
ops_limited_read(unsigned char *, size_t,
ops_region_t *, ops_error_t **,
ops_reader_info_t *,
ops_parse_cb_info_t *);
bool
ops_stacked_limited_read(unsigned char *dest, unsigned length,
ops_region_t * region,
ops_error_t ** errors,
ops_reader_info_t * rinfo,
ops_parse_cb_info_t * cbinfo);
ops_stacked_limited_read(unsigned char *, unsigned,
ops_region_t *,
ops_error_t **,
ops_reader_info_t *,
ops_parse_cb_info_t *);
void
ops_parse_hash_init(ops_parse_info_t * pinfo, ops_hash_algorithm_t type,
const unsigned char *keyid);
ops_parse_hash_init(ops_parse_info_t *, ops_hash_algorithm_t,
const unsigned char *);
void
ops_parse_hash_data(ops_parse_info_t * pinfo, const void *data,
size_t length);
void ops_parse_hash_finish(ops_parse_info_t * pinfo);
ops_parse_hash_data(ops_parse_info_t *, const void *, size_t);
void ops_parse_hash_finish(ops_parse_info_t *);
ops_hash_t *
ops_parse_hash_find(ops_parse_info_t * pinfo,
ops_parse_hash_find(ops_parse_info_t *,
const unsigned char keyid[OPS_KEY_ID_SIZE]);
ops_reader_t ops_stacked_read;
/* vim:set textwidth=120: */
/* vim:set ts=8: */
ops_reader_t ops_stacked_read;
#endif

View File

@ -51,40 +51,36 @@ typedef struct {
const char *string;
} ops_bit_map_t;
void ops_text_init(ops_text_t * text);
void ops_text_free(ops_text_t * text);
void ops_text_init(ops_text_t *);
void ops_text_free(ops_text_t *);
const char *ops_show_packet_tag(ops_packet_tag_t packet_tag);
const char *ops_show_ss_type(ops_ss_type_t ss_type);
const char *ops_show_packet_tag(ops_packet_tag_t);
const char *ops_show_ss_type(ops_ss_type_t);
const char *ops_show_sig_type(ops_sig_type_t sig_type);
const char *ops_show_pka(ops_public_key_algorithm_t pka);
const char *ops_show_sig_type(ops_sig_type_t);
const char *ops_show_pka(ops_public_key_algorithm_t);
ops_text_t *ops_showall_ss_preferred_compression(ops_ss_preferred_compression_t ss_preferred_compression);
const char *ops_show_ss_preferred_compression(unsigned char octet);
ops_text_t *ops_showall_ss_preferred_compression(ops_ss_preferred_compression_t);
const char *ops_show_ss_preferred_compression(unsigned char);
ops_text_t *ops_showall_ss_preferred_hash(ops_ss_preferred_hash_t ss_preferred_hash);
const char *ops_show_hash_algorithm(unsigned char octet);
const char *ops_show_symmetric_algorithm(unsigned char hash);
ops_text_t *ops_showall_ss_preferred_hash(ops_ss_preferred_hash_t);
const char *ops_show_hash_algorithm(unsigned char);
const char *ops_show_symmetric_algorithm(unsigned char);
ops_text_t *ops_showall_ss_preferred_ska(ops_ss_preferred_ska_t ss_preferred_ska);
const char *ops_show_ss_preferred_ska(unsigned char octet);
ops_text_t *ops_showall_ss_preferred_ska(ops_ss_preferred_ska_t);
const char *ops_show_ss_preferred_ska(unsigned char);
const char *ops_show_ss_rr_code(ops_ss_rr_code_t ss_rr_code);
const char *ops_show_ss_rr_code(ops_ss_rr_code_t);
ops_text_t *ops_showall_ss_features(ops_ss_features_t ss_features);
ops_text_t *ops_showall_ss_features(ops_ss_features_t);
ops_text_t *ops_showall_ss_key_flags(ops_ss_key_flags_t ss_key_flags);
const char *ops_show_ss_key_flag(unsigned char octet, ops_bit_map_t * map);
ops_text_t *ops_showall_ss_key_flags(ops_ss_key_flags_t);
const char *ops_show_ss_key_flag(unsigned char, ops_bit_map_t *);
ops_text_t *ops_showall_ss_key_server_prefs(ops_ss_key_server_prefs_t ss_key_server_prefs);
ops_text_t *ops_showall_ss_key_server_prefs(ops_ss_key_server_prefs_t);
const char *
ops_show_ss_key_server_prefs(unsigned char octet,
ops_bit_map_t * map);
ops_show_ss_key_server_prefs(unsigned char, ops_bit_map_t *);
ops_text_t *ops_showall_ss_notation_data_flags(ops_ss_notation_data_t ss_notation_data);
/* vim:set textwidth=120: */
/* vim:set ts=8: */
ops_text_t *ops_showall_ss_notation_data_flags(ops_ss_notation_data_t);
#endif /* OPS_PACKET_TO_TEXT_H */

View File

@ -999,38 +999,35 @@ typedef struct {
unsigned length;
} ops_fingerprint_t;
void ops_init(void);
void ops_finish(void);
void ops_keyid(unsigned char *, const size_t, const int,
void ops_init(void);
void ops_finish(void);
void ops_keyid(unsigned char *, const size_t, const int,
const ops_public_key_t *);
void ops_fingerprint(ops_fingerprint_t *, const ops_public_key_t *);
void ops_public_key_free(ops_public_key_t *);
void ops_user_id_free(ops_user_id_t *);
void ops_user_attribute_free(ops_user_attribute_t *);
void ops_signature_free(ops_signature_t *);
void ops_trust_free(ops_trust_t *);
void ops_ss_preferred_ska_free(ops_ss_preferred_ska_t *);
void ops_ss_preferred_hash_free(ops_ss_preferred_hash_t *);
void ops_ss_preferred_compression_free(ops_ss_preferred_compression_t *);
void ops_ss_key_flags_free(ops_ss_key_flags_t *);
void ops_ss_key_server_prefs_free(ops_ss_key_server_prefs_t *);
void ops_ss_features_free(ops_ss_features_t *);
void ops_ss_notation_data_free(ops_ss_notation_data_t *);
void ops_ss_policy_url_free(ops_ss_policy_url_t *);
void ops_ss_preferred_key_server_free(ops_ss_preferred_key_server_t *);
void ops_ss_regexp_free(ops_ss_regexp_t *);
void ops_ss_userdefined_free(ops_ss_userdefined_t *);
void ops_ss_reserved_free(ops_ss_unknown_t *);
void ops_ss_revocation_reason_free(ops_ss_revocation_reason_t *);
void ops_ss_signature_target_free(ops_ss_signature_target_t *);
void ops_ss_embedded_signature_free(ops_ss_embedded_signature_t *);
void ops_fingerprint(ops_fingerprint_t *, const ops_public_key_t *);
void ops_public_key_free(ops_public_key_t *);
void ops_user_id_free(ops_user_id_t *);
void ops_user_attribute_free(ops_user_attribute_t *);
void ops_signature_free(ops_signature_t *);
void ops_trust_free(ops_trust_t *);
void ops_ss_preferred_ska_free(ops_ss_preferred_ska_t *);
void ops_ss_preferred_hash_free(ops_ss_preferred_hash_t *);
void ops_ss_preferred_compression_free(ops_ss_preferred_compression_t *);
void ops_ss_key_flags_free(ops_ss_key_flags_t *);
void ops_ss_key_server_prefs_free(ops_ss_key_server_prefs_t *);
void ops_ss_features_free(ops_ss_features_t *);
void ops_ss_notation_data_free(ops_ss_notation_data_t *);
void ops_ss_policy_url_free(ops_ss_policy_url_t *);
void ops_ss_preferred_key_server_free(ops_ss_preferred_key_server_t *);
void ops_ss_regexp_free(ops_ss_regexp_t *);
void ops_ss_userdefined_free(ops_ss_userdefined_t *);
void ops_ss_reserved_free(ops_ss_unknown_t *);
void ops_ss_revocation_reason_free(ops_ss_revocation_reason_t *);
void ops_ss_signature_target_free(ops_ss_signature_target_t *);
void ops_ss_embedded_signature_free(ops_ss_embedded_signature_t *);
void ops_packet_free(ops_packet_t *);
void ops_parser_content_free(ops_parser_content_t *);
void ops_secret_key_free(ops_secret_key_t *);
void ops_pk_session_key_free(ops_pk_session_key_t *);
/* vim:set textwidth=120: */
/* vim:set ts=8: */
void ops_packet_free(ops_packet_t *);
void ops_parser_content_free(ops_parser_content_t *);
void ops_secret_key_free(ops_secret_key_t *);
void ops_pk_session_key_free(ops_pk_session_key_t *);
#endif

View File

@ -25,4 +25,4 @@
#include <unistd.h>
#endif
void ops_random(void *dest, size_t length);
void ops_random(void *, size_t);

View File

@ -26,66 +26,59 @@
#include <openpgpsdk/create.h>
void ops_reader_set_fd(ops_parse_info_t * pinfo, int fd);
void ops_reader_set_fd(ops_parse_info_t *, int);
void
ops_reader_set_memory(ops_parse_info_t * pinfo, const void *buffer,
size_t length);
ops_reader_set_memory(ops_parse_info_t *, const void *, size_t);
/* Do a sum mod 65536 of all bytes read (as needed for secret keys) */
void ops_reader_push_sum16(ops_parse_info_t * pinfo);
unsigned short ops_reader_pop_sum16(ops_parse_info_t * pinfo);
void ops_reader_push_sum16(ops_parse_info_t *);
unsigned short ops_reader_pop_sum16(ops_parse_info_t *);
void
ops_reader_push_se_ip_data(ops_parse_info_t * pinfo, ops_crypt_t * decrypt,
ops_region_t * region);
void ops_reader_pop_se_ip_data(ops_parse_info_t * pinfo);
ops_reader_push_se_ip_data(ops_parse_info_t *, ops_crypt_t *, ops_region_t *);
void ops_reader_pop_se_ip_data(ops_parse_info_t *);
/* */
bool
ops_write_mdc(const unsigned char *hashed,
ops_create_info_t * info);
ops_write_mdc(const unsigned char *, ops_create_info_t *);
bool
ops_write_se_ip_pktset(const unsigned char *data,
const unsigned int len,
ops_crypt_t * crypt,
ops_create_info_t * info);
void
ops_writer_push_encrypt_crypt(ops_create_info_t * cinfo,
ops_crypt_t * crypt);
void
ops_writer_push_encrypt_se_ip(ops_create_info_t * cinfo,
const ops_keydata_t * pub_key);
ops_write_se_ip_pktset(const unsigned char *,
const unsigned int,
ops_crypt_t *,
ops_create_info_t *);
void ops_writer_push_encrypt_crypt(ops_create_info_t *, ops_crypt_t *);
void ops_writer_push_encrypt_se_ip(ops_create_info_t *, const ops_keydata_t *);
/* Secret Key checksum */
void ops_push_skey_checksum_writer(ops_create_info_t * cinfo, ops_secret_key_t * skey);
bool ops_pop_skey_checksum_writer(ops_create_info_t * cinfo);
void ops_push_skey_checksum_writer(ops_create_info_t *, ops_secret_key_t *);
bool ops_pop_skey_checksum_writer(ops_create_info_t *);
/* memory writing */
void ops_setup_memory_write(ops_create_info_t ** cinfo, ops_memory_t ** mem, size_t bufsz);
void ops_teardown_memory_write(ops_create_info_t * cinfo, ops_memory_t * mem);
void ops_setup_memory_write(ops_create_info_t **, ops_memory_t **, size_t);
void ops_teardown_memory_write(ops_create_info_t *, ops_memory_t *);
/* memory reading */
void
ops_setup_memory_read(ops_parse_info_t ** pinfo, ops_memory_t * mem,
void *arg,
ops_parse_cb_return_t callback(const ops_parser_content_t *, ops_parse_cb_info_t *), bool accumulate);
void ops_teardown_memory_read(ops_parse_info_t * pinfo, ops_memory_t * mem);
ops_setup_memory_read(ops_parse_info_t **, ops_memory_t *,
void *,
ops_parse_cb_return_t callback(const ops_parser_content_t *, ops_parse_cb_info_t *), bool);
void ops_teardown_memory_read(ops_parse_info_t *, ops_memory_t *);
/* file writing */
int ops_setup_file_write(ops_create_info_t ** cinfo, const char *filename, bool allow_overwrite);
void ops_teardown_file_write(ops_create_info_t * cinfo, int fd);
int ops_setup_file_write(ops_create_info_t **, const char *, bool);
void ops_teardown_file_write(ops_create_info_t *, int);
/* file appending */
int ops_setup_file_append(ops_create_info_t ** cinfo, const char *filename);
void ops_teardown_file_append(ops_create_info_t * cinfo, int fd);
int ops_setup_file_append(ops_create_info_t **, const char *);
void ops_teardown_file_append(ops_create_info_t *, int);
/* file reading */
int ops_setup_file_read(ops_parse_info_t ** pinfo, const char *filename, void *arg,
ops_parse_cb_return_t callback(const ops_parser_content_t *, ops_parse_cb_info_t *), bool accumulate);
void ops_teardown_file_read(ops_parse_info_t * pinfo, int fd);
int ops_setup_file_read(ops_parse_info_t **, const char *, void *,
ops_parse_cb_return_t callback(const ops_parser_content_t *, ops_parse_cb_info_t *), bool);
void ops_teardown_file_read(ops_parse_info_t *, int);
bool ops_reader_set_accumulate(ops_parse_info_t * pinfo, bool state);
bool ops_reader_set_accumulate(ops_parse_info_t *, bool);
/* useful callbacks */
ops_parse_cb_return_t
@ -98,6 +91,6 @@ ops_parse_cb_return_t
get_passphrase_cb(const ops_parser_content_t * content_, ops_parse_cb_info_t * cbinfo);
/* from reader_fd.c */
void ops_reader_set_fd(ops_parse_info_t *, int);
void ops_reader_set_fd(ops_parse_info_t *, int);
#endif /* OPS_READERWRITER_H__ */

View File

@ -32,70 +32,68 @@
typedef struct ops_create_signature ops_create_signature_t;
ops_create_signature_t *ops_create_signature_new(void);
void ops_create_signature_delete(ops_create_signature_t * sig);
void ops_create_signature_delete(ops_create_signature_t *);
bool
ops_check_user_id_certification_signature(const ops_public_key_t * key,
const ops_user_id_t * id,
const ops_signature_t * sig,
const ops_public_key_t * signer,
const unsigned char *raw_packet);
ops_check_user_id_certification_signature(const ops_public_key_t *,
const ops_user_id_t *,
const ops_signature_t *,
const ops_public_key_t *,
const unsigned char *);
bool
ops_check_user_attribute_certification_signature(const ops_public_key_t * key,
const ops_user_attribute_t * attribute,
const ops_signature_t * sig,
const ops_public_key_t * signer,
const unsigned char *raw_packet);
ops_check_user_attribute_certification_signature(const ops_public_key_t *,
const ops_user_attribute_t *,
const ops_signature_t *,
const ops_public_key_t *,
const unsigned char *);
bool
ops_check_subkey_signature(const ops_public_key_t * key,
const ops_public_key_t * subkey,
const ops_signature_t * sig,
const ops_public_key_t * signer,
const unsigned char *raw_packet);
ops_check_subkey_signature(const ops_public_key_t *,
const ops_public_key_t *,
const ops_signature_t *,
const ops_public_key_t *,
const unsigned char *);
bool
ops_check_direct_signature(const ops_public_key_t * key,
const ops_signature_t * sig,
const ops_public_key_t * signer,
const unsigned char *raw_packet);
ops_check_direct_signature(const ops_public_key_t *,
const ops_signature_t *,
const ops_public_key_t *,
const unsigned char *);
bool
ops_check_hash_signature(ops_hash_t * hash,
const ops_signature_t * sig,
const ops_public_key_t * signer);
ops_check_hash_signature(ops_hash_t *,
const ops_signature_t *,
const ops_public_key_t *);
void
ops_signature_start_key_signature(ops_create_signature_t * sig,
const ops_public_key_t * key,
const ops_user_id_t * id,
ops_sig_type_t type);
ops_signature_start_key_signature(ops_create_signature_t *,
const ops_public_key_t *,
const ops_user_id_t *,
ops_sig_type_t);
void
ops_signature_start_cleartext_signature(ops_create_signature_t * sig,
const ops_secret_key_t * key,
const ops_hash_algorithm_t hash,
const ops_sig_type_t type);
ops_signature_start_cleartext_signature(ops_create_signature_t *,
const ops_secret_key_t *,
const ops_hash_algorithm_t,
const ops_sig_type_t);
void
ops_signature_start_message_signature(ops_create_signature_t * sig,
const ops_secret_key_t * key,
const ops_hash_algorithm_t hash,
const ops_sig_type_t type);
ops_signature_start_message_signature(ops_create_signature_t *,
const ops_secret_key_t *,
const ops_hash_algorithm_t,
const ops_sig_type_t);
void
ops_signature_add_data(ops_create_signature_t * sig, const void *buf,
size_t length);
ops_hash_t *ops_signature_get_hash(ops_create_signature_t * sig);
bool ops_signature_hashed_subpackets_end(ops_create_signature_t * sig);
ops_signature_add_data(ops_create_signature_t *, const void *, size_t);
ops_hash_t *ops_signature_get_hash(ops_create_signature_t *);
bool ops_signature_hashed_subpackets_end(ops_create_signature_t *);
bool
ops_write_signature(ops_create_signature_t * sig, const ops_public_key_t * key,
const ops_secret_key_t * skey, ops_create_info_t * opt);
bool ops_signature_add_creation_time(ops_create_signature_t * sig, time_t when);
ops_write_signature(ops_create_signature_t *, const ops_public_key_t *,
const ops_secret_key_t *, ops_create_info_t *);
bool ops_signature_add_creation_time(ops_create_signature_t *, time_t);
bool
ops_signature_add_issuer_key_id(ops_create_signature_t * sig,
ops_signature_add_issuer_key_id(ops_create_signature_t *,
const unsigned char keyid[OPS_KEY_ID_SIZE]);
void ops_signature_add_primary_user_id(ops_create_signature_t * sig,
bool primary);
void ops_signature_add_primary_user_id(ops_create_signature_t *, bool);
/* Standard Interface */
bool ops_sign_file_as_cleartext(const char *input_filename, const char *output_filename, const ops_secret_key_t * skey, const bool overwrite);
bool ops_sign_buf_as_cleartext(const char *input, const size_t len, ops_memory_t ** output, const ops_secret_key_t * skey);
bool ops_sign_file(const char *input_filename, const char *output_filename, const ops_secret_key_t * skey, const bool use_armour, const bool overwrite);
ops_memory_t *ops_sign_buf(const void *input, const size_t input_len, const ops_sig_type_t sig_type, const ops_secret_key_t * skey, const bool use_armour);
bool ops_sign_file_as_cleartext(const char *, const char *, const ops_secret_key_t *, const bool);
bool ops_sign_buf_as_cleartext(const char *, const size_t, ops_memory_t **, const ops_secret_key_t *);
bool ops_sign_file(const char *, const char *, const ops_secret_key_t *, const bool, const bool);
ops_memory_t *ops_sign_buf(const void *, const size_t, const ops_sig_type_t, const ops_secret_key_t *, const bool);
#endif

View File

@ -30,19 +30,18 @@
#include "openpgpsdk/keyring.h"
void
print_bn(const char *name,
const BIGNUM * bn);
print_bn(const char *, const BIGNUM *);
void
ops_print_pk_session_key(ops_content_tag_t tag,
const ops_pk_session_key_t * key);
void ops_print_public_keydata(const ops_keydata_t * key);
ops_print_pk_session_key(ops_content_tag_t,
const ops_pk_session_key_t *);
void ops_print_public_keydata(const ops_keydata_t *);
void ops_print_public_keydata_verbose(const ops_keydata_t * key);
void ops_print_public_key(const ops_public_key_t * pkey);
void ops_print_public_keydata_verbose(const ops_keydata_t *);
void ops_print_public_key(const ops_public_key_t *);
void ops_print_secret_keydata(const ops_keydata_t * key);
void ops_print_secret_keydata_verbose(const ops_keydata_t * key);
int ops_print_packet(const ops_parser_content_t * content_);
void ops_list_packets(char *filename, bool armour, ops_keyring_t * pubring, ops_parse_cb_t * cb_get_passphrase);
void ops_print_secret_keydata(const ops_keydata_t *);
void ops_print_secret_keydata_verbose(const ops_keydata_t *);
int ops_print_packet(const ops_parser_content_t *);
void ops_list_packets(char *, bool, ops_keyring_t *, ops_parse_cb_t *);
#endif

View File

@ -29,75 +29,74 @@ typedef struct {
ops_signature_info_t *unknown_sigs;
} ops_validate_result_t;
void ops_validate_result_free(ops_validate_result_t * result);
void ops_validate_result_free(ops_validate_result_t *);
bool
ops_validate_key_signatures(ops_validate_result_t * result,
const ops_keydata_t * keydata,
const ops_keyring_t * ring,
ops_validate_key_signatures(ops_validate_result_t *,
const ops_keydata_t *,
const ops_keyring_t *,
ops_parse_cb_return_t cb(const ops_parser_content_t *, ops_parse_cb_info_t *));
bool ops_validate_all_signatures(ops_validate_result_t * result,
const ops_keyring_t * ring,
ops_parse_cb_return_t cb(const ops_parser_content_t *, ops_parse_cb_info_t *));
bool ops_validate_all_signatures(ops_validate_result_t *,
const ops_keyring_t *,
ops_parse_cb_return_t cb(const ops_parser_content_t *, ops_parse_cb_info_t *));
void ops_keydata_reader_set(ops_parse_info_t * pinfo,
const ops_keydata_t * key);
void ops_keydata_reader_set(ops_parse_info_t *, const ops_keydata_t *);
typedef struct {
const ops_keydata_t *key;
unsigned packet;
unsigned offset;
} validate_reader_arg_t;
typedef struct {
const ops_keydata_t *key;
unsigned packet;
unsigned offset;
} validate_reader_arg_t;
/** Struct used with the validate_key_cb callback */
typedef struct {
ops_public_key_t pkey;
ops_public_key_t subkey;
ops_secret_key_t skey;
enum {
ATTRIBUTE = 1,
ID
} last_seen;
ops_user_id_t user_id;
ops_user_attribute_t user_attribute;
unsigned char hash[OPS_MAX_HASH_SIZE];
const ops_keyring_t *keyring;
validate_reader_arg_t *rarg;
ops_validate_result_t *result;
ops_parse_cb_return_t(*cb_get_passphrase) (const ops_parser_content_t *, ops_parse_cb_info_t *);
} validate_key_cb_arg_t;
typedef struct {
ops_public_key_t pkey;
ops_public_key_t subkey;
ops_secret_key_t skey;
enum {
ATTRIBUTE = 1,
ID
} last_seen;
ops_user_id_t user_id;
ops_user_attribute_t user_attribute;
unsigned char hash[OPS_MAX_HASH_SIZE];
const ops_keyring_t *keyring;
validate_reader_arg_t *rarg;
ops_validate_result_t *result;
ops_parse_cb_return_t(*cb_get_passphrase) (const ops_parser_content_t *, ops_parse_cb_info_t *);
} validate_key_cb_arg_t;
/** Struct use with the validate_data_cb callback */
typedef struct {
enum {
LITERAL_DATA,
SIGNED_CLEARTEXT
} use; /* <! this is set to indicate what
* kind of data we have */
union {
ops_literal_data_body_t literal_data_body; /* <! Used to hold
* Literal Data */
ops_signed_cleartext_body_t signed_cleartext_body; /* <! Used to hold
* Signed Cleartext */
} data; /* <! the data itself */
unsigned char hash[OPS_MAX_HASH_SIZE]; /* <! the hash */
ops_memory_t *mem;
const ops_keyring_t *keyring; /* <! keyring to use */
validate_reader_arg_t *rarg; /* <! reader-specific arg */
ops_validate_result_t *result; /* <! where to put the result */
} validate_data_cb_arg_t; /* <! used with
* validate_data_cb callback */
typedef struct {
enum {
LITERAL_DATA,
SIGNED_CLEARTEXT
} use; /* <! this is set to indicate what
* kind of data we have */
union {
ops_literal_data_body_t literal_data_body;
/* <! Used to hold Literal Data */
ops_signed_cleartext_body_t signed_cleartext_body;
/* <! Used to hold * Signed Cleartext */
} data; /* <! the data itself */
unsigned char hash[OPS_MAX_HASH_SIZE]; /* <! the hash */
ops_memory_t *mem;
const ops_keyring_t *keyring; /* <! keyring to use */
validate_reader_arg_t *rarg; /* <! reader-specific arg */
ops_validate_result_t *result; /* <! where to put the result */
} validate_data_cb_arg_t; /* <! used with
* validate_data_cb callback */
bool ops_check_signature(const unsigned char *hash,
unsigned length,
const ops_signature_t * sig,
const ops_public_key_t * signer);
bool ops_check_signature(const unsigned char *, unsigned,
const ops_signature_t *,
const ops_public_key_t *);
ops_parse_cb_return_t
ops_validate_key_cb(const ops_parser_content_t * content_, ops_parse_cb_info_t * cbinfo);
ops_validate_key_cb(const ops_parser_content_t *, ops_parse_cb_info_t *);
bool ops_validate_file(ops_validate_result_t * result, const char *filename, const int armoured, const ops_keyring_t * keyring);
bool ops_validate_mem(ops_validate_result_t * result, ops_memory_t * mem, const int armoured, const ops_keyring_t * keyring);
bool ops_validate_file(ops_validate_result_t *, const char *, const int, const ops_keyring_t *);
bool ops_validate_mem(ops_validate_result_t *, ops_memory_t *, const int, const ops_keyring_t *);
ops_parse_cb_return_t
validate_data_cb(const ops_parser_content_t *, ops_parse_cb_info_t *);
bool validate_result_status(ops_validate_result_t *);
bool validate_result_status(ops_validate_result_t *);

View File

@ -43,14 +43,13 @@
typedef struct ops_writer_info ops_writer_info_t;
typedef bool
ops_writer_t(const unsigned char *src,
unsigned length,
ops_error_t ** errors,
ops_writer_info_t * winfo);
typedef bool
ops_writer_finaliser_t(ops_error_t ** errors,
ops_writer_info_t * winfo);
typedef void ops_writer_destroyer_t(ops_writer_info_t * winfo);
ops_writer_t(const unsigned char *,
unsigned,
ops_error_t **,
ops_writer_info_t *);
typedef bool ops_writer_finaliser_t(ops_error_t **, ops_writer_info_t *);
typedef void ops_writer_destroyer_t(ops_writer_info_t *);
/** Writer settings */
struct ops_writer_info {
ops_writer_t *writer; /* !< the writer itself */
@ -61,47 +60,42 @@ struct ops_writer_info {
};
void *ops_writer_get_arg(ops_writer_info_t * winfo);
void *ops_writer_get_arg(ops_writer_info_t *);
bool
ops_stacked_write(const void *src, unsigned length,
ops_error_t ** errors,
ops_writer_info_t * winfo);
ops_stacked_write(const void *, unsigned, ops_error_t **, ops_writer_info_t *);
void
ops_writer_set(ops_create_info_t * info,
ops_writer_t * writer,
ops_writer_finaliser_t * finaliser,
ops_writer_destroyer_t * destroyer,
void *arg);
ops_writer_set(ops_create_info_t *,
ops_writer_t *,
ops_writer_finaliser_t *,
ops_writer_destroyer_t *,
void *);
void
ops_writer_push(ops_create_info_t * info,
ops_writer_t * writer,
ops_writer_finaliser_t * finaliser,
ops_writer_destroyer_t * destroyer,
void *arg);
void ops_writer_pop(ops_create_info_t * info);
void ops_writer_generic_destroyer(ops_writer_info_t * winfo);
ops_writer_push(ops_create_info_t *,
ops_writer_t *,
ops_writer_finaliser_t *,
ops_writer_destroyer_t *,
void *);
void ops_writer_pop(ops_create_info_t *);
void ops_writer_generic_destroyer(ops_writer_info_t *);
bool
ops_writer_passthrough(const unsigned char *src,
unsigned length,
ops_error_t ** errors,
ops_writer_info_t * winfo);
ops_writer_passthrough(const unsigned char *,
unsigned,
ops_error_t **,
ops_writer_info_t *);
void ops_writer_set_fd(ops_create_info_t * info, int fd);
bool ops_writer_close(ops_create_info_t * info);
void ops_writer_set_fd(ops_create_info_t *, int);
bool ops_writer_close(ops_create_info_t *);
bool
ops_write(const void *src, unsigned length,
ops_create_info_t * opt);
bool ops_write_length(unsigned length, ops_create_info_t * opt);
bool ops_write_ptag(ops_content_tag_t tag, ops_create_info_t * opt);
bool
ops_write_scalar(unsigned n, unsigned length,
ops_create_info_t * opt);
bool ops_write_mpi(const BIGNUM * bn, ops_create_info_t * opt);
bool ops_write_encrypted_mpi(const BIGNUM * bn, ops_crypt_t * crypt, ops_create_info_t * info);
ops_write(const void *, unsigned, ops_create_info_t *);
bool ops_write_length(unsigned, ops_create_info_t *);
bool ops_write_ptag(ops_content_tag_t, ops_create_info_t *);
bool ops_write_scalar(unsigned, unsigned, ops_create_info_t *);
bool ops_write_mpi(const BIGNUM *, ops_create_info_t *);
bool ops_write_encrypted_mpi(const BIGNUM *, ops_crypt_t *, ops_create_info_t *);
void writer_info_delete(ops_writer_info_t * winfo);
bool writer_info_finalise(ops_error_t ** errors, ops_writer_info_t * winfo);
void writer_info_delete(ops_writer_info_t *);
bool writer_info_finalise(ops_error_t **, ops_writer_info_t *);
#endif

View File

@ -22,9 +22,8 @@
#include <openpgpsdk/armour.h>
bool
ops_writer_push_clearsigned(ops_create_info_t * info,
ops_create_signature_t * sig);
void ops_writer_push_armoured_message(ops_create_info_t * info);
bool ops_writer_switch_to_armoured_signature(ops_create_info_t * info);
ops_writer_push_clearsigned(ops_create_info_t *, ops_create_signature_t *);
void ops_writer_push_armoured_message(ops_create_info_t *);
bool ops_writer_switch_to_armoured_signature(ops_create_info_t *);
void ops_writer_push_armoured(ops_create_info_t * info, ops_armor_type_t type);
void ops_writer_push_armoured(ops_create_info_t *, ops_armor_type_t);