gnutls

gnutls

Synopsis

#define             LIBGNUTLS_VERSION
#define             LIBGNUTLS_VERSION_MAJOR
#define             LIBGNUTLS_VERSION_MINOR
#define             LIBGNUTLS_VERSION_PATCH
#define             LIBGNUTLS_VERSION_NUMBER
#define             HAVE_SSIZE_T
#define             GNUTLS_CIPHER_RIJNDAEL_128_CBC
#define             GNUTLS_CIPHER_RIJNDAEL_256_CBC
#define             GNUTLS_CIPHER_RIJNDAEL_CBC
#define             GNUTLS_CIPHER_ARCFOUR
enum                gnutls_cipher_algorithm_t;
enum                gnutls_kx_algorithm_t;
enum                gnutls_params_type_t;
enum                gnutls_credentials_type_t;
#define             GNUTLS_MAC_SHA
#define             GNUTLS_DIG_SHA
enum                gnutls_mac_algorithm_t;
enum                gnutls_digest_algorithm_t;
#define             GNUTLS_MAX_ALGORITHM_NUM
#define             GNUTLS_COMP_ZLIB
enum                gnutls_compression_method_t;
enum                gnutls_connection_end_t;
enum                gnutls_alert_level_t;
enum                gnutls_alert_description_t;
enum                gnutls_handshake_description_t;
enum                gnutls_certificate_status_t;
enum                gnutls_certificate_request_t;
enum                gnutls_openpgp_crt_status_t;
enum                gnutls_close_request_t;
#define             GNUTLS_TLS1
enum                gnutls_protocol_t;
enum                gnutls_certificate_type_t;
enum                gnutls_x509_crt_fmt_t;
enum                gnutls_certificate_print_formats_t;
enum                gnutls_pk_algorithm_t;
const char*         gnutls_pk_algorithm_get_name        (gnutls_pk_algorithm_t algorithm);
#define             GNUTLS_SIGN_RSA_SHA
#define             GNUTLS_SIGN_DSA_SHA
enum                gnutls_sign_algorithm_t;
const char*         gnutls_sign_algorithm_get_name      (gnutls_sign_algorithm_talgorithm );
typedef             gnutls_transport_ptr_t;
struct              gnutls_session_int;
typedef             gnutls_session_t;
struct              gnutls_dh_params_int;
typedef             gnutls_dh_params_t;
struct              gnutls_x509_privkey_int;
typedef             gnutls_rsa_params_t;
struct              gnutls_priority_st;
typedef             gnutls_priority_t;
int                 gnutls_init                         (gnutls_session_t *session,
                                                         gnutls_connection_end_t con_end);
void                gnutls_deinit                       (gnutls_session_t session);
int                 gnutls_bye                          (gnutls_session_t session,
                                                         gnutls_close_request_t how);
int                 gnutls_handshake                    (gnutls_session_t session);
int                 gnutls_rehandshake                  (gnutls_session_t session);
gnutls_alert_description_t gnutls_alert_get             (gnutls_session_t session);
int                 gnutls_alert_send                   (gnutls_session_t session,
                                                         gnutls_alert_level_t level,
                                                         gnutls_alert_description_t desc);
int                 gnutls_alert_send_appropriate       (gnutls_session_t session,
                                                         int err);
const char*         gnutls_alert_get_name               (gnutls_alert_description_t alert);
gnutls_cipher_algorithm_t gnutls_cipher_get             (gnutls_session_t session);
gnutls_kx_algorithm_t gnutls_kx_get                     (gnutls_session_t session);
gnutls_mac_algorithm_t gnutls_mac_get                   (gnutls_session_t session);
gnutls_compression_method_t gnutls_compression_get      (gnutls_session_tsession );
gnutls_certificate_type_t gnutls_certificate_type_get   (gnutls_session_tsession );
size_t              gnutls_cipher_get_key_size          (gnutls_cipher_algorithm_t algorithm);
size_t              gnutls_mac_get_key_size             (gnutls_mac_algorithm_t algorithm);
const char*         gnutls_cipher_get_name              (gnutls_cipher_algorithm_t algorithm);
const char*         gnutls_mac_get_name                 (gnutls_mac_algorithm_t algorithm);
const char*         gnutls_compression_get_name         (gnutls_compression_method_talgorithm );
const char*         gnutls_kx_get_name                  (gnutls_kx_algorithm_t algorithm);
const char*         gnutls_certificate_type_get_name    (gnutls_certificate_type_ttype );
gnutls_mac_algorithm_t gnutls_mac_get_id                (const char *name);
gnutls_compression_method_t gnutls_compression_get_id   (const char *name);
gnutls_cipher_algorithm_t gnutls_cipher_get_id          (const char *name);
gnutls_kx_algorithm_t gnutls_kx_get_id                  (const char *name);
gnutls_protocol_t   gnutls_protocol_get_id              (const char *name);
gnutls_certificate_type_t gnutls_certificate_type_get_id
                                                        (const char *name);
const gnutls_cipher_algorithm_t* gnutls_cipher_list     (void);
const gnutls_mac_algorithm_t* gnutls_mac_list           (void);
const gnutls_compression_method_t* gnutls_compression_list
                                                        (void);
const gnutls_protocol_t* gnutls_protocol_list           (void);
const gnutls_certificate_type_t* gnutls_certificate_type_list
                                                        (void);
const gnutls_kx_algorithm_t* gnutls_kx_list             (void);
const char*         gnutls_cipher_suite_info            (size_t i,
                                                         char *id,
                                                         gnutls_kx_algorithm_t *kx,
                                                         gnutls_cipher_algorithm_t *cipher,
                                                         gnutls_mac_algorithm_t *mac,
                                                         gnutls_protocol_t *version);
int                 gnutls_error_is_fatal               (int error);
int                 gnutls_error_to_alert               (int err,
                                                         int *level);
void                gnutls_perror                       (int error);
const char*         gnutls_strerror                     (int error);
void                gnutls_handshake_set_private_extensions
                                                        (gnutls_session_t session,
                                                         int allow);
gnutls_handshake_description_t gnutls_handshake_get_last_out
                                                        (gnutls_session_t session);
gnutls_handshake_description_t gnutls_handshake_get_last_in
                                                        (gnutls_session_t session);
ssize_t             gnutls_record_send                  (gnutls_session_t session,
                                                         const void *data,
                                                         size_t sizeofdata);
ssize_t             gnutls_record_recv                  (gnutls_session_t session,
                                                         void *data,
                                                         size_t sizeofdata);
#define             gnutls_read
#define             gnutls_write
void                gnutls_session_enable_compatibility_mode
                                                        (gnutls_session_t session);
void                gnutls_record_disable_padding       (gnutls_session_t session);
int                 gnutls_record_get_direction         (gnutls_session_t session);
size_t              gnutls_record_get_max_size          (gnutls_session_t session);
ssize_t             gnutls_record_set_max_size          (gnutls_session_t session,
                                                         size_t size);
size_t              gnutls_record_check_pending         (gnutls_session_t session);
int                 gnutls_prf                          (gnutls_session_t session,
                                                         size_t label_size,
                                                         const char *label,
                                                         int server_random_first,
                                                         size_t extra_size,
                                                         const char *extra,
                                                         size_t outsize,
                                                         char *out);
int                 gnutls_prf_raw                      (gnutls_session_t session,
                                                         size_t label_size,
                                                         const char *label,
                                                         size_t seed_size,
                                                         const char *seed,
                                                         size_t outsize,
                                                         char *out);
enum                gnutls_server_name_type_t;
int                 gnutls_server_name_set              (gnutls_session_t session,
                                                         gnutls_server_name_type_t type,
                                                         const void *name,
                                                         size_t name_length);
int                 gnutls_server_name_get              (gnutls_session_t session,
                                                         void *data,
                                                         size_t *data_length,
                                                         unsigned int *type,
                                                         unsigned int indx);
void                gnutls_oprfi_enable_client          (gnutls_session_t session,
                                                         size_t len,
                                                         unsigned char *data);
int                 (*gnutls_oprfi_callback_func)       (gnutls_session_t session,
                                                         void *userdata,
                                                         size_t oprfi_len,
                                                         unsigned char *in_oprfi,
                                                         unsigned char *out_oprfi);
void                gnutls_oprfi_enable_server          (gnutls_session_t session,
                                                         gnutls_oprfi_callback_func cb,
                                                         void *userdata);
enum                gnutls_supplemental_data_format_type_t;
const char*         gnutls_supplemental_get_name        (gnutls_supplemental_data_format_type_t type);
int                 gnutls_cipher_set_priority          (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_mac_set_priority             (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_compression_set_priority     (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_kx_set_priority              (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_protocol_set_priority        (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_certificate_type_set_priority
                                                        (gnutls_session_t session,
                                                         const int *list);
int                 gnutls_priority_init                (gnutls_priority_t *,
                                                         const char *priority,
                                                         const char **err_pos);
void                gnutls_priority_deinit              (gnutls_priority_t );
int                 gnutls_priority_set                 (gnutls_session_t session,
                                                         gnutls_priority_t );
int                 gnutls_priority_set_direct          (gnutls_session_t session,
                                                         const char *priority,
                                                         const char **err_pos);
int                 gnutls_set_default_priority         (gnutls_session_t session);
int                 gnutls_set_default_export_priority  (gnutls_session_t session);
const char*         gnutls_cipher_suite_get_name        (gnutls_kx_algorithm_tkx_algorithm ,
                                                         gnutls_cipher_algorithm_tcipher_algorithm ,
                                                         gnutls_mac_algorithm_tmac_algorithm );
gnutls_protocol_t   gnutls_protocol_get_version         (gnutls_session_t session);
const char*         gnutls_protocol_get_name            (gnutls_protocol_t version);
int                 gnutls_session_set_data             (gnutls_session_t session,
                                                         const void *session_data,
                                                         size_t session_data_size);
int                 gnutls_session_get_data             (gnutls_session_t session,
                                                         void *session_data,
                                                         size_t *session_data_size);
int                 gnutls_session_get_data2            (gnutls_session_t session,
                                                         gnutls_datum_t *data);
#define             GNUTLS_MAX_SESSION_ID
int                 gnutls_session_get_id               (gnutls_session_t session,
                                                         void *session_id,
                                                         size_t *session_id_size);
#define             TLS_MASTER_SIZE
#define             TLS_RANDOM_SIZE
const void*         gnutls_session_get_server_random    (gnutls_session_t session);
const void*         gnutls_session_get_client_random    (gnutls_session_t session);
const void*         gnutls_session_get_master_secret    (gnutls_session_t session);
int                 gnutls_session_is_resumed           (gnutls_session_t session);
int                 (*gnutls_db_store_func)             (void *,
                                                         gnutls_datum_t key,
                                                         gnutls_datum_t data);
int                 (*gnutls_db_remove_func)            (void *,
                                                         gnutls_datum_t key);
gnutls_datum_t      (*gnutls_db_retr_func)              (void *,
                                                         gnutls_datum_t key);
void                gnutls_db_set_cache_expiration      (gnutls_session_t session,
                                                         int seconds);
void                gnutls_db_remove_session            (gnutls_session_t session);
void                gnutls_db_set_retrieve_function     (gnutls_session_t session,
                                                         gnutls_db_retr_func retr_func);
void                gnutls_db_set_remove_function       (gnutls_session_t session,
                                                         gnutls_db_remove_func rem_func);
void                gnutls_db_set_store_function        (gnutls_session_t session,
                                                         gnutls_db_store_func store_func);
void                gnutls_db_set_ptr                   (gnutls_session_t session,
                                                         void *ptr);
void*               gnutls_db_get_ptr                   (gnutls_session_t session);
int                 gnutls_db_check_entry               (gnutls_session_t session,
                                                         gnutls_datum_t session_entry);
int                 (*gnutls_handshake_post_client_hello_func)
                                                        (gnutls_session_t );
void                gnutls_handshake_set_post_client_hello_function
                                                        (gnutls_session_t ,
                                                         gnutls_handshake_post_client_hello_func );
void                gnutls_handshake_set_max_packet_length
                                                        (gnutls_session_t session,
                                                         size_t max);
const char*         gnutls_check_version                (const char *req_version);
void                gnutls_credentials_clear            (gnutls_session_t session);
int                 gnutls_credentials_set              (gnutls_session_t session,
                                                         gnutls_credentials_type_t type,
                                                         void *cred);
#define             gnutls_cred_set
struct              gnutls_certificate_credentials_st;
void                gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc);
int                 gnutls_anon_allocate_server_credentials
                                                        (gnutls_anon_server_credentials_t *sc);
void                gnutls_anon_set_server_dh_params    (gnutls_anon_server_credentials_t res,
                                                         gnutls_dh_params_t dh_params);
void                gnutls_anon_set_server_params_function
                                                        (gnutls_anon_server_credentials_tres ,
                                                         gnutls_params_function *func);
void                gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_tsc );
int                 gnutls_anon_allocate_client_credentials
                                                        (gnutls_anon_client_credentials_t *sc);
void                gnutls_certificate_free_credentials (gnutls_certificate_credentials_tsc );
int                 gnutls_certificate_allocate_credentials
                                                        (gnutls_certificate_credentials_t *res);
void                gnutls_certificate_free_keys        (gnutls_certificate_credentials_t sc);
void                gnutls_certificate_free_cas         (gnutls_certificate_credentials_t sc);
void                gnutls_certificate_free_ca_names    (gnutls_certificate_credentials_t sc);
void                gnutls_certificate_free_crls        (gnutls_certificate_credentials_t sc);
void                gnutls_certificate_set_dh_params    (gnutls_certificate_credentials_t res,
                                                         gnutls_dh_params_t dh_params);
void                gnutls_certificate_set_rsa_export_params
                                                        (gnutls_certificate_credentials_tres ,
                                                         gnutls_rsa_params_t rsa_params);
void                gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_tres ,
                                                         unsigned int flags);
void                gnutls_certificate_set_verify_limits
                                                        (gnutls_certificate_credentials_tres ,
                                                         unsigned int max_bits,
                                                         unsigned int max_depth);
int                 gnutls_certificate_set_x509_trust_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CAFILE,
                                                         gnutls_x509_crt_fmt_t type);
int                 gnutls_certificate_set_x509_trust_mem
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CA,
                                                         gnutls_x509_crt_fmt_t type);
