diff options
Diffstat (limited to 'libextra')
-rw-r--r-- | libextra/auth_srp.c | 44 | ||||
-rw-r--r-- | libextra/auth_srp.h | 24 | ||||
-rw-r--r-- | libextra/auth_srp_passwd.c | 4 | ||||
-rw-r--r-- | libextra/auth_srp_passwd.h | 10 | ||||
-rw-r--r-- | libextra/auth_srp_rsa.c | 14 | ||||
-rw-r--r-- | libextra/auth_srp_sb64.c | 12 | ||||
-rw-r--r-- | libextra/ext_srp.c | 6 | ||||
-rw-r--r-- | libextra/ext_srp.h | 4 | ||||
-rw-r--r-- | libextra/gnutls_extra.h | 24 | ||||
-rw-r--r-- | libextra/gnutls_openpgp.c | 74 | ||||
-rw-r--r-- | libextra/gnutls_openssl.c | 20 | ||||
-rw-r--r-- | libextra/gnutls_srp.c | 104 | ||||
-rw-r--r-- | libextra/gnutls_srp.h | 12 | ||||
-rw-r--r-- | libextra/openpgp/compat.c | 22 | ||||
-rw-r--r-- | libextra/openpgp/extras.c | 30 | ||||
-rw-r--r-- | libextra/openpgp/gnutls_openpgp.h | 40 | ||||
-rw-r--r-- | libextra/openpgp/openpgp.c | 48 | ||||
-rw-r--r-- | libextra/openpgp/openpgp.h | 72 | ||||
-rw-r--r-- | libextra/openpgp/privkey.c | 20 | ||||
-rw-r--r-- | libextra/openpgp/verify.c | 20 | ||||
-rw-r--r-- | libextra/openpgp/xml.c | 4 | ||||
-rw-r--r-- | libextra/openssl_compat.c | 80 | ||||
-rw-r--r-- | libextra/openssl_compat.h | 34 |
23 files changed, 361 insertions, 361 deletions
diff --git a/libextra/auth_srp.c b/libextra/auth_srp.c index 306d49a5b2..750e25bcb4 100644 --- a/libextra/auth_srp.c +++ b/libextra/auth_srp.c @@ -35,11 +35,11 @@ #include <gnutls_datum.h> #include <gnutls_alert.h> -int _gnutls_gen_srp_server_kx(gnutls_session, opaque **); -int _gnutls_gen_srp_client_kx(gnutls_session, opaque **); +int _gnutls_gen_srp_server_kx(gnutls_session_t, opaque **); +int _gnutls_gen_srp_client_kx(gnutls_session_t, opaque **); -int _gnutls_proc_srp_server_kx(gnutls_session, opaque *, size_t); -int _gnutls_proc_srp_client_kx(gnutls_session, opaque *, size_t); +int _gnutls_proc_srp_server_kx(gnutls_session_t, opaque *, size_t); +int _gnutls_proc_srp_client_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st srp_auth_struct = { "SRP", @@ -72,10 +72,10 @@ const mod_auth_st srp_auth_struct = { * Returns a proper error code in that case, and 0 when * all are ok. */ -inline static int check_b_mod_n(GNUTLS_MPI b, GNUTLS_MPI n) +inline static int check_b_mod_n(mpi_t b, mpi_t n) { int ret; - GNUTLS_MPI r = _gnutls_mpi_alloc_like(b); + mpi_t r = _gnutls_mpi_alloc_like(b); if (r == NULL) { gnutls_assert(); @@ -99,10 +99,10 @@ inline static int check_b_mod_n(GNUTLS_MPI b, GNUTLS_MPI n) * Returns a proper error code in that case, and 0 when * all are ok. */ -inline static int check_a_mod_n(GNUTLS_MPI a, GNUTLS_MPI n) +inline static int check_a_mod_n(mpi_t a, mpi_t n) { int ret; - GNUTLS_MPI r = _gnutls_mpi_alloc_like(a); + mpi_t r = _gnutls_mpi_alloc_like(a); if (r == NULL) { gnutls_assert(); @@ -126,7 +126,7 @@ inline static int check_a_mod_n(GNUTLS_MPI a, GNUTLS_MPI n) /* Send the first key exchange message ( g, n, s) and append the verifier algorithm number * Data is allocated by the caller, and should have data_size size. */ -int _gnutls_gen_srp_server_kx(gnutls_session session, opaque ** data) +int _gnutls_gen_srp_server_kx(gnutls_session_t session, opaque ** data) { int ret; uint8 *data_n, *data_s; @@ -238,7 +238,7 @@ int _gnutls_gen_srp_server_kx(gnutls_session session, opaque ** data) } /* return A = g^a % N */ -int _gnutls_gen_srp_client_kx(gnutls_session session, opaque ** data) +int _gnutls_gen_srp_client_kx(gnutls_session_t session, opaque ** data) { size_t n_a; int ret; @@ -246,7 +246,7 @@ int _gnutls_gen_srp_client_kx(gnutls_session session, opaque ** data) char *username; char buf[64]; char *password; - const gnutls_srp_client_credentials cred = + const gnutls_srp_client_credentials_t cred = _gnutls_get_cred(session->key, GNUTLS_CRD_SRP, NULL); if (cred == NULL) { @@ -341,7 +341,7 @@ int _gnutls_gen_srp_client_kx(gnutls_session session, opaque ** data) /* just read A and put it to session */ -int _gnutls_proc_srp_client_kx(gnutls_session session, opaque * data, +int _gnutls_proc_srp_client_kx(gnutls_session_t session, opaque * data, size_t _data_size) { size_t _n_A; @@ -430,10 +430,10 @@ static const unsigned char srp_params_1024[] = { static const unsigned char srp_generator = 0x02; -const gnutls_datum gnutls_srp_1024_group_prime = { +const gnutls_datum_t gnutls_srp_1024_group_prime = { (void *) srp_params_1024, sizeof(srp_params_1024) }; -const gnutls_datum gnutls_srp_1024_group_generator = { +const gnutls_datum_t gnutls_srp_1024_group_generator = { (void *) &srp_generator, sizeof(srp_generator) }; @@ -462,10 +462,10 @@ static const unsigned char srp_params_1536[] = { 0x35, 0xF9, 0xBB }; -const gnutls_datum gnutls_srp_1536_group_prime = { +const gnutls_datum_t gnutls_srp_1536_group_prime = { (void *) srp_params_1536, sizeof(srp_params_1536) }; -const gnutls_datum gnutls_srp_1536_group_generator = { +const gnutls_datum_t gnutls_srp_1536_group_generator = { (void *) &srp_generator, sizeof(srp_generator) }; @@ -501,10 +501,10 @@ static const unsigned char srp_params_2048[] = { 0x9E, 0x4A, 0xFF, 0x73 }; -const gnutls_datum gnutls_srp_2048_group_prime = { +const gnutls_datum_t gnutls_srp_2048_group_prime = { (void *) srp_params_2048, sizeof(srp_params_2048) }; -const gnutls_datum gnutls_srp_2048_group_generator = { +const gnutls_datum_t gnutls_srp_2048_group_generator = { (void *) &srp_generator, sizeof(srp_generator) }; @@ -539,9 +539,9 @@ static int check_g_n(const opaque * g, size_t n_g, /* Check if N is a prime and G a generator of the * group. */ -static int group_check_g_n(GNUTLS_MPI g, GNUTLS_MPI n) +static int group_check_g_n(mpi_t g, mpi_t n) { - GNUTLS_MPI q = NULL, two = NULL, w = NULL; + mpi_t q = NULL, two = NULL, w = NULL; int ret; /* N must be of the form N=2q+1 @@ -629,7 +629,7 @@ static int group_check_g_n(GNUTLS_MPI g, GNUTLS_MPI n) /* receive the key exchange message ( n, g, s, B) */ -int _gnutls_proc_srp_server_kx(gnutls_session session, opaque * data, +int _gnutls_proc_srp_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { uint8 n_s; @@ -644,7 +644,7 @@ int _gnutls_proc_srp_server_kx(gnutls_session session, opaque * data, char *username, *password; ssize_t data_size = _data_size; - const gnutls_srp_client_credentials cred = + const gnutls_srp_client_credentials_t cred = _gnutls_get_cred(session->key, GNUTLS_CRD_SRP, NULL); if (cred == NULL) { diff --git a/libextra/auth_srp.h b/libextra/auth_srp.h index bd1a9bfd7f..7060277204 100644 --- a/libextra/auth_srp.h +++ b/libextra/auth_srp.h @@ -4,11 +4,11 @@ #include <gnutls_auth.h> -typedef int gnutls_srp_server_credentials_function(gnutls_session, - const char *username, gnutls_datum * salt, gnutls_datum * verifier, - gnutls_datum * generator, gnutls_datum * prime); +typedef int gnutls_srp_server_credentials_function(gnutls_session_t, + const char *username, gnutls_datum_t * salt, gnutls_datum_t * verifier, + gnutls_datum_t * generator, gnutls_datum_t * prime); -typedef int gnutls_srp_client_credentials_function(gnutls_session, +typedef int gnutls_srp_client_credentials_function(gnutls_session_t, unsigned int times, char **username, char** password); @@ -18,7 +18,7 @@ typedef struct { gnutls_srp_client_credentials_function *get_function; } srp_client_credentials_st; -#define gnutls_srp_client_credentials srp_client_credentials_st* +#define gnutls_srp_client_credentials_t srp_client_credentials_st* typedef struct { char *password_file; @@ -29,7 +29,7 @@ typedef struct { gnutls_srp_server_credentials_function *pwd_callback; } srp_server_cred_st; -#define gnutls_srp_server_credentials srp_server_cred_st* +#define gnutls_srp_server_credentials_t srp_server_cred_st* /* these structures should not use allocated data */ typedef struct srp_server_auth_info_st { @@ -38,16 +38,16 @@ typedef struct srp_server_auth_info_st { #ifdef ENABLE_SRP -int _gnutls_proc_srp_server_hello(gnutls_session state, +int _gnutls_proc_srp_server_hello(gnutls_session_t state, const opaque * data, size_t data_size); -int _gnutls_gen_srp_server_hello(gnutls_session state, opaque * data, +int _gnutls_gen_srp_server_hello(gnutls_session_t state, opaque * data, size_t data_size); -int _gnutls_gen_srp_server_kx(gnutls_session, opaque **); -int _gnutls_gen_srp_client_kx(gnutls_session, opaque **); +int _gnutls_gen_srp_server_kx(gnutls_session_t, opaque **); +int _gnutls_gen_srp_client_kx(gnutls_session_t, opaque **); -int _gnutls_proc_srp_server_kx(gnutls_session, opaque *, size_t); -int _gnutls_proc_srp_client_kx(gnutls_session, opaque *, size_t); +int _gnutls_proc_srp_server_kx(gnutls_session_t, opaque *, size_t); +int _gnutls_proc_srp_client_kx(gnutls_session_t, opaque *, size_t); typedef struct srp_server_auth_info_st srp_server_auth_info_st; diff --git a/libextra/auth_srp_passwd.c b/libextra/auth_srp_passwd.c index 981dd8e4f6..037b1cb232 100644 --- a/libextra/auth_srp_passwd.c +++ b/libextra/auth_srp_passwd.c @@ -221,10 +221,10 @@ static int pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, } -int _gnutls_srp_pwd_read_entry(gnutls_session state, char *username, +int _gnutls_srp_pwd_read_entry(gnutls_session_t state, char *username, SRP_PWD_ENTRY ** _entry) { - const gnutls_srp_server_credentials cred; + const gnutls_srp_server_credentials_t cred; FILE *fd; char line[2 * 1024]; uint i, len; diff --git a/libextra/auth_srp_passwd.h b/libextra/auth_srp_passwd.h index a6adf875b8..a9ff502536 100644 --- a/libextra/auth_srp_passwd.h +++ b/libextra/auth_srp_passwd.h @@ -3,14 +3,14 @@ typedef struct { char* username; - gnutls_datum salt; - gnutls_datum v; - gnutls_datum g; - gnutls_datum n; + gnutls_datum_t salt; + gnutls_datum_t v; + gnutls_datum_t g; + gnutls_datum_t n; } SRP_PWD_ENTRY; /* this is locally allocated. It should be freed using the provided function */ -int _gnutls_srp_pwd_read_entry( gnutls_session state, char* username, SRP_PWD_ENTRY**); +int _gnutls_srp_pwd_read_entry( gnutls_session_t state, char* username, SRP_PWD_ENTRY**); void _gnutls_srp_entry_free( SRP_PWD_ENTRY * entry); int _gnutls_sbase64_encode(uint8 * data, size_t data_size, uint8 ** result); int _gnutls_sbase64_decode(uint8 * data, size_t data_size, uint8 ** result); diff --git a/libextra/auth_srp_rsa.c b/libextra/auth_srp_rsa.c index aec03b17c6..5bccdb268e 100644 --- a/libextra/auth_srp_rsa.c +++ b/libextra/auth_srp_rsa.c @@ -39,8 +39,8 @@ #include <gnutls_x509.h> #include <gnutls_extra.h> -static int gen_srp_cert_server_kx(gnutls_session, opaque **); -static int proc_srp_cert_server_kx(gnutls_session, opaque *, size_t); +static int gen_srp_cert_server_kx(gnutls_session_t, opaque **); +static int proc_srp_cert_server_kx(gnutls_session_t, opaque *, size_t); const mod_auth_st srp_rsa_auth_struct = { "SRP", @@ -76,11 +76,11 @@ const mod_auth_st srp_dss_auth_struct = { NULL }; -static int gen_srp_cert_server_kx(gnutls_session session, opaque ** data) +static int gen_srp_cert_server_kx(gnutls_session_t session, opaque ** data) { ssize_t ret, data_size; - gnutls_datum signature, ddata; - const gnutls_certificate_credentials cred; + gnutls_datum_t signature, ddata; + const gnutls_certificate_credentials_t cred; gnutls_cert *apr_cert_list; gnutls_privkey *apr_pkey; int apr_cert_list_length; @@ -133,12 +133,12 @@ static int gen_srp_cert_server_kx(gnutls_session session, opaque ** data) } -static int proc_srp_cert_server_kx(gnutls_session session, opaque * data, +static int proc_srp_cert_server_kx(gnutls_session_t session, opaque * data, size_t _data_size) { ssize_t ret; int sigsize; - gnutls_datum vparams, signature; + gnutls_datum_t vparams, signature; ssize_t data_size; cert_auth_info_t info; gnutls_cert peer_cert; diff --git a/libextra/auth_srp_sb64.c b/libextra/auth_srp_sb64.c index 9b0eb65979..975ebf5ca1 100644 --- a/libextra/auth_srp_sb64.c +++ b/libextra/auth_srp_sb64.c @@ -296,7 +296,7 @@ int _gnutls_sbase64_decode(uint8 * data, size_t idata_size, * If the provided buffer is not long enough GNUTLS_E_SHORT_MEMORY_BUFFER is returned. * **/ -int gnutls_srp_base64_encode(const gnutls_datum * data, char *result, +int gnutls_srp_base64_encode(const gnutls_datum_t * data, char *result, int *result_size) { opaque *ret; @@ -331,8 +331,8 @@ int gnutls_srp_base64_encode(const gnutls_datum * data, char *result, * You should use gnutls_free() to free the returned data. * **/ -int gnutls_srp_base64_encode_alloc(const gnutls_datum * data, - gnutls_datum * result) +int gnutls_srp_base64_encode_alloc(const gnutls_datum_t * data, + gnutls_datum_t * result) { opaque *ret; int size; @@ -366,7 +366,7 @@ int gnutls_srp_base64_encode_alloc(const gnutls_datum * data, * Returns GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not long enough, * or 0 on success. **/ -int gnutls_srp_base64_decode(const gnutls_datum * b64_data, char *result, +int gnutls_srp_base64_decode(const gnutls_datum_t * b64_data, char *result, int *result_size) { opaque *ret; @@ -401,8 +401,8 @@ int gnutls_srp_base64_decode(const gnutls_datum * b64_data, char *result, * You should use gnutls_free() to free the returned data. * **/ -int gnutls_srp_base64_decode_alloc(const gnutls_datum * b64_data, - gnutls_datum * result) +int gnutls_srp_base64_decode_alloc(const gnutls_datum_t * b64_data, + gnutls_datum_t * result) { opaque *ret; int size; diff --git a/libextra/ext_srp.c b/libextra/ext_srp.c index d148094d40..990c810847 100644 --- a/libextra/ext_srp.c +++ b/libextra/ext_srp.c @@ -30,7 +30,7 @@ #include "gnutls_algorithms.h" #include <gnutls_num.h> -int _gnutls_srp_recv_params(gnutls_session session, const opaque * data, +int _gnutls_srp_recv_params(gnutls_session_t session, const opaque * data, size_t _data_size) { uint8 len; @@ -77,7 +77,7 @@ inline static int is_srp(cipher_suite_st suite) /* returns data_size or a negative number on failure * data is allocated locally */ -int _gnutls_srp_send_params(gnutls_session session, opaque * data, +int _gnutls_srp_send_params(gnutls_session_t session, opaque * data, size_t data_size) { uint len; @@ -92,7 +92,7 @@ int _gnutls_srp_send_params(gnutls_session session, opaque * data, /* this function sends the client extension data (username) */ if (session->security_parameters.entity == GNUTLS_CLIENT) { - const gnutls_srp_client_credentials cred = + const gnutls_srp_client_credentials_t cred = _gnutls_get_cred(session->key, GNUTLS_CRD_SRP, NULL); if (cred == NULL) diff --git a/libextra/ext_srp.h b/libextra/ext_srp.h index 7e231be3dc..8f69518be9 100644 --- a/libextra/ext_srp.h +++ b/libextra/ext_srp.h @@ -3,7 +3,7 @@ #define IS_SRP_KX(kx) ((kx == GNUTLS_KX_SRP || (kx == GNUTLS_KX_SRP_RSA) || \ kx == GNUTLS_KX_SRP_DSS)?1:0) -int _gnutls_srp_recv_params( gnutls_session state, const opaque* data, size_t data_size); -int _gnutls_srp_send_params( gnutls_session state, opaque* data, size_t); +int _gnutls_srp_recv_params( gnutls_session_t state, const opaque* data, size_t data_size); +int _gnutls_srp_send_params( gnutls_session_t state, opaque* data, size_t); #endif diff --git a/libextra/gnutls_extra.h b/libextra/gnutls_extra.h index 40aef209d2..4d6e24479f 100644 --- a/libextra/gnutls_extra.h +++ b/libextra/gnutls_extra.h @@ -1,18 +1,18 @@ #include <auth_cert.h> typedef int (*OPENPGP_VERIFY_KEY_FUNC)( const char *, - const gnutls_datum *, const gnutls_datum*, int); -typedef time_t (*OPENPGP_KEY_CREATION_TIME_FUNC)( const gnutls_datum*); -typedef time_t (*OPENPGP_KEY_EXPIRATION_TIME_FUNC)( const gnutls_datum*); -typedef int (*OPENPGP_KEY_REQUEST)(gnutls_session, gnutls_datum*, - const gnutls_certificate_credentials, opaque*,int); -typedef int (*OPENPGP_FINGERPRINT)(const gnutls_datum*, unsigned char*, size_t*); + const gnutls_datum_t *, const gnutls_datum_t*, int); +typedef time_t (*OPENPGP_KEY_CREATION_TIME_FUNC)( const gnutls_datum_t*); +typedef time_t (*OPENPGP_KEY_EXPIRATION_TIME_FUNC)( const gnutls_datum_t*); +typedef int (*OPENPGP_KEY_REQUEST)(gnutls_session_t, gnutls_datum_t*, + const gnutls_certificate_credentials_t, opaque*,int); +typedef int (*OPENPGP_FINGERPRINT)(const gnutls_datum_t*, unsigned char*, size_t*); -typedef int (*OPENPGP_RAW_KEY_TO_GCERT)(gnutls_cert*, const gnutls_datum*); -typedef int (*OPENPGP_RAW_PRIVKEY_TO_GKEY)(gnutls_privkey*, const gnutls_datum*); +typedef int (*OPENPGP_RAW_KEY_TO_GCERT)(gnutls_cert*, const gnutls_datum_t*); +typedef int (*OPENPGP_RAW_PRIVKEY_TO_GKEY)(gnutls_privkey*, const gnutls_datum_t*); -typedef int (*OPENPGP_KEY_TO_GCERT)(gnutls_cert*, gnutls_openpgp_key); -typedef int (*OPENPGP_PRIVKEY_TO_GKEY)(gnutls_privkey*, gnutls_openpgp_privkey); +typedef int (*OPENPGP_KEY_TO_GCERT)(gnutls_cert*, gnutls_openpgp_key_t); +typedef int (*OPENPGP_PRIVKEY_TO_GKEY)(gnutls_privkey*, gnutls_openpgp_privkey_t); -typedef void (*OPENPGP_KEY_DEINIT)(gnutls_openpgp_key); -typedef void (*OPENPGP_PRIVKEY_DEINIT)(gnutls_openpgp_privkey); +typedef void (*OPENPGP_KEY_DEINIT)(gnutls_openpgp_key_t); +typedef void (*OPENPGP_PRIVKEY_DEINIT)(gnutls_openpgp_privkey_t); diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index c861e4dd48..71430a4db6 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -40,9 +40,9 @@ -static void release_mpi_array(GNUTLS_MPI * arr, size_t n) +static void release_mpi_array(mpi_t * arr, size_t n) { - GNUTLS_MPI x; + mpi_t x; while (arr && n--) { x = *arr; @@ -152,7 +152,7 @@ cdk_keydb_hd_t kbx_to_keydb(keybox_blob * blob) /* Extract a keybox blob from the given position. */ -keybox_blob *kbx_read_blob(const gnutls_datum * keyring, size_t pos) +keybox_blob *kbx_read_blob(const gnutls_datum_t * keyring, size_t pos) { keybox_blob *blob = NULL; int rc; @@ -219,7 +219,7 @@ static uint8 *kbx_data_to_keyring(int type, int enc, const char *data, } -cdk_packet_t search_packet(const gnutls_datum * buf, int pkttype) +cdk_packet_t search_packet(const gnutls_datum_t * buf, int pkttype) { static cdk_kbnode_t knode = NULL; cdk_packet_t pkt; @@ -293,7 +293,7 @@ openpgp_pk_to_gnutls_cert(gnutls_cert * cert, cdk_pkt_pubkey_t pk) -*/ int _gnutls_openpgp_raw_privkey_to_gkey(gnutls_privkey * pkey, - const gnutls_datum * raw_key) + const gnutls_datum_t * raw_key) { cdk_kbnode_t snode; cdk_packet_t pkt; @@ -376,7 +376,7 @@ _gnutls_openpgp_raw_privkey_to_gkey(gnutls_privkey * pkey, -*/ int _gnutls_openpgp_raw_key_to_gcert(gnutls_cert * cert, - const gnutls_datum * raw) + const gnutls_datum_t * raw) { cdk_kbnode_t knode = NULL; cdk_packet_t pkt = NULL; @@ -417,7 +417,7 @@ _gnutls_openpgp_raw_key_to_gcert(gnutls_cert * cert, * from a binary or a file keyring. -*/ int -gnutls_openpgp_get_key(gnutls_datum * key, const gnutls_datum * keyring, +gnutls_openpgp_get_key(gnutls_datum_t * key, const gnutls_datum_t * keyring, key_attr_t by, opaque * pattern) { keybox_blob *blob = NULL; @@ -480,7 +480,7 @@ gnutls_openpgp_get_key(gnutls_datum * key, const gnutls_datum * keyring, return rc; } -static int stream_to_datum(cdk_stream_t inp, gnutls_datum * raw) +static int stream_to_datum(cdk_stream_t inp, gnutls_datum_t * raw) { uint8 buf[4096]; int rc = 0, nread, nbytes = 0; @@ -518,11 +518,11 @@ static int stream_to_datum(cdk_stream_t inp, gnutls_datum * raw) * should only contain one key which should not be encrypted. **/ int -gnutls_certificate_set_openpgp_key_mem(gnutls_certificate_credentials res, - const gnutls_datum * cert, - const gnutls_datum * key) +gnutls_certificate_set_openpgp_key_mem(gnutls_certificate_credentials_t res, + const gnutls_datum_t * cert, + const gnutls_datum_t * key) { - gnutls_datum raw; + gnutls_datum_t raw; cdk_kbnode_t knode = NULL, ctx = NULL, p; cdk_packet_t pkt; int i = 0; @@ -658,13 +658,13 @@ gnutls_certificate_set_openpgp_key_mem(gnutls_certificate_credentials res, * should only contain one key which should not be encrypted. **/ int -gnutls_certificate_set_openpgp_key_file(gnutls_certificate_credentials res, +gnutls_certificate_set_openpgp_key_file(gnutls_certificate_credentials_t res, const char *certfile, const char *keyfile) { struct stat statbuf; int rc = 0; - gnutls_datum key, cert; + gnutls_datum_t key, cert; strfile xcert, xkey; if (!res || !keyfile || !certfile) { @@ -710,7 +710,7 @@ gnutls_certificate_set_openpgp_key_file(gnutls_certificate_credentials res, } -int gnutls_openpgp_count_key_names(const gnutls_datum * cert) +int gnutls_openpgp_count_key_names(const gnutls_datum_t * cert) { cdk_kbnode_t knode, p, ctx = NULL; cdk_packet_t pkt; @@ -747,7 +747,7 @@ int gnutls_openpgp_count_key_names(const gnutls_datum * cert) * is needed for an operations. -*/ int -gnutls_openpgp_add_keyring_file(gnutls_datum * keyring, const char *name) +gnutls_openpgp_add_keyring_file(gnutls_datum_t * keyring, const char *name) { cdk_stream_t inp = NULL; uint8 *blob; @@ -789,7 +789,7 @@ gnutls_openpgp_add_keyring_file(gnutls_datum * keyring, const char *name) * data instead of the filename. -*/ int -gnutls_openpgp_add_keyring_mem(gnutls_datum * keyring, +gnutls_openpgp_add_keyring_mem(gnutls_datum_t * keyring, const void *data, size_t len) { uint8 *blob; @@ -824,7 +824,7 @@ gnutls_openpgp_add_keyring_mem(gnutls_datum * keyring, * **/ int -gnutls_certificate_set_openpgp_keyring_file(gnutls_certificate_credentials +gnutls_certificate_set_openpgp_keyring_file(gnutls_certificate_credentials_t c, const char *file) { struct stat statbuf; @@ -842,7 +842,7 @@ gnutls_certificate_set_openpgp_keyring_file(gnutls_certificate_credentials int -gnutls_certificate_set_openpgp_keyring_mem(gnutls_certificate_credentials +gnutls_certificate_set_openpgp_keyring_mem(gnutls_certificate_credentials_t c, const opaque * data, size_t dlen) { @@ -885,8 +885,8 @@ gnutls_certificate_set_openpgp_keyring_mem(gnutls_certificate_credentials /*- * _gnutls_openpgp_request_key - Receives a key from a database, key server etc - * @ret - a pointer to gnutls_datum structure. - * @cred - a gnutls_certificate_credentials structure. + * @ret - a pointer to gnutls_datum_t structure. + * @cred - a gnutls_certificate_credentials_t structure. * @key_fingerprint - The keyFingerprint * @key_fingerprint_size - the size of the fingerprint * @@ -895,8 +895,8 @@ gnutls_certificate_set_openpgp_keyring_mem(gnutls_certificate_credentials * -*/ int -_gnutls_openpgp_request_key(gnutls_session session, gnutls_datum * ret, - const gnutls_certificate_credentials cred, +_gnutls_openpgp_request_key(gnutls_session_t session, gnutls_datum_t * ret, + const gnutls_certificate_credentials_t cred, opaque * key_fpr, int key_fpr_size) { int rc = 0; @@ -945,7 +945,7 @@ _gnutls_openpgp_request_key(gnutls_session session, gnutls_datum * ret, * **/ int -gnutls_certificate_set_openpgp_keyserver(gnutls_certificate_credentials +gnutls_certificate_set_openpgp_keyserver(gnutls_certificate_credentials_t res, const char *keyserver, int port) { @@ -977,7 +977,7 @@ gnutls_certificate_set_openpgp_keyserver(gnutls_certificate_credentials * **/ int -gnutls_certificate_set_openpgp_trustdb(gnutls_certificate_credentials res, +gnutls_certificate_set_openpgp_trustdb(gnutls_certificate_credentials_t res, const char *trustdb) { if (!res || !trustdb) { @@ -1006,17 +1006,17 @@ gnutls_certificate_set_openpgp_trustdb(gnutls_certificate_credentials res, * sent a key fingerprint instead of a full key. * **/ -void gnutls_openpgp_set_recv_key_function(gnutls_session session, +void gnutls_openpgp_set_recv_key_function(gnutls_session_t session, gnutls_openpgp_recv_key_func func) { session->internals.openpgp_recv_key_func = func; } -/* Copies a gnutls_openpgp_privkey to a gnutls_privkey structure. +/* Copies a gnutls_openpgp_privkey_t to a gnutls_privkey structure. */ int _gnutls_openpgp_privkey_to_gkey(gnutls_privkey * dest, - gnutls_openpgp_privkey src) + gnutls_openpgp_privkey_t src) { int i, ret; @@ -1043,15 +1043,15 @@ int _gnutls_openpgp_privkey_to_gkey(gnutls_privkey * dest, return ret; } -/* Converts a parsed gnutls_openpgp_key to a gnutls_cert structure. +/* Converts a parsed gnutls_openpgp_key_t to a gnutls_cert structure. */ int _gnutls_openpgp_key_to_gcert(gnutls_cert * gcert, - gnutls_openpgp_key cert) + gnutls_openpgp_key_t cert) { int ret = 0; opaque *der; size_t der_size = 0; - gnutls_datum raw; + gnutls_datum_t raw; memset(gcert, 0, sizeof(gnutls_cert)); gcert->cert_type = GNUTLS_CRT_OPENPGP; @@ -1092,20 +1092,20 @@ int _gnutls_openpgp_key_to_gcert(gnutls_cert * gcert, } /** - * gnutls_certificate_set_openpgp_key - Used to set keys in a gnutls_certificate_credentials structure - * @res: is an &gnutls_certificate_credentials structure. + * gnutls_certificate_set_openpgp_key - Used to set keys in a gnutls_certificate_credentials_t structure + * @res: is an &gnutls_certificate_credentials_t structure. * @key: contains an openpgp public key * @pkey: is an openpgp private key * * This function sets a certificate/private key pair in the - * gnutls_certificate_credentials structure. This function may be called + * gnutls_certificate_credentials_t structure. This function may be called * more than once (in case multiple keys/certificates exist for the * server). * **/ -int gnutls_certificate_set_openpgp_key(gnutls_certificate_credentials res, - gnutls_openpgp_key key, - gnutls_openpgp_privkey pkey) +int gnutls_certificate_set_openpgp_key(gnutls_certificate_credentials_t res, + gnutls_openpgp_key_t key, + gnutls_openpgp_privkey_t pkey) { int ret; diff --git a/libextra/gnutls_openssl.c b/libextra/gnutls_openssl.c index 2270b95b93..439634e964 100644 --- a/libextra/gnutls_openssl.c +++ b/libextra/gnutls_openssl.c @@ -224,8 +224,8 @@ SSL *SSL_new(SSL_CTX * ctx) ssl->options = ctx->options; - ssl->rfd = (gnutls_transport_ptr) - 1; - ssl->wfd = (gnutls_transport_ptr) - 1; + ssl->rfd = (gnutls_transport_ptr_t) - 1; + ssl->wfd = (gnutls_transport_ptr_t) - 1; return ssl; } @@ -251,15 +251,15 @@ int SSL_get_error(SSL * ssl, int ret) int SSL_set_fd(SSL * ssl, int fd) { - gnutls_transport_set_ptr(ssl->gnutls_state, (gnutls_transport_ptr) fd); + gnutls_transport_set_ptr(ssl->gnutls_state, (gnutls_transport_ptr_t) fd); return 1; } int SSL_set_rfd(SSL * ssl, int fd) { - ssl->rfd = (gnutls_transport_ptr) fd; + ssl->rfd = (gnutls_transport_ptr_t) fd; - if (ssl->wfd != (gnutls_transport_ptr) - 1) + if (ssl->wfd != (gnutls_transport_ptr_t) - 1) gnutls_transport_set_ptr2(ssl->gnutls_state, ssl->rfd, ssl->wfd); return 1; @@ -267,9 +267,9 @@ int SSL_set_rfd(SSL * ssl, int fd) int SSL_set_wfd(SSL * ssl, int fd) { - ssl->wfd = (gnutls_transport_ptr) fd; + ssl->wfd = (gnutls_transport_ptr_t) fd; - if (ssl->rfd != (gnutls_transport_ptr) - 1) + if (ssl->rfd != (gnutls_transport_ptr_t) - 1) gnutls_transport_set_ptr2(ssl->gnutls_state, ssl->rfd, ssl->wfd); return 1; @@ -299,7 +299,7 @@ void SSL_set_verify(SSL * ssl, int verify_mode, const X509 *SSL_get_peer_certificate(SSL * ssl) { - const gnutls_datum *cert_list; + const gnutls_datum_t *cert_list; int cert_list_size = 0; cert_list = gnutls_certificate_get_peers(ssl->gnutls_state, @@ -801,7 +801,7 @@ void X509_free(const X509 * cert) /* BIO functions */ -void BIO_get_fd(gnutls_session gnutls_state, int *fd) +void BIO_get_fd(gnutls_session_t gnutls_state, int *fd) { *fd = (int) gnutls_transport_get_ptr(gnutls_state); } @@ -814,7 +814,7 @@ BIO *BIO_new_socket(int sock, int close_flag) if (!bio) return NULL; - bio->fd = (gnutls_transport_ptr) sock; + bio->fd = (gnutls_transport_ptr_t) sock; return bio; } diff --git a/libextra/gnutls_srp.c b/libextra/gnutls_srp.c index 3439da1c2f..196b047c50 100644 --- a/libextra/gnutls_srp.c +++ b/libextra/gnutls_srp.c @@ -37,10 +37,10 @@ */ int _gnutls_srp_gx(opaque * text, size_t textsize, opaque ** result, - GNUTLS_MPI g, GNUTLS_MPI prime, + mpi_t g, mpi_t prime, gnutls_alloc_function galloc_func) { - GNUTLS_MPI x, e; + mpi_t x, e; size_t result_size; if (_gnutls_mpi_scan(&x, text, &textsize)) { @@ -80,11 +80,11 @@ int _gnutls_srp_gx(opaque * text, size_t textsize, opaque ** result, * where k == SHA1(N|g) * Return: B and if ret_b is not NULL b. */ -GNUTLS_MPI _gnutls_calc_srp_B(GNUTLS_MPI * ret_b, GNUTLS_MPI g, - GNUTLS_MPI n, GNUTLS_MPI v) +mpi_t _gnutls_calc_srp_B(mpi_t * ret_b, mpi_t g, + mpi_t n, mpi_t v) { - GNUTLS_MPI tmpB = NULL, tmpV = NULL; - GNUTLS_MPI b = NULL, B = NULL, k = NULL; + mpi_t tmpB = NULL, tmpV = NULL; + mpi_t b = NULL, B = NULL, k = NULL; int bits; /* calculate: B = (k*v + g^b) % N @@ -151,14 +151,14 @@ GNUTLS_MPI _gnutls_calc_srp_B(GNUTLS_MPI * ret_b, GNUTLS_MPI g, /* This calculates the SHA1(A | B) */ -GNUTLS_MPI _gnutls_calc_srp_u(GNUTLS_MPI A, GNUTLS_MPI B) +mpi_t _gnutls_calc_srp_u(mpi_t A, mpi_t B) { size_t b_size, a_size; opaque *holder, hd[MAX_HASH_SIZE]; size_t holder_size, hash_size; GNUTLS_HASH_HANDLE td; int ret; - GNUTLS_MPI res; + mpi_t res; _gnutls_mpi_print(NULL, &a_size, A); _gnutls_mpi_print(NULL, &b_size, B); @@ -198,11 +198,11 @@ GNUTLS_MPI _gnutls_calc_srp_u(GNUTLS_MPI A, GNUTLS_MPI B) /* S = (A * v^u) ^ b % N * this is our shared key (server premaster secret) */ -GNUTLS_MPI _gnutls_calc_srp_S1(GNUTLS_MPI A, GNUTLS_MPI b, GNUTLS_MPI u, - GNUTLS_MPI v, GNUTLS_MPI n) +mpi_t _gnutls_calc_srp_S1(mpi_t A, mpi_t b, mpi_t u, + mpi_t v, mpi_t n) { - GNUTLS_MPI tmp1 = NULL, tmp2 = NULL; - GNUTLS_MPI S = NULL; + mpi_t tmp1 = NULL, tmp2 = NULL; + mpi_t S = NULL; S = _gnutls_mpi_alloc_like(n); if (S == NULL) @@ -232,10 +232,10 @@ GNUTLS_MPI _gnutls_calc_srp_S1(GNUTLS_MPI A, GNUTLS_MPI b, GNUTLS_MPI u, /* A = g^a % N * returns A and a (which is random) */ -GNUTLS_MPI _gnutls_calc_srp_A(GNUTLS_MPI * a, GNUTLS_MPI g, GNUTLS_MPI n) +mpi_t _gnutls_calc_srp_A(mpi_t * a, mpi_t g, mpi_t n) { - GNUTLS_MPI tmpa; - GNUTLS_MPI A; + mpi_t tmpa; + mpi_t A; int bits; bits = _gnutls_mpi_get_nbits(n); @@ -310,11 +310,11 @@ int _gnutls_calc_srp_x(char *username, char *password, opaque * salt, /* S = (B - k*g^x) ^ (a + u * x) % N * this is our shared key (client premaster secret) */ -GNUTLS_MPI _gnutls_calc_srp_S2(GNUTLS_MPI B, GNUTLS_MPI g, GNUTLS_MPI x, - GNUTLS_MPI a, GNUTLS_MPI u, GNUTLS_MPI n) +mpi_t _gnutls_calc_srp_S2(mpi_t B, mpi_t g, mpi_t x, + mpi_t a, mpi_t u, mpi_t n) { - GNUTLS_MPI S = NULL, tmp1 = NULL, tmp2 = NULL; - GNUTLS_MPI tmp4 = NULL, tmp3 = NULL, k = NULL; + mpi_t S = NULL, tmp1 = NULL, tmp2 = NULL; + mpi_t tmp4 = NULL, tmp3 = NULL, k = NULL; S = _gnutls_mpi_alloc_like(n); if (S == NULL) @@ -364,14 +364,14 @@ GNUTLS_MPI _gnutls_calc_srp_S2(GNUTLS_MPI B, GNUTLS_MPI g, GNUTLS_MPI x, } /** - * gnutls_srp_free_server_credentials - Used to free an allocated gnutls_srp_client_credentials structure - * @sc: is an &gnutls_srp_client_credentials structure. + * gnutls_srp_free_server_credentials - Used to free an allocated gnutls_srp_client_credentials_t structure + * @sc: is an &gnutls_srp_client_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to free (deallocate) it. * **/ -void gnutls_srp_free_client_credentials(gnutls_srp_client_credentials sc) +void gnutls_srp_free_client_credentials(gnutls_srp_client_credentials_t sc) { gnutls_free(sc->username); gnutls_free(sc->password); @@ -379,15 +379,15 @@ void gnutls_srp_free_client_credentials(gnutls_srp_client_credentials sc) } /** - * gnutls_srp_allocate_server_credentials - Used to allocate an gnutls_srp_server_credentials structure - * @sc: is a pointer to an &gnutls_srp_server_credentials structure. + * gnutls_srp_allocate_server_credentials - Used to allocate an gnutls_srp_server_credentials_t structure + * @sc: is a pointer to an &gnutls_srp_server_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to allocate it. * * Returns 0 on success. **/ -int gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials * +int gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials_t * sc) { *sc = gnutls_calloc(1, sizeof(srp_client_credentials_st)); @@ -399,18 +399,18 @@ int gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials * } /** - * gnutls_srp_set_client_credentials - Used to set the username/password, in a gnutls_srp_client_credentials structure - * @res: is an &gnutls_srp_client_credentials structure. + * gnutls_srp_set_client_credentials - Used to set the username/password, in a gnutls_srp_client_credentials_t structure + * @res: is an &gnutls_srp_client_credentials_t structure. * @username: is the user's userid * @password: is the user's password * - * This function sets the username and password, in a gnutls_srp_client_credentials structure. + * This function sets the username and password, in a gnutls_srp_client_credentials_t structure. * Those will be used in SRP authentication. @username and @password should be ASCII * strings or UTF-8 strings prepared using the "SASLprep" profile of "stringprep". * * Returns 0 on success. **/ -int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials res, +int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials_t res, char *username, char *password) { @@ -433,14 +433,14 @@ int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials res, } /** - * gnutls_srp_free_server_credentials - Used to free an allocated gnutls_srp_server_credentials structure - * @sc: is an &gnutls_srp_server_credentials structure. + * gnutls_srp_free_server_credentials - Used to free an allocated gnutls_srp_server_credentials_t structure + * @sc: is an &gnutls_srp_server_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to free (deallocate) it. * **/ -void gnutls_srp_free_server_credentials(gnutls_srp_server_credentials sc) +void gnutls_srp_free_server_credentials(gnutls_srp_server_credentials_t sc) { gnutls_free(sc->password_file); gnutls_free(sc->password_conf_file); @@ -449,15 +449,15 @@ void gnutls_srp_free_server_credentials(gnutls_srp_server_credentials sc) } /** - * gnutls_srp_allocate_server_credentials - Used to allocate an gnutls_srp_server_credentials structure - * @sc: is a pointer to an &gnutls_srp_server_credentials structure. + * gnutls_srp_allocate_server_credentials - Used to allocate an gnutls_srp_server_credentials_t structure + * @sc: is a pointer to an &gnutls_srp_server_credentials_t structure. * * This structure is complex enough to manipulate directly thus * this helper function is provided in order to allocate it. * * Returns 0 on success. **/ -int gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials * +int gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials_t * sc) { *sc = gnutls_calloc(1, sizeof(srp_server_cred_st)); @@ -481,18 +481,18 @@ inline static int file_exists(const char *file) } /** - * gnutls_srp_set_server_credentials_file - Used to set the password files, in a gnutls_srp_server_credentials structure - * @res: is an &gnutls_srp_server_credentials structure. + * gnutls_srp_set_server_credentials_file - Used to set the password files, in a gnutls_srp_server_credentials_t structure + * @res: is an &gnutls_srp_server_credentials_t structure. * @password_file: is the SRP password file (tpasswd) * @password_conf_file: is the SRP password conf file (tpasswd.conf) * - * This function sets the password files, in a gnutls_srp_server_credentials structure. + * This function sets the password files, in a gnutls_srp_server_credentials_t structure. * Those password files hold usernames and verifiers and will be used for SRP authentication. * * Returns 0 on success. * **/ -int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials +int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials_t res, const char *password_file, const char *password_conf_file) { @@ -533,14 +533,14 @@ int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials /** * gnutls_srp_set_server_credentials_function - Used to set a callback to retrieve the user's SRP credentials - * @cred: is a &gnutls_srp_server_credentials structure. + * @cred: is a &gnutls_srp_server_credentials_t structure. * @func: is the callback function * * This function can be used to set a callback to retrieve the user's SRP credentials. * The callback's function form is: - * int (*callback)(gnutls_session, const char* username, - * gnutls_datum* salt, gnutls_datum *verifier, gnutls_datum* g, - * gnutls_datum* n); + * int (*callback)(gnutls_session_t, const char* username, + * gnutls_datum_t* salt, gnutls_datum_t *verifier, gnutls_datum_t* g, + * gnutls_datum_t* n); * * @username contains the actual username. * The @salt, @verifier, @generator and @prime must be filled @@ -560,7 +560,7 @@ int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials * **/ void -gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials +gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials_t cred, gnutls_srp_server_credentials_function * func) @@ -570,13 +570,13 @@ gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials /** * gnutls_srp_set_client_credentials_function - Used to set a callback to retrieve the username and password - * @cred: is a &gnutls_srp_server_credentials structure. + * @cred: is a &gnutls_srp_server_credentials_t structure. * @func: is the callback function * * This function can be used to set a callback to retrieve the username and * password for client SRP authentication. * The callback's function form is: - * int (*callback)(gnutls_session, unsigned int times, char** username, + * int (*callback)(gnutls_session_t, unsigned int times, char** username, * char** password); * * The @username and @password must be allocated using gnutls_malloc(). @@ -600,7 +600,7 @@ gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials * **/ void -gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials +gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials_t cred, gnutls_srp_client_credentials_function * func) @@ -618,7 +618,7 @@ gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials * Returns NULL in case of an error. * **/ -const char *gnutls_srp_server_get_username(gnutls_session session) +const char *gnutls_srp_server_get_username(gnutls_session_t session) { srp_server_auth_info_t info; @@ -648,11 +648,11 @@ const char *gnutls_srp_server_get_username(gnutls_session session) * **/ int gnutls_srp_verifier(const char *username, const char *password, - const gnutls_datum * salt, - const gnutls_datum * generator, - const gnutls_datum * prime, gnutls_datum * res) + const gnutls_datum_t * salt, + const gnutls_datum_t * generator, + const gnutls_datum_t * prime, gnutls_datum_t * res) { - GNUTLS_MPI _n, _g; + mpi_t _n, _g; int ret; size_t digest_size = 20, size; opaque digest[20]; diff --git a/libextra/gnutls_srp.h b/libextra/gnutls_srp.h index 4990ec09ef..d9c9bcb90d 100644 --- a/libextra/gnutls_srp.h +++ b/libextra/gnutls_srp.h @@ -1,11 +1,11 @@ #ifdef ENABLE_SRP -int _gnutls_srp_gx(opaque *text, size_t textsize, opaque** result, GNUTLS_MPI g, GNUTLS_MPI prime, gnutls_alloc_function); -GNUTLS_MPI _gnutls_calc_srp_B(GNUTLS_MPI * ret_b, GNUTLS_MPI g, GNUTLS_MPI n, GNUTLS_MPI v); -GNUTLS_MPI _gnutls_calc_srp_u( GNUTLS_MPI A, GNUTLS_MPI B); -GNUTLS_MPI _gnutls_calc_srp_S1(GNUTLS_MPI A, GNUTLS_MPI b, GNUTLS_MPI u, GNUTLS_MPI v, GNUTLS_MPI n); -GNUTLS_MPI _gnutls_calc_srp_A(GNUTLS_MPI *a, GNUTLS_MPI g, GNUTLS_MPI n); -GNUTLS_MPI _gnutls_calc_srp_S2(GNUTLS_MPI B, GNUTLS_MPI g, GNUTLS_MPI x, GNUTLS_MPI a, GNUTLS_MPI u, GNUTLS_MPI n); +int _gnutls_srp_gx(opaque *text, size_t textsize, opaque** result, mpi_t g, mpi_t prime, gnutls_alloc_function); +mpi_t _gnutls_calc_srp_B(mpi_t * ret_b, mpi_t g, mpi_t n, mpi_t v); +mpi_t _gnutls_calc_srp_u( mpi_t A, mpi_t B); +mpi_t _gnutls_calc_srp_S1(mpi_t A, mpi_t b, mpi_t u, mpi_t v, mpi_t n); +mpi_t _gnutls_calc_srp_A(mpi_t *a, mpi_t g, mpi_t n); +mpi_t _gnutls_calc_srp_S2(mpi_t B, mpi_t g, mpi_t x, mpi_t a, mpi_t u, mpi_t n); int _gnutls_calc_srp_x( char* username, char* password, opaque* salt, size_t salt_size, size_t* size, void* digest); int _gnutls_srp_gn( opaque** ret_g, opaque** ret_n, int bits); diff --git a/libextra/openpgp/compat.c b/libextra/openpgp/compat.c index c54a1972a5..bfde758871 100644 --- a/libextra/openpgp/compat.c +++ b/libextra/openpgp/compat.c @@ -48,14 +48,14 @@ * may use GnuPG for that purpose, or any other external PGP application. -*/ int _gnutls_openpgp_verify_key(const char *trustdb, - const gnutls_datum * keyring, - const gnutls_datum * cert_list, + const gnutls_datum_t * keyring, + const gnutls_datum_t * cert_list, int cert_list_length) { int ret = 0; - gnutls_openpgp_key key = NULL; - gnutls_openpgp_keyring ring = NULL; - gnutls_openpgp_trustdb tdb = NULL; + gnutls_openpgp_key_t key = NULL; + gnutls_openpgp_keyring_t ring = NULL; + gnutls_openpgp_trustdb_t tdb = NULL; unsigned int verify_ring = 0, verify_db = 0, verify_self = 0; if (!cert_list || cert_list_length != 1) { @@ -146,10 +146,10 @@ int _gnutls_openpgp_verify_key(const char *trustdb, * Returns the fingerprint of the OpenPGP key. Depence on the algorithm, * the fingerprint can be 16 or 20 bytes. -*/ -int _gnutls_openpgp_fingerprint(const gnutls_datum * cert, +int _gnutls_openpgp_fingerprint(const gnutls_datum_t * cert, unsigned char *fpr, size_t * fprlen) { - gnutls_openpgp_key key; + gnutls_openpgp_key_t key; int ret; ret = gnutls_openpgp_key_init(&key); @@ -181,9 +181,9 @@ int _gnutls_openpgp_fingerprint(const gnutls_datum * cert, * * Returns the timestamp when the OpenPGP key was created. -*/ -time_t _gnutls_openpgp_get_raw_key_creation_time(const gnutls_datum * cert) +time_t _gnutls_openpgp_get_raw_key_creation_time(const gnutls_datum_t * cert) { - gnutls_openpgp_key key; + gnutls_openpgp_key_t key; int ret; time_t tim; @@ -214,10 +214,10 @@ time_t _gnutls_openpgp_get_raw_key_creation_time(const gnutls_datum * cert) * Returns the time when the OpenPGP key expires. A value of '0' means * that the key doesn't expire at all. -*/ -time_t _gnutls_openpgp_get_raw_key_expiration_time(const gnutls_datum * +time_t _gnutls_openpgp_get_raw_key_expiration_time(const gnutls_datum_t * cert) { - gnutls_openpgp_key key; + gnutls_openpgp_key_t key; int ret; time_t tim; diff --git a/libextra/openpgp/extras.c b/libextra/openpgp/extras.c index c45dea88b6..19e3a27376 100644 --- a/libextra/openpgp/extras.c +++ b/libextra/openpgp/extras.c @@ -35,7 +35,7 @@ */ /** - * gnutls_openpgp_keyring_init - This function initializes a gnutls_openpgp_keyring structure + * gnutls_openpgp_keyring_init - This function initializes a gnutls_openpgp_keyring_t structure * @keyring: The structure to be initialized * * This function will initialize an OpenPGP keyring structure. @@ -43,7 +43,7 @@ * Returns 0 on success. * **/ -int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring * keyring) +int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring_t * keyring) { *keyring = gnutls_calloc(1, sizeof(gnutls_openpgp_keyring_int)); @@ -54,13 +54,13 @@ int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring * keyring) } /** - * gnutls_openpgp_keyring_deinit - This function deinitializes memory used by a gnutls_openpgp_keyring structure + * gnutls_openpgp_keyring_deinit - This function deinitializes memory used by a gnutls_openpgp_keyring_t structure * @keyring: The structure to be initialized * * This function will deinitialize a CRL structure. * **/ -void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring keyring) +void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring_t keyring) { if (!keyring) return; @@ -84,7 +84,7 @@ void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring keyring) * Returns 0 on success (if keyid exists) and a negative error code * on failure. */ -int gnutls_openpgp_keyring_check_id( gnutls_openpgp_keyring ring, +int gnutls_openpgp_keyring_check_id( gnutls_openpgp_keyring_t ring, const unsigned char keyid[8], unsigned int flags) { int rc; @@ -108,14 +108,14 @@ uint32 id[2]; * @format: One of gnutls_openpgp_keyring_fmt elements. * * This function will convert the given RAW or Base64 encoded keyring - * to the native gnutls_openpgp_keyring format. The output will be stored in 'keyring'. + * to the native gnutls_openpgp_keyring_t format. The output will be stored in 'keyring'. * * Returns 0 on success. * **/ -int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring, - const gnutls_datum * data, - gnutls_openpgp_key_fmt format) +int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring_t keyring, + const gnutls_datum_t * data, + gnutls_openpgp_key_fmt_t format) { int rc; keybox_blob *blob = NULL; @@ -146,7 +146,7 @@ int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring, */ /** - * gnutls_openpgp_trustdb_init - This function initializes a gnutls_openpgp_trustdb structure + * gnutls_openpgp_trustdb_init - This function initializes a gnutls_openpgp_trustdb_t structure * @trustdb: The structure to be initialized * * This function will initialize an OpenPGP trustdb structure. @@ -154,7 +154,7 @@ int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring, * Returns 0 on success. * **/ -int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb * trustdb) +int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb_t * trustdb) { *trustdb = gnutls_calloc(1, sizeof(gnutls_openpgp_trustdb_int)); @@ -165,13 +165,13 @@ int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb * trustdb) } /** - * gnutls_openpgp_trustdb_deinit - This function deinitializes memory used by a gnutls_openpgp_trustdb structure + * gnutls_openpgp_trustdb_deinit - This function deinitializes memory used by a gnutls_openpgp_trustdb_t structure * @trustdb: The structure to be initialized * * This function will deinitialize a CRL structure. * **/ -void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb trustdb) +void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb_t trustdb) { if (!trustdb) return; @@ -190,12 +190,12 @@ void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb trustdb) * @file: The file that holds the trustdb. * * This function will convert the given RAW or Base64 encoded trustdb - * to the native gnutls_openpgp_trustdb format. The output will be stored in 'trustdb'. + * to the native gnutls_openpgp_trustdb_t format. The output will be stored in 'trustdb'. * * Returns 0 on success. * **/ -int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb trustdb, +int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb_t trustdb, const char *file) { int rc; diff --git a/libextra/openpgp/gnutls_openpgp.h b/libextra/openpgp/gnutls_openpgp.h index 5989a1b256..ca54289070 100644 --- a/libextra/openpgp/gnutls_openpgp.h +++ b/libextra/openpgp/gnutls_openpgp.h @@ -29,34 +29,34 @@ typedef enum { } key_attr_t; int gnutls_certificate_set_openpgp_key_file( - gnutls_certificate_credentials res, + gnutls_certificate_credentials_t res, const char* CERTFILE, const char* KEYFILE); int gnutls_openpgp_count_key_names( - const gnutls_datum *cert ); + const gnutls_datum_t *cert ); int gnutls_openpgp_add_keyring_mem( - gnutls_datum *keyring, + gnutls_datum_t *keyring, const void *data, size_t len ); int gnutls_openpgp_add_keyring_file( - gnutls_datum *keyring, + gnutls_datum_t *keyring, const char *name ); int gnutls_certificate_set_openpgp_keyring_file( - gnutls_certificate_credentials c, + gnutls_certificate_credentials_t c, const char *file ); int gnutls_certificate_set_openpgp_keyring_mem( - gnutls_certificate_credentials c, + gnutls_certificate_credentials_t c, const opaque *data, size_t dlen ); int gnutls_openpgp_get_key( - gnutls_datum *key, - const gnutls_datum *keyring, + gnutls_datum_t *key, + const gnutls_datum_t *keyring, key_attr_t by, opaque *pattern ); @@ -64,37 +64,37 @@ int gnutls_openpgp_recv_key( const char *host, short port, uint32 keyid, - gnutls_datum *key ); + gnutls_datum_t *key ); /* internal */ int _gnutls_openpgp_raw_key_to_gcert( gnutls_cert *cert, - const gnutls_datum *raw ); + const gnutls_datum_t *raw ); int _gnutls_openpgp_raw_privkey_to_gkey( gnutls_privkey *pkey, - const gnutls_datum *raw_key); + const gnutls_datum_t *raw_key); int _gnutls_openpgp_request_key( - gnutls_session, - gnutls_datum* ret, - const gnutls_certificate_credentials cred, + gnutls_session_t, + gnutls_datum_t* ret, + const gnutls_certificate_credentials_t cred, opaque* key_fpr, int key_fpr_size ); -keybox_blob* kbx_read_blob( const gnutls_datum* keyring, size_t pos ); +keybox_blob* kbx_read_blob( const gnutls_datum_t* keyring, size_t pos ); cdk_keydb_hd_t kbx_to_keydb( keybox_blob *blob ); void kbx_blob_release( keybox_blob *ctx ); int _gnutls_openpgp_verify_key(const char *trustdb, - const gnutls_datum * keyring, - const gnutls_datum * cert_list, + const gnutls_datum_t * keyring, + const gnutls_datum_t * cert_list, int cert_list_length); -int _gnutls_openpgp_fingerprint(const gnutls_datum * cert, +int _gnutls_openpgp_fingerprint(const gnutls_datum_t * cert, unsigned char *fpr, size_t * fprlen); -time_t _gnutls_openpgp_get_raw_key_creation_time(const gnutls_datum * cert); -time_t _gnutls_openpgp_get_raw_key_expiration_time(const gnutls_datum * cert); +time_t _gnutls_openpgp_get_raw_key_creation_time(const gnutls_datum_t * cert); +time_t _gnutls_openpgp_get_raw_key_expiration_time(const gnutls_datum_t * cert); #endif /*GNUTLS_OPENPGP_H*/ diff --git a/libextra/openpgp/openpgp.c b/libextra/openpgp/openpgp.c index 51fe89b2a1..6a169fec81 100644 --- a/libextra/openpgp/openpgp.c +++ b/libextra/openpgp/openpgp.c @@ -32,7 +32,7 @@ #include <x509/rfc2818.h> /** - * gnutls_openpgp_key_init - This function initializes a gnutls_openpgp_key structure + * gnutls_openpgp_key_init - This function initializes a gnutls_openpgp_key_t structure * @key: The structure to be initialized * * This function will initialize an OpenPGP key structure. @@ -40,7 +40,7 @@ * Returns 0 on success. * **/ -int gnutls_openpgp_key_init(gnutls_openpgp_key * key) +int gnutls_openpgp_key_init(gnutls_openpgp_key_t * key) { *key = gnutls_calloc(1, sizeof(gnutls_openpgp_key_int)); @@ -51,13 +51,13 @@ int gnutls_openpgp_key_init(gnutls_openpgp_key * key) } /** - * gnutls_openpgp_key_deinit - This function deinitializes memory used by a gnutls_openpgp_key structure + * gnutls_openpgp_key_deinit - This function deinitializes memory used by a gnutls_openpgp_key_t structure * @key: The structure to be initialized * * This function will deinitialize a key structure. * **/ -void gnutls_openpgp_key_deinit(gnutls_openpgp_key key) +void gnutls_openpgp_key_deinit(gnutls_openpgp_key_t key) { if (!key) return; @@ -76,17 +76,17 @@ void gnutls_openpgp_key_deinit(gnutls_openpgp_key key) * gnutls_openpgp_key_import - This function will import a RAW or BASE64 encoded key * @key: The structure to store the parsed key. * @data: The RAW or BASE64 encoded key. - * @format: One of gnutls_openpgp_key_fmt elements. + * @format: One of gnutls_openpgp_key_fmt_t elements. * * This function will convert the given RAW or Base64 encoded key - * to the native gnutls_openpgp_key format. The output will be stored in 'key'. + * to the native gnutls_openpgp_key_t format. The output will be stored in 'key'. * * Returns 0 on success. * **/ -int gnutls_openpgp_key_import(gnutls_openpgp_key key, - const gnutls_datum * data, - gnutls_openpgp_key_fmt format) +int gnutls_openpgp_key_import(gnutls_openpgp_key_t key, + const gnutls_datum_t * data, + gnutls_openpgp_key_fmt_t format) { int rc; @@ -125,7 +125,7 @@ int gnutls_openpgp_key_import(gnutls_openpgp_key key, /** * gnutls_openpgp_key_export - This function will export a RAW or BASE64 encoded key * @key: Holds the key. - * @format: One of gnutls_openpgp_key_fmt elements. + * @format: One of gnutls_openpgp_key_fmt_t elements. * @output_data: will contain the key base64 encoded or raw * @output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters) * @@ -136,8 +136,8 @@ int gnutls_openpgp_key_import(gnutls_openpgp_key key, * Returns 0 on success. * **/ -int gnutls_openpgp_key_export(gnutls_openpgp_key key, - gnutls_openpgp_key_fmt format, +int gnutls_openpgp_key_export(gnutls_openpgp_key_t key, + gnutls_openpgp_key_fmt_t format, void *output_data, size_t * output_data_size) { int rc; @@ -204,7 +204,7 @@ int gnutls_openpgp_key_export(gnutls_openpgp_key key, * the fingerprint can be 16 or 20 bytes. **/ int -gnutls_openpgp_key_get_fingerprint(gnutls_openpgp_key key, +gnutls_openpgp_key_get_fingerprint(gnutls_openpgp_key_t key, void *fpr, size_t * fprlen) { cdk_packet_t pkt; @@ -231,7 +231,7 @@ gnutls_openpgp_key_get_fingerprint(gnutls_openpgp_key key, return 0; } -int _gnutls_openpgp_count_key_names(gnutls_openpgp_key key) +int _gnutls_openpgp_count_key_names(gnutls_openpgp_key_t key) { cdk_kbnode_t p, ctx = NULL; cdk_packet_t pkt; @@ -265,7 +265,7 @@ int _gnutls_openpgp_count_key_names(gnutls_openpgp_key key) * **/ int -gnutls_openpgp_key_get_name(gnutls_openpgp_key key, +gnutls_openpgp_key_get_name(gnutls_openpgp_key_t key, int idx, char *buf, size_t * sizeof_buf) { cdk_kbnode_t ctx = NULL, p; @@ -340,7 +340,7 @@ gnutls_openpgp_key_get_name(gnutls_openpgp_key key, * **/ int -gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key key, +gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key_t key, unsigned int *bits) { cdk_packet_t pkt; @@ -372,7 +372,7 @@ gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key key, * * Extract the version of the OpenPGP key. **/ -int gnutls_openpgp_key_get_version(gnutls_openpgp_key key) +int gnutls_openpgp_key_get_version(gnutls_openpgp_key_t key) { cdk_packet_t pkt; int version = 0; @@ -394,7 +394,7 @@ int gnutls_openpgp_key_get_version(gnutls_openpgp_key key) * * Returns the timestamp when the OpenPGP key was created. **/ -time_t gnutls_openpgp_key_get_creation_time(gnutls_openpgp_key key) +time_t gnutls_openpgp_key_get_creation_time(gnutls_openpgp_key_t key) { cdk_packet_t pkt; time_t timestamp = 0; @@ -417,7 +417,7 @@ time_t gnutls_openpgp_key_get_creation_time(gnutls_openpgp_key key) * Returns the time when the OpenPGP key expires. A value of '0' means * that the key doesn't expire at all. **/ -time_t gnutls_openpgp_key_get_expiration_time(gnutls_openpgp_key key) +time_t gnutls_openpgp_key_get_expiration_time(gnutls_openpgp_key_t key) { cdk_packet_t pkt; time_t expiredate = 0; @@ -440,7 +440,7 @@ time_t gnutls_openpgp_key_get_expiration_time(gnutls_openpgp_key key) * Returns the 64-bit keyID of the OpenPGP key. **/ int -gnutls_openpgp_key_get_id(gnutls_openpgp_key key, unsigned char keyid[8]) +gnutls_openpgp_key_get_id(gnutls_openpgp_key_t key, unsigned char keyid[8]) { cdk_packet_t pkt; cdk_pkt_pubkey_t pk = NULL; @@ -471,7 +471,7 @@ gnutls_openpgp_key_get_id(gnutls_openpgp_key key, unsigned char keyid[8]) /** * gnutls_openpgp_key_check_hostname - This function compares the given hostname with the hostname in the key - * @key: should contain an gnutls_openpgp_key structure + * @key: should contain an gnutls_openpgp_key_t structure * @hostname: A null terminated string that contains a DNS name * * This function will check if the given key's owner matches @@ -481,7 +481,7 @@ gnutls_openpgp_key_get_id(gnutls_openpgp_key key, unsigned char keyid[8]) * Returns non zero on success, and zero on failure. * **/ -int gnutls_openpgp_key_check_hostname(gnutls_openpgp_key key, +int gnutls_openpgp_key_check_hostname(gnutls_openpgp_key_t key, const char *hostname) { @@ -509,7 +509,7 @@ int gnutls_openpgp_key_check_hostname(gnutls_openpgp_key key, /** * gnutls_openpgp_key_get_key_usage - This function returns the key's usage - * @key: should contain a gnutls_openpgp_key structure + * @key: should contain a gnutls_openpgp_key_t structure * @key_usage: where the key usage bits will be stored * * This function will return certificate's key usage, by checking the @@ -519,7 +519,7 @@ int gnutls_openpgp_key_check_hostname(gnutls_openpgp_key key, * A negative value may be returned in case of parsing error. * **/ -int gnutls_openpgp_key_get_key_usage(gnutls_openpgp_key key, +int gnutls_openpgp_key_get_key_usage(gnutls_openpgp_key_t key, unsigned int *key_usage) { cdk_packet_t pkt; diff --git a/libextra/openpgp/openpgp.h b/libextra/openpgp/openpgp.h index d4711d68c2..e2c8d6cbd7 100644 --- a/libextra/openpgp/openpgp.h +++ b/libextra/openpgp/openpgp.h @@ -3,9 +3,9 @@ #include <config.h> -typedef enum gnutls_openpgp_key_fmt { +typedef enum gnutls_openpgp_key_fmt_t { GNUTLS_OPENPGP_FMT_RAW, GNUTLS_OPENPGP_FMT_BASE64 -} gnutls_openpgp_key_fmt; +} gnutls_openpgp_key_fmt_t; #ifdef USE_OPENPGP @@ -29,63 +29,63 @@ typedef struct gnutls_openpgp_trustdb_int { cdk_stream_t st; } gnutls_openpgp_trustdb_int; -typedef struct gnutls_openpgp_key_int *gnutls_openpgp_key; -typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey; -typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring; -typedef struct gnutls_openpgp_trustdb_int *gnutls_openpgp_trustdb; +typedef struct gnutls_openpgp_key_int *gnutls_openpgp_key_t; +typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t; +typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t; +typedef struct gnutls_openpgp_trustdb_int *gnutls_openpgp_trustdb_t; int _gnutls_map_cdk_rc(int rc); int -gnutls_openpgp_key_get_name(gnutls_openpgp_key key, +gnutls_openpgp_key_get_name(gnutls_openpgp_key_t key, int idx, char *buf, size_t * sizeof_buf); -int gnutls_openpgp_key_get_fingerprint(gnutls_openpgp_key key, +int gnutls_openpgp_key_get_fingerprint(gnutls_openpgp_key_t key, void *fpr, size_t * fprlen); -int gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key key, +int gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key_t key, unsigned int *bits); -int gnutls_openpgp_key_get_version(gnutls_openpgp_key key); -time_t gnutls_openpgp_key_get_creation_time(gnutls_openpgp_key key); -time_t gnutls_openpgp_key_get_expiration_time(gnutls_openpgp_key key); -int gnutls_openpgp_key_get_id(gnutls_openpgp_key key, +int gnutls_openpgp_key_get_version(gnutls_openpgp_key_t key); +time_t gnutls_openpgp_key_get_creation_time(gnutls_openpgp_key_t key); +time_t gnutls_openpgp_key_get_expiration_time(gnutls_openpgp_key_t key); +int gnutls_openpgp_key_get_id(gnutls_openpgp_key_t key, unsigned char keyid[8]); -int gnutls_openpgp_key_init(gnutls_openpgp_key * key); -void gnutls_openpgp_key_deinit(gnutls_openpgp_key key); -int gnutls_openpgp_key_import(gnutls_openpgp_key key, - const gnutls_datum * data, - gnutls_openpgp_key_fmt format); -int gnutls_openpgp_key_export(gnutls_openpgp_key key, - gnutls_openpgp_key_fmt format, void *output_data, +int gnutls_openpgp_key_init(gnutls_openpgp_key_t * key); +void gnutls_openpgp_key_deinit(gnutls_openpgp_key_t key); +int gnutls_openpgp_key_import(gnutls_openpgp_key_t key, + const gnutls_datum_t * data, + gnutls_openpgp_key_fmt_t format); +int gnutls_openpgp_key_export(gnutls_openpgp_key_t key, + gnutls_openpgp_key_fmt_t format, void *output_data, size_t * output_data_size); -void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring keyring); -int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring * keyring); -int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring, - const gnutls_datum * data, gnutls_openpgp_key_fmt format); -int gnutls_openpgp_keyring_check_id( gnutls_openpgp_keyring ring, +void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring_t keyring); +int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring_t * keyring); +int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring_t keyring, + const gnutls_datum_t * data, gnutls_openpgp_key_fmt_t format); +int gnutls_openpgp_keyring_check_id( gnutls_openpgp_keyring_t ring, const unsigned char keyid[8], unsigned int flags); -void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb trustdb); -int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb * trustdb); -int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb trustdb, +void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb_t trustdb); +int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb_t * trustdb); +int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb_t trustdb, const char *file); -int gnutls_openpgp_key_verify_ring(gnutls_openpgp_key key, - gnutls_openpgp_keyring keyring, unsigned int flags, +int gnutls_openpgp_key_verify_ring(gnutls_openpgp_key_t key, + gnutls_openpgp_keyring_t keyring, unsigned int flags, unsigned int *verify); -int gnutls_openpgp_key_verify_trustdb(gnutls_openpgp_key key, - gnutls_openpgp_trustdb trustdb, unsigned int flags, +int gnutls_openpgp_key_verify_trustdb(gnutls_openpgp_key_t key, + gnutls_openpgp_trustdb_t trustdb, unsigned int flags, unsigned int *verify); -int gnutls_openpgp_key_verify_self(gnutls_openpgp_key key, +int gnutls_openpgp_key_verify_self(gnutls_openpgp_key_t key, unsigned int flags, unsigned int *verify); int _gnutls_openpgp_key_to_gcert(gnutls_cert * gcert, - gnutls_openpgp_key cert); + gnutls_openpgp_key_t cert); int _gnutls_openpgp_privkey_to_gkey(gnutls_privkey * dest, - gnutls_openpgp_privkey src); + gnutls_openpgp_privkey_t src); -void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey key); +void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey_t key); #else /* no opencdk */ diff --git a/libextra/openpgp/privkey.c b/libextra/openpgp/privkey.c index 4dba0e043d..8c59097e0b 100644 --- a/libextra/openpgp/privkey.c +++ b/libextra/openpgp/privkey.c @@ -33,7 +33,7 @@ #include <gnutls_cert.h> /** - * gnutls_openpgp_privkey_init - This function initializes a gnutls_openpgp_privkey structure + * gnutls_openpgp_privkey_init - This function initializes a gnutls_openpgp_privkey_t structure * @key: The structure to be initialized * * This function will initialize an OpenPGP key structure. @@ -41,7 +41,7 @@ * Returns 0 on success. * **/ -int gnutls_openpgp_privkey_init(gnutls_openpgp_privkey * key) +int gnutls_openpgp_privkey_init(gnutls_openpgp_privkey_t * key) { *key = gnutls_calloc(1, sizeof(gnutls_openpgp_privkey_int)); @@ -52,13 +52,13 @@ int gnutls_openpgp_privkey_init(gnutls_openpgp_privkey * key) } /** - * gnutls_openpgp_privkey_deinit - This function deinitializes memory used by a gnutls_openpgp_privkey structure + * gnutls_openpgp_privkey_deinit - This function deinitializes memory used by a gnutls_openpgp_privkey_t structure * @key: The structure to be initialized * * This function will deinitialize a key structure. * **/ -void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey key) +void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey_t key) { if (!key) return; @@ -71,19 +71,19 @@ void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey key) * gnutls_openpgp_privkey_import - This function will import a RAW or BASE64 encoded key * @key: The structure to store the parsed key. * @data: The RAW or BASE64 encoded key. - * @format: One of gnutls_openpgp_key_fmt elements. + * @format: One of gnutls_openpgp_key_fmt_t elements. * @pass: Unused for now * @flags: should be zero * * This function will convert the given RAW or Base64 encoded key - * to the native gnutls_openpgp_privkey format. The output will be stored in 'key'. + * to the native gnutls_openpgp_privkey_t format. The output will be stored in 'key'. * * Returns 0 on success. * **/ -int gnutls_openpgp_privkey_import(gnutls_openpgp_privkey key, - const gnutls_datum * data, - gnutls_openpgp_key_fmt format, +int gnutls_openpgp_privkey_import(gnutls_openpgp_privkey_t key, + const gnutls_datum_t * data, + gnutls_openpgp_key_fmt_t format, const char *pass, unsigned int flags) { int rc; @@ -114,7 +114,7 @@ int gnutls_openpgp_privkey_import(gnutls_openpgp_privkey key, * **/ int -gnutls_openpgp_privkey_get_pk_algorithm(gnutls_openpgp_privkey key, +gnutls_openpgp_privkey_get_pk_algorithm(gnutls_openpgp_privkey_t key, unsigned int *bits) { int pk = key->pkey.pk_algorithm; diff --git a/libextra/openpgp/verify.c b/libextra/openpgp/verify.c index 5b1d3420d7..7112bbf428 100644 --- a/libextra/openpgp/verify.c +++ b/libextra/openpgp/verify.c @@ -31,8 +31,8 @@ #include <openpgp.h> static int -openpgp_get_key_trust(gnutls_openpgp_trustdb trustdb, - gnutls_openpgp_key key, unsigned int *r_trustval) +openpgp_get_key_trust(gnutls_openpgp_trustdb_t trustdb, + gnutls_openpgp_key_t key, unsigned int *r_trustval) { cdk_packet_t pkt; cdk_pkt_pubkey_t pk = NULL; @@ -85,7 +85,7 @@ openpgp_get_key_trust(gnutls_openpgp_trustdb trustdb, * Verify all signatures in the key, using the given set of keys (keyring). * * The key verification output will be put in @verify and will be - * one or more of the gnutls_certificate_status enumerated elements bitwise or'd. + * one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd. * * GNUTLS_CERT_INVALID\: A signature on the key is invalid. * @@ -96,8 +96,8 @@ openpgp_get_key_trust(gnutls_openpgp_trustdb trustdb, * * Returns 0 on success. **/ -int gnutls_openpgp_key_verify_ring(gnutls_openpgp_key key, - gnutls_openpgp_keyring keyring, +int gnutls_openpgp_key_verify_ring(gnutls_openpgp_key_t key, + gnutls_openpgp_keyring_t keyring, unsigned int flags, unsigned int *verify) { int rc = 0; @@ -165,13 +165,13 @@ void cdk_md_close(cdk_md_hd_t hd); * * Verifies the self signature in the key. * The key verification output will be put in @verify and will be - * one or more of the gnutls_certificate_status enumerated elements bitwise or'd. + * one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd. * * GNUTLS_CERT_INVALID\: The self signature on the key is invalid. * * Returns 0 on success. **/ -int gnutls_openpgp_key_verify_self(gnutls_openpgp_key key, +int gnutls_openpgp_key_verify_self(gnutls_openpgp_key_t key, unsigned int flags, unsigned int *verify) { @@ -252,7 +252,7 @@ int gnutls_openpgp_key_verify_self(gnutls_openpgp_key key, * * Checks if the key is revoked or disabled, in the trustdb. * The verification output will be put in @verify and will be - * one or more of the gnutls_certificate_status enumerated elements bitwise or'd. + * one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd. * * GNUTLS_CERT_INVALID\: A signature on the key is invalid. * @@ -263,8 +263,8 @@ int gnutls_openpgp_key_verify_self(gnutls_openpgp_key key, * * Returns 0 on success. **/ -int gnutls_openpgp_key_verify_trustdb(gnutls_openpgp_key key, - gnutls_openpgp_trustdb trustdb, +int gnutls_openpgp_key_verify_trustdb(gnutls_openpgp_key_t key, + gnutls_openpgp_trustdb_t trustdb, unsigned int flags, unsigned int *verify) { diff --git a/libextra/openpgp/xml.c b/libextra/openpgp/xml.c index f726acd7ea..2f5dbe72d5 100644 --- a/libextra/openpgp/xml.c +++ b/libextra/openpgp/xml.c @@ -343,8 +343,8 @@ xml_add_sig(gnutls_string * xmlkey, int ext, cdk_pkt_signature_t sig) * a XML string. **/ int -gnutls_openpgp_key_to_xml(gnutls_openpgp_key key, - gnutls_datum * xmlkey, int ext) +gnutls_openpgp_key_to_xml(gnutls_openpgp_key_t key, + gnutls_datum_t * xmlkey, int ext) { cdk_kbnode_t node, ctx = NULL; cdk_packet_t pkt; diff --git a/libextra/openssl_compat.c b/libextra/openssl_compat.c index 2752d5cb84..77a0d7bd30 100644 --- a/libextra/openssl_compat.c +++ b/libextra/openssl_compat.c @@ -43,7 +43,7 @@ * Returns a negative error code in case of an error. * **/ -int gnutls_x509_extract_dn(const gnutls_datum * idn, gnutls_x509_dn * rdn) +int gnutls_x509_extract_dn(const gnutls_datum_t * idn, gnutls_x509_dn * rdn) { ASN1_TYPE dn = ASN1_TYPE_EMPTY; int result; @@ -110,10 +110,10 @@ int gnutls_x509_extract_dn(const gnutls_datum * idn, gnutls_x509_dn * rdn) * Returns a negative error code in case of an error. * **/ -int gnutls_x509_extract_certificate_dn(const gnutls_datum * cert, +int gnutls_x509_extract_certificate_dn(const gnutls_datum_t * cert, gnutls_x509_dn * ret) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; size_t len; @@ -174,10 +174,10 @@ int gnutls_x509_extract_certificate_dn(const gnutls_datum * cert, * Returns a negative error code in case of an error. * **/ -int gnutls_x509_extract_certificate_issuer_dn(const gnutls_datum * cert, +int gnutls_x509_extract_certificate_issuer_dn(const gnutls_datum_t * cert, gnutls_x509_dn * ret) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; size_t len; @@ -255,12 +255,12 @@ int gnutls_x509_extract_certificate_issuer_dn(const gnutls_datum * cert, * sequence number then returns GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; * **/ -int gnutls_x509_extract_certificate_subject_alt_name(const gnutls_datum * +int gnutls_x509_extract_certificate_subject_alt_name(const gnutls_datum_t * cert, int seq, char *ret, int *ret_size) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; size_t size = *ret_size; @@ -297,9 +297,9 @@ int gnutls_x509_extract_certificate_subject_alt_name(const gnutls_datum * * GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. * **/ -int gnutls_x509_extract_certificate_ca_status(const gnutls_datum * cert) +int gnutls_x509_extract_certificate_ca_status(const gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; result = gnutls_x509_crt_init(&xcert); @@ -329,9 +329,9 @@ int gnutls_x509_extract_certificate_ca_status(const gnutls_datum * cert) * **/ time_t gnutls_x509_extract_certificate_activation_time(const - gnutls_datum * cert) + gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; time_t result; result = gnutls_x509_crt_init(&xcert); @@ -361,9 +361,9 @@ time_t gnutls_x509_extract_certificate_activation_time(const * **/ time_t gnutls_x509_extract_certificate_expiration_time(const - gnutls_datum * cert) + gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; time_t result; result = gnutls_x509_crt_init(&xcert); @@ -391,9 +391,9 @@ time_t gnutls_x509_extract_certificate_expiration_time(const * Version field. Returns a negative value in case of an error. * **/ -int gnutls_x509_extract_certificate_version(const gnutls_datum * cert) +int gnutls_x509_extract_certificate_version(const gnutls_datum_t * cert) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; result = gnutls_x509_crt_init(&xcert); @@ -428,10 +428,10 @@ int gnutls_x509_extract_certificate_version(const gnutls_datum * cert) * Returns a negative value in case of an error. * **/ -int gnutls_x509_extract_certificate_serial(const gnutls_datum * cert, +int gnutls_x509_extract_certificate_serial(const gnutls_datum_t * cert, char *result, int *result_size) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; size_t size = *result_size; int ret; @@ -467,14 +467,14 @@ int gnutls_x509_extract_certificate_serial(const gnutls_datum * cert, * For DSA the bits returned are of the public * exponent. * - * Returns a member of the gnutls_pk_algorithm enumeration on success, + * Returns a member of the gnutls_pk_algorithm_t enumeration on success, * or a negative value on error. * **/ -int gnutls_x509_extract_certificate_pk_algorithm(const gnutls_datum * cert, +int gnutls_x509_extract_certificate_pk_algorithm(const gnutls_datum_t * cert, int *bits) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; result = gnutls_x509_crt_init(&xcert); @@ -511,10 +511,10 @@ int gnutls_x509_extract_certificate_pk_algorithm(const gnutls_datum * cert, **/ int gnutls_x509_extract_certificate_dn_string(char *buf, unsigned int sizeof_buf, - const gnutls_datum * cert, + const gnutls_datum_t * cert, int issuer) { - gnutls_x509_crt xcert; + gnutls_x509_crt_t xcert; int result; result = gnutls_x509_crt_init(&xcert); @@ -547,7 +547,7 @@ int gnutls_x509_extract_certificate_dn_string(char *buf, * @CRL_list_length: not used * * This function will try to verify the given certificate list and return its status (TRUSTED, EXPIRED etc.). - * The return value (status) should be one or more of the gnutls_certificate_status + * The return value (status) should be one or more of the gnutls_certificate_status_t * enumerated elements bitwise or'd. Note that expiration and activation dates are not checked * by this function, you should check them using the appropriate functions. * @@ -557,7 +557,7 @@ int gnutls_x509_extract_certificate_dn_string(char *buf, * However you must also check the peer's name in order to check if the verified certificate belongs to the * actual peer. * - * The return value (status) should be one or more of the gnutls_certificate_status + * The return value (status) should be one or more of the gnutls_certificate_status_t * enumerated elements bitwise or'd. * * GNUTLS_CERT_INVALID\: the peer's certificate is not valid. @@ -570,17 +570,17 @@ int gnutls_x509_extract_certificate_dn_string(char *buf, * * **/ -int gnutls_x509_verify_certificate(const gnutls_datum * cert_list, +int gnutls_x509_verify_certificate(const gnutls_datum_t * cert_list, int cert_list_length, - const gnutls_datum * CA_list, + const gnutls_datum_t * CA_list, int CA_list_length, - const gnutls_datum * CRL_list, + const gnutls_datum_t * CRL_list, int CRL_list_length) { unsigned int verify; - gnutls_x509_crt *peer_certificate_list = NULL; - gnutls_x509_crt *ca_certificate_list = NULL; - gnutls_x509_crl *crl_list = NULL; + gnutls_x509_crt_t *peer_certificate_list = NULL; + gnutls_x509_crt_t *ca_certificate_list = NULL; + gnutls_x509_crl_t *crl_list = NULL; int peer_certificate_list_size = 0, i, x, ret; int ca_certificate_list_size = 0, crl_list_size = 0; @@ -594,7 +594,7 @@ int gnutls_x509_verify_certificate(const gnutls_datum * cert_list, peer_certificate_list = gnutls_calloc(1, peer_certificate_list_size * - sizeof(gnutls_x509_crt)); + sizeof(gnutls_x509_crt_t)); if (peer_certificate_list == NULL) { gnutls_assert(); ret = GNUTLS_E_MEMORY_ERROR; @@ -604,7 +604,7 @@ int gnutls_x509_verify_certificate(const gnutls_datum * cert_list, ca_certificate_list_size = CA_list_length; ca_certificate_list = gnutls_calloc(1, - ca_certificate_list_size * sizeof(gnutls_x509_crt)); + ca_certificate_list_size * sizeof(gnutls_x509_crt_t)); if (ca_certificate_list == NULL) { gnutls_assert(); ret = GNUTLS_E_MEMORY_ERROR; @@ -614,7 +614,7 @@ int gnutls_x509_verify_certificate(const gnutls_datum * cert_list, /* allocate memory for CRL */ crl_list_size = CRL_list_length; - crl_list = gnutls_calloc(1, crl_list_size * sizeof(gnutls_x509_crl)); + crl_list = gnutls_calloc(1, crl_list_size * sizeof(gnutls_x509_crl_t)); if (crl_list == NULL) { gnutls_assert(); ret = GNUTLS_E_MEMORY_ERROR; @@ -729,13 +729,13 @@ int gnutls_x509_verify_certificate(const gnutls_datum * cert_list, * This function will return the public key algorithm of a DER encoded private * key. * - * Returns a member of the gnutls_pk_algorithm enumeration on success, + * Returns a member of the gnutls_pk_algorithm_t enumeration on success, * or GNUTLS_E_UNKNOWN_PK_ALGORITHM on error. * **/ -int gnutls_x509_extract_key_pk_algorithm(const gnutls_datum * key) +int gnutls_x509_extract_key_pk_algorithm(const gnutls_datum_t * key) { - gnutls_x509_privkey pkey; + gnutls_x509_privkey_t pkey; int ret, pk; ret = gnutls_x509_privkey_init(&pkey); @@ -773,12 +773,12 @@ int gnutls_x509_extract_key_pk_algorithm(const gnutls_datum * key) * will be returned. * **/ -int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum * +int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum_t * pkcs7_struct, int indx, char *certificate, int *certificate_size) { - gnutls_pkcs7 pkcs7; + gnutls_pkcs7_t pkcs7; int result; size_t size = *certificate_size; @@ -811,10 +811,10 @@ int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum * * Returns a negative value on failure. * **/ -int gnutls_x509_pkcs7_extract_certificate_count(const gnutls_datum * +int gnutls_x509_pkcs7_extract_certificate_count(const gnutls_datum_t * pkcs7_struct) { - gnutls_pkcs7 pkcs7; + gnutls_pkcs7_t pkcs7; int result; result = gnutls_pkcs7_init(&pkcs7); diff --git a/libextra/openssl_compat.h b/libextra/openssl_compat.h index aa9f931c54..b91c20fada 100644 --- a/libextra/openssl_compat.h +++ b/libextra/openssl_compat.h @@ -4,29 +4,29 @@ /* Extra definitions */ #include <gnutls/openssl.h> -int gnutls_x509_extract_dn( const gnutls_datum*, gnutls_x509_dn*); -int gnutls_x509_extract_dn_string(const gnutls_datum * idn, +int gnutls_x509_extract_dn( const gnutls_datum_t*, gnutls_x509_dn*); +int gnutls_x509_extract_dn_string(const gnutls_datum_t * idn, char *buf, unsigned int sizeof_buf); -int gnutls_x509_extract_certificate_dn( const gnutls_datum*, gnutls_x509_dn*); +int gnutls_x509_extract_certificate_dn( const gnutls_datum_t*, gnutls_x509_dn*); int gnutls_x509_extract_certificate_dn_string(char *buf, unsigned int sizeof_buf, - const gnutls_datum * cert, int issuer); -int gnutls_x509_extract_certificate_issuer_dn( const gnutls_datum*, gnutls_x509_dn *); -int gnutls_x509_extract_certificate_version( const gnutls_datum*); -int gnutls_x509_extract_certificate_serial(const gnutls_datum * cert, char* result, int* result_size); -time_t gnutls_x509_extract_certificate_activation_time( const gnutls_datum*); -time_t gnutls_x509_extract_certificate_expiration_time( const gnutls_datum*); -int gnutls_x509_extract_certificate_subject_alt_name( const gnutls_datum*, int seq, char*, int*); -int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum * pkcs7_struct, int indx, char* certificate, int* certificate_size); -int gnutls_x509_extract_certificate_pk_algorithm( const gnutls_datum * cert, int* bits); -int gnutls_x509_extract_certificate_ca_status(const gnutls_datum * cert); -int gnutls_x509_extract_key_pk_algorithm( const gnutls_datum * key); + const gnutls_datum_t * cert, int issuer); +int gnutls_x509_extract_certificate_issuer_dn( const gnutls_datum_t*, gnutls_x509_dn *); +int gnutls_x509_extract_certificate_version( const gnutls_datum_t*); +int gnutls_x509_extract_certificate_serial(const gnutls_datum_t * cert, char* result, int* result_size); +time_t gnutls_x509_extract_certificate_activation_time( const gnutls_datum_t*); +time_t gnutls_x509_extract_certificate_expiration_time( const gnutls_datum_t*); +int gnutls_x509_extract_certificate_subject_alt_name( const gnutls_datum_t*, int seq, char*, int*); +int gnutls_x509_pkcs7_extract_certificate(const gnutls_datum_t * pkcs7_struct, int indx, char* certificate, int* certificate_size); +int gnutls_x509_extract_certificate_pk_algorithm( const gnutls_datum_t * cert, int* bits); +int gnutls_x509_extract_certificate_ca_status(const gnutls_datum_t * cert); +int gnutls_x509_extract_key_pk_algorithm( const gnutls_datum_t * key); -int gnutls_x509_verify_certificate( const gnutls_datum* cert_list, int cert_list_length, const gnutls_datum * CA_list, int CA_list_length, const gnutls_datum* CRL_list, int CRL_list_length); +int gnutls_x509_verify_certificate( const gnutls_datum_t* cert_list, int cert_list_length, const gnutls_datum_t * CA_list, int CA_list_length, const gnutls_datum_t* CRL_list, int CRL_list_length); #define gnutls_x509_fingerprint gnutls_fingerprint -#define gnutls_x509_certificate_format gnutls_x509_crt_fmt +#define gnutls_x509_certificate_format gnutls_x509_crt_fmt_t -int gnutls_x509_extract_key_pk_algorithm( const gnutls_datum * key); +int gnutls_x509_extract_key_pk_algorithm( const gnutls_datum_t * key); #define gnutls_certificate_set_rsa_params gnutls_certificate_set_rsa_export_params |