gnutls

gnutls

Functions

Types and Values

Description

Functions

gnutls_global_set_mem_functions ()

void
gnutls_global_set_mem_functions (gnutls_alloc_function alloc_func,
                                 gnutls_alloc_function secure_alloc_func,
                                 gnutls_is_secure_function is_secure_func,
                                 gnutls_realloc_function realloc_func,
                                 gnutls_free_function free_func);

gnutls_global_set_mem_functions is deprecated and should not be used in newly-written code.

since 3.3.0 it is no longer possible to replace the internally used memory allocation functions

This is the function where 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

This function must be called before gnutls_global_init() is called. This function is not thread safe.

Parameters

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_sec_param_to_pk_bits ()

return
gnutls_sec_param_to_pk_bits (GNUTLS_PK_DH Param1);

When generating private and public key pairs a difficult question is which size of "bits" the modulus will be in RSA and the group size in DSA. The easy answer is 1024, which is also wrong. This function will convert a human understandable security parameter to an appropriate size for the specific algorithm.

Parameters

algo

is a public key algorithm

 

param

is a security parameter

 

Returns

The number of bits, or (0).

Since: 2.12.0

Types and Values

HAVE_SSIZE_T

#define HAVE_SSIZE_T

gnutls_openpgp_crt_int

typedef struct {
	cdk_kbnode_t knode;
	uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
	int preferred_set;
} gnutls_openpgp_crt_int;

gnutls_openpgp_keyring_int

typedef struct {
	cdk_keydb_hd_t db;
} gnutls_openpgp_keyring_int;

gnutls_openpgp_privkey_int

typedef struct {
	cdk_kbnode_t knode;
	uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
	int preferred_set;
} gnutls_openpgp_privkey_int;

struct gnutls_priority_st

struct gnutls_priority_st {
	priority_st cipher;
	priority_st mac;
	priority_st kx;
	priority_st compression;
	priority_st protocol;
	priority_st cert_type;
	priority_st sign_algo;
	priority_st supported_ecc;

	/* to disable record padding */
	bool no_extensions;
	bool no_ext_master_secret;
	bool allow_large_records;
	unsigned int dumbfw;
	safe_renegotiation_t sr;
	bool min_record_version;
	bool server_precedence;
	bool allow_key_usage_violation;
	bool allow_server_key_usage_violation; /* for test suite purposes only */
	bool allow_wrong_pms;
	bool no_tickets;
	bool no_etm;
	bool have_cbc;
	/* Whether stateless compression will be used */
	bool stateless_compression;
	unsigned int additional_verify_flags;

	/* The session's expected security level.
	 * Will be used to determine the minimum DH bits,
	 * (or the acceptable certificate security level).
	 */
	gnutls_sec_param_t level;
	unsigned int dh_prime_bits; /* old (deprecated) variable */

	/* TLS_FALLBACK_SCSV */
	bool fallback;
};

struct gnutls_session_int

struct gnutls_session_int {
	security_parameters_st security_parameters;
	record_parameters_st *record_parameters[MAX_EPOCH_INDEX];
	internals_st internals;
	gnutls_key_st key;
};

gnutls_x509_crl_int

typedef struct {
	ASN1_TYPE crl;

	unsigned expanded;
	/* This is used to optimize reads by gnutls_x509_crl_get_crt_serial2() */
	ASN1_TYPE rcache;
	unsigned rcache_idx;
	int use_extensions;

	gnutls_datum_t der;
	gnutls_datum_t raw_issuer_dn;
} gnutls_x509_crl_int;

gnutls_x509_crq_int

typedef struct {
	ASN1_TYPE crq;
} gnutls_x509_crq_int;

gnutls_x509_crt_int

typedef struct {
	ASN1_TYPE cert;
	int use_extensions;
	unsigned expanded; /* a certificate has been expanded */
	unsigned modified; /* the cached values below may no longer be valid */

	struct pin_info_st pin;

	/* These two cached values allow fast calls to
	 * get_raw_*_dn(). */
	gnutls_datum_t raw_dn;
	gnutls_datum_t raw_issuer_dn;
	gnutls_datum_t raw_spki;

	gnutls_datum_t der;

	/* this cached value allows fast access to alt names */
	gnutls_subject_alt_names_t san;
	gnutls_subject_alt_names_t ian;

	/* backwards compatibility for gnutls_x509_crt_get_subject()
	 * and gnutls_x509_crt_get_issuer() */
	gnutls_x509_dn_st dn;
	gnutls_x509_dn_st idn;
} gnutls_x509_crt_int;

gnutls_x509_privkey_int

typedef struct {
	/* the size of params depends on the public
	 * key algorithm
	 */
	gnutls_pk_params_st params;

	gnutls_pk_algorithm_t pk_algorithm;
	unsigned expanded;
	unsigned flags;

	ASN1_TYPE key;
	struct pin_info_st pin;
} gnutls_x509_privkey_int;