int                 gnutls_certificate_set_x509_crl_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *crlfile,
                                                         gnutls_x509_crt_fmt_t type);
int                 gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CRL,
                                                         gnutls_x509_crt_fmt_t type);
int                 gnutls_certificate_set_x509_key_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         gnutls_x509_crt_fmt_t type);
int                 gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         gnutls_x509_crt_fmt_t type);
void                gnutls_certificate_send_x509_rdn_sequence
                                                        (gnutls_session_t session,
                                                         int status);
int                 gnutls_certificate_set_x509_simple_pkcs12_file
                                                        (gnutls_certificate_credentials_t res,
                                                         const char *pkcs12file,
                                                         gnutls_x509_crt_fmt_t type,
                                                         const char *password);
typedef             gnutls_x509_privkey_t;
struct              gnutls_x509_crl_int;
typedef             gnutls_x509_crl_t;
struct              gnutls_x509_crt_int;
typedef             gnutls_x509_crt_t;
struct              gnutls_openpgp_keyring_int;
typedef             gnutls_openpgp_keyring_t;
int                 gnutls_certificate_set_x509_key     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crt_t *cert_list,
                                                         int cert_list_size,
                                                         gnutls_x509_privkey_t key);
int                 gnutls_certificate_set_x509_trust   (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crt_t *ca_list,
                                                         int ca_list_size);
int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);
void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);
void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);
void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);
int                 gnutls_global_init                  (void);
void                gnutls_global_deinit                (void);
void*               (*gnutls_alloc_function)            (size_t );
void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );
int                 (*gnutls_is_secure_function)        (const void *);
void                (*gnutls_free_function)             (void *);
void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );
void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);
extern              gnutls_alloc_function gnutls_malloc;
extern              gnutls_alloc_function gnutls_secure_malloc;
extern              gnutls_realloc_function gnutls_realloc;
extern              gnutls_calloc_function gnutls_calloc;
extern              gnutls_free_function gnutls_free;
char*               gnutls_strdup                       (const char *);
void                (*gnutls_log_func)                  (...,
                                                         const char *);
void                gnutls_global_set_log_function      (gnutls_log_func log_func);
void                gnutls_global_set_log_level         (int level);
int                 gnutls_dh_params_init               (gnutls_dh_params_t *dh_params);
void                gnutls_dh_params_deinit             (gnutls_dh_params_t dh_params);
int                 gnutls_dh_params_import_raw         (gnutls_dh_params_t dh_params,
                                                         const gnutls_datum_t *prime,
                                                         const gnutls_datum_t *generator);
int                 gnutls_dh_params_import_pkcs3       (gnutls_dh_params_t params,
                                                         const gnutls_datum_t *pkcs3_params,
                                                         gnutls_x509_crt_fmt_t format);
int                 gnutls_dh_params_generate2          (gnutls_dh_params_t params,
                                                         unsigned int bits);
int                 gnutls_dh_params_export_pkcs3       (gnutls_dh_params_t params,
                                                         gnutls_x509_crt_fmt_t format,
                                                         unsigned char *params_data,
                                                         size_t *params_data_size);
int                 gnutls_dh_params_export_raw         (gnutls_dh_params_t params,
                                                         gnutls_datum_t *prime,
                                                         gnutls_datum_t *generator,
                                                         unsigned int *bits);
int                 gnutls_dh_params_cpy                (gnutls_dh_params_t dst,
                                                         gnutls_dh_params_t src);
int                 gnutls_rsa_params_init              (gnutls_rsa_params_t *rsa_params);
void                gnutls_rsa_params_deinit            (gnutls_rsa_params_t rsa_params);
int                 gnutls_rsa_params_cpy               (gnutls_rsa_params_t dst,
                                                         gnutls_rsa_params_t src);
int                 gnutls_rsa_params_import_raw        (gnutls_rsa_params_t rsa_params,
                                                         const gnutls_datum_t *m,
                                                         const gnutls_datum_t *e,
                                                         const gnutls_datum_t *d,
                                                         const gnutls_datum_t *p,
                                                         const gnutls_datum_t *q,
                                                         const gnutls_datum_t *u);
int                 gnutls_rsa_params_generate2         (gnutls_rsa_params_t params,
                                                         unsigned int bits);
int                 gnutls_rsa_params_export_raw        (gnutls_rsa_params_t params,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e,
                                                         gnutls_datum_t *d,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *u,
                                                         unsigned int *bits);
int                 gnutls_rsa_params_export_pkcs1      (gnutls_rsa_params_t params,
                                                         gnutls_x509_crt_fmt_t format,
                                                         unsigned char *params_data,
                                                         size_t *params_data_size);
int                 gnutls_rsa_params_import_pkcs1      (gnutls_rsa_params_t params,
                                                         const gnutls_datum_t *pkcs1_params,
                                                         gnutls_x509_crt_fmt_t format);
ssize_t             (*gnutls_pull_func)                 (gnutls_transport_ptr_t ,
                                                         void *,
                                                         size_t );
ssize_t             (*gnutls_push_func)                 (gnutls_transport_ptr_t ,
                                                         const void *,
                                                         size_t );
void                gnutls_transport_set_ptr            (gnutls_session_t session,
                                                         gnutls_transport_ptr_t ptr);
void                gnutls_transport_set_ptr2           (gnutls_session_t session,
                                                         gnutls_transport_ptr_t recv_ptr,
                                                         gnutls_transport_ptr_t send_ptr);
gnutls_transport_ptr_t gnutls_transport_get_ptr         (gnutls_session_t session);
void                gnutls_transport_get_ptr2           (gnutls_session_t session,
                                                         gnutls_transport_ptr_t *recv_ptr,
                                                         gnutls_transport_ptr_t *send_ptr);
void                gnutls_transport_set_lowat          (gnutls_session_t session,
                                                         int num);
void                gnutls_transport_set_push_function  (gnutls_session_t session,
                                                         gnutls_push_func push_func);
void                gnutls_transport_set_pull_function  (gnutls_session_t session,
                                                         gnutls_pull_func pull_func);
void                gnutls_transport_set_errno          (gnutls_session_t session,
                                                         int err);
void                gnutls_transport_set_global_errno   (int err);
void                gnutls_session_set_ptr              (gnutls_session_t session,
                                                         void *ptr);
void*               gnutls_session_get_ptr              (gnutls_session_t session);
void                gnutls_openpgp_send_cert            (gnutls_session_t session,
                                                         gnutls_openpgp_crt_status_t status);
int                 gnutls_fingerprint                  (gnutls_digest_algorithm_t algo,
                                                         const gnutls_datum_t *data,
                                                         void *result,
                                                         size_t *result_size);
void                gnutls_srp_free_client_credentials  (gnutls_srp_client_credentials_tsc );
int                 gnutls_srp_allocate_client_credentials
                                                        (gnutls_srp_client_credentials_t *sc);
int                 gnutls_srp_set_client_credentials   (gnutls_srp_client_credentials_t res,
                                                         const char *username,
                                                         const char *password);
void                gnutls_srp_free_server_credentials  (gnutls_srp_server_credentials_tsc );
int                 gnutls_srp_allocate_server_credentials
                                                        (gnutls_srp_server_credentials_t *sc);
int                 gnutls_srp_set_server_credentials_file
                                                        (gnutls_srp_server_credentials_tres ,
                                                         const char *password_file,
                                                         const char *password_conf_file);
const char*         gnutls_srp_server_get_username      (gnutls_session_t session);
int                 gnutls_srp_verifier                 (const char *username,
                                                         const char *password,
                                                         const gnutls_datum_t *salt,
                                                         const gnutls_datum_t *generator,
                                                         const gnutls_datum_t *prime,
                                                         gnutls_datum_t *res);
extern              const gnutls_datum_t gnutls_srp_2048_group_prime;
extern              const gnutls_datum_t gnutls_srp_2048_group_generator;
extern              const gnutls_datum_t gnutls_srp_1536_group_prime;
extern              const gnutls_datum_t gnutls_srp_1536_group_generator;
extern              const gnutls_datum_t gnutls_srp_1024_group_prime;
extern              const gnutls_datum_t gnutls_srp_1024_group_generator;
void                gnutls_srp_set_server_credentials_function
                                                        (gnutls_srp_server_credentials_t cred,
                                                         gnutls_srp_server_credentials_function *func);
void                gnutls_srp_set_client_credentials_function
                                                        (gnutls_srp_client_credentials_t cred,
                                                         gnutls_srp_client_credentials_function *func);
int                 gnutls_srp_base64_encode            (const gnutls_datum_t *data,
                                                         char *result,
                                                         size_t *result_size);
int                 gnutls_srp_base64_encode_alloc      (const gnutls_datum_t *data,
                                                         gnutls_datum_t *result);
int                 gnutls_srp_base64_decode            (const gnutls_datum_t *b64_data,
                                                         char *result,
                                                         size_t *result_size);
int                 gnutls_srp_base64_decode_alloc      (const gnutls_datum_t *b64_data,
                                                         gnutls_datum_t *result);
enum                gnutls_psk_key_flags;
void                gnutls_psk_free_client_credentials  (gnutls_psk_client_credentials_tsc );
int                 gnutls_psk_allocate_client_credentials
                                                        (gnutls_psk_client_credentials_t *sc);
int                 gnutls_psk_set_client_credentials   (gnutls_psk_client_credentials_t res,
                                                         const char *username,
                                                         const gnutls_datum_t *key,
                                                         gnutls_psk_key_flags format);
void                gnutls_psk_free_server_credentials  (gnutls_psk_server_credentials_tsc );
int                 gnutls_psk_allocate_server_credentials
                                                        (gnutls_psk_server_credentials_t *sc);
int                 gnutls_psk_set_server_credentials_file
                                                        (gnutls_psk_server_credentials_tres ,
                                                         const char *password_file);
int                 gnutls_psk_set_server_credentials_hint
                                                        (gnutls_psk_server_credentials_t res,
                                                         const char *hint);
const char*         gnutls_psk_server_get_username      (gnutls_session_t session);
const char*         gnutls_psk_client_get_hint          (gnutls_session_t session);
void                gnutls_psk_set_server_credentials_function
                                                        (gnutls_psk_server_credentials_t cred,
                                                         gnutls_psk_server_credentials_function *func);
void                gnutls_psk_set_client_credentials_function
                                                        (gnutls_psk_client_credentials_t cred,
                                                         gnutls_psk_client_credentials_function *func);
int                 gnutls_hex_encode                   (const gnutls_datum_t *data,
                                                         char *result,
                                                         size_t *result_size);
int                 gnutls_hex_decode                   (const gnutls_datum_t *hex_data,
                                                         char *result,
                                                         size_t *result_size);
void                gnutls_psk_set_server_dh_params     (gnutls_psk_server_credentials_t res,
                                                         gnutls_dh_params_t dh_params);
void                gnutls_psk_set_server_params_function
                                                        (gnutls_psk_server_credentials_tres ,
                                                         gnutls_params_function *func);
int                 gnutls_psk_netconf_derive_key       (const char *password,
                                                         const char *psk_identity,
                                                         const char *psk_identity_hint,
                                                         gnutls_datum_t *output_key);
enum                gnutls_x509_subject_alt_name_t;
struct              gnutls_openpgp_crt_int;
typedef             gnutls_openpgp_crt_t;
struct              gnutls_openpgp_privkey_int;
typedef             gnutls_openpgp_privkey_t;
gnutls_credentials_type_t gnutls_auth_get_type          (gnutls_session_t session);
gnutls_credentials_type_t gnutls_auth_server_get_type   (gnutls_session_t session);
gnutls_credentials_type_t gnutls_auth_client_get_type   (gnutls_session_t session);
void                gnutls_dh_set_prime_bits            (gnutls_session_t session,
                                                         unsigned int bits);
int                 gnutls_dh_get_secret_bits           (gnutls_session_t session);
int                 gnutls_dh_get_peers_public_bits     (gnutls_session_t session);
int                 gnutls_dh_get_prime_bits            (gnutls_session_t session);
int                 gnutls_dh_get_group                 (gnutls_session_t session,
                                                         gnutls_datum_t *raw_gen,
                                                         gnutls_datum_t *raw_prime);
int                 gnutls_dh_get_pubkey                (gnutls_session_t session,
                                                         gnutls_datum_t *raw_key);
int                 gnutls_rsa_export_get_pubkey        (gnutls_session_t session,
                                                         gnutls_datum_t *exponent,
                                                         gnutls_datum_t *modulus);
int                 gnutls_rsa_export_get_modulus_bits  (gnutls_session_t session);
int                 (*gnutls_sign_func)                 (gnutls_session_t session,
                                                         void *userdata,
                                                         gnutls_certificate_type_t cert_type,
                                                         const gnutls_datum_t *cert,
                                                         const gnutls_datum_t *hash,
                                                         gnutls_datum_t *signature);
void                gnutls_sign_callback_set            (gnutls_session_t session,
                                                         gnutls_sign_func sign_func,
                                                         void *userdata);
gnutls_sign_func    gnutls_sign_callback_get            (gnutls_session_t session,
                                                         void **userdata);
void                gnutls_certificate_client_set_retrieve_function
                                                        (gnutls_certificate_credentials_t cred,
                                                         gnutls_certificate_client_retrieve_function *func);
void                gnutls_certificate_server_set_retrieve_function
                                                        (gnutls_certificate_credentials_t cred,
                                                         gnutls_certificate_server_retrieve_function *func);
void                gnutls_certificate_server_set_request
                                                        (gnutls_session_t session,
                                                         gnutls_certificate_request_treq );
const gnutls_datum_t* gnutls_certificate_get_peers      (gnutls_session_tsession ,
                                                         unsigned int *list_size);
const gnutls_datum_t* gnutls_certificate_get_ours       (gnutls_session_tsession );
time_t              gnutls_certificate_activation_time_peers
                                                        (gnutls_session_t session);
time_t              gnutls_certificate_expiration_time_peers
                                                        (gnutls_session_t session);
int                 gnutls_certificate_client_get_request_status
                                                        (gnutls_session_t session);
int                 gnutls_certificate_verify_peers2    (gnutls_session_t session,
                                                         unsigned int *status);
int                 gnutls_certificate_verify_peers     (gnutls_session_t session);
int                 gnutls_pem_base64_encode            (const char *msg,
                                                         const gnutls_datum_t *data,
                                                         char *result,
                                                         size_t *result_size);
int                 gnutls_pem_base64_decode            (const char *header,
                                                         const gnutls_datum_t *b64_data,
                                                         unsigned char *result,
                                                         size_t *result_size);
int                 gnutls_pem_base64_encode_alloc      (const char *msg,
                                                         const gnutls_datum_t *data,
                                                         gnutls_datum_t *result);
int                 gnutls_pem_base64_decode_alloc      (const char *header,
                                                         const gnutls_datum_t *b64_data,
                                                         gnutls_datum_t *result);
#define             GNUTLS_KEY_DIGITAL_SIGNATURE
#define             GNUTLS_KEY_NON_REPUDIATION
#define             GNUTLS_KEY_KEY_ENCIPHERMENT
#define             GNUTLS_KEY_DATA_ENCIPHERMENT
#define             GNUTLS_KEY_KEY_AGREEMENT
#define             GNUTLS_KEY_KEY_CERT_SIGN
#define             GNUTLS_KEY_CRL_SIGN
#define             GNUTLS_KEY_ENCIPHER_ONLY
#define             GNUTLS_KEY_DECIPHER_ONLY
void                gnutls_certificate_set_params_function
                                                        (gnutls_certificate_credentials_t res,
                                                         gnutls_params_function *func);
void                gnutls_anon_set_params_function     (gnutls_anon_server_credentials_t res,
                                                         gnutls_params_function *func);
void                gnutls_psk_set_params_function      (gnutls_psk_server_credentials_t res,
                                                         gnutls_params_function *func);
int                 gnutls_hex2bin                      (const char *hex_data,
                                                         size_t hex_size,
                                                         char *bin_data,
                                                         size_t *bin_size);
#define             GNUTLS_E_SUCCESS
#define             GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM
#define             GNUTLS_E_UNKNOWN_CIPHER_TYPE
#define             GNUTLS_E_LARGE_PACKET
#define             GNUTLS_E_UNSUPPORTED_VERSION_PACKET
#define             GNUTLS_E_UNEXPECTED_PACKET_LENGTH
#define             GNUTLS_E_INVALID_SESSION
#define             GNUTLS_E_FATAL_ALERT_RECEIVED
#define             GNUTLS_E_UNEXPECTED_PACKET
#define             GNUTLS_E_WARNING_ALERT_RECEIVED
#define             GNUTLS_E_ERROR_IN_FINISHED_PACKET
#define             GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET
#define             GNUTLS_E_UNKNOWN_CIPHER_SUITE
#define             GNUTLS_E_UNWANTED_ALGORITHM
#define             GNUTLS_E_MPI_SCAN_FAILED
#define             GNUTLS_E_DECRYPTION_FAILED
#define             GNUTLS_E_MEMORY_ERROR
#define             GNUTLS_E_DECOMPRESSION_FAILED
#define             GNUTLS_E_COMPRESSION_FAILED
#define             GNUTLS_E_AGAIN
#define             GNUTLS_E_EXPIRED
#define             GNUTLS_E_DB_ERROR
#define             GNUTLS_E_SRP_PWD_ERROR
#define             GNUTLS_E_INSUFFICIENT_CREDENTIALS
#define             GNUTLS_E_INSUFICIENT_CREDENTIALS
#define             GNUTLS_E_INSUFFICIENT_CRED
#define             GNUTLS_E_INSUFICIENT_CRED
#define             GNUTLS_E_HASH_FAILED
#define             GNUTLS_E_BASE64_DECODING_ERROR
#define             GNUTLS_E_MPI_PRINT_FAILED
#define             GNUTLS_E_REHANDSHAKE
#define             GNUTLS_E_GOT_APPLICATION_DATA
#define             GNUTLS_E_RECORD_LIMIT_REACHED
#define             GNUTLS_E_ENCRYPTION_FAILED
#define             GNUTLS_E_PK_ENCRYPTION_FAILED
#define             GNUTLS_E_PK_DECRYPTION_FAILED
#define             GNUTLS_E_PK_SIGN_FAILED
#define             GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION
#define             GNUTLS_E_KEY_USAGE_VIOLATION
#define             GNUTLS_E_NO_CERTIFICATE_FOUND
#define             GNUTLS_E_INVALID_REQUEST
#define             GNUTLS_E_SHORT_MEMORY_BUFFER
#define             GNUTLS_E_INTERRUPTED
#define             GNUTLS_E_PUSH_ERROR
#define             GNUTLS_E_PULL_ERROR
#define             GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER
#define             GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
#define             GNUTLS_E_PKCS1_WRONG_PAD
#define             GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION
#define             GNUTLS_E_INTERNAL_ERROR
#define             GNUTLS_E_DH_PRIME_UNACCEPTABLE
#define             GNUTLS_E_FILE_ERROR
#define             GNUTLS_E_TOO_MANY_EMPTY_PACKETS
#define             GNUTLS_E_UNKNOWN_PK_ALGORITHM
#define             GNUTLS_E_INIT_LIBEXTRA
#define             GNUTLS_E_LIBRARY_VERSION_MISMATCH
#define             GNUTLS_E_NO_TEMPORARY_RSA_PARAMS
#define             GNUTLS_E_LZO_INIT_FAILED
#define             GNUTLS_E_NO_COMPRESSION_ALGORITHMS
#define             GNUTLS_E_NO_CIPHER_SUITES
#define             GNUTLS_E_OPENPGP_GETKEY_FAILED
#define             GNUTLS_E_PK_SIG_VERIFY_FAILED
#define             GNUTLS_E_ILLEGAL_SRP_USERNAME
#define             GNUTLS_E_SRP_PWD_PARSING_ERROR
#define             GNUTLS_E_NO_TEMPORARY_DH_PARAMS
#define             GNUTLS_E_ASN1_ELEMENT_NOT_FOUND
#define             GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND
#define             GNUTLS_E_ASN1_DER_ERROR
#define             GNUTLS_E_ASN1_VALUE_NOT_FOUND
#define             GNUTLS_E_ASN1_GENERIC_ERROR
#define             GNUTLS_E_ASN1_VALUE_NOT_VALID
#define             GNUTLS_E_ASN1_TAG_ERROR
#define             GNUTLS_E_ASN1_TAG_IMPLICIT
#define             GNUTLS_E_ASN1_TYPE_ANY_ERROR
#define             GNUTLS_E_ASN1_SYNTAX_ERROR
#define             GNUTLS_E_ASN1_DER_OVERFLOW
#define             GNUTLS_E_OPENPGP_UID_REVOKED
#define             GNUTLS_E_CERTIFICATE_ERROR
#define             GNUTLS_E_X509_CERTIFICATE_ERROR
#define             GNUTLS_E_CERTIFICATE_KEY_MISMATCH
#define             GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE
#define             GNUTLS_E_X509_UNKNOWN_SAN
#define             GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED
#define             GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE
#define             GNUTLS_E_UNKNOWN_HASH_ALGORITHM
#define             GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE
#define             GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE
#define             GNUTLS_E_INVALID_PASSWORD
#define             GNUTLS_E_MAC_VERIFY_FAILED
#define             GNUTLS_E_CONSTRAINT_ERROR
#define             GNUTLS_E_WARNING_IA_IPHF_RECEIVED
#define             GNUTLS_E_WARNING_IA_FPHF_RECEIVED
#define             GNUTLS_E_IA_VERIFY_FAILED
#define             GNUTLS_E_UNKNOWN_ALGORITHM
#define             GNUTLS_E_BASE64_ENCODING_ERROR
#define             GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY
#define             GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY
#define             GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY
#define             GNUTLS_E_OPENPGP_KEYRING_ERROR
#define             GNUTLS_E_X509_UNSUPPORTED_OID
#define             GNUTLS_E_RANDOM_FAILED
#define             GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR
#define             GNUTLS_E_OPENPGP_SUBKEY_ERROR
#define             GNUTLS_E_CRYPTO_ALREADY_REGISTERED
#define             GNUTLS_E_HANDSHAKE_TOO_LARGE
#define             GNUTLS_E_UNIMPLEMENTED_FEATURE
#define             GNUTLS_E_APPLICATION_ERROR_MAX
#define             GNUTLS_E_APPLICATION_ERROR_MIN

Description

A longer description goes here.

Details

LIBGNUTLS_VERSION

#define LIBGNUTLS_VERSION "2.4.2"

LIBGNUTLS_VERSION_MAJOR

#define LIBGNUTLS_VERSION_MAJOR 2

LIBGNUTLS_VERSION_MINOR

#define LIBGNUTLS_VERSION_MINOR 4

LIBGNUTLS_VERSION_PATCH

#define LIBGNUTLS_VERSION_PATCH 2

LIBGNUTLS_VERSION_NUMBER

#define LIBGNUTLS_VERSION_NUMBER 0x020402

HAVE_SSIZE_T

# define HAVE_SSIZE_T

GNUTLS_CIPHER_RIJNDAEL_128_CBC

#define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC

GNUTLS_CIPHER_RIJNDAEL_256_CBC

#define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC

GNUTLS_CIPHER_RIJNDAEL_CBC

#define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC

GNUTLS_CIPHER_ARCFOUR

#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128

enum gnutls_cipher_algorithm_t

  typedef enum gnutls_cipher_algorithm
  {
    GNUTLS_CIPHER_UNKNOWN = 0,
    GNUTLS_CIPHER_NULL = 1,
    GNUTLS_CIPHER_ARCFOUR_128,
    GNUTLS_CIPHER_3DES_CBC,
    GNUTLS_CIPHER_AES_128_CBC,
    GNUTLS_CIPHER_AES_256_CBC,
    GNUTLS_CIPHER_ARCFOUR_40,
    GNUTLS_CIPHER_CAMELLIA_128_CBC,
    GNUTLS_CIPHER_CAMELLIA_256_CBC,
    GNUTLS_CIPHER_RC2_40_CBC = 90,
    GNUTLS_CIPHER_DES_CBC
  } gnutls_cipher_algorithm_t;

enum gnutls_kx_algorithm_t

  typedef enum
  {
    GNUTLS_KX_UNKNOWN = 0,
    GNUTLS_KX_RSA = 1,
    GNUTLS_KX_DHE_DSS,
    GNUTLS_KX_DHE_RSA,
    GNUTLS_KX_ANON_DH,
    GNUTLS_KX_SRP,
    GNUTLS_KX_RSA_EXPORT,
    GNUTLS_KX_SRP_RSA,
    GNUTLS_KX_SRP_DSS,
    GNUTLS_KX_PSK,
    GNUTLS_KX_DHE_PSK
  } gnutls_kx_algorithm_t;

enum gnutls_params_type_t

  typedef enum
  {
    GNUTLS_PARAMS_RSA_EXPORT = 1,
    GNUTLS_PARAMS_DH
  } gnutls_params_type_t;

enum gnutls_credentials_type_t

  typedef enum
  {
    GNUTLS_CRD_CERTIFICATE = 1,
    GNUTLS_CRD_ANON,
    GNUTLS_CRD_SRP,
    GNUTLS_CRD_PSK,
    GNUTLS_CRD_IA
  } gnutls_credentials_type_t;

GNUTLS_MAC_SHA

#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1

GNUTLS_DIG_SHA

#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1

enum gnutls_mac_algorithm_t

  typedef enum
  {
    GNUTLS_MAC_UNKNOWN = 0,
    GNUTLS_MAC_NULL = 1,
    GNUTLS_MAC_MD5,
    GNUTLS_MAC_SHA1,
    GNUTLS_MAC_RMD160,
    GNUTLS_MAC_MD2,
    GNUTLS_MAC_SHA256,
    GNUTLS_MAC_SHA384,
    GNUTLS_MAC_SHA512
    /* If you add anything here, make sure you align with
       gnutls_digest_algorithm_t, in particular SHA-224. */
  } gnutls_mac_algorithm_t;

enum gnutls_digest_algorithm_t

  typedef enum
  {
    GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
    GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
    GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
    GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160,
    GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2,
    GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
    GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384,
    GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512,
    GNUTLS_DIG_SHA224
  } gnutls_digest_algorithm_t;

GNUTLS_MAX_ALGORITHM_NUM

#define GNUTLS_MAX_ALGORITHM_NUM 16

GNUTLS_COMP_ZLIB

#define GNUTLS_COMP_ZLIB GNUTLS_COMP_DEFLATE

enum gnutls_compression_method_t

  typedef enum
  {
    GNUTLS_COMP_UNKNOWN = 0,
    GNUTLS_COMP_NULL = 1,
    GNUTLS_COMP_DEFLATE,
    GNUTLS_COMP_LZO		/* only available if gnutls-extra has
				   been initialized
				 */
  } gnutls_compression_method_t;

enum gnutls_connection_end_t

  typedef enum
  {
    GNUTLS_SERVER = 1,
    GNUTLS_CLIENT
  } gnutls_connection_end_t;

enum gnutls_alert_level_t

  typedef enum
  {
    GNUTLS_AL_WARNING = 1,
    GNUTLS_AL_FATAL
  } gnutls_alert_level_t;

enum gnutls_alert_description_t

  typedef enum
  {
    GNUTLS_A_CLOSE_NOTIFY,
    GNUTLS_A_UNEXPECTED_MESSAGE = 10,
    GNUTLS_A_BAD_RECORD_MAC = 20,
    GNUTLS_A_DECRYPTION_FAILED,
    GNUTLS_A_RECORD_OVERFLOW,
    GNUTLS_A_DECOMPRESSION_FAILURE = 30,
    GNUTLS_A_HANDSHAKE_FAILURE = 40,
    GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
    GNUTLS_A_BAD_CERTIFICATE = 42,
    GNUTLS_A_UNSUPPORTED_CERTIFICATE,
    GNUTLS_A_CERTIFICATE_REVOKED,
    GNUTLS_A_CERTIFICATE_EXPIRED,
    GNUTLS_A_CERTIFICATE_UNKNOWN,
    GNUTLS_A_ILLEGAL_PARAMETER,
    GNUTLS_A_UNKNOWN_CA,
    GNUTLS_A_ACCESS_DENIED,
    GNUTLS_A_DECODE_ERROR = 50,
    GNUTLS_A_DECRYPT_ERROR,
    GNUTLS_A_EXPORT_RESTRICTION = 60,
    GNUTLS_A_PROTOCOL_VERSION = 70,
    GNUTLS_A_INSUFFICIENT_SECURITY,
    GNUTLS_A_INTERNAL_ERROR = 80,
    GNUTLS_A_USER_CANCELED = 90,
    GNUTLS_A_NO_RENEGOTIATION = 100,
    GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
    GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
    GNUTLS_A_UNRECOGNIZED_NAME = 112,
    GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
    GNUTLS_A_INNER_APPLICATION_FAILURE = 208,
    GNUTLS_A_INNER_APPLICATION_VERIFICATION = 209
  } gnutls_alert_description_t;

enum gnutls_handshake_description_t

  typedef enum
  { GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
    GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
    GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
    GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
    GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
    GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
    GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
    GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
    GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
    GNUTLS_HANDSHAKE_FINISHED = 20,
    GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23
  } gnutls_handshake_description_t;

enum gnutls_certificate_status_t

  typedef enum
  {
    GNUTLS_CERT_INVALID = 2,	/* will be set if the certificate
				 * was not verified.
				 */
    GNUTLS_CERT_REVOKED = 32,	/* in X.509 this will be set only if CRLs are checked
				 */

    /* Those are extra information about the verification
     * process. Will be set only if the certificate was 
     * not verified.
     */
    GNUTLS_CERT_SIGNER_NOT_FOUND = 64,
    GNUTLS_CERT_SIGNER_NOT_CA = 128,
    GNUTLS_CERT_INSECURE_ALGORITHM = 256
  } gnutls_certificate_status_t;

enum gnutls_certificate_request_t

  typedef enum
  {
    GNUTLS_CERT_IGNORE,
    GNUTLS_CERT_REQUEST = 1,
    GNUTLS_CERT_REQUIRE
  } gnutls_certificate_request_t;

enum gnutls_openpgp_crt_status_t

  typedef enum
  { GNUTLS_OPENPGP_CERT,
    GNUTLS_OPENPGP_CERT_FINGERPRINT
  } gnutls_openpgp_crt_status_t;

enum gnutls_close_request_t

  typedef enum
  {
    GNUTLS_SHUT_RDWR = 0,
    GNUTLS_SHUT_WR = 1
  } gnutls_close_request_t;

GNUTLS_TLS1

#define GNUTLS_TLS1 GNUTLS_TLS1_0

enum gnutls_protocol_t

  typedef enum
  {
    GNUTLS_SSL3 = 1,
    GNUTLS_TLS1_0,
    GNUTLS_TLS1_1,
    GNUTLS_TLS1_2,
    GNUTLS_VERSION_UNKNOWN = 0xff
  } gnutls_protocol_t;

enum gnutls_certificate_type_t

  typedef enum
  {
    GNUTLS_CRT_UNKNOWN = 0,
    GNUTLS_CRT_X509 = 1,
    GNUTLS_CRT_OPENPGP
  } gnutls_certificate_type_t;

enum gnutls_x509_crt_fmt_t

  typedef enum
  {
    GNUTLS_X509_FMT_DER,
    GNUTLS_X509_FMT_PEM
  } gnutls_x509_crt_fmt_t;

enum gnutls_certificate_print_formats_t

  typedef enum gnutls_certificate_print_formats
    {
      GNUTLS_CRT_PRINT_FULL,
      GNUTLS_CRT_PRINT_ONELINE,
      GNUTLS_CRT_PRINT_UNSIGNED_FULL,
    } gnutls_certificate_print_formats_t;

enum gnutls_pk_algorithm_t

  typedef enum
  {
    GNUTLS_PK_UNKNOWN = 0,
    GNUTLS_PK_RSA = 1,
    GNUTLS_PK_DSA
  } gnutls_pk_algorithm_t;

gnutls_pk_algorithm_get_name ()

const char*         gnutls_pk_algorithm_get_name        (gnutls_pk_algorithm_t algorithm);

Convert a gnutls_pk_algorithm_t value to a string.

algorithm :

is a pk algorithm

Returns :

a string that contains the name of the specified public key algorithm, or NULL.

GNUTLS_SIGN_RSA_SHA

#define GNUTLS_SIGN_RSA_SHA GNUTLS_SIGN_RSA_SHA1

GNUTLS_SIGN_DSA_SHA

#define GNUTLS_SIGN_DSA_SHA GNUTLS_SIGN_DSA_SHA1

enum gnutls_sign_algorithm_t

  typedef enum
  {
    GNUTLS_SIGN_UNKNOWN = 0,
    GNUTLS_SIGN_RSA_SHA1 = 1,
    GNUTLS_SIGN_DSA_SHA1,
    GNUTLS_SIGN_RSA_MD5,
    GNUTLS_SIGN_RSA_MD2,
    GNUTLS_SIGN_RSA_RMD160,
    GNUTLS_SIGN_RSA_SHA256,
    GNUTLS_SIGN_RSA_SHA384,
    GNUTLS_SIGN_RSA_SHA512,
    GNUTLS_SIGN_RSA_SHA224
  } gnutls_sign_algorithm_t;

gnutls_sign_algorithm_get_name ()

const char*         gnutls_sign_algorithm_get_name      (gnutls_sign_algorithm_talgorithm );

Convert a gnutls_sign_algorithm_t value to a string.

algorithm :

is a sign algorithm

Returns :

a string that contains the name of the specified sign algorithm, or NULL.

gnutls_transport_ptr_t

  typedef void *gnutls_transport_ptr_t;

struct gnutls_session_int

struct gnutls_session_int;

gnutls_session_t

  typedef struct gnutls_session_int *gnutls_session_t;

struct gnutls_dh_params_int

struct gnutls_dh_params_int;

gnutls_dh_params_t

  typedef struct gnutls_dh_params_int *gnutls_dh_params_t;

struct gnutls_x509_privkey_int

struct gnutls_x509_privkey_int;

gnutls_rsa_params_t

  typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t;

struct gnutls_priority_st

struct gnutls_priority_st;

gnutls_priority_t

  typedef struct gnutls_priority_st *gnutls_priority_t;

gnutls_init ()

int                 gnutls_init                         (gnutls_session_t *session,
                                                         gnutls_connection_end_t con_end);

This function initializes the current session to null. Every session must be initialized before use, so internal structures can be allocated. This function allocates structures which can only be free'd by calling gnutls_deinit(). Returns zero on success.

con_end can be one of GNUTLS_CLIENT and GNUTLS_SERVER.

con_end :

indicate if this session is to be used for server or client.

session :

is a pointer to a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_deinit ()

void                gnutls_deinit                       (gnutls_session_t session);

This function clears all buffers associated with the session. This function will also remove session data from the session database if the session was terminated abnormally.

session :

is a gnutls_session_t structure.

gnutls_bye ()

int                 gnutls_bye                          (gnutls_session_t session,
                                                         gnutls_close_request_t how);

Terminates the current TLS/SSL connection. The connection should have been initiated using gnutls_handshake(). how should be one of GNUTLS_SHUT_RDWR, GNUTLS_SHUT_WR.

In case of GNUTLS_SHUT_RDWR then the TLS connection gets terminated and further receives and sends will be disallowed. If the return value is zero you may continue using the connection. GNUTLS_SHUT_RDWR actually sends an alert containing a close request and waits for the peer to reply with the same message.

In case of GNUTLS_SHUT_WR then the TLS connection gets terminated and further sends will be disallowed. In order to reuse the connection you should wait for an EOF from the peer. GNUTLS_SHUT_WR sends an alert containing a close request.

Note that not all implementations will properly terminate a TLS connection. Some of them, usually for performance reasons, will terminate only the underlying transport layer, thus causing a transmission error to the peer. This error cannot be distinguished from a malicious party prematurely terminating the session, thus this behavior is not recommended.

This function may also return GNUTLS_E_AGAIN or GNUTLS_E_INTERRUPTED; cf. gnutls_record_get_direction().

session :

is a gnutls_session_t structure.

how :

is an integer

Returns :

GNUTLS_E_SUCCESS on success, or an error code, see function documentation for entire semantics.

gnutls_handshake ()

int                 gnutls_handshake                    (gnutls_session_t session);

This function does the handshake of the TLS/SSL protocol, and initializes the TLS connection.

This function will fail if any problem is encountered, and will return a negative error code. In case of a client, if the client has asked to resume a session, but the server couldn't, then a full handshake will be performed.

The non-fatal errors such as GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED interrupt the handshake procedure, which should be later be resumed. Call this function again, until it returns 0; cf. gnutls_record_get_direction() and gnutls_error_is_fatal().

If this function is called by a server after a rehandshake request then GNUTLS_E_GOT_APPLICATION_DATA or GNUTLS_E_WARNING_ALERT_RECEIVED may be returned. Note that these are non fatal errors, only in the specific case of a rehandshake. Their meaning is that the client rejected the rehandshake request.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, otherwise an error.

gnutls_rehandshake ()

int                 gnutls_rehandshake                  (gnutls_session_t session);

This function will renegotiate security parameters with the client. This should only be called in case of a server.

This message informs the peer that we want to renegotiate parameters (perform a handshake).

If this function succeeds (returns 0), you must call the gnutls_handshake() function in order to negotiate the new parameters.

If the client does not wish to renegotiate parameters he will should with an alert message, thus the return code will be GNUTLS_E_WARNING_ALERT_RECEIVED and the alert will be GNUTLS_A_NO_RENEGOTIATION. A client may also choose to ignore this message.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, otherwise an error.

gnutls_alert_get ()

gnutls_alert_description_t gnutls_alert_get             (gnutls_session_t session);

This function will return the last alert number received. This function should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or GNUTLS_E_FATAL_ALERT_RECEIVED has been returned by a gnutls function. The peer may send alerts if he thinks some things were not right. Check gnutls.h for the available alert descriptions.

If no alert has been received the returned value is undefined.

session :

is a gnutls_session_t structure.

Returns :

returns the last alert received, a gnutls_alert_description_t value.

gnutls_alert_send ()

int                 gnutls_alert_send                   (gnutls_session_t session,
                                                         gnutls_alert_level_t level,
                                                         gnutls_alert_description_t desc);

This function will send an alert to the peer in order to inform him of something important (eg. his Certificate could not be verified). If the alert level is Fatal then the peer is expected to close the connection, otherwise he may ignore the alert and continue.

The error code of the underlying record send function will be returned, so you may also receive GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN as well.

session :

is a gnutls_session_t structure.

level :

is the level of the alert

desc :

is the alert description

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

gnutls_alert_send_appropriate ()

int                 gnutls_alert_send_appropriate       (gnutls_session_t session,
                                                         int err);

Sends an alert to the peer depending on the error code returned by a gnutls function. This function will call gnutls_error_to_alert() to determine the appropriate alert to send.

This function may also return GNUTLS_E_AGAIN, or GNUTLS_E_INTERRUPTED.

If the return value is GNUTLS_E_INVALID_REQUEST, then no alert has been sent to the peer.

session :

is a gnutls_session_t structure.

err :

is an integer

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

gnutls_alert_get_name ()

const char*         gnutls_alert_get_name               (gnutls_alert_description_t alert);

This function will return a string that describes the given alert number, or NULL. See gnutls_alert_get().

alert :

is an alert number gnutls_session_t structure.

Returns :

string corresponding to gnutls_alert_description_t value.

gnutls_cipher_get ()

gnutls_cipher_algorithm_t gnutls_cipher_get             (gnutls_session_t session);

Get currently used cipher.

session :

is a gnutls_session_t structure.

Returns :

the currently used cipher, an gnutls_cipher_algorithm_t type.

gnutls_kx_get ()

gnutls_kx_algorithm_t gnutls_kx_get                     (gnutls_session_t session);

Get currently used key exchange algorithm.

session :

is a gnutls_session_t structure.

Returns :

the key exchange algorithm used in the last handshake, a gnutls_kx_algorithm_t value.

gnutls_mac_get ()

gnutls_mac_algorithm_t gnutls_mac_get                   (gnutls_session_t session);

Get currently used MAC algorithm.

session :

is a gnutls_session_t structure.

Returns :

the currently used mac algorithm, a gnutls_mac_algorithm_t value.

gnutls_compression_get ()

gnutls_compression_method_t gnutls_compression_get      (gnutls_session_tsession );

Get currently used compression algorithm.

session :

is a gnutls_session_t structure.

Returns :

the currently used compression method, a gnutls_compression_method_t value.

gnutls_certificate_type_get ()

gnutls_certificate_type_t gnutls_certificate_type_get   (gnutls_session_tsession );

The certificate type is by default X.509, unless it is negotiated as a TLS extension.

session :

is a gnutls_session_t structure.

Returns :

the currently used gnutls_certificate_type_t certificate type.

gnutls_cipher_get_key_size ()

size_t              gnutls_cipher_get_key_size          (gnutls_cipher_algorithm_t algorithm);

Get key size for cipher.

algorithm :

is an encryption algorithm

Returns :

length (in bytes) of the given cipher's key size, or 0 if the given cipher is invalid.

gnutls_mac_get_key_size ()

size_t              gnutls_mac_get_key_size             (gnutls_mac_algorithm_t algorithm);

Get size of MAC key.

algorithm :

is an encryption algorithm

Returns :

length (in bytes) of the given MAC key size, or 0 if the given MAC algorithm is invalid.

gnutls_cipher_get_name ()

const char*         gnutls_cipher_get_name              (gnutls_cipher_algorithm_t algorithm);

Convert a gnutls_cipher_algorithm_t type to a string.

algorithm :

is an encryption algorithm

Returns :

a pointer to a string that contains the name of the specified cipher, or NULL.

gnutls_mac_get_name ()

const char*         gnutls_mac_get_name                 (gnutls_mac_algorithm_t algorithm);

Convert a gnutls_mac_algorithm_t value to a string.

algorithm :

is a MAC algorithm

Returns :

a string that contains the name of the specified MAC algorithm, or NULL.

gnutls_compression_get_name ()

const char*         gnutls_compression_get_name         (gnutls_compression_method_talgorithm );

Convert a gnutls_compression_method_t value to a string.

algorithm :

is a Compression algorithm

Returns :

a pointer to a string that contains the name of the specified compression algorithm, or NULL.

gnutls_kx_get_name ()

const char*         gnutls_kx_get_name                  (gnutls_kx_algorithm_t algorithm);

Convert a gnutls_kx_algorithm_t value to a string.

algorithm :

is a key exchange algorithm

Returns :

a pointer to a string that contains the name of the specified key exchange algorithm, or NULL.

gnutls_certificate_type_get_name ()

const char*         gnutls_certificate_type_get_name    (gnutls_certificate_type_ttype );

Convert a gnutls_certificate_type_t type to a string.

type :

is a certificate type

Returns :

a string that contains the name of the specified certificate type, or NULL in case of unknown types.

gnutls_mac_get_id ()

gnutls_mac_algorithm_t gnutls_mac_get_id                (const char *name);

Convert a string to a gnutls_mac_algorithm_t value. The names are compared in a case insensitive way.

algorithm :

is a MAC algorithm name

Returns :

an gnutls_mac_algorithm_tid of the specified in a string MAC algorithm, or GNUTLS_MAC_UNKNOWN on failures.

gnutls_compression_get_id ()

gnutls_compression_method_t gnutls_compression_get_id   (const char *name);

The names are compared in a case insensitive way.

algorithm :

is a compression method name

Returns :

an id of the specified in a string compression method, or GNUTLS_COMP_UNKNOWN on error.

gnutls_cipher_get_id ()

gnutls_cipher_algorithm_t gnutls_cipher_get_id          (const char *name);

The names are compared in a case insensitive way.

algorithm :

is a MAC algorithm name

Returns :

return a gnutls_cipher_algorithm_t value corresponding to the specified cipher, or GNUTLS_CIPHER_UNKNOWN on error.

gnutls_kx_get_id ()

gnutls_kx_algorithm_t gnutls_kx_get_id                  (const char *name);

Convert a string to a gnutls_kx_algorithm_t value. The names are compared in a case insensitive way.

algorithm :

is a KX name

Returns :

an id of the specified KX algorithm, or GNUTLS_KX_UNKNOWN on error.

gnutls_protocol_get_id ()

gnutls_protocol_t   gnutls_protocol_get_id              (const char *name);

The names are compared in a case insensitive way.

algorithm :

is a protocol name

Returns :

an id of the specified protocol, or GNUTLS_VERSION_UNKNOWN on error.

gnutls_certificate_type_get_id ()

gnutls_certificate_type_t gnutls_certificate_type_get_id
                                                        (const char *name);

The names are compared in a case insensitive way.

name :

is a certificate type name

Returns :

an id of the specified in a string certificate type, or GNUTLS_CRT_UNKNOWN on error.

gnutls_cipher_list ()

const gnutls_cipher_algorithm_t* gnutls_cipher_list     (void);

Get a list of supported cipher algorithms. Note that not necessarily all ciphers are supported as TLS cipher suites. For example, DES is not supported as a cipher suite, but is supported for other purposes (e.g., PKCS8 or similar).

Returns :

a zero-terminated list of gnutls_cipher_algorithm_t integers indicating the available ciphers.

gnutls_mac_list ()

const gnutls_mac_algorithm_t* gnutls_mac_list           (void);

Get a list of hash algorithms for use as MACs. Note that not necessarily all MACs are supported in TLS cipher suites. For example, MD2 is not supported as a cipher suite, but is supported for other purposes (e.g., X.509 signature verification or similar).

Returns :

Return a zero-terminated list of gnutls_mac_algorithm_t integers indicating the available MACs.

gnutls_compression_list ()

const gnutls_compression_method_t* gnutls_compression_list
                                                        (void);

Get a list of compression methods. Note that to be able to use LZO compression, you must link to libgnutls-extra and call gnutls_global_init_extra().

Returns :

a zero-terminated list of gnutls_compression_method_t integers indicating the available compression methods.

gnutls_protocol_list ()

const gnutls_protocol_t* gnutls_protocol_list           (void);

Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc.

Returns :

a zero-terminated list of gnutls_protocol_t integers indicating the available protocols.

gnutls_certificate_type_list ()

const gnutls_certificate_type_t* gnutls_certificate_type_list
                                                        (void);

Get a list of certificate types. Note that to be able to use OpenPGP certificates, you must link to libgnutls-extra and call gnutls_global_init_extra().

Returns :

a zero-terminated list of gnutls_certificate_type_t integers indicating the available certificate types.

gnutls_kx_list ()

const gnutls_kx_algorithm_t* gnutls_kx_list             (void);

Get a list of supported key exchange algorithms.

Returns :

a zero-terminated list of gnutls_kx_algorithm_t integers indicating the available key exchange algorithms.

gnutls_cipher_suite_info ()

const char*         gnutls_cipher_suite_info            (size_t i,
                                                         char *id,
                                                         gnutls_kx_algorithm_t *kx,
                                                         gnutls_cipher_algorithm_t *cipher,
                                                         gnutls_mac_algorithm_t *mac,
                                                         gnutls_protocol_t *version);

Get information about supported cipher suites. Use the function iteratively to get information about all supported cipher suites. Call with idx=0 to get information about first cipher suite, then idx=1 and so on until the function returns NULL.

idx :

index of cipher suite to get information about, starts on 0.

cs_id :

output buffer with room for 2 bytes, indicating cipher suite value

kx :

output variable indicating key exchange algorithm, or NULL.

cipher :

output variable indicating cipher, or NULL.

mac :

output variable indicating MAC algorithm, or NULL.

version :

output variable indicating TLS protocol version, or NULL.

Returns :

the name of idx cipher suite, and set the information about the cipher suite in the output variables. If idx is out of bounds, NULL is returned.

gnutls_error_is_fatal ()

int                 gnutls_error_is_fatal               (int error);

If a function returns a negative value you may feed that value to this function to see if it is fatal. Returns 1 for a fatal error 0 otherwise. However you may want to check the error code manually, since some non-fatal errors to the protocol may be fatal for you (your program).

This is only useful if you are dealing with errors from the record layer or the handshake layer.

For positive error values, 0 is returned.

error :

is an error returned by a gnutls function. Error should be a negative value.

gnutls_error_to_alert ()

int                 gnutls_error_to_alert               (int err,
                                                         int *level);

Get an alert depending on the error code returned by a gnutls function. All alerts sent by this function should be considered fatal. The only exception is when err is GNUTLS_E_REHANDSHAKE, where a warning alert should be sent to the peer indicating that no renegotiation will be performed.

If there is no mapping to a valid alert the alert to indicate internal error is returned.

err :

is a negative integer

level :

the alert level will be stored there

Returns :

the alert code to use for a particular error code.

gnutls_perror ()

void                gnutls_perror                       (int error);

This function is like perror(). The only difference is that it accepts an error number returned by a gnutls function.

error :

is an error returned by a gnutls function. Error is always a negative value.

gnutls_strerror ()

const char*         gnutls_strerror                     (int error);

This function is similar to strerror(). Differences: it accepts an error number returned by a gnutls function; In case of an unknown error a descriptive string is sent instead of NULL.

error :

is an error returned by a gnutls function. Error is always a negative value.

gnutls_handshake_set_private_extensions ()

void                gnutls_handshake_set_private_extensions
                                                        (gnutls_session_t session,
                                                         int allow);

This function will enable or disable the use of private cipher suites (the ones that start with 0xFF). By default or if allow is 0 then these cipher suites will not be advertized nor used.

Unless this function is called with the option to allow (1), then no compression algorithms, like LZO. That is because these algorithms are not yet defined in any RFC or even internet draft.

Enabling the private ciphersuites when talking to other than gnutls servers and clients may cause interoperability problems.

session :

is a gnutls_session_t structure.

allow :

is an integer (0 or 1)

gnutls_handshake_get_last_out ()

gnutls_handshake_description_t gnutls_handshake_get_last_out
                                                        (gnutls_session_t session);

This function is only useful to check where the last performed handshake failed. If the previous handshake succeed or was not performed at all then no meaningful value will be returned.

Check gnutls_handshake_description_t in gnutls.h for the available handshake descriptions.

session :

is a gnutls_session_t structure.

Returns :

the last handshake message type sent, a gnutls_handshake_description_t.

gnutls_handshake_get_last_in ()

gnutls_handshake_description_t gnutls_handshake_get_last_in
                                                        (gnutls_session_t session);

This function is only useful to check where the last performed handshake failed. If the previous handshake succeed or was not performed at all then no meaningful value will be returned.

Check gnutls_handshake_description_t in gnutls.h for the available handshake descriptions.

session :

is a gnutls_session_t structure.

Returns :

the last handshake message type received, a gnutls_handshake_description_t.

gnutls_record_send ()

ssize_t             gnutls_record_send                  (gnutls_session_t session,
                                                         const void *data,
                                                         size_t sizeofdata);

This function has the similar semantics with send(). The only difference is that is accepts a GNUTLS session, and uses different error codes.

Note that if the send buffer is full, send() will block this function. See the send() documentation for full information. You can replace the default push function by using gnutls_transport_set_ptr2() with a call to send() with a MSG_DONTWAIT flag if blocking is a problem.

If the EINTR is returned by the internal push function (the default is send()} then GNUTLS_E_INTERRUPTED will be returned. If GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call this function again, with the same parameters; alternatively you could provide a NULL pointer for data, and 0 for size. cf. gnutls_record_get_direction().

session :

is a gnutls_session_t structure.

data :

contains the data to send

sizeofdata :

is the length of the data

Returns :

the number of bytes sent, or a negative error code. The number of bytes sent might be less than sizeofdata. The maximum number of bytes this function can send in a single call depends on the negotiated maximum record size.

gnutls_record_recv ()

ssize_t             gnutls_record_recv                  (gnutls_session_t session,
                                                         void *data,
                                                         size_t sizeofdata);

This function has the similar semantics with recv(). The only difference is that is accepts a GNUTLS session, and uses different error codes.

In the special case that a server requests a renegotiation, the client may receive an error code of GNUTLS_E_REHANDSHAKE. This message may be simply ignored, replied with an alert containing NO_RENEGOTIATION, or replied with a new handshake, depending on the client's will.

If EINTR is returned by the internal push function (the default is recv()) then GNUTLS_E_INTERRUPTED will be returned. If GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call this function again to get the data. See also gnutls_record_get_direction().

A server may also receive GNUTLS_E_REHANDSHAKE when a client has initiated a handshake. In that case the server can only initiate a handshake or terminate the connection.

session :

is a gnutls_session_t structure.

data :

the buffer that the data will be read into

sizeofdata :

the number of requested bytes

Returns :

the number of bytes received and zero on EOF. A negative error code is returned in case of an error. The number of bytes received might be less than sizeofdata.

gnutls_read

#define gnutls_read gnutls_record_recv

gnutls_write

#define gnutls_write gnutls_record_send

gnutls_session_enable_compatibility_mode ()

void                gnutls_session_enable_compatibility_mode
                                                        (gnutls_session_t session);

This function can be used to disable certain (security) features in TLS in order to maintain maximum compatibility with buggy clients. It is equivalent to calling: gnutls_record_disable_padding()

Normally only servers that require maximum compatibility with everything out there, need to call this function.

session :

is a gnutls_session_t structure.

gnutls_record_disable_padding ()

void                gnutls_record_disable_padding       (gnutls_session_t session);

Used to disabled padding in TLS 1.0 and above. Normally you do not need to use this function, but there are buggy clients that complain if a server pads the encrypted data. This of course will disable protection against statistical attacks on the data.

Normally only servers that require maximum compatibility with everything out there, need to call this function.

session :

is a gnutls_session_t structure.

gnutls_record_get_direction ()

int                 gnutls_record_get_direction         (gnutls_session_t session);

This function provides information about the internals of the record protocol and is only useful if a prior gnutls function call (e.g. gnutls_handshake()) was interrupted for some reason, that is, if a function returned GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN. In such a case, you might want to call select() or poll() before calling the interrupted gnutls function again. To tell you whether a file descriptor should be selected for either reading or writing, gnutls_record_get_direction() returns 0 if the interrupted function was trying to read data, and 1 if it was trying to write data.

session :

is a gnutls_session_t structure.

Returns :

0 if trying to read data, 1 if trying to write data.

gnutls_record_get_max_size ()

size_t              gnutls_record_get_max_size          (gnutls_session_t session);

This function returns the maximum record packet size in this connection. The maximum record size is negotiated by the client after the first handshake message.

session :

is a gnutls_session_t structure.

gnutls_record_set_max_size ()

ssize_t             gnutls_record_set_max_size          (gnutls_session_t session,
                                                         size_t size);

This function sets the maximum record packet size in this connection. This property can only be set to clients. The server may choose not to accept the requested size.

Acceptable values are 512(=2^9), 1024(=2^10), 2048(=2^11) and 4096(=2^12). Returns 0 on success. The requested record size does get in effect immediately only while sending data. The receive part will take effect after a successful handshake.

This function uses a TLS extension called 'max record size'. Not all TLS implementations use or even understand this extension.

session :

is a gnutls_session_t structure.

size :

is the new size

gnutls_record_check_pending ()

size_t              gnutls_record_check_pending         (gnutls_session_t session);

This function checks if there are any data to receive in the gnutls buffers. Returns the size of that data or 0. Notice that you may also use select() to check for data in a TCP connection, instead of this function. (gnutls leaves some data in the tcp buffer in order for select to work).

session :

is a gnutls_session_t structure.

gnutls_prf ()

int                 gnutls_prf                          (gnutls_session_t session,
                                                         size_t label_size,
                                                         const char *label,
                                                         int server_random_first,
                                                         size_t extra_size,
                                                         const char *extra,
                                                         size_t outsize,
                                                         char *out);

Apply the TLS Pseudo-Random-Function (PRF) using the master secret on some data, seeded with the client and server random fields.

The label variable usually contain a string denoting the purpose for the generated data. The server_random_first indicate whether the client random field or the server random field should be first in the seed. Non-0 indicate that the server random field is first, 0 that the client random field is first.

The extra variable can be used to add more data to the seed, after the random variables. It can be used to tie make sure the generated output is strongly connected to some additional data (e.g., a string used in user authentication).

The output is placed in *OUT, which must be pre-allocated.

session :

is a gnutls_session_t structure.

label_size :

length of the label variable.

label :

label used in PRF computation, typically a short string.

server_random_first :

non-0 if server random field should be first in seed

extra_size :

length of the extra variable.

extra :

optional extra data to seed the PRF with.

outsize :

size of pre-allocated output buffer to hold the output.

out :

pre-allocate buffer to hold the generated data.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_prf_raw ()

int                 gnutls_prf_raw                      (gnutls_session_t session,
                                                         size_t label_size,
                                                         const char *label,
                                                         size_t seed_size,
                                                         const char *seed,
                                                         size_t outsize,
                                                         char *out);

Apply the TLS Pseudo-Random-Function (PRF) using the master secret on some data.

The label variable usually contain a string denoting the purpose for the generated data. The seed usually contain data such as the client and server random, perhaps together with some additional data that is added to guarantee uniqueness of the output for a particular purpose.

Because the output is not guaranteed to be unique for a particular session unless seed include the client random and server random fields (the PRF would output the same data on another connection resumed from the first one), it is not recommended to use this function directly. The gnutls_prf() function seed the PRF with the client and server random fields directly, and is recommended if you want to generate pseudo random data unique for each session.

session :

is a gnutls_session_t structure.

label_size :

length of the label variable.

label :

label used in PRF computation, typically a short string.

seed_size :

length of the seed variable.

seed :

optional extra data to seed the PRF with.

outsize :

size of pre-allocated output buffer to hold the output.

out :

pre-allocate buffer to hold the generated data.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

enum gnutls_server_name_type_t

  typedef enum
  {
    GNUTLS_NAME_DNS = 1
  } gnutls_server_name_type_t;

gnutls_server_name_set ()

int                 gnutls_server_name_set              (gnutls_session_t session,
                                                         gnutls_server_name_type_t type,
                                                         const void *name,
                                                         size_t name_length);

This function is to be used by clients that want to inform (via a TLS extension mechanism) the server of the name they connected to. This should be used by clients that connect to servers that do virtual hosting.

The value of name depends on the ind type. In case of GNUTLS_NAME_DNS, an ASCII or UTF-8 null terminated string, without the trailing dot, is expected. IPv4 or IPv6 addresses are not permitted.

session :

is a gnutls_session_t structure.

type :

specifies the indicator type

name :

is a string that contains the server name.

name_length :

holds the length of name

gnutls_server_name_get ()

int                 gnutls_server_name_get              (gnutls_session_t session,
                                                         void *data,
                                                         size_t *data_length,
                                                         unsigned int *type,
                                                         unsigned int indx);

This function will allow you to get the name indication (if any), a client has sent. The name indication may be any of the enumeration gnutls_server_name_type_t.

If type is GNUTLS_NAME_DNS, then this function is to be used by servers that support virtual hosting, and the data will be a null terminated UTF-8 string.

If data has not enough size to hold the server name GNUTLS_E_SHORT_MEMORY_BUFFER is returned, and data_length will hold the required size.

index is used to retrieve more than one server names (if sent by the client). The first server name has an index of 0, the second 1 and so on. If no name with the given index exists GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.

session :

is a gnutls_session_t structure.

data :

will hold the data

data_length :

will hold the data length. Must hold the maximum size of data.

type :

will hold the server name indicator type

indx :

is the index of the server_name

gnutls_oprfi_enable_client ()

void                gnutls_oprfi_enable_client          (gnutls_session_t session,
                                                         size_t len,
                                                         unsigned char *data);

Request that the client should attempt to negotiate the Opaque PRF Input TLS extension, using the given data as the client's Opaque PRF input.

The data is copied into the session context after this call, so you may de-allocate it immediately after calling this function.

session :

is a gnutls_session_t structure.

len :

length of Opaque PRF data to use in client.

data :

Opaque PRF data to use in client.

gnutls_oprfi_callback_func ()

int                 (*gnutls_oprfi_callback_func)       (gnutls_session_t session,
                                                         void *userdata,
                                                         size_t oprfi_len,
                                                         unsigned char *in_oprfi,
                                                         unsigned char *out_oprfi);

gnutls_oprfi_enable_server ()

void                gnutls_oprfi_enable_server          (gnutls_session_t session,
                                                         gnutls_oprfi_callback_func cb,
                                                         void *userdata);

Request that the server should attempt to accept the Opaque PRF Input TLS extension. If the client requests the extension, the provided callback cb will be invoked. The callback must have the following prototype:

int callback (gnutls_session_t session, void *userdata, size_t oprfi_len, const unsigned char *in_oprfi, unsigned char *out_oprfi);

The callback can inspect the client-provided data in the input parameters, and specify its own opaque prf input data in the output variable. The function must return 0 on success, otherwise the handshake will be aborted.

session :

is a gnutls_session_t structure.

cb :

function pointer to Opaque PRF extension server callback.

userdata :

hook passed to callback function for passing application state.

enum gnutls_supplemental_data_format_type_t

  typedef enum
    {
      GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0
    } gnutls_supplemental_data_format_type_t;

gnutls_supplemental_get_name ()

const char*         gnutls_supplemental_get_name        (gnutls_supplemental_data_format_type_t type);

gnutls_cipher_set_priority ()

int                 gnutls_cipher_set_priority          (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the ciphers supported by gnutls. Priority is higher for elements specified before others. After specifying the ciphers you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_cipher_algorithm_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_mac_set_priority ()

int                 gnutls_mac_set_priority             (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the mac algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_mac_algorithm_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_compression_set_priority ()

int                 gnutls_compression_set_priority     (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the compression algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.

TLS 1.0 does not define any compression algorithms except NULL. Other compression algorithms are to be considered as gnutls extensions.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_compression_method_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_kx_set_priority ()

int                 gnutls_kx_set_priority              (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the key exchange algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_kx_algorithm_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_protocol_set_priority ()

int                 gnutls_protocol_set_priority        (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the protocol versions supported by gnutls. This function actually enables or disables protocols. Newer protocol versions always have highest priority.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_protocol_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_certificate_type_set_priority ()

int                 gnutls_certificate_type_set_priority
                                                        (gnutls_session_t session,
                                                         const int *list);

Sets the priority on the certificate types supported by gnutls. Priority is higher for elements specified before others. After specifying the types you want, you must append a 0. Note that the certificate type priority is set on the client. The server does not use the cert type priority except for disabling types that were not specified.

session :

is a gnutls_session_t structure.

list :

is a 0 terminated list of gnutls_certificate_type_t elements.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_priority_init ()

int                 gnutls_priority_init                (gnutls_priority_t *,
                                                         const char *priority,
                                                         const char **err_pos);

Sets priorities for the ciphers, key exchange methods, macs and compression methods. This is to avoid using the gnutls_*_priority() functions.

The priorities option allows you to specify a semi-colon separated list of the cipher priorities to enable.

Unless the first keyword is "NONE" the defaults are: Protocols: TLS1.1, TLS1.0, and SSL3.0. Compression: NULL. Certificate types: X.509, OpenPGP.

You can also use predefined sets of ciphersuites: "PERFORMANCE" all the "secure" ciphersuites are enabled, limited to 128 bit ciphers and sorted by terms of speed performance.

"NORMAL" option enables all "secure" ciphersuites. The 256-bit ciphers are included as a fallback only. The ciphers are sorted by security margin.

"SECURE128" flag enables all "secure" ciphersuites with ciphers up to 128 bits, sorted by security margin.

"SECURE256" flag enables all "secure" ciphersuites including the 256 bit ciphers, sorted by security margin.

"EXPORT" all the ciphersuites are enabled, including the low-security 40 bit ciphers.

"NONE" nothing is enabled. This disables even protocols and compression methods.

Special keywords: '!' or '-' appended with an algorithm will remove this algorithm. '+' appended with an algorithm will add this algorithm. 'COMPAT' will enable compatibility features for a server.

To avoid collisions in order to specify a compression algorithm in this string you have to prefix it with "COMP-", protocol versions with "VERS-" and certificate types with "CTYPE-". All other algorithms don't need a prefix.

For key exchange algorithms when in NORMAL or SECURE levels the perfect forward secrecy algorithms take precendence of the other protocols. In all cases all the supported key exchange algorithms are enabled (except for the RSA-EXPORT which is only enabled in EXPORT level).

Note that although one can select very long key sizes (such as 256 bits) for symmetric algorithms, to actually increase security the public key algorithms have to use longer key sizes as well.

Examples: "NORMAL:!AES-128-CBC", "EXPORT:!VERS-TLS1.0:+COMP-DEFLATE:+CTYPE-OPENPGP", "NONE:+VERS-TLS1.0:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL", "NORMAL", "NORMAL:COMPAT".

For all the current available algorithms and protocols use "gnutls-cli -l" to get a listing.

priority_cache :

is a gnutls_prioritity_t structure.

priorities :

is a string describing priorities

err_pos :

In case of an error this will have the position in the string the error occured

Returns :

On syntax error GNUTLS_E_INVALID_REQUEST is returned, GNUTLS_E_SUCCESS on success, or an error code.

gnutls_priority_deinit ()

void                gnutls_priority_deinit              (gnutls_priority_t );

Deinitializes the priority cache.

priority_cache :

is a gnutls_prioritity_t structure.

gnutls_priority_set ()

int                 gnutls_priority_set                 (gnutls_session_t session,
                                                         gnutls_priority_t );

Sets the priorities to use on the ciphers, key exchange methods, macs and compression methods.

session :

is a gnutls_session_t structure.

priority :

is a gnutls_priority_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_priority_set_direct ()

int                 gnutls_priority_set_direct          (gnutls_session_t session,
                                                         const char *priority,
                                                         const char **err_pos);

Sets the priorities to use on the ciphers, key exchange methods, macs and compression methods. This function avoids keeping a priority cache and is used to directly set string priorities to a TLS session. For documentation check the gnutls_priority_init().

session :

is a gnutls_session_t structure.

priorities :

is a string describing priorities

err_pos :

In case of an error this will have the position in the string the error occured

Returns :

On syntax error GNUTLS_E_INVALID_REQUEST is returned, GNUTLS_E_SUCCESS on success, or an error code.

gnutls_set_default_priority ()

int                 gnutls_set_default_priority         (gnutls_session_t session);

Sets some default priority on the ciphers, key exchange methods, macs and compression methods.

This is the same as calling:

gnutls_priority_set_direct (session, "NORMAL", NULL);

This function is kept around for backwards compatibility, but because of its wide use it is still fully supported. If you wish to allow users to provide a string that specify which ciphers to use (which is recommended), you should use gnutls_priority_set_direct() or gnutls_priority_set() instead.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_set_default_export_priority ()

int                 gnutls_set_default_export_priority  (gnutls_session_t session);

Sets some default priority on the ciphers, key exchange methods, macs and compression methods. This function also includes weak algorithms.

This is the same as calling:

gnutls_priority_set_direct (session, "EXPORT", NULL);

This function is kept around for backwards compatibility, but because of its wide use it is still fully supported. If you wish to allow users to provide a string that specify which ciphers to use (which is recommended), you should use gnutls_priority_set_direct() or gnutls_priority_set() instead.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_cipher_suite_get_name ()

const char*         gnutls_cipher_suite_get_name        (gnutls_kx_algorithm_tkx_algorithm ,
                                                         gnutls_cipher_algorithm_tcipher_algorithm ,
                                                         gnutls_mac_algorithm_tmac_algorithm );

Note that the full cipher suite name must be prepended by TLS or SSL depending of the protocol in use.

kx_algorithm :

is a Key exchange algorithm

cipher_algorithm :

is a cipher algorithm

mac_algorithm :

is a MAC algorithm

Returns :

a string that contains the name of a TLS cipher suite, specified by the given algorithms, or NULL.

gnutls_protocol_get_version ()

gnutls_protocol_t   gnutls_protocol_get_version         (gnutls_session_t session);

Get TLS version, a gnutls_protocol_t value.

session :

is a gnutls_session_t structure.

Returns :

the version of the currently used protocol.

gnutls_protocol_get_name ()

const char*         gnutls_protocol_get_name            (gnutls_protocol_t version);

Convert a gnutls_protocol_t value to a string.

version :

is a (gnutls) version number

Returns :

a string that contains the name of the specified TLS version (e.g., "TLS1.0"), or NULL.

gnutls_session_set_data ()

int                 gnutls_session_set_data             (gnutls_session_t session,
                                                         const void *session_data,
                                                         size_t session_data_size);

Sets all session parameters, in order to resume a previously established session. The session data given must be the one returned by gnutls_session_get_data(). This function should be called before gnutls_handshake().

Keep in mind that session resuming is advisory. The server may choose not to resume the session, thus a full handshake will be performed.

session :

is a gnutls_session_t structure.

session_data :

is a pointer to space to hold the session.

session_data_size :

is the session's size

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

gnutls_session_get_data ()

int                 gnutls_session_get_data             (gnutls_session_t session,
                                                         void *session_data,
                                                         size_t *session_data_size);

Returns all session parameters, in order to support resuming. The client should call this, and keep the returned session, if he wants to resume that current version later by calling gnutls_session_set_data() This function must be called after a successful handshake.

Resuming sessions is really useful and speedups connections after a succesful one.

session :

is a gnutls_session_t structure.

session_data :

is a pointer to space to hold the session.

session_data_size :

is the session_data's size, or it will be set by the function.

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

gnutls_session_get_data2 ()

int                 gnutls_session_get_data2            (gnutls_session_t session,
                                                         gnutls_datum_t *data);

Returns all session parameters, in order to support resuming. The client should call this, and keep the returned session, if he wants to resume that current version later by calling gnutls_session_set_data() This function must be called after a successful handshake. The returned datum must be freed with gnutls_free().

Resuming sessions is really useful and speedups connections after a succesful one.

session :

is a gnutls_session_t structure.

session_data :

is a pointer to a datum that will hold the session.

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

GNUTLS_MAX_SESSION_ID

#define GNUTLS_MAX_SESSION_ID 32

gnutls_session_get_id ()

int                 gnutls_session_get_id               (gnutls_session_t session,
                                                         void *session_id,
                                                         size_t *session_id_size);

Returns the current session id. This can be used if you want to check if the next session you tried to resume was actually resumed. This is because resumed sessions have the same sessionID with the original session.

Session id is some data set by the server, that identify the current session. In TLS 1.0 and SSL 3.0 session id is always less than 32 bytes.

session :

is a gnutls_session_t structure.

session_id :

is a pointer to space to hold the session id.

session_id_size :

is the session id's size, or it will be set by the function.

Returns :

On success, GNUTLS_E_SUCCESS (0) is returned, otherwise an error code is returned.

TLS_MASTER_SIZE

#define TLS_MASTER_SIZE 48

TLS_RANDOM_SIZE

#define TLS_RANDOM_SIZE 32

gnutls_session_get_server_random ()

const void*         gnutls_session_get_server_random    (gnutls_session_t session);

Return a pointer to the 32-byte server random field used in the session. The pointer must not be modified or deallocated.

If a server random value has not yet been established, the output will be garbage; in particular, a NULL return value should not be expected.

session :

is a gnutls_session_t structure.

Returns :

pointer to server random data.

gnutls_session_get_client_random ()

const void*         gnutls_session_get_client_random    (gnutls_session_t session);

Return a pointer to the 32-byte client random field used in the session. The pointer must not be modified or deallocated.

If a client random value has not yet been established, the output will be garbage; in particular, a NULL return value should not be expected.

session :

is a gnutls_session_t structure.

Returns :

pointer to client random data.

gnutls_session_get_master_secret ()

const void*         gnutls_session_get_master_secret    (gnutls_session_t session);

Return a pointer to the 48-byte master secret in the session. The pointer must not be modified or deallocated.

If a master secret value has not yet been established, the output will be garbage; in particular, a NULL return value should not be expected.

Consider using gnutls_prf() rather than extracting the master secret and use it to derive further data.

session :

is a gnutls_session_t structure.

Returns :

pointer to master secret data.

gnutls_session_is_resumed ()

int                 gnutls_session_is_resumed           (gnutls_session_t session);

Check whether session is resumed or not.

session :

is a gnutls_session_t structure.

Returns :

non zero if this session is resumed, or a zero if this is a new session.

gnutls_db_store_func ()

int                 (*gnutls_db_store_func)             (void *,
                                                         gnutls_datum_t key,
                                                         gnutls_datum_t data);

gnutls_db_remove_func ()

int                 (*gnutls_db_remove_func)            (void *,
                                                         gnutls_datum_t key);

gnutls_db_retr_func ()

gnutls_datum_t      (*gnutls_db_retr_func)              (void *,
                                                         gnutls_datum_t key);

gnutls_db_set_cache_expiration ()

void                gnutls_db_set_cache_expiration      (gnutls_session_t session,
                                                         int seconds);

Set the expiration time for resumed sessions. The default is 3600 (one hour) at the time writing this.

session :

is a gnutls_session_t structure.

seconds :

is the number of seconds.

gnutls_db_remove_session ()

void                gnutls_db_remove_session            (gnutls_session_t session);

This function will remove the current session data from the session database. This will prevent future handshakes reusing these session data. This function should be called if a session was terminated abnormally, and before gnutls_deinit() is called.

Normally gnutls_deinit() will remove abnormally terminated sessions.

session :

is a gnutls_session_t structure.

gnutls_db_set_retrieve_function ()

void                gnutls_db_set_retrieve_function     (gnutls_session_t session,
                                                         gnutls_db_retr_func retr_func);

Sets the function that will be used to retrieve data from the resumed sessions database. This function must return a gnutls_datum_t containing the data on success, or a gnutls_datum_t containing null and 0 on failure.

The datum's data must be allocated using the function gnutls_malloc().

The first argument to retr_func() will be null unless gnutls_db_set_ptr() has been called.

session :

is a gnutls_session_t structure.

retr_func :

is the function.

gnutls_db_set_remove_function ()

void                gnutls_db_set_remove_function       (gnutls_session_t session,
                                                         gnutls_db_remove_func rem_func);

Sets the function that will be used to remove data from the resumed sessions database. This function must return 0 on success.

The first argument to rem_func() will be null unless gnutls_db_set_ptr() has been called.

session :

is a gnutls_session_t structure.

rem_func :

is the function.

gnutls_db_set_store_function ()

void                gnutls_db_set_store_function        (gnutls_session_t session,
                                                         gnutls_db_store_func store_func);

Sets the function that will be used to store data from the resumed sessions database. This function must remove 0 on success.

The first argument to store_func() will be null unless gnutls_db_set_ptr() has been called.

session :

is a gnutls_session_t structure.

store_func :

is the function

gnutls_db_set_ptr ()

void                gnutls_db_set_ptr                   (gnutls_session_t session,
                                                         void *ptr);

Sets the pointer that will be provided to db store, retrieve and delete functions, as the first argument.

session :

is a gnutls_session_t structure.

ptr :

is the pointer

gnutls_db_get_ptr ()

void*               gnutls_db_get_ptr                   (gnutls_session_t session);

Get db function pointer.

session :

is a gnutls_session_t structure.

Returns :

the pointer that will be sent to db store, retrieve and delete functions, as the first argument.

gnutls_db_check_entry ()

int                 gnutls_db_check_entry               (gnutls_session_t session,
                                                         gnutls_datum_t session_entry);

Check if database entry has expired. This function is to be used when you want to clear unnesessary session which occupy space in your backend.

session :

is a gnutls_session_t structure.

session_entry :

is the session data (not key)

Returns :

Returns GNUTLS_E_EXPIRED, if the database entry has expired or 0 otherwise.

gnutls_handshake_post_client_hello_func ()

int                 (*gnutls_handshake_post_client_hello_func)
                                                        (gnutls_session_t );

gnutls_handshake_set_post_client_hello_function ()

void                gnutls_handshake_set_post_client_hello_function
                                                        (gnutls_session_t ,
                                                         gnutls_handshake_post_client_hello_func );

This function will set a callback to be called after the client hello has been received (callback valid in server side only). This allows the server to adjust settings based on received extensions.

Those settings could be ciphersuites, requesting certificate, or anything else except for version negotiation (this is done before the hello message is parsed).

This callback must return 0 on success or a gnutls error code to terminate the handshake.

Warning: You should not use this function to terminate the handshake based on client input unless you know what you are doing. Before the handshake is finished there is no way to know if there is a man-in-the-middle attack being performed.

res :

is a gnutls_anon_server_credentials_t structure

func :

is the function to be called

gnutls_handshake_set_max_packet_length ()

void                gnutls_handshake_set_max_packet_length
                                                        (gnutls_session_t session,
                                                         size_t max);

This function will set the maximum size of all handshake messages. Handshakes over this size are rejected with GNUTLS_E_HANDSHAKE_TOO_LARGE error code. The default value is 48kb which is typically large enough. Set this to 0 if you do not want to set an upper limit.

The reason for restricting the handshake message sizes are to limit Denial of Service attacks.

session :

is a gnutls_session_t structure.

max :

is the maximum number.

gnutls_check_version ()

const char*         gnutls_check_version                (const char *req_version);

Check that the version of the library is at minimum the requested one and return the version string; return NULL if the condition is not satisfied. If a NULL is passed to this function, no check is done, but the version string is simply returned.

See LIBGNUTLS_VERSION for a suitable req_version string.

req_version :

the version to check

Returns :

Version string of run-time library, or NULL if the run-time library does not meet the required version number. If NULL is passed to this function no check is done and only the version string is returned.

gnutls_credentials_clear ()

void                gnutls_credentials_clear            (gnutls_session_t session);

Clears all the credentials previously set in this session.

session :

is a gnutls_session_t structure.

gnutls_credentials_set ()

int                 gnutls_credentials_set              (gnutls_session_t session,
                                                         gnutls_credentials_type_t type,
                                                         void *cred);

Sets the needed credentials for the specified type. Eg username, password - or public and private keys etc. The (void* cred) parameter is a structure that depends on the specified type and on the current session (client or server). [ In order to minimize memory usage, and share credentials between several threads gnutls keeps a pointer to cred, and not the whole cred structure. Thus you will have to keep the structure allocated until you call gnutls_deinit(). ]

For GNUTLS_CRD_ANON cred should be gnutls_anon_client_credentials_t in case of a client. In case of a server it should be gnutls_anon_server_credentials_t.

For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials_t in case of a client, and gnutls_srp_server_credentials_t, in case of a server.

For GNUTLS_CRD_CERTIFICATE cred should be gnutls_certificate_credentials_t.

session :

is a gnutls_session_t structure.

type :

is the type of the credentials

cred :

is a pointer to a structure.

gnutls_cred_set

#define gnutls_cred_set	gnutls_credentials_set

struct gnutls_certificate_credentials_st

struct gnutls_certificate_credentials_st;

gnutls_anon_free_server_credentials ()

void                gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

sc :

is an gnutls_anon_server_credentials_t structure.

gnutls_anon_allocate_server_credentials ()

int                 gnutls_anon_allocate_server_credentials
                                                        (gnutls_anon_server_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

sc :

is a pointer to an gnutls_anon_server_credentials_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_anon_set_server_dh_params ()

void                gnutls_anon_set_server_dh_params    (gnutls_anon_server_credentials_t res,
                                                         gnutls_dh_params_t dh_params);

This function will set the diffie hellman parameters for an anonymous server to use. These parameters will be used in Anonymous Diffie Hellman cipher suites.

res :

is a gnutls_anon_server_credentials_t structure

dh_params :

is a structure that holds diffie hellman parameters.

gnutls_anon_set_server_params_function ()

void                gnutls_anon_set_server_params_function
                                                        (gnutls_anon_server_credentials_tres ,
                                                         gnutls_params_function *func);

This function will set a callback in order for the server to get the diffie hellman parameters for anonymous authentication. The callback should return zero on success.

res :

is a gnutls_certificate_credentials_t structure

func :

is the function to be called

gnutls_anon_free_client_credentials ()

void                gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_tsc );

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

sc :

is an gnutls_anon_client_credentials_t structure.

gnutls_anon_allocate_client_credentials ()

int                 gnutls_anon_allocate_client_credentials
                                                        (gnutls_anon_client_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

sc :

is a pointer to an gnutls_anon_client_credentials_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_certificate_free_credentials ()

void                gnutls_certificate_free_credentials (gnutls_certificate_credentials_tsc );

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

This function does not free any temporary parameters associated with this structure (ie RSA and DH parameters are not freed by this function).

sc :

is an gnutls_certificate_credentials_t structure.

gnutls_certificate_allocate_credentials ()

int                 gnutls_certificate_allocate_credentials
                                                        (gnutls_certificate_credentials_t *res);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

res :

is a pointer to an gnutls_certificate_credentials_t structure.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_certificate_free_keys ()

void                gnutls_certificate_free_keys        (gnutls_certificate_credentials_t sc);

This function will delete all the keys and the certificates associated with the given credentials. This function must not be called when a TLS negotiation that uses the credentials is in progress.

sc :

is an gnutls_certificate_credentials_t structure.

gnutls_certificate_free_cas ()

void                gnutls_certificate_free_cas         (gnutls_certificate_credentials_t sc);

This function will delete all the CAs associated with the given credentials. Servers that do not use gnutls_certificate_verify_peers2() may call this to save some memory.

sc :

is an gnutls_certificate_credentials_t structure.

gnutls_certificate_free_ca_names ()

void                gnutls_certificate_free_ca_names    (gnutls_certificate_credentials_t sc);

This function will delete all the CA name in the given credentials. Clients may call this to save some memory since in client side the CA names are not used.

CA names are used by servers to advertize the CAs they support to clients.

sc :

is an gnutls_certificate_credentials_t structure.

gnutls_certificate_free_crls ()

void                gnutls_certificate_free_crls        (gnutls_certificate_credentials_t sc);

This function will delete all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

gnutls_certificate_set_dh_params ()

void                gnutls_certificate_set_dh_params    (gnutls_certificate_credentials_t res,
                                                         gnutls_dh_params_t dh_params);

This function will set the diffie hellman parameters for a certificate server to use. These parameters will be used in Ephemeral Diffie Hellman cipher suites. Note that only a pointer to the parameters are stored in the certificate handle, so if you deallocate the parameters before the certificate is deallocated, you must change the parameters stored in the certificate first.

res :

is a gnutls_certificate_credentials_t structure

dh_params :

is a structure that holds diffie hellman parameters.

gnutls_certificate_set_rsa_export_params ()

void                gnutls_certificate_set_rsa_export_params
                                                        (gnutls_certificate_credentials_tres ,
                                                         gnutls_rsa_params_t rsa_params);

This function will set the temporary RSA parameters for a certificate server to use. These parameters will be used in RSA-EXPORT cipher suites.

res :

is a gnutls_certificate_credentials_t structure

rsa_params :

is a structure that holds temporary RSA parameters.

gnutls_certificate_set_verify_flags ()

void                gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_tres ,
                                                         unsigned int flags);

This function will set the flags to be used at verification of the certificates. Flags must be OR of the gnutls_certificate_verify_flags enumerations.

res :

is a gnutls_certificate_credentials_t structure

flags :

are the flags

gnutls_certificate_set_verify_limits ()

void                gnutls_certificate_set_verify_limits
                                                        (gnutls_certificate_credentials_tres ,
                                                         unsigned int max_bits,
                                                         unsigned int max_depth);

This function will set some upper limits for the default verification function, gnutls_certificate_verify_peers2(), to avoid denial of service attacks. You can set them to zero to disable limits.

res :

is a gnutls_certificate_credentials structure

max_bits :

is the number of bits of an acceptable certificate (default 8200)

max_depth :

is maximum depth of the verification of a certificate chain (default 5)

gnutls_certificate_set_x509_trust_file ()

int                 gnutls_certificate_set_x509_trust_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CAFILE,
                                                         gnutls_x509_crt_fmt_t type);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

In case of a server the names of the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

cafile :

is a file containing the list of trusted CAs (DER or PEM list)

type :

is PEM or DER

Returns :

number of certificates processed, or a negative value on error.

gnutls_certificate_set_x509_trust_mem ()

int                 gnutls_certificate_set_x509_trust_mem
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CA,
                                                         gnutls_x509_crt_fmt_t type);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

In case of a server the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca :

is a list of trusted CAs or a DER certificate

type :

is DER or PEM

Returns :

the number of certificates processed or a negative value on error.

gnutls_certificate_set_x509_crl_file ()

int                 gnutls_certificate_set_x509_crl_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *crlfile,
                                                         gnutls_x509_crt_fmt_t type);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crlfile :

is a file containing the list of verified CRLs (DER or PEM list)

type :

is PEM or DER

Returns :

number of CRLs processed or a negative value on error.

gnutls_certificate_set_x509_crl_mem ()

int                 gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CRL,
                                                         gnutls_x509_crt_fmt_t type);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

CRL :

is a list of trusted CRLs. They should have been verified before.

type :

is DER or PEM

Returns :

number of CRLs processed, or a negative value on error.

gnutls_certificate_set_x509_key_file ()

int                 gnutls_certificate_set_x509_key_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         gnutls_x509_crt_fmt_t type);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).

Currently only PKCS-1 encoded RSA and DSA private keys are accepted by this function.

res :

is an gnutls_certificate_credentials_t structure.

CERTFILE :

is a file that containing the certificate list (path) for the specified private key, in PKCS7 format, or a list of certificates

KEYFILE :

is a file that contains the private key

type :

is PEM or DER

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_certificate_set_x509_key_mem ()

int                 gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         gnutls_x509_crt_fmt_t type);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).

Currently are supported: RSA PKCS-1 encoded private keys, DSA private keys.

DSA private keys are encoded the OpenSSL way, which is an ASN.1 DER sequence of 6 INTEGERs - version, p, q, g, pub, priv.

Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates is supported. This means that certificates intended for signing cannot be used for ciphersuites that require encryption.

If the certificate and the private key are given in PEM encoding then the strings that hold their values must be null terminated.

The key may be NULL if you are using a sign callback, see gnutls_sign_callback_set().

res :

is an gnutls_certificate_credentials_t structure.

cert :

contains a certificate list (path) for the specified private key

key :

is the private key, or NULL

type :

is PEM or DER

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_certificate_send_x509_rdn_sequence ()

void                gnutls_certificate_send_x509_rdn_sequence
                                                        (gnutls_session_t session,
                                                         int status);

If status is non zero, this function will order gnutls not to send the rdnSequence in the certificate request message. That is the server will not advertize it's trusted CAs to the peer. If status is zero then the default behaviour will take effect, which is to advertize the server's trusted CAs.

This function has no effect in clients, and in authentication methods other than certificate with X.509 certificates.

session :

is a pointer to a gnutls_session_t structure.

status :

is 0 or 1

gnutls_certificate_set_x509_simple_pkcs12_file ()

int                 gnutls_certificate_set_x509_simple_pkcs12_file
                                                        (gnutls_certificate_credentials_t res,
                                                         const char *pkcs12file,
                                                         gnutls_x509_crt_fmt_t type,
                                                         const char *password);

This function sets a certificate/private key pair and/or a CRL in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).

MAC:ed PKCS12 files are supported. Encrypted PKCS12 bags are supported. Encrypted PKCS8 private keys are supported. However, only password based security, and the same password for all operations, are supported.

The private keys may be RSA PKCS1 or DSA private keys encoded in the OpenSSL way.

PKCS12 file may contain many keys and/or certificates, and there is no way to identify which key/certificate pair you want. You should make sure the PKCS12 file only contain one key/certificate pair and/or one CRL.

It is believed that the limitations of this function is acceptable for most usage, and that any more flexibility would introduce complexity that would make it harder to use this functionality at all.

res :

is an gnutls_certificate_credentials_t structure.

pkcs12file :

filename of file containing PKCS12 blob.

type :

is PEM or DER of the pkcs12file.

password :

optional password used to decrypt PKCS12 file, bags and keys.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

gnutls_x509_privkey_t

  typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t;

struct gnutls_x509_crl_int

struct gnutls_x509_crl_int;

gnutls_x509_crl_t

  typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t;

struct gnutls_x509_crt_int

struct gnutls_x509_crt_int;

gnutls_x509_crt_t

  typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t;

struct gnutls_openpgp_keyring_int

struct gnutls_openpgp_keyring_int;

gnutls_openpgp_keyring_t

  typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t;

gnutls_certificate_set_x509_key ()

int                 gnutls_certificate_set_x509_key     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crt_t *cert_list,
                                                         int cert_list_size,
                                                         gnutls_x509_privkey_t key);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).

res :

is an gnutls_certificate_credentials_t structure.

cert_list :

contains a certificate list (path) for the specified private key

cert_list_size :

holds the size of the certificate list

key :

is a gnutls_x509_privkey_t key

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_trust ()

int                 gnutls_certificate_set_x509_trust   (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crt_t *ca_list,
                                                         int ca_list_size);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

In case of a server the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,
                                                         gnutls_alloc_functiongt_secure_alloc_func ,
                                                         gnutls_is_secure_functiongt_is_secure_func ,
                                                         gnutls_realloc_function gt_realloc_func,
                                                         gnutls_free_function gt_free_func);

This is the function were you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (malloc(), free()), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults (ie the gcrypt allocation functions).

This function must be called before gnutls_global_init() is called.

alloc_func :

it's the default memory allocation function. Like malloc().

secure_alloc_func :

This is the memory allocation function that will be used for sensitive data.

is_secure_func :

a function that returns 0 if the memory given is not secure. May be NULL.

realloc_func :

A realloc function

free_func :

The function that frees allocated data. Must accept a NULL pointer.

gnutls_malloc

  extern gnutls_alloc_function gnutls_malloc;

This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.

The allocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_secure_malloc

  extern gnutls_alloc_function gnutls_secure_malloc;

gnutls_realloc

  extern gnutls_realloc_function gnutls_realloc;

gnutls_calloc

  extern gnutls_calloc_function gnutls_calloc;

gnutls_free

  extern gnutls_free_function gnutls_free;

This function will free data pointed by ptr.

The deallocation function used is the one set by gnutls_global_set_mem_functions().


gnutls_strdup ()

char*               gnutls_strdup                       (const char *);

gnutls_log_func ()

void                (*gnutls_is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().

res :

is an gnutls_certificate_credentials_t structure.

ca_list :

is a list of trusted CAs

ca_list_size :

holds the size of the CA list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_set_x509_crl ()

int                 gnutls_certificate_set_x509_crl     (gnutls_certificate_credentials_t res,
                                                         gnutls_x509_crl_t *crl_list,
                                                         int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using gnutls_certificate_verify_peers2(). This function may be called multiple times.

res :

is an gnutls_certificate_credentials_t structure.

crl_list :

is a list of trusted CRLs. They should have been verified before.

crl_list_size :

holds the size of the crl_list

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

Since 2.4.0


gnutls_certificate_get_x509_cas ()

void                gnutls_certificate_get_x509_cas     (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crt_t **x509_ca_list,
                                                         unsigned int *ncas);

This function will export all the CAs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_ca_list :

will point to the CA list. Should be treated as constant

ncas :

the number of CAs

Since 2.4.0


gnutls_certificate_get_x509_crls ()

void                gnutls_certificate_get_x509_crls    (gnutls_certificate_credentials_t sc,
                                                         gnutls_x509_crl_t **x509_crl_list,
                                                         unsigned int *ncrls);

This function will export all the CRLs associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

x509_crl_list :

the exported CRL list. Should be treated as constant

ncrls :

the number of exported CRLs

Since 2.4.0


gnutls_certificate_get_openpgp_keyring ()

void                gnutls_certificate_get_openpgp_keyring
                                                        (gnutls_certificate_credentials_t sc,
                                                         gnutls_openpgp_keyring_t *keyring);

This function will export the OpenPGP keyring associated with the given credentials.

sc :

is an gnutls_certificate_credentials_t structure.

ring :

the exported keyring. Should be treated as constant

Since 2.4.0


gnutls_global_init ()

int                 gnutls_global_init                  (void);

This function initializes the global data to defaults. Every gnutls application has a global data which holds common parameters shared by gnutls session structures. You should call gnutls_global_deinit() when gnutls usage is no longer needed

Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.

This function increment a global counter, so that gnutls_global_deinit() only releases resources when it has been called as many times as gnutls_global_init(). This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.

Returns :

On success, GNUTLS_E_SUCCESS (zero) is returned, otherwise an error code is returned.

gnutls_global_deinit ()

void                gnutls_global_deinit                (void);

This function deinitializes the global data, that were initialized using gnutls_global_init().

Note! This function is not thread safe. See the discussion for gnutls_global_init() for more information.


gnutls_alloc_function ()

void*               (*gnutls_alloc_function)            (size_t );

gnutls_calloc_function ()

void*               (*gnutls_calloc_function)           (size_t ,
                                                         size_t );

gnutls_is_secure_function ()

int                 (*gnutls_is_secure_function)        (const void *);

gnutls_free_function ()

void                (*gnutls_free_function)             (void *);

gnutls_realloc_function ()

void*               (*gnutls_realloc_function)          (void *,
                                                         size_t );

gnutls_global_set_mem_functions ()

void                gnutls_global_set_mem_functions     (gnutls_alloc_function gt_alloc_func,