ABI
Tracker

(GnuTLS)




Headers diff: 3.2.6 vs 3.2.7



 abstract.h (3.2.6)   abstract.h (3.2.7) 
skipping to change at line 32 skipping to change at line 32
#ifndef __GNUTLS_ABSTRACT_H #ifndef __GNUTLS_ABSTRACT_H
#define __GNUTLS_ABSTRACT_H #define __GNUTLS_ABSTRACT_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
#include <gnutls/pkcs11.h> #include <gnutls/pkcs11.h>
#include <gnutls/openpgp.h> #include <gnutls/openpgp.h>
#include <gnutls/tpm.h> #include <gnutls/tpm.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
/* Public key operations */ /* Public key operations */
#define GNUTLS_PUBKEY_VERIFY_FLAG_TLS_RSA GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RS A #define GNUTLS_PUBKEY_VERIFY_FLAG_TLS_RSA GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RS A
/** /**
* gnutls_pubkey_flags: * gnutls_pubkey_flags:
* @GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA: This indicates that a (raw) RSA sig nature is provided * @GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA: This indicates that a (raw) RSA sig nature is provided
* as in the TLS 1.0 protocol. * as in the TLS 1.0 protocol.
* @GNUTLS_PUBKEY_DISABLE_CALLBACKS: The following flag disables call to PI N callbacks. Only * @GNUTLS_PUBKEY_DISABLE_CALLBACKS: The following flag disables call to PI N callbacks. Only
* relevant to TPM keys. * relevant to TPM keys.
* @GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT: request an OPENPGP fingerprint i nstead of the default. * @GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT: request an OPENPGP fingerprint i nstead of the default.
* *
* Enumeration of different certificate import flags. * Enumeration of different certificate import flags.
*/ */
typedef enum gnutls_pubkey_flags typedef enum gnutls_pubkey_flags {
{ GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA = 1,
GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA = 1, GNUTLS_PUBKEY_DISABLE_CALLBACKS = 1 << 2,
GNUTLS_PUBKEY_DISABLE_CALLBACKS = 1<<2, GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT = 1 << 3,
GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT = 1<<3, } gnutls_pubkey_flags_t;
} gnutls_pubkey_flags_t;
typedef int (*gnutls_privkey_sign_func) (gnutls_privkey_t key, typedef int (*gnutls_privkey_sign_func) (gnutls_privkey_t key,
void *userdata, void *userdata,
const gnutls_datum_t * raw_data, const gnutls_datum_t *
gnutls_datum_t * signature); raw_data,
gnutls_datum_t * signature);
typedef int (*gnutls_privkey_decrypt_func) (gnutls_privkey_t key, typedef int (*gnutls_privkey_decrypt_func) (gnutls_privkey_t key,
void *userdata, void *userdata,
const gnutls_datum_t * cipherte const gnutls_datum_t *
xt, ciphertext,
gnutls_datum_t * plaintext); gnutls_datum_t * plaintext);
typedef void (*gnutls_privkey_deinit_func) (gnutls_privkey_t key, typedef void (*gnutls_privkey_deinit_func) (gnutls_privkey_t key,
void *userdata); void *userdata);
int gnutls_pubkey_init (gnutls_pubkey_t * key); int gnutls_pubkey_init(gnutls_pubkey_t * key);
void gnutls_pubkey_deinit (gnutls_pubkey_t key); void gnutls_pubkey_deinit(gnutls_pubkey_t key);
void gnutls_pubkey_set_pin_function (gnutls_pubkey_t key, void gnutls_pubkey_set_pin_function(gnutls_pubkey_t key,
gnutls_pin_callback_t fn, void *userd gnutls_pin_callback_t fn,
ata); void *userdata);
int gnutls_pubkey_get_pk_algorithm (gnutls_pubkey_t key, unsigned int *bits int gnutls_pubkey_get_pk_algorithm(gnutls_pubkey_t key,
); unsigned int *bits);
int gnutls_pubkey_import_x509 (gnutls_pubkey_t key, gnutls_x509_crt_t crt, int gnutls_pubkey_import_x509(gnutls_pubkey_t key,
unsigned int flags); gnutls_x509_crt_t crt, unsigned int flags);
int gnutls_pubkey_import_x509_crq (gnutls_pubkey_t key, gnutls_x509_crq_t c int gnutls_pubkey_import_x509_crq(gnutls_pubkey_t key,
rq, gnutls_x509_crq_t crq,
unsigned int flags); unsigned int flags);
int gnutls_pubkey_import_pkcs11 (gnutls_pubkey_t key, int gnutls_pubkey_import_pkcs11(gnutls_pubkey_t key,
gnutls_pkcs11_obj_t obj, unsigned int flag gnutls_pkcs11_obj_t obj,
s); unsigned int flags);
int gnutls_pubkey_import_openpgp (gnutls_pubkey_t key, int gnutls_pubkey_import_openpgp(gnutls_pubkey_t key,
gnutls_openpgp_crt_t crt, gnutls_openpgp_crt_t crt,
unsigned int flags); unsigned int flags);
int gnutls_pubkey_import_openpgp_raw (gnutls_pubkey_t pkey, int gnutls_pubkey_import_openpgp_raw(gnutls_pubkey_t pkey,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t
const gnutls_openpgp_keyid_t keyid, format,
unsigned int flags); const gnutls_openpgp_keyid_t
int gnutls_pubkey_import_x509_raw (gnutls_pubkey_t pkey, keyid, unsigned int flags);
const gnutls_datum_t * data, int gnutls_pubkey_import_x509_raw(gnutls_pubkey_t pkey,
gnutls_x509_crt_fmt_t format, const gnutls_datum_t * data,
unsigned int flags); gnutls_x509_crt_fmt_t format,
unsigned int flags);
int int
gnutls_pubkey_import_privkey (gnutls_pubkey_t key, gnutls_privkey_t pkey, gnutls_pubkey_import_privkey(gnutls_pubkey_t key,
unsigned int usage, unsigned int flags); gnutls_privkey_t pkey,
unsigned int usage, unsigned int flags);
int int
gnutls_pubkey_import_tpm_url (gnutls_pubkey_t pkey, gnutls_pubkey_import_tpm_url(gnutls_pubkey_t pkey,
const char* url, const char *url,
const char *srk_password, const char *srk_password, unsigned int flags);
unsigned int flags);
int int
gnutls_pubkey_import_url (gnutls_pubkey_t key, const char *url, gnutls_pubkey_import_url(gnutls_pubkey_t key, const char *url,
unsigned int flags); unsigned int flags);
int int
gnutls_pubkey_import_tpm_raw (gnutls_pubkey_t pkey, gnutls_pubkey_import_tpm_raw(gnutls_pubkey_t pkey,
const gnutls_datum_t * fdata, const gnutls_datum_t * fdata,
gnutls_tpmkey_fmt_t format, gnutls_tpmkey_fmt_t format,
const char *srk_password, const char *srk_password, unsigned int flags);
unsigned int flags);
int gnutls_pubkey_get_preferred_hash_algorithm (gnutls_pubkey_t key, int gnutls_pubkey_get_preferred_hash_algorithm(gnutls_pubkey_t key,
gnutls_digest_algorithm_t * gnutls_digest_algorithm_t
hash, unsigned int *mand); * hash, unsigned int *mand);
int gnutls_pubkey_get_pk_rsa_raw (gnutls_pubkey_t key, int gnutls_pubkey_get_pk_rsa_raw(gnutls_pubkey_t key,
gnutls_datum_t * m, gnutls_datum_t * e); gnutls_datum_t * m, gnutls_datum_t * e);
int gnutls_pubkey_get_pk_dsa_raw (gnutls_pubkey_t key, int gnutls_pubkey_get_pk_dsa_raw(gnutls_pubkey_t key,
gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * p,
gnutls_datum_t * g, gnutls_datum_t * y); gnutls_datum_t * q,
int gnutls_pubkey_get_pk_ecc_raw (gnutls_pubkey_t key, gnutls_ecc_curve_t * gnutls_datum_t * g, gnutls_datum_t * y);
curve, int gnutls_pubkey_get_pk_ecc_raw(gnutls_pubkey_t key,
gnutls_datum_t * x, gnutls_datum_t * y); gnutls_ecc_curve_t * curve,
int gnutls_pubkey_get_pk_ecc_x962 (gnutls_pubkey_t key, gnutls_datum_t* par gnutls_datum_t * x, gnutls_datum_t * y);
ameters, int gnutls_pubkey_get_pk_ecc_x962(gnutls_pubkey_t key,
gnutls_datum_t * ecpoint); gnutls_datum_t * parameters,
gnutls_datum_t * ecpoint);
int gnutls_pubkey_export (gnutls_pubkey_t key, int gnutls_pubkey_export(gnutls_pubkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size); void *output_data, size_t * output_data_size);
int gnutls_pubkey_export2 (gnutls_pubkey_t key, int gnutls_pubkey_export2(gnutls_pubkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
gnutls_datum_t * out); gnutls_datum_t * out);
int gnutls_pubkey_get_key_id (gnutls_pubkey_t key, unsigned int flags, int gnutls_pubkey_get_key_id(gnutls_pubkey_t key,
unsigned char *output_data, unsigned int flags,
size_t * output_data_size); unsigned char *output_data,
size_t * output_data_size);
int int
gnutls_pubkey_get_openpgp_key_id (gnutls_pubkey_t key, unsigned int flags, gnutls_pubkey_get_openpgp_key_id(gnutls_pubkey_t key,
unsigned char *output_data, unsigned int flags,
size_t * output_data_size, unsigned char *output_data,
unsigned int *subkey); size_t * output_data_size,
unsigned int *subkey);
int gnutls_pubkey_get_key_usage (gnutls_pubkey_t key, unsigned int *usage); int gnutls_pubkey_get_key_usage(gnutls_pubkey_t key, unsigned int *usage);
int gnutls_pubkey_set_key_usage (gnutls_pubkey_t key, unsigned int usage); int gnutls_pubkey_set_key_usage(gnutls_pubkey_t key, unsigned int usage);
int gnutls_pubkey_import (gnutls_pubkey_t key, int gnutls_pubkey_import(gnutls_pubkey_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_pubkey_import_pkcs11_url (gnutls_pubkey_t key, const char *url, int gnutls_pubkey_import_pkcs11_url(gnutls_pubkey_t key,
unsigned int flags const char *url, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); /* GNUTLS_PKCS11_OBJ_FLAG_* */
int gnutls_pubkey_import_dsa_raw (gnutls_pubkey_t key, );
const gnutls_datum_t * p, int gnutls_pubkey_import_dsa_raw(gnutls_pubkey_t key,
const gnutls_datum_t * q, const gnutls_datum_t * p,
const gnutls_datum_t * g, const gnutls_datum_t * q,
const gnutls_datum_t * y); const gnutls_datum_t * g,
int gnutls_pubkey_import_rsa_raw (gnutls_pubkey_t key, const gnutls_datum_t * y);
const gnutls_datum_t * m, int gnutls_pubkey_import_rsa_raw(gnutls_pubkey_t key,
const gnutls_datum_t * e); const gnutls_datum_t * m,
const gnutls_datum_t * e);
int int
gnutls_pubkey_import_ecc_x962 (gnutls_pubkey_t key, gnutls_pubkey_import_ecc_x962(gnutls_pubkey_t key,
const gnutls_datum_t * parameters, const gnutls_datum_t * parameters,
const gnutls_datum_t * ecpoint); const gnutls_datum_t * ecpoint);
int int
gnutls_pubkey_import_ecc_raw (gnutls_pubkey_t key, gnutls_pubkey_import_ecc_raw(gnutls_pubkey_t key,
gnutls_ecc_curve_t curve, gnutls_ecc_curve_t curve,
const gnutls_datum_t * x, const gnutls_datum_t * x,
const gnutls_datum_t * y); const gnutls_datum_t * y);
int int
gnutls_pubkey_encrypt_data (gnutls_pubkey_t key, unsigned int flags, gnutls_pubkey_encrypt_data(gnutls_pubkey_t key,
const gnutls_datum_t * plaintext, unsigned int flags,
gnutls_datum_t * ciphertext); const gnutls_datum_t * plaintext,
gnutls_datum_t * ciphertext);
int gnutls_x509_crt_set_pubkey (gnutls_x509_crt_t crt, gnutls_pubkey_t key) ; int gnutls_x509_crt_set_pubkey(gnutls_x509_crt_t crt, gnutls_pubkey_t key);
int gnutls_x509_crq_set_pubkey (gnutls_x509_crq_t crq, gnutls_pubkey_t key) ; int gnutls_x509_crq_set_pubkey(gnutls_x509_crq_t crq, gnutls_pubkey_t key);
int int
gnutls_pubkey_verify_hash2 (gnutls_pubkey_t key, gnutls_pubkey_verify_hash2(gnutls_pubkey_t key,
gnutls_sign_algorithm_t algo, gnutls_sign_algorithm_t algo,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * hash, const gnutls_datum_t * hash,
const gnutls_datum_t * signature); const gnutls_datum_t * signature);
int int
gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key, gnutls_pubkey_get_verify_algorithm(gnutls_pubkey_t key,
const gnutls_datum_t * signature, const gnutls_datum_t *
gnutls_digest_algorithm_t * hash); signature,
gnutls_digest_algorithm_t * hash);
int int
gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey, gnutls_pubkey_verify_data2(gnutls_pubkey_t pubkey,
gnutls_sign_algorithm_t algo, gnutls_sign_algorithm_t algo,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
const gnutls_datum_t * signature); const gnutls_datum_t * signature);
/* Private key operations */ /* Private key operations */
int gnutls_privkey_init (gnutls_privkey_t * key); int gnutls_privkey_init(gnutls_privkey_t * key);
void gnutls_privkey_deinit (gnutls_privkey_t key); void gnutls_privkey_deinit(gnutls_privkey_t key);
void gnutls_privkey_set_pin_function (gnutls_privkey_t key, void gnutls_privkey_set_pin_function(gnutls_privkey_t key,
gnutls_pin_callback_t fn, void *userd gnutls_pin_callback_t fn,
ata); void *userdata);
int gnutls_privkey_get_pk_algorithm (gnutls_privkey_t key, int gnutls_privkey_get_pk_algorithm(gnutls_privkey_t key,
unsigned int *bits); unsigned int *bits);
gnutls_privkey_type_t gnutls_privkey_get_type (gnutls_privkey_t key); gnutls_privkey_type_t gnutls_privkey_get_type(gnutls_privkey_t key);
int gnutls_privkey_status (gnutls_privkey_t key); int gnutls_privkey_status(gnutls_privkey_t key);
/** /**
* gnutls_privkey_flags: * gnutls_privkey_flags:
* @GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA: Make an RSA signature on the hashed data as in the TLS protocol. * @GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA: Make an RSA signature on the hashed data as in the TLS protocol.
* @GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE: When importing a private key, autom atically * @GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE: When importing a private key, autom atically
* release it when the structure it was imported is released. * release it when the structure it was imported is released.
* @GNUTLS_PRIVKEY_IMPORT_COPY: Copy required values during import. * @GNUTLS_PRIVKEY_IMPORT_COPY: Copy required values during import.
* @GNUTLS_PRIVKEY_DISABLE_CALLBACKS: The following flag disables call to P IN callbacks etc. * @GNUTLS_PRIVKEY_DISABLE_CALLBACKS: The following flag disables call to P IN callbacks etc.
* Only relevant to TPM keys. * Only relevant to TPM keys.
* *
* Enumeration of different certificate import flags. * Enumeration of different certificate import flags.
*/ */
typedef enum gnutls_privkey_flags typedef enum gnutls_privkey_flags {
{ GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE = 1,
GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE = 1, GNUTLS_PRIVKEY_IMPORT_COPY = 1 << 1,
GNUTLS_PRIVKEY_IMPORT_COPY = 1<<1, GNUTLS_PRIVKEY_DISABLE_CALLBACKS = 1 << 2,
GNUTLS_PRIVKEY_DISABLE_CALLBACKS = 1<<2, GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA = 1 << 4,
GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA = 1<<4, } gnutls_privkey_flags_t;
} gnutls_privkey_flags_t;
int gnutls_privkey_import_pkcs11 (gnutls_privkey_t pkey, int gnutls_privkey_import_pkcs11(gnutls_privkey_t pkey,
gnutls_pkcs11_privkey_t key, gnutls_pkcs11_privkey_t key,
unsigned int flags); unsigned int flags);
int gnutls_privkey_import_x509 (gnutls_privkey_t pkey, int gnutls_privkey_import_x509(gnutls_privkey_t pkey,
gnutls_x509_privkey_t key, gnutls_x509_privkey_t key,
unsigned int flags); unsigned int flags);
int gnutls_privkey_import_openpgp (gnutls_privkey_t pkey, int gnutls_privkey_import_openpgp(gnutls_privkey_t pkey,
gnutls_openpgp_privkey_t key, gnutls_openpgp_privkey_t key,
unsigned int flags); unsigned int flags);
int gnutls_privkey_import_openpgp_raw (gnutls_privkey_t pkey, int gnutls_privkey_import_openpgp_raw(gnutls_privkey_t pkey,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t
const gnutls_openpgp_keyid_t keyid, format,
const char* password); const gnutls_openpgp_keyid_t
keyid, const char *password);
int gnutls_privkey_import_x509_raw (gnutls_privkey_t pkey, int gnutls_privkey_import_x509_raw(gnutls_privkey_t pkey,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
const char* password, unsigned int flag const char *password,
s); unsigned int flags);
int int
gnutls_privkey_import_tpm_raw (gnutls_privkey_t pkey, gnutls_privkey_import_tpm_raw(gnutls_privkey_t pkey,
const gnutls_datum_t * fdata, const gnutls_datum_t * fdata,
gnutls_tpmkey_fmt_t format, gnutls_tpmkey_fmt_t format,
const char *srk_password, const char *srk_password,
const char *key_password, unsigned int flags) const char *key_password,
; unsigned int flags);
int int
gnutls_privkey_import_tpm_url (gnutls_privkey_t pkey, gnutls_privkey_import_tpm_url(gnutls_privkey_t pkey,
const char* url, const char *srk_password, const char *key_passwo const char *url,
rd, const char *srk_password,
unsigned int flags); const char *key_password,
unsigned int flags);
int gnutls_privkey_import_url (gnutls_privkey_t key, const char *url, unsig int gnutls_privkey_import_url(gnutls_privkey_t key,
ned int flags); const char *url, unsigned int flags);
int gnutls_privkey_import_pkcs11_url (gnutls_privkey_t key, const char *url int gnutls_privkey_import_pkcs11_url(gnutls_privkey_t key,
); const char *url);
int int
gnutls_privkey_import_ext (gnutls_privkey_t pkey, gnutls_privkey_import_ext(gnutls_privkey_t pkey,
gnutls_pk_algorithm_t pk, gnutls_pk_algorithm_t pk,
void* userdata, void *userdata,
gnutls_privkey_sign_func sign_func, gnutls_privkey_sign_func sign_func,
gnutls_privkey_decrypt_func decrypt_func, gnutls_privkey_decrypt_func
unsigned int flags); decrypt_func, unsigned int flags);
int int
gnutls_privkey_import_ext2 (gnutls_privkey_t pkey, gnutls_privkey_import_ext2(gnutls_privkey_t pkey,
gnutls_pk_algorithm_t pk, gnutls_pk_algorithm_t pk,
void* userdata, void *userdata,
gnutls_privkey_sign_func sign_func, gnutls_privkey_sign_func sign_func,
gnutls_privkey_decrypt_func decrypt_func, gnutls_privkey_decrypt_func
gnutls_privkey_deinit_func deinit_func, decrypt_func,
unsigned int flags); gnutls_privkey_deinit_func deinit_func,
unsigned int flags);
int gnutls_privkey_sign_data (gnutls_privkey_t signer, int gnutls_privkey_sign_data(gnutls_privkey_t signer,
gnutls_digest_algorithm_t hash, gnutls_digest_algorithm_t hash,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_datum_t * signature); gnutls_datum_t * signature);
int gnutls_privkey_sign_hash (gnutls_privkey_t signer, int gnutls_privkey_sign_hash(gnutls_privkey_t signer,
gnutls_digest_algorithm_t hash_algo, gnutls_digest_algorithm_t hash_algo,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * hash_data, const gnutls_datum_t * hash_data,
gnutls_datum_t * signature); gnutls_datum_t * signature);
int gnutls_privkey_decrypt_data (gnutls_privkey_t key, int gnutls_privkey_decrypt_data(gnutls_privkey_t key,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * ciphertext, const gnutls_datum_t * ciphertext,
gnutls_datum_t * plaintext); gnutls_datum_t * plaintext);
int gnutls_x509_crt_privkey_sign (gnutls_x509_crt_t crt, int gnutls_x509_crt_privkey_sign(gnutls_x509_crt_t crt,
gnutls_x509_crt_t issuer, gnutls_x509_crt_t issuer,
gnutls_privkey_t issuer_key, gnutls_privkey_t issuer_key,
gnutls_digest_algorithm_t dig, gnutls_digest_algorithm_t dig,
unsigned int flags); unsigned int flags);
int gnutls_x509_crl_privkey_sign (gnutls_x509_crl_t crl, int gnutls_x509_crl_privkey_sign(gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer, gnutls_x509_crt_t issuer,
gnutls_privkey_t issuer_key, gnutls_privkey_t issuer_key,
gnutls_digest_algorithm_t dig, gnutls_digest_algorithm_t dig,
unsigned int flags); unsigned int flags);
int gnutls_x509_crq_privkey_sign (gnutls_x509_crq_t crq, int gnutls_x509_crq_privkey_sign(gnutls_x509_crq_t crq,
gnutls_privkey_t key, gnutls_privkey_t key,
gnutls_digest_algorithm_t dig, gnutls_digest_algorithm_t dig,
unsigned int flags); unsigned int flags);
/** /**
* gnutls_pcert_st: * gnutls_pcert_st:
* @pubkey: public key of parsed certificate. * @pubkey: public key of parsed certificate.
* @cert: certificate itself of parsed certificate * @cert: certificate itself of parsed certificate
* @type: type of certificate, a #gnutls_certificate_type_t type. * @type: type of certificate, a #gnutls_certificate_type_t type.
* *
* A parsed certificate. * A parsed certificate.
*/ */
typedef struct gnutls_pcert_st typedef struct gnutls_pcert_st {
{ gnutls_pubkey_t pubkey;
gnutls_pubkey_t pubkey; gnutls_datum_t cert;
gnutls_datum_t cert; gnutls_certificate_type_t type;
gnutls_certificate_type_t type;
} gnutls_pcert_st; } gnutls_pcert_st;
/* Do not initialize the "cert" element of /* Do not initialize the "cert" element of
* the certificate */ * the certificate */
#define GNUTLS_PCERT_NO_CERT 1 #define GNUTLS_PCERT_NO_CERT 1
int gnutls_pcert_import_x509 (gnutls_pcert_st* pcert, int gnutls_pcert_import_x509(gnutls_pcert_st * pcert,
gnutls_x509_crt_t crt, unsigned int flags); gnutls_x509_crt_t crt, unsigned int flags);
int int
gnutls_pcert_list_import_x509_raw (gnutls_pcert_st * pcerts, gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts,
unsigned int *pcert_max, unsigned int *pcert_max,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int fla gnutls_x509_crt_fmt_t format,
gs); unsigned int flags);
int gnutls_pcert_import_x509_raw (gnutls_pcert_st* pcert, int gnutls_pcert_import_x509_raw(gnutls_pcert_st * pcert,
const gnutls_datum_t* cert, const gnutls_datum_t * cert,
gnutls_x509_crt_fmt_t format, unsigned int flags); gnutls_x509_crt_fmt_t format,
unsigned int flags);
int gnutls_pcert_import_openpgp_raw (gnutls_pcert_st* pcert, int gnutls_pcert_import_openpgp_raw(gnutls_pcert_st * pcert,
const gnutls_datum_t* cert, const gnutls_datum_t * cert,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t
gnutls_openpgp_keyid_t keyid, unsigned int flags); format,
gnutls_openpgp_keyid_t keyid,
unsigned int flags);
int gnutls_pcert_import_openpgp (gnutls_pcert_st* pcert, int gnutls_pcert_import_openpgp(gnutls_pcert_st * pcert,
gnutls_openpgp_crt_t crt, unsigned int flags); gnutls_openpgp_crt_t crt,
unsigned int flags);
void gnutls_pcert_deinit (gnutls_pcert_st* pcert); void gnutls_pcert_deinit(gnutls_pcert_st * pcert);
/* For certificate credentials */ /* For certificate credentials */
/* This is the same as gnutls_certificate_retrieve_function() /* This is the same as gnutls_certificate_retrieve_function()
* but retrieves a gnutls_pcert_st which requires much less processing * but retrieves a gnutls_pcert_st which requires much less processi
* within the library. ng
*/ * within the library.
typedef int gnutls_certificate_retrieve_function2 (gnutls_session_t, */
const gnutls_datum_t * typedef int gnutls_certificate_retrieve_function2(gnutls_session_t,
req_ca_rdn, const
int nreqs, gnutls_datum_t *
const req_ca_rdn,
gnutls_pk_algorithm_t int nreqs, const
* pk_algos, gnutls_pk_algorithm_t
int pk_algos_length, * pk_algos,
gnutls_pcert_st **, int
unsigned int *pcert_len pk_algos_length,
gth, gnutls_pcert_st
gnutls_privkey_t *privk **, unsigned int
ey); *pcert_length,
gnutls_privkey_t
* privkey);
void gnutls_certificate_set_retrieve_function2 ( void gnutls_certificate_set_retrieve_function2
gnutls_certificate_credentials_t cred, (gnutls_certificate_credentials_t cred,
gnutls_certificate_retrieve_function2 * func); gnutls_certificate_retrieve_function2 * func);
int int
gnutls_certificate_set_key (gnutls_certificate_credentials_t res, gnutls_certificate_set_key(gnutls_certificate_credentials_t res,
const char** names, const char **names,
int names_size, int names_size,
gnutls_pcert_st * pcert_list, gnutls_pcert_st * pcert_list,
int pcert_list_size, int pcert_list_size, gnutls_privkey_t key);
gnutls_privkey_t key);
#include <gnutls/compat.h> #include <gnutls/compat.h>
int gnutls_pubkey_verify_data (gnutls_pubkey_t pubkey, int gnutls_pubkey_verify_data(gnutls_pubkey_t pubkey,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
const gnutls_datum_t * signature) _GNUTLS_GC const gnutls_datum_t *
C_ATTR_DEPRECATED; signature) _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned int flags, int gnutls_pubkey_verify_hash(gnutls_pubkey_t key,
const gnutls_datum_t * hash, unsigned int flags,
const gnutls_datum_t * signature) _GNUTLS_GCC_AT const gnutls_datum_t * hash,
TR_DEPRECATED; const gnutls_datum_t *
signature) _GNUTLS_GCC_ATTR_DEPRECATED;
int int
gnutls_pubkey_print (gnutls_pubkey_t pubkey, gnutls_pubkey_print(gnutls_pubkey_t pubkey,
gnutls_certificate_print_formats_t format, gnutls_certificate_print_formats_t format,
gnutls_datum_t * out); gnutls_datum_t * out);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif #endif
 End of changes. 67 change blocks. 
273 lines changed or deleted 288 lines changed or added


 compat.h (3.2.6)   compat.h (3.2.7) 
skipping to change at line 28 skipping to change at line 28
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
/* Typedefs for more compatibility with older GnuTLS. */ /* Typedefs for more compatibility with older GnuTLS. */
#ifndef _GNUTLS_COMPAT_H #ifndef _GNUTLS_COMPAT_H
#define _GNUTLS_COMPAT_H #define _GNUTLS_COMPAT_H
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
#ifdef __GNUC__ #ifdef __GNUC__
#define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GN UC_PATCHLEVEL__) #define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GN UC_PATCHLEVEL__)
#if !defined GNUTLS_INTERNAL_BUILD #if !defined GNUTLS_INTERNAL_BUILD
#if _GNUTLS_GCC_VERSION >= 30100 #if _GNUTLS_GCC_VERSION >= 30100
#define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) #define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
#endif #endif
#endif #endif
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#ifndef _GNUTLS_GCC_ATTR_DEPRECATED #ifndef _GNUTLS_GCC_ATTR_DEPRECATED
#define _GNUTLS_GCC_ATTR_DEPRECATED #define _GNUTLS_GCC_ATTR_DEPRECATED
#endif #endif
/* gnutls_connection_end_t was made redundant in 2.99.0 */ /* gnutls_connection_end_t was made redundant in 2.99.0 */
typedef unsigned int gnutls_connection_end_t _GNUTLS_GCC_ATTR_DEPRECATED; typedef unsigned int gnutls_connection_end_t _GNUTLS_GCC_ATTR_DEPRECATED;
/* Stuff deprected in 2.x */ /* Stuff deprected in 2.x */
typedef gnutls_cipher_algorithm_t gnutls_cipher_algorithm _GNUTLS_GCC_ATTR_ typedef gnutls_cipher_algorithm_t gnutls_cipher_algorithm
DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_kx_algorithm_t gnutls_kx_algorithm _GNUTLS_GCC_ATTR_DEPRECAT typedef gnutls_kx_algorithm_t gnutls_kx_algorithm
ED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_mac_algorithm_t gnutls_mac_algorithm _GNUTLS_GCC_ATTR_DEPREC typedef gnutls_mac_algorithm_t gnutls_mac_algorithm
ATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_digest_algorithm_t gnutls_digest_algorithm _GNUTLS_GCC_ATTR_ typedef gnutls_digest_algorithm_t gnutls_digest_algorithm
DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_compression_method_t gnutls_compression_method _GNUTLS_GCC_A typedef gnutls_compression_method_t gnutls_compression_method
TTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_connection_end_t gnutls_connection_end _GNUTLS_GCC_ATTR_DEPR typedef gnutls_connection_end_t gnutls_connection_end
ECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_crt_fmt_t gnutls_x509_crt_fmt _GNUTLS_GCC_ATTR_DEPRECAT typedef gnutls_x509_crt_fmt_t gnutls_x509_crt_fmt
ED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_pk_algorithm_t gnutls_pk_algorithm _GNUTLS_GCC_ATTR_DEPRECAT typedef gnutls_pk_algorithm_t gnutls_pk_algorithm
ED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_sign_algorithm_t gnutls_sign_algorithm _GNUTLS_GCC_ATTR_DEPR typedef gnutls_sign_algorithm_t gnutls_sign_algorithm
ECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_close_request_t gnutls_close_request _GNUTLS_GCC_ATTR_DEPREC typedef gnutls_close_request_t gnutls_close_request
ATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_certificate_request_t gnutls_certificate_request _GNUTLS_GCC typedef gnutls_certificate_request_t gnutls_certificate_request
_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_certificate_status_t gnutls_certificate_status _GNUTLS_GCC_A typedef gnutls_certificate_status_t gnutls_certificate_status
TTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_session_t gnutls_session _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_session_t gnutls_session _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_alert_level_t gnutls_alert_level _GNUTLS_GCC_ATTR_DEPRECATED typedef gnutls_alert_level_t gnutls_alert_level
; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_alert_description_t gnutls_alert_description _GNUTLS_GCC_ATT typedef gnutls_alert_description_t gnutls_alert_description
R_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_subject_alt_name_t gnutls_x509_subject_alt_name _GNUTLS typedef gnutls_x509_subject_alt_name_t gnutls_x509_subject_alt_name
_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_openpgp_privkey_t gnutls_openpgp_privkey _GNUTLS_GCC_ATTR_DE typedef gnutls_openpgp_privkey_t gnutls_openpgp_privkey
PRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_openpgp_keyring_t gnutls_openpgp_keyring _GNUTLS_GCC_ATTR_DE typedef gnutls_openpgp_keyring_t gnutls_openpgp_keyring
PRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_crt_t gnutls_x509_crt _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_x509_crt_t gnutls_x509_crt _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_privkey_t gnutls_x509_privkey _GNUTLS_GCC_ATTR_DEPRECAT typedef gnutls_x509_privkey_t gnutls_x509_privkey
ED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_crl_t gnutls_x509_crl _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_x509_crl_t gnutls_x509_crl _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_x509_crq_t gnutls_x509_crq _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_x509_crq_t gnutls_x509_crq _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_certificate_credentials_t gnutls_certificate_credentials _GN typedef gnutls_certificate_credentials_t
UTLS_GCC_ATTR_DEPRECATED; gnutls_certificate_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_anon_server_credentials_t gnutls_anon_server_credentials _GN typedef gnutls_anon_server_credentials_t
UTLS_GCC_ATTR_DEPRECATED; gnutls_anon_server_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_anon_client_credentials_t gnutls_anon_client_credentials _GN typedef gnutls_anon_client_credentials_t
UTLS_GCC_ATTR_DEPRECATED; gnutls_anon_client_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_srp_client_credentials_t gnutls_srp_client_credentials _GNUT typedef gnutls_srp_client_credentials_t
LS_GCC_ATTR_DEPRECATED; gnutls_srp_client_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_srp_server_credentials_t gnutls_srp_server_credentials _GNUT typedef gnutls_srp_server_credentials_t
LS_GCC_ATTR_DEPRECATED; gnutls_srp_server_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_dh_params_t gnutls_dh_params _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_dh_params_t gnutls_dh_params _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_rsa_params_t gnutls_rsa_params _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_rsa_params_t gnutls_rsa_params _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_params_type_t gnutls_params_type _GNUTLS_GCC_ATTR_DEPRECATED typedef gnutls_params_type_t gnutls_params_type
; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_credentials_type_t gnutls_credentials_type _GNUTLS_GCC_ATTR_ typedef gnutls_credentials_type_t gnutls_credentials_type
DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_certificate_type_t gnutls_certificate_type _GNUTLS_GCC_ATTR_ typedef gnutls_certificate_type_t gnutls_certificate_type
DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_datum_t gnutls_datum _GNUTLS_GCC_ATTR_DEPRECATED; typedef gnutls_datum_t gnutls_datum _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_transport_ptr_t gnutls_transport_ptr _GNUTLS_GCC_ATTR_DEPREC typedef gnutls_transport_ptr_t gnutls_transport_ptr
ATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was /* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was
modified to use the PSK alert. */ modified to use the PSK alert. */
#define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY #define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
#define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY #define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
/* OpenPGP stuff renamed in 2.1.x. */ /* OpenPGP stuff renamed in 2.1.x. */
#define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT #define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT
#define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT #define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT
#define gnutls_openpgp_send_key gnutls_openpgp_send_cert #define gnutls_openpgp_send_key gnutls_openpgp_send_cert
typedef gnutls_openpgp_crt_status_t gnutls_openpgp_key_status_t _GNUTLS_GCC typedef gnutls_openpgp_crt_status_t gnutls_openpgp_key_status_t
_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
typedef gnutls_openpgp_crt_t gnutls_openpgp_key_t _GNUTLS_GCC_ATTR_DEPRECAT typedef gnutls_openpgp_crt_t gnutls_openpgp_key_t
ED; _GNUTLS_GCC_ATTR_DEPRECATED;
#define gnutls_openpgp_key_init gnutls_openpgp_crt_init #define gnutls_openpgp_key_init gnutls_openpgp_crt_init
#define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit #define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit
#define gnutls_openpgp_key_import gnutls_openpgp_crt_import #define gnutls_openpgp_key_import gnutls_openpgp_crt_import
#define gnutls_openpgp_key_export gnutls_openpgp_crt_export #define gnutls_openpgp_key_export gnutls_openpgp_crt_export
#define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage #define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage
#define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerpri nt #define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerpri nt
#define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algor ithm #define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algor ithm
#define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name #define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name
#define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version #define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version
#define gnutls_openpgp_key_get_creation_time gnutls_openpgp_crt_get_creatio n_time #define gnutls_openpgp_key_get_creation_time gnutls_openpgp_crt_get_creatio n_time
skipping to change at line 133 skipping to change at line 163
#define LIBGNUTLS_VERSION GNUTLS_VERSION #define LIBGNUTLS_VERSION GNUTLS_VERSION
#define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR #define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR
#define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR #define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR
#define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH #define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH
#define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER #define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER
#define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION #define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION
/* The gnutls_retr_st was deprecated by gnutls_certificate_retrieve_functio n() /* The gnutls_retr_st was deprecated by gnutls_certificate_retrieve_functio n()
* and gnutls_retr2_st. * and gnutls_retr2_st.
*/ */
typedef struct gnutls_retr_st typedef struct gnutls_retr_st {
{ gnutls_certificate_type_t type;
gnutls_certificate_type_t type; union {
union gnutls_x509_crt_t *x509;
{ gnutls_openpgp_crt_t pgp;
gnutls_x509_crt_t *x509; } cert;
gnutls_openpgp_crt_t pgp; unsigned int ncerts; /* one for pgp keys */
} cert;
unsigned int ncerts; /* one for pgp keys */
union union {
{ gnutls_x509_privkey_t x509;
gnutls_x509_privkey_t x509; gnutls_openpgp_privkey_t pgp;
gnutls_openpgp_privkey_t pgp; } key;
} key;
unsigned int deinit_all; /* if non zero all keys will be deinited */ unsigned int deinit_all; /* if non zero all keys will be dein ited */
} gnutls_retr_st; } gnutls_retr_st;
typedef int gnutls_certificate_client_retrieve_function (gnutls_session_t, typedef int
const gnutls_certificate_client_retrieve_function(gnutls_session_t,
gnutls_datum_t * const
req_ca_rdn, gnutls_datum_t *
int nreqs, req_ca_rdn,
const int nreqs, const
gnutls_pk_algorith gnutls_pk_algorithm_t
m_t * pk_algos, int
* pk_algos, pk_algos_length,
int gnutls_retr_st *);
pk_algos_length, typedef int
gnutls_retr_st *); gnutls_certificate_server_retrieve_function(gnutls_session_t,
typedef int gnutls_certificate_server_retrieve_function (gnutls_session_t, gnutls_retr_st *);
gnutls_retr_st *);
void gnutls_certificate_client_set_retrieve_function void gnutls_certificate_client_set_retrieve_function
(gnutls_certificate_credentials_t cred, (gnutls_certificate_credentials_t cred,
gnutls_certificate_client_retrieve_function * gnutls_certificate_client_retrieve_function *
func) _GNUTLS_GCC_ATTR_DEPRECATED; func) _GNUTLS_GCC_ATTR_DEPRECATED;
void void
gnutls_certificate_server_set_retrieve_function gnutls_certificate_server_set_retrieve_function
(gnutls_certificate_credentials_t cred, (gnutls_certificate_credentials_t cred,
gnutls_certificate_server_retrieve_function * gnutls_certificate_server_retrieve_function *
func) _GNUTLS_GCC_ATTR_DEPRECATED; func) _GNUTLS_GCC_ATTR_DEPRECATED;
/* External signing callback. No longer supported because it /* External signing callback. No longer supported because it
* was deprecated by the PKCS #11 API or gnutls_privkey_import_ext. */ * was deprecated by the PKCS #11 API or gnutls_privkey_import_ext.
*/
typedef int (*gnutls_sign_func) (gnutls_session_t session, typedef int (*gnutls_sign_func) (gnutls_session_t session,
void *userdata, void *userdata,
gnutls_certificate_type_t cert_type, gnutls_certificate_type_t
const gnutls_datum_t * cert, cert_type,
const gnutls_datum_t * hash, const gnutls_datum_t * cert,
gnutls_datum_t * signature); const gnutls_datum_t * hash,
gnutls_datum_t * signature);
void void
gnutls_sign_callback_set (gnutls_session_t session, gnutls_sign_callback_set(gnutls_session_t session,
gnutls_sign_func sign_func, void *userdata) gnutls_sign_func sign_func,
_GNUTLS_GCC_ATTR_DEPRECATED; void *userdata) _GNUTLS_GCC_ATTR_DEPRECATED;
gnutls_sign_func gnutls_sign_func
gnutls_sign_callback_get (gnutls_session_t session, void **userdata) gnutls_sign_callback_get(gnutls_session_t session,
_GNUTLS_GCC_ATTR_DEPRECATED; void **userdata) _GNUTLS_GCC_ATTR_DEPRECATED;
/* This is a very dangerous and error-prone function. /* This is a very dangerous and error-prone function.
* Use gnutls_privkey_sign_hash() instead. * Use gnutls_privkey_sign_hash() instead.
*/ */
int gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key, int gnutls_x509_privkey_sign_hash(gnutls_x509_privkey_t key,
const gnutls_datum_t * hash, const gnutls_datum_t * hash,
gnutls_datum_t * signature) gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_openpgp_privkey_sign_hash (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_sign_hash(gnutls_openpgp_privkey_t key,
const gnutls_datum_t * hash, const gnutls_datum_t * hash,
gnutls_datum_t * signature) gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* we support the gnutls_privkey_sign_data() instead. /* we support the gnutls_privkey_sign_data() instead.
*/ */
int gnutls_x509_privkey_sign_data (gnutls_x509_privkey_t key, int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key,
gnutls_digest_algorithm_t digest, gnutls_digest_algorithm_t digest,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
void *signature, void *signature,
size_t * signature_size) size_t * signature_size)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_verify_data() */ /* gnutls_pubkey_verify_data() */
int gnutls_x509_crt_verify_data (gnutls_x509_crt_t crt, int gnutls_x509_crt_verify_data(gnutls_x509_crt_t crt,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
const gnutls_datum_t * signature) const gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_verify_hash() */ /* gnutls_pubkey_verify_hash() */
int gnutls_x509_crt_verify_hash (gnutls_x509_crt_t crt, int gnutls_x509_crt_verify_hash(gnutls_x509_crt_t crt,
unsigned int flags, unsigned int flags,
const gnutls_datum_t * hash, const gnutls_datum_t * hash,
const gnutls_datum_t * signature) const gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_get_verify_algorithm() */ /* gnutls_pubkey_get_verify_algorithm() */
int gnutls_x509_crt_get_verify_algorithm (gnutls_x509_crt_t crt, int gnutls_x509_crt_get_verify_algorithm(gnutls_x509_crt_t crt,
const gnutls_datum_t * signatur const gnutls_datum_t *
e, signature,
gnutls_digest_algorithm_t * has gnutls_digest_algorithm_t
h) * hash)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_get_preferred_hash_algorithm() */ /* gnutls_pubkey_get_preferred_hash_algorithm() */
int gnutls_x509_crt_get_preferred_hash_algorithm (gnutls_x509_crt_t crt, int gnutls_x509_crt_get_preferred_hash_algorithm(gnutls_x509_crt_t
gnutls_digest_algorithm crt,
_t gnutls_digest_algorithm_t
* hash, * hash, unsigned int
unsigned int *mand) *mand)
_GNUTLS_GCC_ATTR_DEPREC _GNUTLS_GCC_ATTR_DEPRECATED;
ATED;
/* gnutls_x509_crq_privkey_sign() */ /* gnutls_x509_crq_privkey_sign() */
int gnutls_x509_crq_sign (gnutls_x509_crq_t crq, gnutls_x509_privkey_t ke int gnutls_x509_crq_sign(gnutls_x509_crq_t crq,
y) gnutls_x509_privkey_t key)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_x509_crl_privkey_sign */ /* gnutls_x509_crl_privkey_sign */
int gnutls_x509_crl_sign (gnutls_x509_crl_t crl, int gnutls_x509_crl_sign(gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer, gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key) gnutls_x509_privkey_t issuer_key)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* functions to set priority of cipher suites /* functions to set priority of cipher suites
*/ */
int gnutls_cipher_set_priority (gnutls_session_t session, const int *list int gnutls_cipher_set_priority(gnutls_session_t session,
) const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_mac_set_priority (gnutls_session_t session, const int *list) int gnutls_mac_set_priority(gnutls_session_t session,
_GNUTLS_GCC_ATTR_DEPRECATED; const int *list) _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_compression_set_priority (gnutls_session_t session, int gnutls_compression_set_priority(gnutls_session_t session,
const int *list) const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_kx_set_priority (gnutls_session_t session, const int *list) int gnutls_kx_set_priority(gnutls_session_t session,
_GNUTLS_GCC_ATTR_DEPRECATED; const int *list) _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_protocol_set_priority (gnutls_session_t session, int gnutls_protocol_set_priority(gnutls_session_t session,
const int *list) const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_certificate_type_set_priority (gnutls_session_t session, int gnutls_certificate_type_set_priority(gnutls_session_t session,
const int *list) const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
/* RSA params /* RSA params
*/ */
int gnutls_rsa_params_init (gnutls_rsa_params_t * rsa_params) _GNUTLS_GCC int gnutls_rsa_params_init(gnutls_rsa_params_t *
_ATTR_DEPRECATED; rsa_params) _GNUTLS_GCC_ATTR_DEPRECATED;
void gnutls_rsa_params_deinit (gnutls_rsa_params_t rsa_params) _GNUTLS_GC void gnutls_rsa_params_deinit(gnutls_rsa_params_t rsa_params)
C_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_params_cpy (gnutls_rsa_params_t dst, int gnutls_rsa_params_cpy(gnutls_rsa_params_t dst,
gnutls_rsa_params_t src) _GNUTLS_GCC_ATTR_DEPR gnutls_rsa_params_t src)
ECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_params_import_raw (gnutls_rsa_params_t rsa_params, int gnutls_rsa_params_import_raw(gnutls_rsa_params_t rsa_params,
const gnutls_datum_t * m, const gnutls_datum_t * m,
const gnutls_datum_t * e, const gnutls_datum_t * e,
const gnutls_datum_t * d, const gnutls_datum_t * d,
const gnutls_datum_t * p, const gnutls_datum_t * p,
const gnutls_datum_t * q, const gnutls_datum_t * q,
const gnutls_datum_t * u); const gnutls_datum_t * u);
int gnutls_rsa_params_generate2 (gnutls_rsa_params_t params, int gnutls_rsa_params_generate2(gnutls_rsa_params_t params,
unsigned int bits) _GNUTLS_GCC_ATTR_DEPR unsigned int bits)
ECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_params_export_raw (gnutls_rsa_params_t rsa, int gnutls_rsa_params_export_raw(gnutls_rsa_params_t rsa,
gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * m,
gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * e,
gnutls_datum_t * q, gnutls_datum_t * u, gnutls_datum_t * d,
unsigned int *bits) _GNUTLS_GCC_ATTR_DE gnutls_datum_t * p,
PRECATED; gnutls_datum_t * q,
int gnutls_rsa_params_export_pkcs1 (gnutls_rsa_params_t params, gnutls_datum_t * u,
gnutls_x509_crt_fmt_t format, unsigned int *bits)
unsigned char *params_data, _GNUTLS_GCC_ATTR_DEPRECATED;
size_t * params_data_size) _GNUTLS_GC int gnutls_rsa_params_export_pkcs1(gnutls_rsa_params_t params,
C_ATTR_DEPRECATED; gnutls_x509_crt_fmt_t format,
int gnutls_rsa_params_import_pkcs1 (gnutls_rsa_params_t params, unsigned char *params_data,
const gnutls_datum_t * pkcs1_params, size_t *
gnutls_x509_crt_fmt_t format) _GNUTLS params_data_size)
_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_params_import_pkcs1(gnutls_rsa_params_t params,
const gnutls_datum_t *
pkcs1_params,
gnutls_x509_crt_fmt_t format)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_export_get_pubkey (gnutls_session_t session, int gnutls_rsa_export_get_pubkey(gnutls_session_t session,
gnutls_datum_t * exponent, gnutls_datum_t * exponent,
gnutls_datum_t * modulus) _GNUTLS_GCC_A gnutls_datum_t *
TTR_DEPRECATED; modulus) _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_rsa_export_get_modulus_bits (gnutls_session_t session) _GNUTLS int gnutls_rsa_export_get_modulus_bits(gnutls_session_t session)
_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_set_default_export_priority (gnutls_session_t session) _GNUTLS int gnutls_set_default_export_priority(gnutls_session_t session)
_GCC_ATTR_DEPRECATED; _GNUTLS_GCC_ATTR_DEPRECATED;
void void gnutls_certificate_set_rsa_export_params
gnutls_certificate_set_rsa_export_params (gnutls_certificate_credential (gnutls_certificate_credentials_t res,
s_t gnutls_rsa_params_t rsa_params) _GNUTLS_GCC_ATTR_DEPRECATED;
res,
gnutls_rsa_params_t rsa_param
s) _GNUTLS_GCC_ATTR_DEPRECATED;
/* use gnutls_privkey_sign_hash() with the GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_ /* use gnutls_privkey_sign_hash() with the GNUTLS_PRIVKEY_SIGN_FLAG_
RSA flag */ TLS1_RSA flag */
int gnutls_privkey_sign_raw_data (gnutls_privkey_t key, int gnutls_privkey_sign_raw_data(gnutls_privkey_t key,
unsigned flags, unsigned flags,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_datum_t * signature) _GNUTLS_GCC_ATTR_ gnutls_datum_t *
DEPRECATED; signature) _GNUTLS_GCC_ATTR_DEPRECATED;
#ifdef _ISOC99_SOURCE #ifdef _ISOC99_SOURCE
/* we provide older functions for compatibility as inline functions that /* we provide older functions for compatibility as inline functions that
* depend on gnutls_session_get_random. */ * depend on gnutls_session_get_random. */
static inline const void *gnutls_session_get_server_random (gnutls_session_ static inline const void
t session) _GNUTLS_GCC_ATTR_DEPRECATED; *gnutls_session_get_server_random(gnutls_session_t session)
static inline const void *gnutls_session_get_server_random (gnutls_session_ _GNUTLS_GCC_ATTR_DEPRECATED;
t session) static inline const void
*gnutls_session_get_server_random(gnutls_session_t session)
{ {
gnutls_datum_t rnd; gnutls_datum_t rnd;
gnutls_session_get_random(session, NULL, &rnd);/*doc-skip*/ gnutls_session_get_random(session, NULL, &rnd); /*doc-skip */
return rnd.data; return rnd.data;
} }
static inline const void *gnutls_session_get_client_random (gnutls_session_ static inline const void
t session) _GNUTLS_GCC_ATTR_DEPRECATED; *gnutls_session_get_client_random(gnutls_session_t session)
static inline const void *gnutls_session_get_client_random (gnutls_session_ _GNUTLS_GCC_ATTR_DEPRECATED;
t session) static inline const void
*gnutls_session_get_client_random(gnutls_session_t session)
{ {
gnutls_datum_t rnd; gnutls_datum_t rnd;
gnutls_session_get_random(session, &rnd, NULL);/*doc-skip*/ gnutls_session_get_random(session, &rnd, NULL); /*doc-skip */
return rnd.data; return rnd.data;
} }
#endif #endif
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* _GNUTLS_COMPAT_H */ #endif /* _GNUTLS_COMPAT_H */
 End of changes. 42 change blocks. 
245 lines changed or deleted 249 lines changed or added


 crypto.h (3.2.6)   crypto.h (3.2.7) 
skipping to change at line 26 skipping to change at line 26
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
#ifndef GNUTLS_CRYPTO_H #ifndef GNUTLS_CRYPTO_H
#define GNUTLS_CRYPTO_H #define GNUTLS_CRYPTO_H
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
typedef struct api_cipher_hd_st *gnutls_cipher_hd_t; typedef struct api_cipher_hd_st *gnutls_cipher_hd_t;
int gnutls_cipher_init (gnutls_cipher_hd_t * handle, int gnutls_cipher_init(gnutls_cipher_hd_t * handle,
gnutls_cipher_algorithm_t cipher, gnutls_cipher_algorithm_t cipher,
const gnutls_datum_t * key, const gnutls_datum_t * key,
const gnutls_datum_t * iv); const gnutls_datum_t * iv);
int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle, int gnutls_cipher_encrypt(const gnutls_cipher_hd_t handle,
void *text, size_t textlen); void *text, size_t textlen);
int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle, int gnutls_cipher_decrypt(const gnutls_cipher_hd_t handle,
void *ciphertext, size_t ciphertextlen); void *ciphertext, size_t ciphertextlen);
int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle, int gnutls_cipher_decrypt2(gnutls_cipher_hd_t handle,
const void *ciphertext, size_t ciphertextlen, const void *ciphertext,
void *text, size_t textlen); size_t ciphertextlen, void *text,
int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle, const void *text, size_t textlen);
size_t textlen, void *ciphertext, int gnutls_cipher_encrypt2(gnutls_cipher_hd_t handle,
size_t ciphertextlen); const void *text, size_t textlen,
void *ciphertext, size_t ciphertextlen);
void gnutls_cipher_set_iv (gnutls_cipher_hd_t handle, void *iv, size_t iv void gnutls_cipher_set_iv(gnutls_cipher_hd_t handle, void *iv,
len); size_t ivlen);
int gnutls_cipher_tag( gnutls_cipher_hd_t handle, void* tag, size_t tag_s int gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag,
ize); size_t tag_size);
int gnutls_cipher_add_auth( gnutls_cipher_hd_t handle, const void* text, int gnutls_cipher_add_auth(gnutls_cipher_hd_t handle,
size_t text_size); const void *text, size_t text_size);
void gnutls_cipher_deinit (gnutls_cipher_hd_t handle); void gnutls_cipher_deinit(gnutls_cipher_hd_t handle);
int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm); int gnutls_cipher_get_block_size(gnutls_cipher_algorithm_t algorithm);
int gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm); int gnutls_cipher_get_iv_size(gnutls_cipher_algorithm_t algorithm);
int gnutls_cipher_get_tag_size (gnutls_cipher_algorithm_t algorithm); int gnutls_cipher_get_tag_size(gnutls_cipher_algorithm_t algorithm);
typedef struct hash_hd_st *gnutls_hash_hd_t; typedef struct hash_hd_st *gnutls_hash_hd_t;
typedef struct hmac_hd_st *gnutls_hmac_hd_t; typedef struct hmac_hd_st *gnutls_hmac_hd_t;
size_t gnutls_mac_get_nonce_size (gnutls_mac_algorithm_t algorithm); size_t gnutls_mac_get_nonce_size(gnutls_mac_algorithm_t algorithm);
int gnutls_hmac_init (gnutls_hmac_hd_t * dig, int gnutls_hmac_init(gnutls_hmac_hd_t * dig,
gnutls_mac_algorithm_t algorithm, const void *key, gnutls_mac_algorithm_t algorithm,
size_t keylen); const void *key, size_t keylen);
void gnutls_hmac_set_nonce (gnutls_hmac_hd_t handle, const void *nonce, s void gnutls_hmac_set_nonce(gnutls_hmac_hd_t handle,
ize_t nonce_len); const void *nonce, size_t nonce_len);
int gnutls_hmac (gnutls_hmac_hd_t handle, const void *text, size_t textle int gnutls_hmac(gnutls_hmac_hd_t handle, const void *text, size_t textlen);
n); void gnutls_hmac_output(gnutls_hmac_hd_t handle, void *digest);
void gnutls_hmac_output (gnutls_hmac_hd_t handle, void *digest); void gnutls_hmac_deinit(gnutls_hmac_hd_t handle, void *digest);
void gnutls_hmac_deinit (gnutls_hmac_hd_t handle, void *digest); int gnutls_hmac_get_len(gnutls_mac_algorithm_t algorithm);
int gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm); int gnutls_hmac_fast(gnutls_mac_algorithm_t algorithm,
int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void *key, const void *key, size_t keylen,
size_t keylen, const void *text, size_t textlen, const void *text, size_t textlen, void *digest);
void *digest);
int gnutls_hash_init (gnutls_hash_hd_t * dig, int gnutls_hash_init(gnutls_hash_hd_t * dig,
gnutls_digest_algorithm_t algorithm); gnutls_digest_algorithm_t algorithm);
int gnutls_hash (gnutls_hash_hd_t handle, const void *text, size_t textle int gnutls_hash(gnutls_hash_hd_t handle, const void *text, size_t textlen);
n); void gnutls_hash_output(gnutls_hash_hd_t handle, void *digest);
void gnutls_hash_output (gnutls_hash_hd_t handle, void *digest); void gnutls_hash_deinit(gnutls_hash_hd_t handle, void *digest);
void gnutls_hash_deinit (gnutls_hash_hd_t handle, void *digest); int gnutls_hash_get_len(gnutls_digest_algorithm_t algorithm);
int gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm); int gnutls_hash_fast(gnutls_digest_algorithm_t algorithm,
int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm, const void *text, size_t textlen, void *digest);
const void *text, size_t textlen, void *digest);
/* register ciphers */ /* register ciphers */
/** /**
* gnutls_rnd_level_t: * gnutls_rnd_level_t:
* @GNUTLS_RND_NONCE: Non-predictable random number. Fatal in parts * @GNUTLS_RND_NONCE: Non-predictable random number. Fatal in parts
* of session if broken, i.e., vulnerable to statistical analysis. * of session if broken, i.e., vulnerable to statistical analysis.
* @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number. * @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number.
* Fatal in session if broken. * Fatal in session if broken.
* @GNUTLS_RND_KEY: Fatal in many sessions if broken. * @GNUTLS_RND_KEY: Fatal in many sessions if broken.
* *
* Enumeration of random quality levels. * Enumeration of random quality levels.
*/ */
typedef enum gnutls_rnd_level typedef enum gnutls_rnd_level {
{ GNUTLS_RND_NONCE = 0,
GNUTLS_RND_NONCE = 0, GNUTLS_RND_RANDOM = 1,
GNUTLS_RND_RANDOM = 1, GNUTLS_RND_KEY = 2
GNUTLS_RND_KEY = 2 } gnutls_rnd_level_t;
} gnutls_rnd_level_t;
int gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len); int gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len);
void gnutls_rnd_refresh (void); void gnutls_rnd_refresh(void);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif #endif
 End of changes. 16 change blocks. 
61 lines changed or deleted 61 lines changed or added


 dtls.h (3.2.6)   dtls.h (3.2.7) 
skipping to change at line 32 skipping to change at line 32
/* This file contains the types and prototypes for the X.509 /* This file contains the types and prototypes for the X.509
* certificate and CRL handling functions. * certificate and CRL handling functions.
*/ */
#ifndef GNUTLS_DTLS_H #ifndef GNUTLS_DTLS_H
#define GNUTLS_DTLS_H #define GNUTLS_DTLS_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
#define GNUTLS_COOKIE_KEY_SIZE 16 #define GNUTLS_COOKIE_KEY_SIZE 16
void gnutls_dtls_set_timeouts (gnutls_session_t session, void gnutls_dtls_set_timeouts(gnutls_session_t session,
unsigned int retrans_timeout, unsigned int retrans_timeout,
unsigned int total_timeout); unsigned int total_timeout);
unsigned int gnutls_dtls_get_mtu (gnutls_session_t session); unsigned int gnutls_dtls_get_mtu(gnutls_session_t session);
unsigned int gnutls_dtls_get_data_mtu (gnutls_session_t session); unsigned int gnutls_dtls_get_data_mtu(gnutls_session_t session);
void gnutls_dtls_set_mtu (gnutls_session_t session, unsigned int mtu); void gnutls_dtls_set_mtu(gnutls_session_t session, unsigned int mtu);
int gnutls_dtls_set_data_mtu (gnutls_session_t session, unsigned int mtu); int gnutls_dtls_set_data_mtu(gnutls_session_t session, unsigned int mtu);
unsigned int gnutls_dtls_get_timeout (gnutls_session_t session); unsigned int gnutls_dtls_get_timeout(gnutls_session_t session);
/** /**
* gnutls_dtls_prestate_st: * gnutls_dtls_prestate_st:
* @record_seq: record sequence number * @record_seq: record sequence number
* @hsk_read_seq: handshake read sequence number * @hsk_read_seq: handshake read sequence number
* @hsk_write_seq: handshake write sequence number * @hsk_write_seq: handshake write sequence number
* *
* DTLS cookie prestate struct. This is usually never modified by * DTLS cookie prestate struct. This is usually never modified by
* the application, it is used to carry the cookie data between * the application, it is used to carry the cookie data between
* gnutls_dtls_cookie_send(), gnutls_dtls_cookie_verify() and * gnutls_dtls_cookie_send(), gnutls_dtls_cookie_verify() and
* gnutls_dtls_prestate_set(). * gnutls_dtls_prestate_set().
*/ */
typedef struct typedef struct {
{ unsigned int record_seq;
unsigned int record_seq; unsigned int hsk_read_seq;
unsigned int hsk_read_seq; unsigned int hsk_write_seq;
unsigned int hsk_write_seq; } gnutls_dtls_prestate_st;
} gnutls_dtls_prestate_st;
int gnutls_dtls_cookie_send (gnutls_datum_t* key, int gnutls_dtls_cookie_send(gnutls_datum_t * key,
void* client_data, size_t client_data_size, void *client_data,
gnutls_dtls_prestate_st* prestate, size_t client_data_size,
gnutls_transport_ptr_t ptr, gnutls_dtls_prestate_st * prestate,
gnutls_push_func push_func); gnutls_transport_ptr_t ptr,
gnutls_push_func push_func);
int gnutls_dtls_cookie_verify (gnutls_datum_t* key, int gnutls_dtls_cookie_verify(gnutls_datum_t * key,
void* client_data, size_t client_data_size, void *client_data,
void* _msg, size_t msg_size, size_t client_data_size, void *_msg,
gnutls_dtls_prestate_st* prestate); size_t msg_size,
gnutls_dtls_prestate_st * prestate);
void gnutls_dtls_prestate_set (gnutls_session_t session, void gnutls_dtls_prestate_set(gnutls_session_t session,
gnutls_dtls_prestate_st* prestate); gnutls_dtls_prestate_st * prestate);
unsigned int gnutls_record_get_discarded (gnutls_session_t session); unsigned int gnutls_record_get_discarded(gnutls_session_t session);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* GNUTLS_DTLS_H */ #endif /* GNUTLS_DTLS_H */
 End of changes. 14 change blocks. 
28 lines changed or deleted 31 lines changed or added


 gnutls.h (3.2.6)   gnutls.h (3.2.7) 
skipping to change at line 49 skipping to change at line 49
#include <stddef.h> #include <stddef.h>
/* Get ssize_t. */ /* Get ssize_t. */
#ifndef HAVE_SSIZE_T #ifndef HAVE_SSIZE_T
#define HAVE_SSIZE_T #define HAVE_SSIZE_T
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#include <sys/types.h> #include <sys/types.h>
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif #endif
/* Get time_t. */ /* Get time_t. */
#include <time.h> #include <time.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
#define GNUTLS_VERSION "3.2.6" #define GNUTLS_VERSION "3.2.7"
#define GNUTLS_VERSION_MAJOR 3 #define GNUTLS_VERSION_MAJOR 3
#define GNUTLS_VERSION_MINOR 2 #define GNUTLS_VERSION_MINOR 2
#define GNUTLS_VERSION_PATCH 6 #define GNUTLS_VERSION_PATCH 7
#define GNUTLS_VERSION_NUMBER 0x030206 #define GNUTLS_VERSION_NUMBER 0x030207
#define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC
#define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC #define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC
#define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC
#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128 #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128
/** /**
* gnutls_cipher_algorithm_t: * gnutls_cipher_algorithm_t:
* @GNUTLS_CIPHER_UNKNOWN: Unknown algorithm. * @GNUTLS_CIPHER_UNKNOWN: Unknown algorithm.
* @GNUTLS_CIPHER_NULL: NULL algorithm. * @GNUTLS_CIPHER_NULL: NULL algorithm.
skipping to change at line 98 skipping to change at line 100
* @GNUTLS_CIPHER_CAST5_PGP_CFB: CAST5 in CFB mode. * @GNUTLS_CIPHER_CAST5_PGP_CFB: CAST5 in CFB mode.
* @GNUTLS_CIPHER_BLOWFISH_PGP_CFB: Blowfish in CFB mode. * @GNUTLS_CIPHER_BLOWFISH_PGP_CFB: Blowfish in CFB mode.
* @GNUTLS_CIPHER_SAFER_SK128_PGP_CFB: Safer-SK in CFB mode with 128-bit ke ys. * @GNUTLS_CIPHER_SAFER_SK128_PGP_CFB: Safer-SK in CFB mode with 128-bit ke ys.
* @GNUTLS_CIPHER_AES128_PGP_CFB: AES in CFB mode with 128-bit keys. * @GNUTLS_CIPHER_AES128_PGP_CFB: AES in CFB mode with 128-bit keys.
* @GNUTLS_CIPHER_AES192_PGP_CFB: AES in CFB mode with 192-bit keys. * @GNUTLS_CIPHER_AES192_PGP_CFB: AES in CFB mode with 192-bit keys.
* @GNUTLS_CIPHER_AES256_PGP_CFB: AES in CFB mode with 256-bit keys. * @GNUTLS_CIPHER_AES256_PGP_CFB: AES in CFB mode with 256-bit keys.
* @GNUTLS_CIPHER_TWOFISH_PGP_CFB: Twofish in CFB mode. * @GNUTLS_CIPHER_TWOFISH_PGP_CFB: Twofish in CFB mode.
* *
* Enumeration of different symmetric encryption algorithms. * Enumeration of different symmetric encryption algorithms.
*/ */
typedef enum gnutls_cipher_algorithm typedef enum gnutls_cipher_algorithm {
{ GNUTLS_CIPHER_UNKNOWN = 0,
GNUTLS_CIPHER_UNKNOWN = 0, GNUTLS_CIPHER_NULL = 1,
GNUTLS_CIPHER_NULL = 1, GNUTLS_CIPHER_ARCFOUR_128 = 2,
GNUTLS_CIPHER_ARCFOUR_128 = 2, GNUTLS_CIPHER_3DES_CBC = 3,
GNUTLS_CIPHER_3DES_CBC = 3, GNUTLS_CIPHER_AES_128_CBC = 4,
GNUTLS_CIPHER_AES_128_CBC = 4, GNUTLS_CIPHER_AES_256_CBC = 5,
GNUTLS_CIPHER_AES_256_CBC = 5, GNUTLS_CIPHER_ARCFOUR_40 = 6,
GNUTLS_CIPHER_ARCFOUR_40 = 6, GNUTLS_CIPHER_CAMELLIA_128_CBC = 7,
GNUTLS_CIPHER_CAMELLIA_128_CBC = 7, GNUTLS_CIPHER_CAMELLIA_256_CBC = 8,
GNUTLS_CIPHER_CAMELLIA_256_CBC = 8, GNUTLS_CIPHER_RC2_40_CBC = 90,
GNUTLS_CIPHER_RC2_40_CBC = 90, GNUTLS_CIPHER_DES_CBC = 91,
GNUTLS_CIPHER_DES_CBC = 91, GNUTLS_CIPHER_AES_192_CBC = 92,
GNUTLS_CIPHER_AES_192_CBC = 92, GNUTLS_CIPHER_AES_128_GCM = 93,
GNUTLS_CIPHER_AES_128_GCM = 93, GNUTLS_CIPHER_AES_256_GCM = 94,
GNUTLS_CIPHER_AES_256_GCM = 94, GNUTLS_CIPHER_CAMELLIA_192_CBC = 95,
GNUTLS_CIPHER_CAMELLIA_192_CBC = 95, GNUTLS_CIPHER_SALSA20_256 = 96,
GNUTLS_CIPHER_SALSA20_256 = 96, GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 97,
GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 97, GNUTLS_CIPHER_CAMELLIA_128_GCM = 98,
GNUTLS_CIPHER_CAMELLIA_128_GCM = 98, GNUTLS_CIPHER_CAMELLIA_256_GCM = 99,
GNUTLS_CIPHER_CAMELLIA_256_GCM = 99,
/* used only for PGP internals. Ignored in TLS/SSL /* used only for PGP internals. Ignored in TLS/SSL
*/ */
GNUTLS_CIPHER_IDEA_PGP_CFB = 200, GNUTLS_CIPHER_IDEA_PGP_CFB = 200,
GNUTLS_CIPHER_3DES_PGP_CFB = 201, GNUTLS_CIPHER_3DES_PGP_CFB = 201,
GNUTLS_CIPHER_CAST5_PGP_CFB = 202, GNUTLS_CIPHER_CAST5_PGP_CFB = 202,
GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203, GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203,
GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204, GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204,
GNUTLS_CIPHER_AES128_PGP_CFB = 205, GNUTLS_CIPHER_AES128_PGP_CFB = 205,
GNUTLS_CIPHER_AES192_PGP_CFB = 206, GNUTLS_CIPHER_AES192_PGP_CFB = 206,
GNUTLS_CIPHER_AES256_PGP_CFB = 207, GNUTLS_CIPHER_AES256_PGP_CFB = 207,
GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208 GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208
} gnutls_cipher_algorithm_t; } gnutls_cipher_algorithm_t;
/** /**
* gnutls_kx_algorithm_t: * gnutls_kx_algorithm_t:
* @GNUTLS_KX_UNKNOWN: Unknown key-exchange algorithm. * @GNUTLS_KX_UNKNOWN: Unknown key-exchange algorithm.
* @GNUTLS_KX_RSA: RSA key-exchange algorithm. * @GNUTLS_KX_RSA: RSA key-exchange algorithm.
* @GNUTLS_KX_DHE_DSS: DHE-DSS key-exchange algorithm. * @GNUTLS_KX_DHE_DSS: DHE-DSS key-exchange algorithm.
* @GNUTLS_KX_DHE_RSA: DHE-RSA key-exchange algorithm. * @GNUTLS_KX_DHE_RSA: DHE-RSA key-exchange algorithm.
* @GNUTLS_KX_ECDHE_RSA: ECDHE-RSA key-exchange algorithm. * @GNUTLS_KX_ECDHE_RSA: ECDHE-RSA key-exchange algorithm.
* @GNUTLS_KX_ECDHE_ECDSA: ECDHE-ECDSA key-exchange algorithm. * @GNUTLS_KX_ECDHE_ECDSA: ECDHE-ECDSA key-exchange algorithm.
* @GNUTLS_KX_ANON_DH: Anon-DH key-exchange algorithm. * @GNUTLS_KX_ANON_DH: Anon-DH key-exchange algorithm.
skipping to change at line 154 skipping to change at line 155
* @GNUTLS_KX_RSA_EXPORT: RSA-EXPORT key-exchange algorithm (defunc). * @GNUTLS_KX_RSA_EXPORT: RSA-EXPORT key-exchange algorithm (defunc).
* @GNUTLS_KX_SRP_RSA: SRP-RSA key-exchange algorithm. * @GNUTLS_KX_SRP_RSA: SRP-RSA key-exchange algorithm.
* @GNUTLS_KX_SRP_DSS: SRP-DSS key-exchange algorithm. * @GNUTLS_KX_SRP_DSS: SRP-DSS key-exchange algorithm.
* @GNUTLS_KX_PSK: PSK key-exchange algorithm. * @GNUTLS_KX_PSK: PSK key-exchange algorithm.
* @GNUTLS_KX_DHE_PSK: DHE-PSK key-exchange algorithm. * @GNUTLS_KX_DHE_PSK: DHE-PSK key-exchange algorithm.
* @GNUTLS_KX_ECDHE_PSK: ECDHE-PSK key-exchange algorithm. * @GNUTLS_KX_ECDHE_PSK: ECDHE-PSK key-exchange algorithm.
* @GNUTLS_KX_RSA_PSK: RSA-PSK key-exchange algorithm. * @GNUTLS_KX_RSA_PSK: RSA-PSK key-exchange algorithm.
* *
* Enumeration of different key exchange algorithms. * Enumeration of different key exchange algorithms.
*/ */
typedef enum typedef enum {
{ GNUTLS_KX_UNKNOWN = 0,
GNUTLS_KX_UNKNOWN = 0, GNUTLS_KX_RSA = 1,
GNUTLS_KX_RSA = 1, GNUTLS_KX_DHE_DSS = 2,
GNUTLS_KX_DHE_DSS = 2, GNUTLS_KX_DHE_RSA = 3,
GNUTLS_KX_DHE_RSA = 3, GNUTLS_KX_ANON_DH = 4,
GNUTLS_KX_ANON_DH = 4, GNUTLS_KX_SRP = 5,
GNUTLS_KX_SRP = 5, GNUTLS_KX_RSA_EXPORT = 6,
GNUTLS_KX_RSA_EXPORT = 6, GNUTLS_KX_SRP_RSA = 7,
GNUTLS_KX_SRP_RSA = 7, GNUTLS_KX_SRP_DSS = 8,
GNUTLS_KX_SRP_DSS = 8, GNUTLS_KX_PSK = 9,
GNUTLS_KX_PSK = 9, GNUTLS_KX_DHE_PSK = 10,
GNUTLS_KX_DHE_PSK = 10, GNUTLS_KX_ANON_ECDH = 11,
GNUTLS_KX_ANON_ECDH = 11, GNUTLS_KX_ECDHE_RSA = 12,
GNUTLS_KX_ECDHE_RSA = 12, GNUTLS_KX_ECDHE_ECDSA = 13,
GNUTLS_KX_ECDHE_ECDSA = 13, GNUTLS_KX_ECDHE_PSK = 14,
GNUTLS_KX_ECDHE_PSK = 14, GNUTLS_KX_RSA_PSK = 15,
GNUTLS_KX_RSA_PSK = 15, } gnutls_kx_algorithm_t;
} gnutls_kx_algorithm_t;
/** /**
* gnutls_params_type_t: * gnutls_params_type_t:
* @GNUTLS_PARAMS_RSA_EXPORT: Session RSA-EXPORT parameters (defunc). * @GNUTLS_PARAMS_RSA_EXPORT: Session RSA-EXPORT parameters (defunc).
* @GNUTLS_PARAMS_DH: Session Diffie-Hellman parameters. * @GNUTLS_PARAMS_DH: Session Diffie-Hellman parameters.
* @GNUTLS_PARAMS_ECDH: Session Elliptic-Curve Diffie-Hellman parameters. * @GNUTLS_PARAMS_ECDH: Session Elliptic-Curve Diffie-Hellman parameters.
* *
* Enumeration of different TLS session parameter types. * Enumeration of different TLS session parameter types.
*/ */
typedef enum typedef enum {
{ GNUTLS_PARAMS_RSA_EXPORT = 1,
GNUTLS_PARAMS_RSA_EXPORT = 1, GNUTLS_PARAMS_DH = 2,
GNUTLS_PARAMS_DH = 2, GNUTLS_PARAMS_ECDH = 3,
GNUTLS_PARAMS_ECDH = 3, } gnutls_params_type_t;
} gnutls_params_type_t;
/** /**
* gnutls_credentials_type_t: * gnutls_credentials_type_t:
* @GNUTLS_CRD_CERTIFICATE: Certificate credential. * @GNUTLS_CRD_CERTIFICATE: Certificate credential.
* @GNUTLS_CRD_ANON: Anonymous credential. * @GNUTLS_CRD_ANON: Anonymous credential.
* @GNUTLS_CRD_SRP: SRP credential. * @GNUTLS_CRD_SRP: SRP credential.
* @GNUTLS_CRD_PSK: PSK credential. * @GNUTLS_CRD_PSK: PSK credential.
* @GNUTLS_CRD_IA: IA credential. * @GNUTLS_CRD_IA: IA credential.
* *
* Enumeration of different credential types. * Enumeration of different credential types.
*/ */
typedef enum typedef enum {
{ GNUTLS_CRD_CERTIFICATE = 1,
GNUTLS_CRD_CERTIFICATE = 1, GNUTLS_CRD_ANON,
GNUTLS_CRD_ANON, GNUTLS_CRD_SRP,
GNUTLS_CRD_SRP, GNUTLS_CRD_PSK,
GNUTLS_CRD_PSK, GNUTLS_CRD_IA
GNUTLS_CRD_IA } gnutls_credentials_type_t;
} gnutls_credentials_type_t;
#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1 #define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1
#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1 #define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1
/** /**
* gnutls_mac_algorithm_t: * gnutls_mac_algorithm_t:
* @GNUTLS_MAC_UNKNOWN: Unknown MAC algorithm. * @GNUTLS_MAC_UNKNOWN: Unknown MAC algorithm.
* @GNUTLS_MAC_NULL: NULL MAC algorithm (empty output). * @GNUTLS_MAC_NULL: NULL MAC algorithm (empty output).
* @GNUTLS_MAC_MD5: HMAC-MD5 algorithm. * @GNUTLS_MAC_MD5: HMAC-MD5 algorithm.
* @GNUTLS_MAC_SHA1: HMAC-SHA-1 algorithm. * @GNUTLS_MAC_SHA1: HMAC-SHA-1 algorithm.
skipping to change at line 230 skipping to change at line 228
* @GNUTLS_MAC_SHA384: HMAC-SHA-384 algorithm. * @GNUTLS_MAC_SHA384: HMAC-SHA-384 algorithm.
* @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm. * @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm.
* @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm. * @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm.
* @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher. * @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher.
* @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm. * @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm.
* @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm. * @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm.
* *
* Enumeration of different Message Authentication Code (MAC) * Enumeration of different Message Authentication Code (MAC)
* algorithms. * algorithms.
*/ */
typedef enum typedef enum {
{ GNUTLS_MAC_UNKNOWN = 0,
GNUTLS_MAC_UNKNOWN = 0, GNUTLS_MAC_NULL = 1,
GNUTLS_MAC_NULL = 1, GNUTLS_MAC_MD5 = 2,
GNUTLS_MAC_MD5 = 2, GNUTLS_MAC_SHA1 = 3,
GNUTLS_MAC_SHA1 = 3, GNUTLS_MAC_RMD160 = 4,
GNUTLS_MAC_RMD160 = 4, GNUTLS_MAC_MD2 = 5,
GNUTLS_MAC_MD2 = 5, GNUTLS_MAC_SHA256 = 6,
GNUTLS_MAC_SHA256 = 6, GNUTLS_MAC_SHA384 = 7,
GNUTLS_MAC_SHA384 = 7, GNUTLS_MAC_SHA512 = 8,
GNUTLS_MAC_SHA512 = 8, GNUTLS_MAC_SHA224 = 9,
GNUTLS_MAC_SHA224 = 9, /* If you add anything here, make sure you align with
/* If you add anything here, make sure you align with gnutls_digest_algorithm_t. */
gnutls_digest_algorithm_t. */ GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */
GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */ GNUTLS_MAC_UMAC_96 = 201,
GNUTLS_MAC_UMAC_96 = 201, GNUTLS_MAC_UMAC_128 = 202,
GNUTLS_MAC_UMAC_128 = 202, } gnutls_mac_algorithm_t;
} gnutls_mac_algorithm_t;
/** /**
* gnutls_digest_algorithm_t: * gnutls_digest_algorithm_t:
* @GNUTLS_DIG_UNKNOWN: Unknown hash algorithm. * @GNUTLS_DIG_UNKNOWN: Unknown hash algorithm.
* @GNUTLS_DIG_NULL: NULL hash algorithm (empty output). * @GNUTLS_DIG_NULL: NULL hash algorithm (empty output).
* @GNUTLS_DIG_MD5: MD5 algorithm. * @GNUTLS_DIG_MD5: MD5 algorithm.
* @GNUTLS_DIG_SHA1: SHA-1 algorithm. * @GNUTLS_DIG_SHA1: SHA-1 algorithm.
* @GNUTLS_DIG_RMD160: RMD160 algorithm. * @GNUTLS_DIG_RMD160: RMD160 algorithm.
* @GNUTLS_DIG_MD2: MD2 algorithm. * @GNUTLS_DIG_MD2: MD2 algorithm.
* @GNUTLS_DIG_SHA256: SHA-256 algorithm. * @GNUTLS_DIG_SHA256: SHA-256 algorithm.
* @GNUTLS_DIG_SHA384: SHA-384 algorithm. * @GNUTLS_DIG_SHA384: SHA-384 algorithm.
* @GNUTLS_DIG_SHA512: SHA-512 algorithm. * @GNUTLS_DIG_SHA512: SHA-512 algorithm.
* @GNUTLS_DIG_SHA224: SHA-224 algorithm. * @GNUTLS_DIG_SHA224: SHA-224 algorithm.
* *
* Enumeration of different digest (hash) algorithms. * Enumeration of different digest (hash) algorithms.
*/ */
typedef enum typedef enum {
{ GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN,
GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN, GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
GNUTLS_DIG_NULL = GNUTLS_MAC_NULL, GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5, GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1, GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160,
GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160, GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2,
GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2, GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256, GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384,
GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384, GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512,
GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512, GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224
GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224 /* If you add anything here, make sure you align with
/* If you add anything here, make sure you align with gnutls_mac_algorithm_t. */
gnutls_mac_algorithm_t. */ } gnutls_digest_algorithm_t;
} gnutls_digest_algorithm_t;
/* exported for other gnutls headers. This is the maximum number of /* exported for other gnutls headers. This is the maximum number of
* algorithms (ciphers, kx or macs). * algorithms (ciphers, kx or macs).
*/ */
#define GNUTLS_MAX_ALGORITHM_NUM 32 #define GNUTLS_MAX_ALGORITHM_NUM 32
/** /**
* gnutls_compression_method_t: * gnutls_compression_method_t:
* @GNUTLS_COMP_UNKNOWN: Unknown compression method. * @GNUTLS_COMP_UNKNOWN: Unknown compression method.
* @GNUTLS_COMP_NULL: The NULL compression method (no compression). * @GNUTLS_COMP_NULL: The NULL compression method (no compression).
* @GNUTLS_COMP_DEFLATE: The DEFLATE compression method from zlib. * @GNUTLS_COMP_DEFLATE: The DEFLATE compression method from zlib.
* @GNUTLS_COMP_ZLIB: Same as %GNUTLS_COMP_DEFLATE. * @GNUTLS_COMP_ZLIB: Same as %GNUTLS_COMP_DEFLATE.
* *
* Enumeration of different TLS compression methods. * Enumeration of different TLS compression methods.
*/ */
typedef enum typedef enum {
{ GNUTLS_COMP_UNKNOWN = 0,
GNUTLS_COMP_UNKNOWN = 0, GNUTLS_COMP_NULL = 1,
GNUTLS_COMP_NULL = 1, GNUTLS_COMP_DEFLATE = 2,
GNUTLS_COMP_DEFLATE = 2, GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE,
GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE, } gnutls_compression_method_t;
} gnutls_compression_method_t;
/* /*
* Flags for gnutls_init() * Flags for gnutls_init()
* *
* @GNUTLS_SERVER: Connection end is a server. * @GNUTLS_SERVER: Connection end is a server.
* @GNUTLS_CLIENT: Connection end is a client. * @GNUTLS_CLIENT: Connection end is a client.
* @GNUTLS_DATAGRAM: Connection is datagram oriented (DTLS). * @GNUTLS_DATAGRAM: Connection is datagram oriented (DTLS).
* @GNUTLS_NONBLOCK: Connection should not block (DTLS). * @GNUTLS_NONBLOCK: Connection should not block (DTLS).
* @GNUTLS_NO_EXTENSIONS: Do not enable any TLS extensions by default. * @GNUTLS_NO_EXTENSIONS: Do not enable any TLS extensions by default.
* @GNUTLS_NO_REPLAY_PROTECTION: Disable any replay protection in DTLS. * @GNUTLS_NO_REPLAY_PROTECTION: Disable any replay protection in DTLS.
skipping to change at line 327 skipping to change at line 322
#define GNUTLS_NO_EXTENSIONS (1<<4) #define GNUTLS_NO_EXTENSIONS (1<<4)
#define GNUTLS_NO_REPLAY_PROTECTION (1<<5) #define GNUTLS_NO_REPLAY_PROTECTION (1<<5)
/** /**
* gnutls_alert_level_t: * gnutls_alert_level_t:
* @GNUTLS_AL_WARNING: Alert of warning severity. * @GNUTLS_AL_WARNING: Alert of warning severity.
* @GNUTLS_AL_FATAL: Alert of fatal severity. * @GNUTLS_AL_FATAL: Alert of fatal severity.
* *
* Enumeration of different TLS alert severities. * Enumeration of different TLS alert severities.
*/ */
typedef enum typedef enum {
{ GNUTLS_AL_WARNING = 1,
GNUTLS_AL_WARNING = 1, GNUTLS_AL_FATAL
GNUTLS_AL_FATAL } gnutls_alert_level_t;
} gnutls_alert_level_t;
/** /**
* gnutls_alert_description_t: * gnutls_alert_description_t:
* @GNUTLS_A_CLOSE_NOTIFY: Close notify. * @GNUTLS_A_CLOSE_NOTIFY: Close notify.
* @GNUTLS_A_UNEXPECTED_MESSAGE: Unexpected message. * @GNUTLS_A_UNEXPECTED_MESSAGE: Unexpected message.
* @GNUTLS_A_BAD_RECORD_MAC: Bad record MAC. * @GNUTLS_A_BAD_RECORD_MAC: Bad record MAC.
* @GNUTLS_A_DECRYPTION_FAILED: Decryption failed. * @GNUTLS_A_DECRYPTION_FAILED: Decryption failed.
* @GNUTLS_A_RECORD_OVERFLOW: Record overflow. * @GNUTLS_A_RECORD_OVERFLOW: Record overflow.
* @GNUTLS_A_DECOMPRESSION_FAILURE: Decompression failed. * @GNUTLS_A_DECOMPRESSION_FAILURE: Decompression failed.
* @GNUTLS_A_HANDSHAKE_FAILURE: Handshake failed. * @GNUTLS_A_HANDSHAKE_FAILURE: Handshake failed.
skipping to change at line 370 skipping to change at line 364
* specified certificate. * specified certificate.
* @GNUTLS_A_UNSUPPORTED_EXTENSION: An unsupported extension was * @GNUTLS_A_UNSUPPORTED_EXTENSION: An unsupported extension was
* sent. * sent.
* @GNUTLS_A_UNRECOGNIZED_NAME: The server name sent was not * @GNUTLS_A_UNRECOGNIZED_NAME: The server name sent was not
* recognized. * recognized.
* @GNUTLS_A_UNKNOWN_PSK_IDENTITY: The SRP/PSK username is missing * @GNUTLS_A_UNKNOWN_PSK_IDENTITY: The SRP/PSK username is missing
* or not known. * or not known.
* *
* Enumeration of different TLS alerts. * Enumeration of different TLS alerts.
*/ */
typedef enum typedef enum {
{ GNUTLS_A_CLOSE_NOTIFY,
GNUTLS_A_CLOSE_NOTIFY, GNUTLS_A_UNEXPECTED_MESSAGE = 10,
GNUTLS_A_UNEXPECTED_MESSAGE = 10, GNUTLS_A_BAD_RECORD_MAC = 20,
GNUTLS_A_BAD_RECORD_MAC = 20, GNUTLS_A_DECRYPTION_FAILED,
GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_RECORD_OVERFLOW,
GNUTLS_A_RECORD_OVERFLOW, GNUTLS_A_DECOMPRESSION_FAILURE = 30,
GNUTLS_A_DECOMPRESSION_FAILURE = 30, GNUTLS_A_HANDSHAKE_FAILURE = 40,
GNUTLS_A_HANDSHAKE_FAILURE = 40, GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
GNUTLS_A_SSL3_NO_CERTIFICATE = 41, GNUTLS_A_BAD_CERTIFICATE = 42,
GNUTLS_A_BAD_CERTIFICATE = 42, GNUTLS_A_UNSUPPORTED_CERTIFICATE,
GNUTLS_A_UNSUPPORTED_CERTIFICATE, GNUTLS_A_CERTIFICATE_REVOKED,
GNUTLS_A_CERTIFICATE_REVOKED, GNUTLS_A_CERTIFICATE_EXPIRED,
GNUTLS_A_CERTIFICATE_EXPIRED, GNUTLS_A_CERTIFICATE_UNKNOWN,
GNUTLS_A_CERTIFICATE_UNKNOWN, GNUTLS_A_ILLEGAL_PARAMETER,
GNUTLS_A_ILLEGAL_PARAMETER, GNUTLS_A_UNKNOWN_CA,
GNUTLS_A_UNKNOWN_CA, GNUTLS_A_ACCESS_DENIED,
GNUTLS_A_ACCESS_DENIED, GNUTLS_A_DECODE_ERROR = 50,
GNUTLS_A_DECODE_ERROR = 50, GNUTLS_A_DECRYPT_ERROR,
GNUTLS_A_DECRYPT_ERROR, GNUTLS_A_EXPORT_RESTRICTION = 60,
GNUTLS_A_EXPORT_RESTRICTION = 60, GNUTLS_A_PROTOCOL_VERSION = 70,
GNUTLS_A_PROTOCOL_VERSION = 70, GNUTLS_A_INSUFFICIENT_SECURITY,
GNUTLS_A_INSUFFICIENT_SECURITY, GNUTLS_A_INTERNAL_ERROR = 80,
GNUTLS_A_INTERNAL_ERROR = 80, GNUTLS_A_USER_CANCELED = 90,
GNUTLS_A_USER_CANCELED = 90, GNUTLS_A_NO_RENEGOTIATION = 100,
GNUTLS_A_NO_RENEGOTIATION = 100, GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
GNUTLS_A_UNSUPPORTED_EXTENSION = 110, GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111, GNUTLS_A_UNRECOGNIZED_NAME = 112,
GNUTLS_A_UNRECOGNIZED_NAME = 112, GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115, GNUTLS_A_NO_APPLICATION_PROTOCOL = 120,
GNUTLS_A_NO_APPLICATION_PROTOCOL = 120, } gnutls_alert_description_t;
} gnutls_alert_description_t;
/** /**
* gnutls_handshake_description_t: * gnutls_handshake_description_t:
* @GNUTLS_HANDSHAKE_HELLO_REQUEST: Hello request. * @GNUTLS_HANDSHAKE_HELLO_REQUEST: Hello request.
* @GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST: DTLS Hello verify request. * @GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST: DTLS Hello verify request.
* @GNUTLS_HANDSHAKE_CLIENT_HELLO: Client hello. * @GNUTLS_HANDSHAKE_CLIENT_HELLO: Client hello.
* @GNUTLS_HANDSHAKE_SERVER_HELLO: Server hello. * @GNUTLS_HANDSHAKE_SERVER_HELLO: Server hello.
* @GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: New session ticket. * @GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: New session ticket.
* @GNUTLS_HANDSHAKE_CERTIFICATE_PKT: Certificate packet. * @GNUTLS_HANDSHAKE_CERTIFICATE_PKT: Certificate packet.
* @GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: Server key exchange. * @GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: Server key exchange.
skipping to change at line 424 skipping to change at line 417
* @GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: Certificate verify. * @GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: Certificate verify.
* @GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: Client key exchange. * @GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: Client key exchange.
* @GNUTLS_HANDSHAKE_FINISHED: Finished. * @GNUTLS_HANDSHAKE_FINISHED: Finished.
* @GNUTLS_HANDSHAKE_CERTIFICATE_STATUS: Certificate status (OCSP). * @GNUTLS_HANDSHAKE_CERTIFICATE_STATUS: Certificate status (OCSP).
* @GNUTLS_HANDSHAKE_SUPPLEMENTAL: Supplemental. * @GNUTLS_HANDSHAKE_SUPPLEMENTAL: Supplemental.
* @GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC: Change Cipher Spec. * @GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC: Change Cipher Spec.
* @GNUTLS_HANDSHAKE_CLIENT_HELLO_V2: SSLv2 Client Hello. * @GNUTLS_HANDSHAKE_CLIENT_HELLO_V2: SSLv2 Client Hello.
* *
* Enumeration of different TLS handshake packets. * Enumeration of different TLS handshake packets.
*/ */
typedef enum typedef enum {
{ GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
GNUTLS_HANDSHAKE_HELLO_REQUEST = 0, GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
GNUTLS_HANDSHAKE_CLIENT_HELLO = 1, GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
GNUTLS_HANDSHAKE_SERVER_HELLO = 2, GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3,
GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3, GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4,
GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4, GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11, GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12, GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13, GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14, GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15, GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16, GNUTLS_HANDSHAKE_FINISHED = 20,
GNUTLS_HANDSHAKE_FINISHED = 20, GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22,
GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22, GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23,
GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23, GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254,
GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254, GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024,
GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024, } gnutls_handshake_description_t;
} gnutls_handshake_description_t;
#define GNUTLS_HANDSHAKE_ANY ((unsigned int)-1) #define GNUTLS_HANDSHAKE_ANY ((unsigned int)-1)
const char * const char
gnutls_handshake_description_get_name (gnutls_handshake_description_t type) *gnutls_handshake_description_get_name(gnutls_handshake_description_t
; type);
/** /**
* gnutls_certificate_status_t: * gnutls_certificate_status_t:
* @GNUTLS_CERT_INVALID: The certificate is not signed by one of the * @GNUTLS_CERT_INVALID: The certificate is not signed by one of the
* known authorities or the signature is invalid (deprecated by the flags * known authorities or the signature is invalid (deprecated by the flags
* %GNUTLS_CERT_SIGNATURE_FAILURE and %GNUTLS_CERT_SIGNER_NOT_FOUND). * %GNUTLS_CERT_SIGNATURE_FAILURE and %GNUTLS_CERT_SIGNER_NOT_FOUND).
* @GNUTLS_CERT_SIGNATURE_FAILURE: The signature verification failed. * @GNUTLS_CERT_SIGNATURE_FAILURE: The signature verification failed.
* @GNUTLS_CERT_REVOKED: Certificate is revoked by its authority. In X.509 this will be * @GNUTLS_CERT_REVOKED: Certificate is revoked by its authority. In X.509 this will be
* set only if CRLs are checked. * set only if CRLs are checked.
* @GNUTLS_CERT_SIGNER_NOT_FOUND: The certificate's issuer is not known. * @GNUTLS_CERT_SIGNER_NOT_FOUND: The certificate's issuer is not known.
skipping to change at line 478 skipping to change at line 471
* @GNUTLS_CERT_EXPIRED: The certificate has expired. * @GNUTLS_CERT_EXPIRED: The certificate has expired.
* @GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED: The revocation data are old and have been superseded. * @GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED: The revocation data are old and have been superseded.
* @GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE: The revocation data have a future issue date. * @GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE: The revocation data have a future issue date.
* @GNUTLS_CERT_UNEXPECTED_OWNER: The owner is not the expected one. * @GNUTLS_CERT_UNEXPECTED_OWNER: The owner is not the expected one.
* @GNUTLS_CERT_MISMATCH: The certificate presented isn't the expected one (TOFU) * @GNUTLS_CERT_MISMATCH: The certificate presented isn't the expected one (TOFU)
* *
* Enumeration of certificate status codes. Note that the status * Enumeration of certificate status codes. Note that the status
* bits may have different meanings in OpenPGP keys and X.509 * bits may have different meanings in OpenPGP keys and X.509
* certificate verification. * certificate verification.
*/ */
typedef enum typedef enum {
{ GNUTLS_CERT_INVALID = 1 << 1,
GNUTLS_CERT_INVALID = 1<<1, GNUTLS_CERT_REVOKED = 1 << 5,
GNUTLS_CERT_REVOKED = 1<<5, GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6,
GNUTLS_CERT_SIGNER_NOT_FOUND = 1<<6, GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7,
GNUTLS_CERT_SIGNER_NOT_CA = 1<<7, GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8,
GNUTLS_CERT_INSECURE_ALGORITHM = 1<<8, GNUTLS_CERT_NOT_ACTIVATED = 1 << 9,
GNUTLS_CERT_NOT_ACTIVATED = 1<<9, GNUTLS_CERT_EXPIRED = 1 << 10,
GNUTLS_CERT_EXPIRED = 1<<10, GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11,
GNUTLS_CERT_SIGNATURE_FAILURE = 1<<11, GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12,
GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1<<12, GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14,
GNUTLS_CERT_UNEXPECTED_OWNER = 1<<14, GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15,
GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1<<15, GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16,
GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1<<16, GNUTLS_CERT_MISMATCH = 1 << 17,
GNUTLS_CERT_MISMATCH = 1<<17, } gnutls_certificate_status_t;
} gnutls_certificate_status_t;
/** /**
* gnutls_certificate_request_t: * gnutls_certificate_request_t:
* @GNUTLS_CERT_IGNORE: Ignore certificate. * @GNUTLS_CERT_IGNORE: Ignore certificate.
* @GNUTLS_CERT_REQUEST: Request certificate. * @GNUTLS_CERT_REQUEST: Request certificate.
* @GNUTLS_CERT_REQUIRE: Require certificate. * @GNUTLS_CERT_REQUIRE: Require certificate.
* *
* Enumeration of certificate request types. * Enumeration of certificate request types.
*/ */
typedef enum typedef enum {
{ GNUTLS_CERT_IGNORE = 0,
GNUTLS_CERT_IGNORE = 0, GNUTLS_CERT_REQUEST = 1,
GNUTLS_CERT_REQUEST = 1, GNUTLS_CERT_REQUIRE = 2
GNUTLS_CERT_REQUIRE = 2 } gnutls_certificate_request_t;
} gnutls_certificate_request_t;
/** /**
* gnutls_openpgp_crt_status_t: * gnutls_openpgp_crt_status_t:
* @GNUTLS_OPENPGP_CERT: Send entire certificate. * @GNUTLS_OPENPGP_CERT: Send entire certificate.
* @GNUTLS_OPENPGP_CERT_FINGERPRINT: Send only certificate fingerprint. * @GNUTLS_OPENPGP_CERT_FINGERPRINT: Send only certificate fingerprint.
* *
* Enumeration of ways to send OpenPGP certificate. * Enumeration of ways to send OpenPGP certificate.
*/ */
typedef enum typedef enum {
{ GNUTLS_OPENPGP_CERT = 0,
GNUTLS_OPENPGP_CERT = 0, GNUTLS_OPENPGP_CERT_FINGERPRINT = 1
GNUTLS_OPENPGP_CERT_FINGERPRINT = 1 } gnutls_openpgp_crt_status_t;
} gnutls_openpgp_crt_status_t;
/** /**
* gnutls_close_request_t: * gnutls_close_request_t:
* @GNUTLS_SHUT_RDWR: Disallow further receives/sends. * @GNUTLS_SHUT_RDWR: Disallow further receives/sends.
* @GNUTLS_SHUT_WR: Disallow further sends. * @GNUTLS_SHUT_WR: Disallow further sends.
* *
* Enumeration of how TLS session should be terminated. See gnutls_bye(). * Enumeration of how TLS session should be terminated. See gnutls_bye().
*/ */
typedef enum typedef enum {
{ GNUTLS_SHUT_RDWR = 0,
GNUTLS_SHUT_RDWR = 0, GNUTLS_SHUT_WR = 1
GNUTLS_SHUT_WR = 1 } gnutls_close_request_t;
} gnutls_close_request_t;
/** /**
* gnutls_protocol_t: * gnutls_protocol_t:
* @GNUTLS_SSL3: SSL version 3.0. * @GNUTLS_SSL3: SSL version 3.0.
* @GNUTLS_TLS1_0: TLS version 1.0. * @GNUTLS_TLS1_0: TLS version 1.0.
* @GNUTLS_TLS1: Same as %GNUTLS_TLS1_0. * @GNUTLS_TLS1: Same as %GNUTLS_TLS1_0.
* @GNUTLS_TLS1_1: TLS version 1.1. * @GNUTLS_TLS1_1: TLS version 1.1.
* @GNUTLS_TLS1_2: TLS version 1.2. * @GNUTLS_TLS1_2: TLS version 1.2.
* @GNUTLS_DTLS1_0: DTLS version 1.0. * @GNUTLS_DTLS1_0: DTLS version 1.0.
* @GNUTLS_DTLS1_2: DTLS version 1.2. * @GNUTLS_DTLS1_2: DTLS version 1.2.
* @GNUTLS_DTLS0_9: DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e). * @GNUTLS_DTLS0_9: DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e).
* @GNUTLS_VERSION_MAX: Maps to the highest supported TLS version. * @GNUTLS_VERSION_MAX: Maps to the highest supported TLS version.
* @GNUTLS_VERSION_UNKNOWN: Unknown SSL/TLS version. * @GNUTLS_VERSION_UNKNOWN: Unknown SSL/TLS version.
* *
* Enumeration of different SSL/TLS protocol versions. * Enumeration of different SSL/TLS protocol versions.
*/ */
typedef enum typedef enum {
{ GNUTLS_SSL3 = 1,
GNUTLS_SSL3 = 1, GNUTLS_TLS1_0 = 2,
GNUTLS_TLS1_0 = 2, GNUTLS_TLS1 = GNUTLS_TLS1_0,
GNUTLS_TLS1 = GNUTLS_TLS1_0, GNUTLS_TLS1_1 = 3,
GNUTLS_TLS1_1 = 3, GNUTLS_TLS1_2 = 4,
GNUTLS_TLS1_2 = 4, GNUTLS_DTLS0_9 = 6, /* FIXME: at some point change it to 200 */
GNUTLS_DTLS0_9 = 6, /* FIXME: at some point change it to 200 */ GNUTLS_DTLS1_0 = 5, /* 201 */
GNUTLS_DTLS1_0 = 5, /* 201 */ GNUTLS_DTLS1_2 = 202,
GNUTLS_DTLS1_2 = 202, GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS1_0,
GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS1_0, GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2,
GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2, GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_2,
GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_2, GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */
GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */ } gnutls_protocol_t;
} gnutls_protocol_t;
/** /**
* gnutls_certificate_type_t: * gnutls_certificate_type_t:
* @GNUTLS_CRT_UNKNOWN: Unknown certificate type. * @GNUTLS_CRT_UNKNOWN: Unknown certificate type.
* @GNUTLS_CRT_X509: X.509 Certificate. * @GNUTLS_CRT_X509: X.509 Certificate.
* @GNUTLS_CRT_OPENPGP: OpenPGP certificate. * @GNUTLS_CRT_OPENPGP: OpenPGP certificate.
* @GNUTLS_CRT_RAW: Raw public key (SubjectPublicKey) * @GNUTLS_CRT_RAW: Raw public key (SubjectPublicKey)
* *
* Enumeration of different certificate types. * Enumeration of different certificate types.
*/ */
typedef enum typedef enum {
{ GNUTLS_CRT_UNKNOWN = 0,
GNUTLS_CRT_UNKNOWN = 0, GNUTLS_CRT_X509 = 1,
GNUTLS_CRT_X509 = 1, GNUTLS_CRT_OPENPGP = 2,
GNUTLS_CRT_OPENPGP = 2, GNUTLS_CRT_RAW = 3
GNUTLS_CRT_RAW = 3 } gnutls_certificate_type_t;
} gnutls_certificate_type_t;
/** /**
* gnutls_x509_crt_fmt_t: * gnutls_x509_crt_fmt_t:
* @GNUTLS_X509_FMT_DER: X.509 certificate in DER format (binary). * @GNUTLS_X509_FMT_DER: X.509 certificate in DER format (binary).
* @GNUTLS_X509_FMT_PEM: X.509 certificate in PEM format (text). * @GNUTLS_X509_FMT_PEM: X.509 certificate in PEM format (text).
* *
* Enumeration of different certificate encoding formats. * Enumeration of different certificate encoding formats.
*/ */
typedef enum typedef enum {
{ GNUTLS_X509_FMT_DER = 0,
GNUTLS_X509_FMT_DER = 0, GNUTLS_X509_FMT_PEM = 1
GNUTLS_X509_FMT_PEM = 1 } gnutls_x509_crt_fmt_t;
} gnutls_x509_crt_fmt_t;
/** /**
* gnutls_certificate_print_formats_t: * gnutls_certificate_print_formats_t:
* @GNUTLS_CRT_PRINT_FULL: Full information about certificate. * @GNUTLS_CRT_PRINT_FULL: Full information about certificate.
* @GNUTLS_CRT_PRINT_FULL_NUMBERS: Full information about certificate and i nclude easy to parse public key parameters. * @GNUTLS_CRT_PRINT_FULL_NUMBERS: Full information about certificate and i nclude easy to parse public key parameters.
* @GNUTLS_CRT_PRINT_COMPACT: Information about certificate name in one lin e, plus identification of the public key. * @GNUTLS_CRT_PRINT_COMPACT: Information about certificate name in one lin e, plus identification of the public key.
* @GNUTLS_CRT_PRINT_ONELINE: Information about certificate in one line. * @GNUTLS_CRT_PRINT_ONELINE: Information about certificate in one line.
* @GNUTLS_CRT_PRINT_UNSIGNED_FULL: All info for an unsigned certificate. * @GNUTLS_CRT_PRINT_UNSIGNED_FULL: All info for an unsigned certificate.
* *
* Enumeration of different certificate printing variants. * Enumeration of different certificate printing variants.
*/ */
typedef enum gnutls_certificate_print_formats typedef enum gnutls_certificate_print_formats {
{ GNUTLS_CRT_PRINT_FULL = 0,
GNUTLS_CRT_PRINT_FULL = 0, GNUTLS_CRT_PRINT_ONELINE = 1,
GNUTLS_CRT_PRINT_ONELINE = 1, GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2,
GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2, GNUTLS_CRT_PRINT_COMPACT = 3,
GNUTLS_CRT_PRINT_COMPACT = 3, GNUTLS_CRT_PRINT_FULL_NUMBERS = 4,
GNUTLS_CRT_PRINT_FULL_NUMBERS = 4, } gnutls_certificate_print_formats_t;
} gnutls_certificate_print_formats_t;
#define GNUTLS_PK_ECC GNUTLS_PK_EC #define GNUTLS_PK_ECC GNUTLS_PK_EC
/** /**
* gnutls_pk_algorithm_t: * gnutls_pk_algorithm_t:
* @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm. * @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm.
* @GNUTLS_PK_RSA: RSA public-key algorithm. * @GNUTLS_PK_RSA: RSA public-key algorithm.
* @GNUTLS_PK_DSA: DSA public-key algorithm. * @GNUTLS_PK_DSA: DSA public-key algorithm.
* @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters. * @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters.
* @GNUTLS_PK_EC: Elliptic curve algorithm. Used to generate parameters. * @GNUTLS_PK_EC: Elliptic curve algorithm. Used to generate parameters.
* *
* Enumeration of different public-key algorithms. * Enumeration of different public-key algorithms.
*/ */
typedef enum typedef enum {
{ GNUTLS_PK_UNKNOWN = 0,
GNUTLS_PK_UNKNOWN = 0, GNUTLS_PK_RSA = 1,
GNUTLS_PK_RSA = 1, GNUTLS_PK_DSA = 2,
GNUTLS_PK_DSA = 2, GNUTLS_PK_DH = 3,
GNUTLS_PK_DH = 3, GNUTLS_PK_EC = 4,
GNUTLS_PK_EC = 4, } gnutls_pk_algorithm_t;
} gnutls_pk_algorithm_t;
const char *gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm ); const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm_t algorithm);
/** /**
* gnutls_sign_algorithm_t: * gnutls_sign_algorithm_t:
* @GNUTLS_SIGN_UNKNOWN: Unknown signature algorithm. * @GNUTLS_SIGN_UNKNOWN: Unknown signature algorithm.
* @GNUTLS_SIGN_RSA_SHA1: Digital signature algorithm RSA with SHA-1 * @GNUTLS_SIGN_RSA_SHA1: Digital signature algorithm RSA with SHA-1
* @GNUTLS_SIGN_RSA_SHA: Same as %GNUTLS_SIGN_RSA_SHA1. * @GNUTLS_SIGN_RSA_SHA: Same as %GNUTLS_SIGN_RSA_SHA1.
* @GNUTLS_SIGN_DSA_SHA1: Digital signature algorithm DSA with SHA-1 * @GNUTLS_SIGN_DSA_SHA1: Digital signature algorithm DSA with SHA-1
* @GNUTLS_SIGN_DSA_SHA224: Digital signature algorithm DSA with SHA-224 * @GNUTLS_SIGN_DSA_SHA224: Digital signature algorithm DSA with SHA-224
* @GNUTLS_SIGN_DSA_SHA256: Digital signature algorithm DSA with SHA-256 * @GNUTLS_SIGN_DSA_SHA256: Digital signature algorithm DSA with SHA-256
* @GNUTLS_SIGN_DSA_SHA: Same as %GNUTLS_SIGN_DSA_SHA1. * @GNUTLS_SIGN_DSA_SHA: Same as %GNUTLS_SIGN_DSA_SHA1.
skipping to change at line 662 skipping to change at line 646
* @GNUTLS_SIGN_RSA_SHA512: Digital signature algorithm RSA with SHA-512. * @GNUTLS_SIGN_RSA_SHA512: Digital signature algorithm RSA with SHA-512.
* @GNUTLS_SIGN_RSA_SHA224: Digital signature algorithm RSA with SHA-224. * @GNUTLS_SIGN_RSA_SHA224: Digital signature algorithm RSA with SHA-224.
* @GNUTLS_SIGN_ECDSA_SHA1: ECDSA with SHA1. * @GNUTLS_SIGN_ECDSA_SHA1: ECDSA with SHA1.
* @GNUTLS_SIGN_ECDSA_SHA256: Digital signature algorithm ECDSA with SHA-25 6. * @GNUTLS_SIGN_ECDSA_SHA256: Digital signature algorithm ECDSA with SHA-25 6.
* @GNUTLS_SIGN_ECDSA_SHA384: Digital signature algorithm ECDSA with SHA-38 4. * @GNUTLS_SIGN_ECDSA_SHA384: Digital signature algorithm ECDSA with SHA-38 4.
* @GNUTLS_SIGN_ECDSA_SHA512: Digital signature algorithm ECDSA with SHA-51 2. * @GNUTLS_SIGN_ECDSA_SHA512: Digital signature algorithm ECDSA with SHA-51 2.
* @GNUTLS_SIGN_ECDSA_SHA224: Digital signature algorithm ECDSA with SHA-22 4. * @GNUTLS_SIGN_ECDSA_SHA224: Digital signature algorithm ECDSA with SHA-22 4.
* *
* Enumeration of different digital signature algorithms. * Enumeration of different digital signature algorithms.
*/ */
typedef enum typedef enum {
{ GNUTLS_SIGN_UNKNOWN = 0,
GNUTLS_SIGN_UNKNOWN = 0, GNUTLS_SIGN_RSA_SHA1 = 1,
GNUTLS_SIGN_RSA_SHA1 = 1, GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1,
GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1, GNUTLS_SIGN_DSA_SHA1 = 2,
GNUTLS_SIGN_DSA_SHA1 = 2, GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1,
GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1, GNUTLS_SIGN_RSA_MD5 = 3,
GNUTLS_SIGN_RSA_MD5 = 3, GNUTLS_SIGN_RSA_MD2 = 4,
GNUTLS_SIGN_RSA_MD2 = 4, GNUTLS_SIGN_RSA_RMD160 = 5,
GNUTLS_SIGN_RSA_RMD160 = 5, GNUTLS_SIGN_RSA_SHA256 = 6,
GNUTLS_SIGN_RSA_SHA256 = 6, GNUTLS_SIGN_RSA_SHA384 = 7,
GNUTLS_SIGN_RSA_SHA384 = 7, GNUTLS_SIGN_RSA_SHA512 = 8,
GNUTLS_SIGN_RSA_SHA512 = 8, GNUTLS_SIGN_RSA_SHA224 = 9,
GNUTLS_SIGN_RSA_SHA224 = 9, GNUTLS_SIGN_DSA_SHA224 = 10,
GNUTLS_SIGN_DSA_SHA224 = 10, GNUTLS_SIGN_DSA_SHA256 = 11,
GNUTLS_SIGN_DSA_SHA256 = 11, GNUTLS_SIGN_ECDSA_SHA1 = 12,
GNUTLS_SIGN_ECDSA_SHA1 = 12, GNUTLS_SIGN_ECDSA_SHA224 = 13,
GNUTLS_SIGN_ECDSA_SHA224 = 13, GNUTLS_SIGN_ECDSA_SHA256 = 14,
GNUTLS_SIGN_ECDSA_SHA256 = 14, GNUTLS_SIGN_ECDSA_SHA384 = 15,
GNUTLS_SIGN_ECDSA_SHA384 = 15, GNUTLS_SIGN_ECDSA_SHA512 = 16,
GNUTLS_SIGN_ECDSA_SHA512 = 16, } gnutls_sign_algorithm_t;
} gnutls_sign_algorithm_t;
/** /**
* gnutls_ecc_curve_t: * gnutls_ecc_curve_t:
* @GNUTLS_ECC_CURVE_INVALID: Cannot be known * @GNUTLS_ECC_CURVE_INVALID: Cannot be known
* @GNUTLS_ECC_CURVE_SECP192R1: the SECP192R1 curve * @GNUTLS_ECC_CURVE_SECP192R1: the SECP192R1 curve
* @GNUTLS_ECC_CURVE_SECP224R1: the SECP224R1 curve * @GNUTLS_ECC_CURVE_SECP224R1: the SECP224R1 curve
* @GNUTLS_ECC_CURVE_SECP256R1: the SECP256R1 curve * @GNUTLS_ECC_CURVE_SECP256R1: the SECP256R1 curve
* @GNUTLS_ECC_CURVE_SECP384R1: the SECP384R1 curve * @GNUTLS_ECC_CURVE_SECP384R1: the SECP384R1 curve
* @GNUTLS_ECC_CURVE_SECP521R1: the SECP521R1 curve * @GNUTLS_ECC_CURVE_SECP521R1: the SECP521R1 curve
* *
* Enumeration of ECC curves. * Enumeration of ECC curves.
*/ */
typedef enum typedef enum {
{ GNUTLS_ECC_CURVE_INVALID = 0,
GNUTLS_ECC_CURVE_INVALID=0, GNUTLS_ECC_CURVE_SECP224R1,
GNUTLS_ECC_CURVE_SECP224R1, GNUTLS_ECC_CURVE_SECP256R1,
GNUTLS_ECC_CURVE_SECP256R1, GNUTLS_ECC_CURVE_SECP384R1,
GNUTLS_ECC_CURVE_SECP384R1, GNUTLS_ECC_CURVE_SECP521R1,
GNUTLS_ECC_CURVE_SECP521R1, GNUTLS_ECC_CURVE_SECP192R1,
GNUTLS_ECC_CURVE_SECP192R1,
} gnutls_ecc_curve_t; } gnutls_ecc_curve_t;
/* macros to allow specifying a specific curve in gnutls_privkey_generate()
* and gnutls_x509_privkey_generate() */
#define GNUTLS_CURVE_TO_BITS(curve) (unsigned int)((1<<31)|(curve))
#define GNUTLS_BITS_TO_CURVE(bits) ((bits) & 0x7FFFFFFF)
#define GNUTLS_BITS_ARE_CURVE(bits) ((bits) & 0x80000000)
/** /**
* gnutls_sec_param_t: * gnutls_sec_param_t:
* @GNUTLS_SEC_PARAM_UNKNOWN: Cannot be known * @GNUTLS_SEC_PARAM_UNKNOWN: Cannot be known
* @GNUTLS_SEC_PARAM_INSECURE: Less than 42 bits of security * @GNUTLS_SEC_PARAM_INSECURE: Less than 42 bits of security
* @GNUTLS_SEC_PARAM_EXPORT: 42 bits of security * @GNUTLS_SEC_PARAM_EXPORT: 42 bits of security
* @GNUTLS_SEC_PARAM_VERY_WEAK: 64 bits of security * @GNUTLS_SEC_PARAM_VERY_WEAK: 64 bits of security
* @GNUTLS_SEC_PARAM_WEAK: 72 bits of security * @GNUTLS_SEC_PARAM_WEAK: 72 bits of security
* @GNUTLS_SEC_PARAM_LOW: 80 bits of security * @GNUTLS_SEC_PARAM_LOW: 80 bits of security
* @GNUTLS_SEC_PARAM_LEGACY: 96 bits of security * @GNUTLS_SEC_PARAM_LEGACY: 96 bits of security
* @GNUTLS_SEC_PARAM_NORMAL: 112 bits of security * @GNUTLS_SEC_PARAM_NORMAL: 112 bits of security
* @GNUTLS_SEC_PARAM_HIGH: 128 bits of security * @GNUTLS_SEC_PARAM_HIGH: 128 bits of security
* @GNUTLS_SEC_PARAM_ULTRA: 192 bits of security * @GNUTLS_SEC_PARAM_ULTRA: 192 bits of security
* *
* Enumeration of security parameters for passive attacks. * Enumeration of security parameters for passive attacks.
*/ */
typedef enum typedef enum {
{ GNUTLS_SEC_PARAM_INSECURE = -20,
GNUTLS_SEC_PARAM_INSECURE = -20, GNUTLS_SEC_PARAM_EXPORT = -15,
GNUTLS_SEC_PARAM_EXPORT = -15, GNUTLS_SEC_PARAM_VERY_WEAK = -12,
GNUTLS_SEC_PARAM_VERY_WEAK = -12, GNUTLS_SEC_PARAM_WEAK = -10,
GNUTLS_SEC_PARAM_WEAK = -10, GNUTLS_SEC_PARAM_UNKNOWN = 0,
GNUTLS_SEC_PARAM_UNKNOWN = 0, GNUTLS_SEC_PARAM_LOW = 1,
GNUTLS_SEC_PARAM_LOW = 1, GNUTLS_SEC_PARAM_LEGACY = 2,
GNUTLS_SEC_PARAM_LEGACY = 2, GNUTLS_SEC_PARAM_NORMAL = 3,
GNUTLS_SEC_PARAM_NORMAL = 3, GNUTLS_SEC_PARAM_HIGH = 4,
GNUTLS_SEC_PARAM_HIGH = 4, GNUTLS_SEC_PARAM_ULTRA = 5,
GNUTLS_SEC_PARAM_ULTRA = 5, } gnutls_sec_param_t;
} gnutls_sec_param_t;
/** /**
* gnutls_channel_binding_t: * gnutls_channel_binding_t:
* @GNUTLS_CB_TLS_UNIQUE: "tls-unique" (RFC 5929) channel binding * @GNUTLS_CB_TLS_UNIQUE: "tls-unique" (RFC 5929) channel binding
* *
* Enumeration of support channel binding types. * Enumeration of support channel binding types.
*/ */
typedef enum typedef enum {
{ GNUTLS_CB_TLS_UNIQUE
GNUTLS_CB_TLS_UNIQUE } gnutls_channel_binding_t;
} gnutls_channel_binding_t;
/* If you want to change this, then also change the define in /* If you want to change this, then also change the define in
* gnutls_int.h, and recompile. * gnutls_int.h, and recompile.
*/ */
typedef void *gnutls_transport_ptr_t; typedef void *gnutls_transport_ptr_t;
struct gnutls_session_int; struct gnutls_session_int;
typedef 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;
typedef struct gnutls_dh_params_int *gnutls_dh_params_t; typedef struct gnutls_dh_params_int *gnutls_dh_params_t;
struct gnutls_ecdh_params_int; struct gnutls_ecdh_params_int;
typedef struct gnutls_ecdh_params_int *gnutls_ecdh_params_t; typedef struct gnutls_ecdh_params_int *gnutls_ecdh_params_t;
/* XXX ugly. */ /* XXX ugly. */
struct gnutls_x509_privkey_int; struct gnutls_x509_privkey_int;
typedef 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;
typedef struct gnutls_priority_st *gnutls_priority_t; typedef struct gnutls_priority_st *gnutls_priority_t;
typedef struct typedef struct {
{ unsigned char *data;
unsigned char *data; unsigned int size;
unsigned int size; } gnutls_datum_t;
} gnutls_datum_t;
typedef struct gnutls_params_st typedef struct gnutls_params_st {
{ gnutls_params_type_t type;
gnutls_params_type_t type; union params {
union params gnutls_dh_params_t dh;
{ gnutls_ecdh_params_t ecdh;
gnutls_dh_params_t dh; gnutls_rsa_params_t rsa_export;
gnutls_ecdh_params_t ecdh; } params;
gnutls_rsa_params_t rsa_export; int deinit;
} params; } gnutls_params_st;
int deinit;
} gnutls_params_st;
typedef int gnutls_params_function (gnutls_session_t, gnutls_params_type_ typedef int gnutls_params_function(gnutls_session_t, gnutls_params_type_t,
t, gnutls_params_st *);
gnutls_params_st *);
/* internal functions */ /* internal functions */
int gnutls_init (gnutls_session_t * session, int gnutls_init(gnutls_session_t * session, unsigned int flags);
unsigned int flags); void gnutls_deinit(gnutls_session_t session);
void gnutls_deinit (gnutls_session_t session);
#define _gnutls_deinit(x) gnutls_deinit(x) #define _gnutls_deinit(x) gnutls_deinit(x)
int gnutls_bye (gnutls_session_t session, gnutls_close_request_t how); int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how);
int gnutls_handshake (gnutls_session_t session); int gnutls_handshake(gnutls_session_t session);
#define GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT ((unsigned int)-1) #define GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT ((unsigned int)-1)
void gnutls_handshake_set_timeout (gnutls_session_t session, void gnutls_handshake_set_timeout(gnutls_session_t session,
unsigned int ms); unsigned int ms);
int gnutls_rehandshake (gnutls_session_t session); int gnutls_rehandshake(gnutls_session_t session);
gnutls_alert_description_t gnutls_alert_get (gnutls_session_t session); gnutls_alert_description_t gnutls_alert_get(gnutls_session_t session);
int gnutls_alert_send (gnutls_session_t session, int gnutls_alert_send(gnutls_session_t session,
gnutls_alert_level_t level, gnutls_alert_level_t level,
gnutls_alert_description_t desc); gnutls_alert_description_t desc);
int gnutls_alert_send_appropriate (gnutls_session_t session, int err); int gnutls_alert_send_appropriate(gnutls_session_t session, int err);
const char *gnutls_alert_get_name (gnutls_alert_description_t alert); const char *gnutls_alert_get_name(gnutls_alert_description_t alert);
const char * gnutls_alert_get_strname (gnutls_alert_description_t alert); const char *gnutls_alert_get_strname(gnutls_alert_description_t alert);
gnutls_sec_param_t gnutls_pk_bits_to_sec_param (gnutls_pk_algorithm_t alg gnutls_sec_param_t gnutls_pk_bits_to_sec_param(gnutls_pk_algorithm_t algo,
o, unsigned int bits);
unsigned int bits); const char *gnutls_sec_param_get_name(gnutls_sec_param_t param);
const char *gnutls_sec_param_get_name (gnutls_sec_param_t param); unsigned int gnutls_sec_param_to_pk_bits(gnutls_pk_algorithm_t algo,
unsigned int gnutls_sec_param_to_pk_bits (gnutls_pk_algorithm_t algo, gnutls_sec_param_t param);
gnutls_sec_param_t param);
/* Elliptic curves */ /* Elliptic curves */
const char * gnutls_ecc_curve_get_name (gnutls_ecc_curve_t curve); const char *gnutls_ecc_curve_get_name(gnutls_ecc_curve_t curve);
int gnutls_ecc_curve_get_size (gnutls_ecc_curve_t curve); int gnutls_ecc_curve_get_size(gnutls_ecc_curve_t curve);
gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session); gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
/* get information on the current session */ /* get information on the current session */
gnutls_cipher_algorithm_t gnutls_cipher_get (gnutls_session_t session); gnutls_cipher_algorithm_t gnutls_cipher_get(gnutls_session_t session);
gnutls_kx_algorithm_t gnutls_kx_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_mac_algorithm_t gnutls_mac_get(gnutls_session_t session);
gnutls_compression_method_t gnutls_compression_method_t
gnutls_compression_get (gnutls_session_t session); gnutls_compression_get(gnutls_session_t session);
gnutls_certificate_type_t gnutls_certificate_type_t
gnutls_certificate_type_get (gnutls_session_t session); gnutls_certificate_type_get(gnutls_session_t session);
int gnutls_sign_algorithm_get (gnutls_session_t session); int gnutls_sign_algorithm_get(gnutls_session_t session);
int gnutls_sign_algorithm_get_client (gnutls_session_t session); int gnutls_sign_algorithm_get_client(gnutls_session_t session);
int gnutls_sign_algorithm_get_requested (gnutls_session_t session, int gnutls_sign_algorithm_get_requested(gnutls_session_t session,
size_t indx, size_t indx,
gnutls_sign_algorithm_t * algo); gnutls_sign_algorithm_t * algo);
/* the name of the specified algorithms */ /* the name of the specified algorithms */
const char *gnutls_cipher_get_name (gnutls_cipher_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_mac_get_name(gnutls_mac_algorithm_t algorithm);
const char *gnutls_digest_get_name (gnutls_digest_algorithm_t algorithm); const char *gnutls_digest_get_name(gnutls_digest_algorithm_t algorithm);
const char *gnutls_compression_get_name (gnutls_compression_method_t const char *gnutls_compression_get_name(gnutls_compression_method_t
algorithm); algorithm);
const char *gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm); const char *gnutls_kx_get_name(gnutls_kx_algorithm_t algorithm);
const char *gnutls_certificate_type_get_name (gnutls_certificate_type_t const char *gnutls_certificate_type_get_name(gnutls_certificate_type_t
type); type);
const char *gnutls_pk_get_name (gnutls_pk_algorithm_t algorithm); const char *gnutls_pk_get_name(gnutls_pk_algorithm_t algorithm);
const char *gnutls_sign_get_name (gnutls_sign_algorithm_t algorithm); const char *gnutls_sign_get_name(gnutls_sign_algorithm_t algorithm);
size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm); size_t gnutls_cipher_get_key_size(gnutls_cipher_algorithm_t algorithm);
size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm); size_t gnutls_mac_get_key_size(gnutls_mac_algorithm_t algorithm);
int gnutls_sign_is_secure (gnutls_sign_algorithm_t algorithm); int gnutls_sign_is_secure(gnutls_sign_algorithm_t algorithm);
gnutls_digest_algorithm_t gnutls_digest_algorithm_t
gnutls_sign_get_hash_algorithm (gnutls_sign_algorithm_t sign); gnutls_sign_get_hash_algorithm(gnutls_sign_algorithm_t sign);
gnutls_pk_algorithm_t gnutls_pk_algorithm_t
gnutls_sign_get_pk_algorithm (gnutls_sign_algorithm_t sign); gnutls_sign_get_pk_algorithm(gnutls_sign_algorithm_t sign);
gnutls_sign_algorithm_t gnutls_sign_algorithm_t
gnutls_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_pk_to_sign(gnutls_pk_algorithm_t pk,
gnutls_digest_algorithm_t hash); gnutls_digest_algorithm_t hash);
#define gnutls_sign_algorithm_get_name gnutls_sign_get_name #define gnutls_sign_algorithm_get_name gnutls_sign_get_name
gnutls_mac_algorithm_t gnutls_mac_get_id (const char *name); gnutls_mac_algorithm_t gnutls_mac_get_id(const char *name);
gnutls_digest_algorithm_t gnutls_digest_get_id (const char *name); gnutls_digest_algorithm_t gnutls_digest_get_id(const char *name);
gnutls_compression_method_t gnutls_compression_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_cipher_algorithm_t gnutls_cipher_get_id(const char *name);
gnutls_kx_algorithm_t gnutls_kx_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_protocol_t gnutls_protocol_get_id(const char *name);
gnutls_certificate_type_t gnutls_certificate_type_get_id (const char *nam gnutls_certificate_type_t gnutls_certificate_type_get_id(const char *name);
e); gnutls_pk_algorithm_t gnutls_pk_get_id(const char *name);
gnutls_pk_algorithm_t gnutls_pk_get_id (const char *name); gnutls_sign_algorithm_t gnutls_sign_get_id(const char *name);
gnutls_sign_algorithm_t gnutls_sign_get_id (const char *name);
/* list supported algorithms */ /* list supported algorithms */
const gnutls_ecc_curve_t * gnutls_ecc_curve_list (void); const gnutls_ecc_curve_t *gnutls_ecc_curve_list(void);
const gnutls_cipher_algorithm_t *gnutls_cipher_list (void); const gnutls_cipher_algorithm_t *gnutls_cipher_list(void);
const gnutls_mac_algorithm_t *gnutls_mac_list (void); const gnutls_mac_algorithm_t *gnutls_mac_list(void);
const gnutls_digest_algorithm_t *gnutls_digest_list (void); const gnutls_digest_algorithm_t *gnutls_digest_list(void);
const gnutls_compression_method_t *gnutls_compression_list (void); const gnutls_compression_method_t *gnutls_compression_list(void);
const gnutls_protocol_t *gnutls_protocol_list (void); const gnutls_protocol_t *gnutls_protocol_list(void);
const gnutls_certificate_type_t *gnutls_certificate_type_list (void); const gnutls_certificate_type_t *gnutls_certificate_type_list(void);
const gnutls_kx_algorithm_t *gnutls_kx_list (void); const gnutls_kx_algorithm_t *gnutls_kx_list(void);
const gnutls_pk_algorithm_t *gnutls_pk_list (void); const gnutls_pk_algorithm_t *gnutls_pk_list(void);
const gnutls_sign_algorithm_t *gnutls_sign_list (void); const gnutls_sign_algorithm_t *gnutls_sign_list(void);
const char *gnutls_cipher_suite_info (size_t idx, const char *gnutls_cipher_suite_info(size_t idx,
unsigned char *cs_id, unsigned char *cs_id,
gnutls_kx_algorithm_t * kx, gnutls_kx_algorithm_t * kx,
gnutls_cipher_algorithm_t * cipher, gnutls_cipher_algorithm_t * cipher,
gnutls_mac_algorithm_t * mac, gnutls_mac_algorithm_t * mac,
gnutls_protocol_t * min_version); gnutls_protocol_t * min_version);
/* error functions */ /* error functions */
int gnutls_error_is_fatal (int error); int gnutls_error_is_fatal(int error);
int gnutls_error_to_alert (int err, int *level); int gnutls_error_to_alert(int err, int *level);
void gnutls_perror (int error); void gnutls_perror(int error);
const char *gnutls_strerror (int error); const char *gnutls_strerror(int error);
const char *gnutls_strerror_name (int error); const char *gnutls_strerror_name(int error);
/* Semi-internal functions. /* Semi-internal functions.
*/ */
void gnutls_handshake_set_private_extensions (gnutls_session_t session, void gnutls_handshake_set_private_extensions(gnutls_session_t session,
int allow); int allow);
int gnutls_handshake_set_random (gnutls_session_t session, const gnutls_d int gnutls_handshake_set_random(gnutls_session_t session,
atum_t* random); const gnutls_datum_t * random);
gnutls_handshake_description_t gnutls_handshake_description_t
gnutls_handshake_get_last_out (gnutls_session_t session); gnutls_handshake_get_last_out(gnutls_session_t session);
gnutls_handshake_description_t gnutls_handshake_description_t
gnutls_handshake_get_last_in (gnutls_session_t session); gnutls_handshake_get_last_in(gnutls_session_t session);
/* Record layer functions. /* Record layer functions.
*/ */
#define GNUTLS_HEARTBEAT_WAIT 1 #define GNUTLS_HEARTBEAT_WAIT 1
int gnutls_heartbeat_ping (gnutls_session_t session, size_t data_size, int gnutls_heartbeat_ping(gnutls_session_t session, size_t data_size,
unsigned int max_tries, unsigned int flags); unsigned int max_tries, unsigned int flags);
int gnutls_heartbeat_pong (gnutls_session_t session, unsigned int flags); int gnutls_heartbeat_pong(gnutls_session_t session, unsigned int flags);
void gnutls_record_set_timeout (gnutls_session_t session, unsigned int ms void gnutls_record_set_timeout(gnutls_session_t session, unsigned int ms);
); void gnutls_record_disable_padding(gnutls_session_t session);
void gnutls_record_disable_padding (gnutls_session_t session);
void gnutls_record_cork (gnutls_session_t session); void gnutls_record_cork(gnutls_session_t session);
#define GNUTLS_RECORD_WAIT 1 #define GNUTLS_RECORD_WAIT 1
int gnutls_record_uncork (gnutls_session_t session, unsigned int flags); int gnutls_record_uncork(gnutls_session_t session, unsigned int flags);
typedef struct { typedef struct {
size_t low; size_t low;
size_t high; size_t high;
} gnutls_range_st; } gnutls_range_st;
int gnutls_range_split (gnutls_session_t session, int gnutls_range_split(gnutls_session_t session,
const gnutls_range_st *orig, const gnutls_range_st * orig,
gnutls_range_st * small_range, gnutls_range_st * small_range,
gnutls_range_st * rem_range); gnutls_range_st * rem_range);
ssize_t gnutls_record_send (gnutls_session_t session, const void *data, ssize_t gnutls_record_send(gnutls_session_t session, const void *data,
size_t data_size); size_t data_size);
ssize_t gnutls_record_send_range (gnutls_session_t session, const void *d ssize_t gnutls_record_send_range(gnutls_session_t session,
ata, const void *data, size_t data_size,
size_t data_size, const gnutls_range_st const gnutls_range_st * range);
*range); ssize_t gnutls_record_recv(gnutls_session_t session, void *data,
ssize_t gnutls_record_recv (gnutls_session_t session, void *data, size_t data_size);
size_t data_size);
#define gnutls_read gnutls_record_recv #define gnutls_read gnutls_record_recv
#define gnutls_write gnutls_record_send #define gnutls_write gnutls_record_send
ssize_t gnutls_record_recv_seq (gnutls_session_t session, void *data, siz ssize_t gnutls_record_recv_seq(gnutls_session_t session, void *data,
e_t data_size, size_t data_size, unsigned char *seq);
unsigned char *seq);
size_t gnutls_record_overhead_size (gnutls_session_t session); size_t gnutls_record_overhead_size(gnutls_session_t session);
size_t gnutls_est_record_overhead_size (gnutls_protocol_t version, size_t gnutls_est_record_overhead_size(gnutls_protocol_t version,
gnutls_cipher_algorithm_t cipher, gnutls_cipher_algorithm_t cipher,
gnutls_mac_algorithm_t mac, gnutls_mac_algorithm_t mac,
gnutls_compression_method_t comp, gnutls_compression_method_t comp,
unsigned int flags); unsigned int flags);
void gnutls_session_enable_compatibility_mode (gnutls_session_t session); void gnutls_session_enable_compatibility_mode(gnutls_session_t session);
void gnutls_record_set_max_empty_records (gnutls_session_t session, const void gnutls_record_set_max_empty_records(gnutls_session_t session,
unsigned int i); const unsigned int i);
int gnutls_record_can_use_length_hiding (gnutls_session_t session); int gnutls_record_can_use_length_hiding(gnutls_session_t session);
int gnutls_record_get_direction (gnutls_session_t session); int gnutls_record_get_direction(gnutls_session_t session);
size_t gnutls_record_get_max_size (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 ssize_t gnutls_record_set_max_size(gnutls_session_t session, size_t size);
);
size_t gnutls_record_check_pending (gnutls_session_t session); size_t gnutls_record_check_pending(gnutls_session_t session);
void gnutls_session_force_valid (gnutls_session_t session); void gnutls_session_force_valid(gnutls_session_t session);
int gnutls_prf (gnutls_session_t session, int gnutls_prf(gnutls_session_t session,
size_t label_size, const char *label, size_t label_size, const char *label,
int server_random_first, int server_random_first,
size_t extra_size, const char *extra, size_t extra_size, const char *extra,
size_t outsize, char *out); size_t outsize, char *out);
int gnutls_prf_raw (gnutls_session_t session, int gnutls_prf_raw(gnutls_session_t session,
size_t label_size, const char *label, size_t label_size, const char *label,
size_t seed_size, const char *seed, size_t seed_size, const char *seed,
size_t outsize, char *out); size_t outsize, char *out);
/** /**
* gnutls_server_name_type_t: * gnutls_server_name_type_t:
* @GNUTLS_NAME_DNS: Domain Name System name type. * @GNUTLS_NAME_DNS: Domain Name System name type.
* *
* Enumeration of different server name types. * Enumeration of different server name types.
*/ */
typedef enum typedef enum {
{ GNUTLS_NAME_DNS = 1
GNUTLS_NAME_DNS = 1 } gnutls_server_name_type_t;
} gnutls_server_name_type_t;
int gnutls_server_name_set (gnutls_session_t session, int gnutls_server_name_set(gnutls_session_t session,
gnutls_server_name_type_t type, gnutls_server_name_type_t type,
const void *name, size_t name_length); const void *name, size_t name_length);
int gnutls_server_name_get (gnutls_session_t session, int gnutls_server_name_get(gnutls_session_t session,
void *data, size_t * data_length, void *data, size_t * data_length,
unsigned int *type, unsigned int indx); unsigned int *type, unsigned int indx);
unsigned int gnutls_heartbeat_get_timeout (gnutls_session_t session); unsigned int gnutls_heartbeat_get_timeout(gnutls_session_t session);
void gnutls_heartbeat_set_timeouts (gnutls_session_t session, unsigned in void gnutls_heartbeat_set_timeouts(gnutls_session_t session,
t retrans_timeout, unsigned int retrans_timeout,
unsigned int total_timeout); unsigned int total_timeout);
#define GNUTLS_HB_PEER_ALLOWED_TO_SEND (1) #define GNUTLS_HB_PEER_ALLOWED_TO_SEND (1)
#define GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND (1<<1) #define GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND (1<<1)
/* Heartbeat */ /* Heartbeat */
void gnutls_heartbeat_enable (gnutls_session_t session, unsigned int type ); void gnutls_heartbeat_enable(gnutls_session_t session, unsigned int type);
#define GNUTLS_HB_LOCAL_ALLOWED_TO_SEND (1<<2) #define GNUTLS_HB_LOCAL_ALLOWED_TO_SEND (1<<2)
int gnutls_heartbeat_allowed (gnutls_session_t session, unsigned int type ); int gnutls_heartbeat_allowed(gnutls_session_t session, unsigned int type);
/* Safe renegotiation */ /* Safe renegotiation */
int gnutls_safe_renegotiation_status (gnutls_session_t session); int gnutls_safe_renegotiation_status(gnutls_session_t session);
/** /**
* gnutls_supplemental_data_format_type_t: * gnutls_supplemental_data_format_type_t:
* @GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA: Supplemental user mapping data. * @GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA: Supplemental user mapping data.
* *
* Enumeration of different supplemental data types (RFC 4680). * Enumeration of different supplemental data types (RFC 4680).
*/ */
typedef enum typedef enum {
{ GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0
GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0 } gnutls_supplemental_data_format_type_t;
} gnutls_supplemental_data_format_type_t;
const char const char
*gnutls_supplemental_get_name (gnutls_supplemental_data_format_type_t *gnutls_supplemental_get_name(gnutls_supplemental_data_format_type_t type);
type);
/* SessionTicket, RFC 5077. */ /* SessionTicket, RFC 5077. */
int gnutls_session_ticket_key_generate (gnutls_datum_t * key); int gnutls_session_ticket_key_generate(gnutls_datum_t * key);
int gnutls_session_ticket_enable_client (gnutls_session_t session); int gnutls_session_ticket_enable_client(gnutls_session_t session);
int gnutls_session_ticket_enable_server (gnutls_session_t session, int gnutls_session_ticket_enable_server(gnutls_session_t session,
const gnutls_datum_t * key); const gnutls_datum_t * key);
/* SRTP, RFC 5764 */ /* SRTP, RFC 5764 */
/** /**
* gnutls_srtp_profile_t: * gnutls_srtp_profile_t:
* @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80: 128 bit AES with a 80 bit HMAC-SHA1 * @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80: 128 bit AES with a 80 bit HMAC-SHA1
* @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32: 128 bit AES with a 32 bit HMAC-SHA1 * @GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32: 128 bit AES with a 32 bit HMAC-SHA1
* @GNUTLS_SRTP_NULL_HMAC_SHA1_80: NULL cipher with a 80 bit HMAC-SHA1 * @GNUTLS_SRTP_NULL_HMAC_SHA1_80: NULL cipher with a 80 bit HMAC-SHA1
* @GNUTLS_SRTP_NULL_HMAC_SHA1_32: NULL cipher with a 32 bit HMAC-SHA1 * @GNUTLS_SRTP_NULL_HMAC_SHA1_32: NULL cipher with a 32 bit HMAC-SHA1
* *
* Enumeration of different SRTP protection profiles. * Enumeration of different SRTP protection profiles.
*/ */
typedef enum typedef enum {
{ GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001,
GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001, GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002,
GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002, GNUTLS_SRTP_NULL_HMAC_SHA1_80 = 0x0005,
GNUTLS_SRTP_NULL_HMAC_SHA1_80 = 0x0005, GNUTLS_SRTP_NULL_HMAC_SHA1_32 = 0x0006
GNUTLS_SRTP_NULL_HMAC_SHA1_32 = 0x0006 } gnutls_srtp_profile_t;
} gnutls_srtp_profile_t;
int gnutls_srtp_set_profile (gnutls_session_t session, int gnutls_srtp_set_profile(gnutls_session_t session,
gnutls_srtp_profile_t profile); gnutls_srtp_profile_t profile);
int gnutls_srtp_set_profile_direct (gnutls_session_t session, int gnutls_srtp_set_profile_direct(gnutls_session_t session,
const char *profiles, const char **er const char *profiles,
r_pos); const char **err_pos);
int gnutls_srtp_get_selected_profile (gnutls_session_t session, int gnutls_srtp_get_selected_profile(gnutls_session_t session,
gnutls_srtp_profile_t *profile); gnutls_srtp_profile_t * profile);
const char *gnutls_srtp_get_profile_name (gnutls_srtp_profile_t profile); const char *gnutls_srtp_get_profile_name(gnutls_srtp_profile_t profile);
int gnutls_srtp_get_profile_id (const char *name, int gnutls_srtp_get_profile_id(const char *name,
gnutls_srtp_profile_t *profile); gnutls_srtp_profile_t * profile);
int gnutls_srtp_get_keys (gnutls_session_t session, int gnutls_srtp_get_keys(gnutls_session_t session,
void *key_material, void *key_material,
unsigned int key_material_size, unsigned int key_material_size,
gnutls_datum_t *client_key, gnutls_datum_t * client_key,
gnutls_datum_t *client_salt, gnutls_datum_t * client_salt,
gnutls_datum_t *server_key, gnutls_datum_t * server_key,
gnutls_datum_t *server_salt); gnutls_datum_t * server_salt);
int gnutls_srtp_set_mki (gnutls_session_t session, const gnutls_datum_t * int gnutls_srtp_set_mki(gnutls_session_t session,
mki); const gnutls_datum_t * mki);
int gnutls_srtp_get_mki (gnutls_session_t session, gnutls_datum_t *mki); int gnutls_srtp_get_mki(gnutls_session_t session, gnutls_datum_t * mki);
/* ALPN TLS extension */ /* ALPN TLS extension */
#define GNUTLS_ALPN_MAND 1 #define GNUTLS_ALPN_MAND 1
int gnutls_alpn_get_selected_protocol (gnutls_session_t session, int gnutls_alpn_get_selected_protocol(gnutls_session_t session,
gnutls_datum_t * protocol); gnutls_datum_t * protocol);
int gnutls_alpn_set_protocols (gnutls_session_t session, int gnutls_alpn_set_protocols(gnutls_session_t session,
const gnutls_datum_t * protocols, unsigned proto const gnutls_datum_t * protocols,
cols_size, unsigned protocols_size, unsigned flags);
unsigned flags);
int gnutls_key_generate (gnutls_datum_t * key, unsigned int key_size); int gnutls_key_generate(gnutls_datum_t * key, unsigned int key_size);
/* if you just want some defaults, use the following. /* if you just want some defaults, use the following.
*/ */
int gnutls_priority_init (gnutls_priority_t * priority_cache, int gnutls_priority_init(gnutls_priority_t * priority_cache,
const char *priorities, const char **err_pos); const char *priorities, const char **err_pos);
void gnutls_priority_deinit (gnutls_priority_t priority_cache); void gnutls_priority_deinit(gnutls_priority_t priority_cache);
int gnutls_priority_get_cipher_suite_index (gnutls_priority_t pcache, uns int gnutls_priority_get_cipher_suite_index(gnutls_priority_t pcache,
igned int idx, unsigned int *sidx); unsigned int idx,
unsigned int *sidx);
int gnutls_priority_set (gnutls_session_t session, int gnutls_priority_set(gnutls_session_t session,
gnutls_priority_t priority); gnutls_priority_t priority);
int gnutls_priority_set_direct (gnutls_session_t session, int gnutls_priority_set_direct(gnutls_session_t session,
const char *priorities, const char *priorities,
const char **err_pos); const char **err_pos);
int gnutls_priority_certificate_type_list (gnutls_priority_t pcache, cons int gnutls_priority_certificate_type_list(gnutls_priority_t pcache,
t unsigned int** list); const unsigned int **list);
int gnutls_priority_sign_list (gnutls_priority_t pcache, const unsigned i int gnutls_priority_sign_list(gnutls_priority_t pcache,
nt** list); const unsigned int **list);
int gnutls_priority_protocol_list (gnutls_priority_t pcache, const unsign int gnutls_priority_protocol_list(gnutls_priority_t pcache,
ed int** list); const unsigned int **list);
int gnutls_priority_compression_list (gnutls_priority_t pcache, const uns int gnutls_priority_compression_list(gnutls_priority_t pcache,
igned int** list); const unsigned int **list);
int gnutls_priority_ecc_curve_list (gnutls_priority_t pcache, const unsig int gnutls_priority_ecc_curve_list(gnutls_priority_t pcache,
ned int** list); const unsigned int **list);
int gnutls_priority_kx_list (gnutls_priority_t pcache, const unsigned int int gnutls_priority_kx_list(gnutls_priority_t pcache,
** list); const unsigned int **list);
int gnutls_priority_cipher_list (gnutls_priority_t pcache, const unsigned int gnutls_priority_cipher_list(gnutls_priority_t pcache,
int** list); const unsigned int **list);
int gnutls_priority_mac_list (gnutls_priority_t pcache, const unsigned in int gnutls_priority_mac_list(gnutls_priority_t pcache,
t** list); const unsigned int **list);
/* for compatibility /* for compatibility
*/ */
int gnutls_set_default_priority (gnutls_session_t session); int gnutls_set_default_priority(gnutls_session_t session);
/* Returns the name of a cipher suite */ /* Returns the name of a cipher suite */
const char *gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm_t
kx_algorithm, kx_algorithm,
gnutls_cipher_algorithm_t gnutls_cipher_algorithm_t
cipher_algorithm, cipher_algorithm,
gnutls_mac_algorithm_t gnutls_mac_algorithm_t
mac_algorithm); mac_algorithm);
/* get the currently used protocol version */ /* get the currently used protocol version */
gnutls_protocol_t gnutls_protocol_get_version (gnutls_session_t session); gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session);
const char *gnutls_protocol_get_name (gnutls_protocol_t version); const char *gnutls_protocol_get_name(gnutls_protocol_t version);
/* get/set session /* get/set session
*/ */
int gnutls_session_set_data (gnutls_session_t session, int gnutls_session_set_data(gnutls_session_t session,
const void *session_data, const void *session_data,
size_t session_data_size); size_t session_data_size);
int gnutls_session_get_data (gnutls_session_t session, void *session_data int gnutls_session_get_data(gnutls_session_t session, void *session_data,
, size_t * session_data_size);
size_t * session_data_size); int gnutls_session_get_data2(gnutls_session_t session,
int gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum_t * data);
gnutls_datum_t * data); void gnutls_session_get_random(gnutls_session_t session,
void gnutls_session_get_random (gnutls_session_t session, gnutls_datum_t* gnutls_datum_t * client,
client, gnutls_datum_t * server);
gnutls_datum_t* server); char *gnutls_session_get_desc(gnutls_session_t session);
char * gnutls_session_get_desc (gnutls_session_t session);
int gnutls_session_set_premaster (gnutls_session_t session, unsigned int int gnutls_session_set_premaster(gnutls_session_t session,
entity, unsigned int entity,
gnutls_protocol_t version, gnutls_protocol_t version,
gnutls_kx_algorithm_t kx, gnutls_kx_algorithm_t kx,
gnutls_cipher_algorithm_t cipher, gnutls_cipher_algorithm_t cipher,
gnutls_mac_algorithm_t mac, gnutls_mac_algorithm_t mac,
gnutls_compression_method_t comp, gnutls_compression_method_t comp,
const gnutls_datum_t* master, const gnutls_datum_t * master,
const gnutls_datum_t * session_id); const gnutls_datum_t * session_id);
/* returns the session ID */ /* returns the session ID */
#define GNUTLS_MAX_SESSION_ID 32 #define GNUTLS_MAX_SESSION_ID 32
int gnutls_session_get_id (gnutls_session_t session, void *session_id, int gnutls_session_get_id(gnutls_session_t session, void *session_id,
size_t * session_id_size); size_t * session_id_size);
int gnutls_session_get_id2 (gnutls_session_t session, gnutls_datum_t *ses int gnutls_session_get_id2(gnutls_session_t session,
sion_id); gnutls_datum_t * session_id);
int gnutls_session_set_id (gnutls_session_t session, int gnutls_session_set_id(gnutls_session_t session,
const gnutls_datum_t * sid); const gnutls_datum_t * sid);
int gnutls_session_channel_binding (gnutls_session_t session, int gnutls_session_channel_binding(gnutls_session_t session,
gnutls_channel_binding_t cbtype, gnutls_channel_binding_t cbtype,
gnutls_datum_t * cb); gnutls_datum_t * cb);
/* checks if this session is a resumed one /* checks if this session is a resumed one
*/ */
int gnutls_session_is_resumed (gnutls_session_t session); int gnutls_session_is_resumed(gnutls_session_t session);
int gnutls_session_resumption_requested (gnutls_session_t session); int gnutls_session_resumption_requested(gnutls_session_t session);
typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key, typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key,
gnutls_datum_t data); gnutls_datum_t data);
typedef int (*gnutls_db_remove_func) (void *, gnutls_datum_t key); typedef int (*gnutls_db_remove_func) (void *, gnutls_datum_t key);
typedef gnutls_datum_t (*gnutls_db_retr_func) (void *, gnutls_datum_t key typedef gnutls_datum_t(*gnutls_db_retr_func) (void *, gnutls_datum_t key);
);
void gnutls_db_set_cache_expiration (gnutls_session_t session, int second s); void gnutls_db_set_cache_expiration(gnutls_session_t session, int seconds);
void gnutls_db_remove_session (gnutls_session_t session); void gnutls_db_remove_session(gnutls_session_t session);
void gnutls_db_set_retrieve_function (gnutls_session_t session, void gnutls_db_set_retrieve_function(gnutls_session_t session,
gnutls_db_retr_func retr_func); gnutls_db_retr_func retr_func);
void gnutls_db_set_remove_function (gnutls_session_t session, void gnutls_db_set_remove_function(gnutls_session_t session,
gnutls_db_remove_func rem_func); gnutls_db_remove_func rem_func);
void gnutls_db_set_store_function (gnutls_session_t session, void gnutls_db_set_store_function(gnutls_session_t session,
gnutls_db_store_func store_func); gnutls_db_store_func store_func);
void gnutls_db_set_ptr (gnutls_session_t session, void *ptr); void gnutls_db_set_ptr(gnutls_session_t session, void *ptr);
void *gnutls_db_get_ptr (gnutls_session_t session); void *gnutls_db_get_ptr(gnutls_session_t session);
int gnutls_db_check_entry (gnutls_session_t session, int gnutls_db_check_entry(gnutls_session_t session,
gnutls_datum_t session_entry); gnutls_datum_t session_entry);
time_t gnutls_db_check_entry_time (gnutls_datum_t *entry); time_t gnutls_db_check_entry_time(gnutls_datum_t * entry);
/** /**
* gnutls_handshake_hook_func: * gnutls_handshake_hook_func:
* @session: the current session * @session: the current session
* @htype: the type of the handshake message (%gnutls_handshake_descripti on_t) * @htype: the type of the handshake message (%gnutls_handshake_descripti on_t)
* @post: non zero if this is a post-process/generation call and zero oth erwise * @post: non zero if this is a post-process/generation call and zero oth erwise
* @incoming: non zero if this is an incoming message and zero if this is an outgoing message * @incoming: non zero if this is an incoming message and zero if this is an outgoing message
* *
* Function prototype for handshake hooks. It is set using * Function prototype for handshake hooks. It is set using
* gnutls_handshake_set_hook_function(). * gnutls_handshake_set_hook_function().
* *
* Returns: Non zero on error. * Returns: Non zero on error.
*/ */
#define GNUTLS_HOOK_POST (1) #define GNUTLS_HOOK_POST (1)
#define GNUTLS_HOOK_PRE (0) #define GNUTLS_HOOK_PRE (0)
#define GNUTLS_HOOK_BOTH (-1) #define GNUTLS_HOOK_BOTH (-1)
typedef int (*gnutls_handshake_hook_func) (gnutls_session_t, unsigned int typedef int (*gnutls_handshake_hook_func) (gnutls_session_t,
htype, unsigned post, unsigned int incoming); unsigned int htype,
void gnutls_handshake_set_hook_function (gnutls_session_t session, unsigned post,
unsigned int htype, unsigned int incoming);
int post, void gnutls_handshake_set_hook_function(gnutls_session_t session,
gnutls_handshake_hook_func func); unsigned int htype, int post,
gnutls_handshake_hook_func func);
typedef int (*gnutls_handshake_post_client_hello_func) (gnutls_session_t) typedef int (*gnutls_handshake_post_client_hello_func) (gnutls_session_t);
; void
void gnutls_handshake_set_post_client_hello_function(gnutls_session_t session,
gnutls_handshake_set_post_client_hello_function (gnutls_session_t sessi gnutls_handshake_post_client
on, _hello_func
gnutls_handshake_post_ func);
client_hello_func
func);
void gnutls_handshake_set_max_packet_length (gnutls_session_t session, void gnutls_handshake_set_max_packet_length(gnutls_session_t session,
size_t max); size_t max);
/* returns libgnutls version (call it with a NULL argument) /* returns libgnutls version (call it with a NULL argument)
*/ */
const char *gnutls_check_version (const char *req_version); const char *gnutls_check_version(const char *req_version);
/* Functions for setting/clearing credentials /* Functions for setting/clearing credentials
*/ */
void gnutls_credentials_clear (gnutls_session_t session); void gnutls_credentials_clear(gnutls_session_t session);
/* cred is a structure defined by the kx algorithm /* cred is a structure defined by the kx algorithm
*/ */
int gnutls_credentials_set (gnutls_session_t session, int gnutls_credentials_set(gnutls_session_t session,
gnutls_credentials_type_t type, void *cred); gnutls_credentials_type_t type, void *cred);
#define gnutls_cred_set gnutls_credentials_set #define gnutls_cred_set gnutls_credentials_set
/* x.509 types */ /* x.509 types */
struct gnutls_pubkey_st; struct gnutls_pubkey_st;
typedef struct gnutls_pubkey_st *gnutls_pubkey_t; typedef struct gnutls_pubkey_st *gnutls_pubkey_t;
struct gnutls_privkey_st; struct gnutls_privkey_st;
typedef struct gnutls_privkey_st *gnutls_privkey_t; typedef struct gnutls_privkey_st *gnutls_privkey_t;
struct gnutls_x509_privkey_int; struct gnutls_x509_privkey_int;
typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t; typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t;
struct gnutls_x509_crl_int; struct gnutls_x509_crl_int;
typedef 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;
typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t; typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t;
struct gnutls_x509_crq_int; struct gnutls_x509_crq_int;
typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t; typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t;
struct gnutls_openpgp_keyring_int; struct gnutls_openpgp_keyring_int;
typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t; typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t;
/* Credential structures - used in gnutls_credentials_set(); */ /* Credential structures - used in gnutls_credentials_set(); */
struct gnutls_certificate_credentials_st; struct gnutls_certificate_credentials_st;
typedef struct gnutls_certificate_credentials_st typedef struct gnutls_certificate_credentials_st
*gnutls_certificate_credentials_t; *gnutls_certificate_credentials_t;
typedef gnutls_certificate_credentials_t typedef gnutls_certificate_credentials_t
gnutls_certificate_server_credentials; gnutls_certificate_server_credentials;
typedef gnutls_certificate_credentials_t typedef gnutls_certificate_credentials_t
gnutls_certificate_client_credentials; gnutls_certificate_client_credentials;
typedef struct gnutls_anon_server_credentials_st typedef struct gnutls_anon_server_credentials_st
*gnutls_anon_server_credentials_t; *gnutls_anon_server_credentials_t;
typedef struct gnutls_anon_client_credentials_st typedef struct gnutls_anon_client_credentials_st
*gnutls_anon_client_credentials_t; *gnutls_anon_client_credentials_t;
void gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_ void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t
t sc);
sc); int
int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t
gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials * sc);
_t
* sc);
void gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t r void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials_t res,
es, gnutls_dh_params_t dh_params);
gnutls_dh_params_t dh_params);
void void
gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_ gnutls_anon_set_server_params_function(gnutls_anon_server_credentials_t
t res, gnutls_params_function * func);
res,
gnutls_params_function * func);
void void
gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t s gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t sc);
c); int
int gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials_t
gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials * sc);
_t
* sc);
/* CERTFILE is an x509 certificate in PEM form. /* CERTFILE is an x509 certificate in PEM form.
* KEYFILE is a pkcs-1 private key in PEM form (for RSA keys). * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys).
*/ */
void void
gnutls_certificate_free_credentials (gnutls_certificate_credentials_t s gnutls_certificate_free_credentials(gnutls_certificate_credentials_t sc);
c); int
int gnutls_certificate_allocate_credentials(gnutls_certificate_credentials_t
gnutls_certificate_allocate_credentials (gnutls_certificate_credentials * res);
_t
* res);
int int
gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc, gnutls_certificate_get_issuer(gnutls_certificate_credentials_t sc,
gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, unsigned int flags); gnutls_x509_crt_t cert,
gnutls_x509_crt_t * issuer,
unsigned int flags);
int gnutls_certificate_get_crt_raw (gnutls_certificate_credentials_t sc, int gnutls_certificate_get_crt_raw(gnutls_certificate_credentials_t sc,
unsigned idx1, unsigned idx1, unsigned idx2,
unsigned idx2, gnutls_datum_t * cert); gnutls_datum_t * cert);
void gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc); void gnutls_certificate_free_keys(gnutls_certificate_credentials_t sc);
void gnutls_certificate_free_cas (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 s void gnutls_certificate_free_ca_names(gnutls_certificate_credentials_t sc);
c); void gnutls_certificate_free_crls(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 r void gnutls_certificate_set_dh_params(gnutls_certificate_credentials_t res,
es, gnutls_dh_params_t dh_params);
gnutls_dh_params_t dh_params); void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t
void gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_ res, unsigned int flags);
t void gnutls_certificate_set_verify_limits(gnutls_certificate_credentials_t
res, unsigned int flags); res, unsigned int max_bits,
void gnutls_certificate_set_verify_limits (gnutls_certificate_credentials unsigned int max_depth);
_t
res, unsigned int max_bits,
unsigned int max_depth);
int int
gnutls_certificate_set_x509_system_trust (gnutls_certificate_credential gnutls_certificate_set_x509_system_trust(gnutls_certificate_credentials_t
s_t cred); cred);
int int
gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_ gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials_t
t cred, const char *cafile,
cred, const char *cafile, gnutls_x509_crt_fmt_t type);
gnutls_x509_crt_fmt_t type); int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t
int gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials res, const gnutls_datum_t * ca,
_t gnutls_x509_crt_fmt_t type);
res, const gnutls_datum_t * ca
,
gnutls_x509_crt_fmt_t type);
int int
gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials_t
res, const char *crlfile, res, const char *crlfile,
gnutls_x509_crt_fmt_t type); gnutls_x509_crt_fmt_t type);
int gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials_t
res, const gnutls_datum_t * CRL, res, const gnutls_datum_t * CRL,
gnutls_x509_crt_fmt_t type); gnutls_x509_crt_fmt_t type);
int int
gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials_t
res, const char *certfile, res, const char *certfile,
const char *keyfile, const char *keyfile,
gnutls_x509_crt_fmt_t type); gnutls_x509_crt_fmt_t type);
int int
gnutls_certificate_set_x509_key_file2 (gnutls_certificate_credentials_t gnutls_certificate_set_x509_key_file2(gnutls_certificate_credentials_t
res, const char *certfile, res, const char *certfile,
const char *keyfile, const char *keyfile,
gnutls_x509_crt_fmt_t type, gnutls_x509_crt_fmt_t type,
const char* pass, const char *pass,
unsigned int flags); unsigned int flags);
int gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials_t
res, const gnutls_datum_t * cert res, const gnutls_datum_t * cert,
, const gnutls_datum_t * key,
const gnutls_datum_t * key, gnutls_x509_crt_fmt_t type);
gnutls_x509_crt_fmt_t type);
int gnutls_certificate_set_x509_key_mem2 (gnutls_certificate_credentials_ int gnutls_certificate_set_x509_key_mem2(gnutls_certificate_credentials_t
t res, const gnutls_datum_t * cert,
res, const gnutls_datum_t * cert const gnutls_datum_t * key,
, gnutls_x509_crt_fmt_t type,
const gnutls_datum_t * key, const char *pass,
gnutls_x509_crt_fmt_t type, unsigned int flags);
const char* pass,
unsigned int flags);
void gnutls_certificate_send_x509_rdn_sequence (gnutls_session_t session, void gnutls_certificate_send_x509_rdn_sequence(gnutls_session_t session,
int status); int status);
int gnutls_certificate_set_x509_simple_pkcs12_file (gnutls_certificate_cr int
edentials_t res, const char *pkcs12file, gnutls_certificate_set_x509_simple_pkcs12_file
gnutls_x509_crt_fmt_t type, const char *password); (gnutls_certificate_credentials_t res, const char *pkcs12file,
int gnutls_certificate_set_x509_simple_pkcs12_mem (gnutls_certificate_cre gnutls_x509_crt_fmt_t type, const char *password);
dentials_t res, const gnutls_datum_t * p12blob, int
gnutls_x509_crt_fmt_t type, const char *password); gnutls_certificate_set_x509_simple_pkcs12_mem
(gnutls_certificate_credentials_t res, const gnutls_datum_t * p12blob,
gnutls_x509_crt_fmt_t type, const char *password);
/* New functions to allow setting already parsed X.509 stuff. /* New functions to allow setting already parsed X.509 stuff.
*/ */
int gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res int gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res,
, gnutls_x509_crt_t * cert_list,
gnutls_x509_crt_t * cert_list, int cert_list_size,
int cert_list_size, gnutls_x509_privkey_t key);
gnutls_x509_privkey_t key); int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res,
int gnutls_certificate_set_x509_trust (gnutls_certificate_credentials_t r gnutls_x509_crt_t * ca_list,
es, int ca_list_size);
gnutls_x509_crt_t * ca_list, int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res,
int ca_list_size); gnutls_x509_crl_t * crl_list,
int gnutls_certificate_set_x509_crl (gnutls_certificate_credentials_t res int crl_list_size);
,
gnutls_x509_crl_t * crl_list,
int crl_list_size);
/* OCSP status request extension, RFC 6066 */ /* OCSP status request extension, RFC 6066 */
typedef int (*gnutls_status_request_ocsp_func) typedef int (*gnutls_status_request_ocsp_func)
(gnutls_session_t session, void *ptr, gnutls_datum_t *ocsp_response); (gnutls_session_t session, void *ptr, gnutls_datum_t * ocsp_response);
void gnutls_certificate_set_ocsp_status_request_function (gnutls_certific void
ate_credentials_t res, gnutls_certificate_set_ocsp_status_request_function
gnutls_status_re (gnutls_certificate_credentials_t res,
quest_ocsp_func ocsp_func, gnutls_status_request_ocsp_func ocsp_func, void *ptr);
void *ptr);
int gnutls_certificate_set_ocsp_status_request_file (gnutls_certificate_c int
redentials_t res, gnutls_certificate_set_ocsp_status_request_file
const char* response (gnutls_certificate_credentials_t res, const char *response_file,
_file, unsigned int flags); unsigned int flags);
int gnutls_ocsp_status_request_enable_client (gnutls_session_t session, int gnutls_ocsp_status_request_enable_client(gnutls_session_t session,
gnutls_datum_t *responder_id gnutls_datum_t * responder_id,
, size_t responder_id_size,
size_t responder_id_size, gnutls_datum_t *
gnutls_datum_t *request_exte request_extensions);
nsions);
int gnutls_ocsp_status_request_get (gnutls_session_t session, gnutls_datu int gnutls_ocsp_status_request_get(gnutls_session_t session,
m_t *response); gnutls_datum_t * response);
int gnutls_ocsp_status_request_is_checked (gnutls_session_t session, unsi int gnutls_ocsp_status_request_is_checked(gnutls_session_t session,
gned int flags); unsigned int flags);
/* global state functions /* global state functions
*/ */
int gnutls_global_init (void); int gnutls_global_init(void);
void gnutls_global_deinit (void); void gnutls_global_deinit(void);
/** /**
* gnutls_time_func: * gnutls_time_func:
* @t: where to store time. * @t: where to store time.
* *
* Function prototype for time()-like function. Set with * Function prototype for time()-like function. Set with
* gnutls_global_set_time_function(). * gnutls_global_set_time_function().
* *
* Returns: Number of seconds since the epoch, or (time_t)-1 on errors. * Returns: Number of seconds since the epoch, or (time_t)-1 on errors.
*/ */
typedef time_t (*gnutls_time_func) (time_t *t); typedef time_t(*gnutls_time_func) (time_t * t);
typedef int (*mutex_init_func) (void **mutex); typedef int (*mutex_init_func) (void **mutex);
typedef int (*mutex_lock_func) (void **mutex); typedef int (*mutex_lock_func) (void **mutex);
typedef int (*mutex_unlock_func) (void **mutex); typedef int (*mutex_unlock_func) (void **mutex);
typedef int (*mutex_deinit_func) (void **mutex); typedef int (*mutex_deinit_func) (void **mutex);
void gnutls_global_set_mutex (mutex_init_func init, mutex_deinit_func dei void gnutls_global_set_mutex(mutex_init_func init,
nit, mutex_deinit_func deinit,
mutex_lock_func lock, mutex_unlock_func unl mutex_lock_func lock,
ock); mutex_unlock_func unlock);
typedef void *(*gnutls_alloc_function) (size_t); typedef void *(*gnutls_alloc_function) (size_t);
typedef void *(*gnutls_calloc_function) (size_t, size_t); typedef void *(*gnutls_calloc_function) (size_t, size_t);
typedef int (*gnutls_is_secure_function) (const void *); typedef int (*gnutls_is_secure_function) (const void *);
typedef void (*gnutls_free_function) (void *); typedef void (*gnutls_free_function) (void *);
typedef void *(*gnutls_realloc_function) (void *, size_t); typedef void *(*gnutls_realloc_function) (void *, size_t);
void void
gnutls_global_set_mem_functions (gnutls_alloc_function alloc_func, gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func,
gnutls_alloc_function secure_alloc_fun gnutls_alloc_function secure_alloc_func,
c, gnutls_is_secure_function is_secure_func,
gnutls_is_secure_function is_secure_fu gnutls_realloc_function realloc_func,
nc, gnutls_free_function free_func);
gnutls_realloc_function realloc_func,
gnutls_free_function free_func);
void gnutls_global_set_time_function (gnutls_time_func time_func); void gnutls_global_set_time_function(gnutls_time_func time_func);
/* For use in callbacks */ /* For use in callbacks */
extern gnutls_alloc_function gnutls_malloc; extern gnutls_alloc_function gnutls_malloc;
extern gnutls_alloc_function gnutls_secure_malloc; extern gnutls_alloc_function gnutls_secure_malloc;
extern gnutls_realloc_function gnutls_realloc; extern gnutls_realloc_function gnutls_realloc;
extern gnutls_calloc_function gnutls_calloc; extern gnutls_calloc_function gnutls_calloc;
extern gnutls_free_function gnutls_free; extern gnutls_free_function gnutls_free;
extern char *(*gnutls_strdup) (const char *); extern char *(*gnutls_strdup) (const char *);
typedef void (*gnutls_log_func) (int, const char *); typedef void (*gnutls_log_func) (int, const char *);
typedef void (*gnutls_audit_log_func) (gnutls_session_t, const char *); typedef void (*gnutls_audit_log_func) (gnutls_session_t, const char *);
void gnutls_global_set_log_function (gnutls_log_func log_func); void gnutls_global_set_log_function(gnutls_log_func log_func);
void gnutls_global_set_audit_log_function (gnutls_audit_log_func log_func void gnutls_global_set_audit_log_function(gnutls_audit_log_func log_func);
); void gnutls_global_set_log_level(int level);
void gnutls_global_set_log_level (int level);
/* Diffie-Hellman parameter handling. /* Diffie-Hellman parameter handling.
*/ */
int gnutls_dh_params_init (gnutls_dh_params_t * dh_params); int gnutls_dh_params_init(gnutls_dh_params_t * dh_params);
void gnutls_dh_params_deinit (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, int gnutls_dh_params_import_raw(gnutls_dh_params_t dh_params,
const gnutls_datum_t * prime, const gnutls_datum_t * prime,
const gnutls_datum_t * generator); const gnutls_datum_t * generator);
int gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params, int gnutls_dh_params_import_pkcs3(gnutls_dh_params_t params,
const gnutls_datum_t * pkcs3_params, const gnutls_datum_t * pkcs3_params,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_dh_params_generate2 (gnutls_dh_params_t params, int gnutls_dh_params_generate2(gnutls_dh_params_t params,
unsigned int bits); unsigned int bits);
int gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params, int gnutls_dh_params_export_pkcs3(gnutls_dh_params_t params,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
unsigned char *params_data, unsigned char *params_data,
size_t * params_data_size); size_t * params_data_size);
int gnutls_dh_params_export2_pkcs3 (gnutls_dh_params_t params, int gnutls_dh_params_export2_pkcs3(gnutls_dh_params_t params,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
gnutls_datum_t *out); gnutls_datum_t * out);
int gnutls_dh_params_export_raw (gnutls_dh_params_t params, int gnutls_dh_params_export_raw(gnutls_dh_params_t params,
gnutls_datum_t * prime, gnutls_datum_t * prime,
gnutls_datum_t * generator, gnutls_datum_t * generator,
unsigned int *bits); unsigned int *bits);
int gnutls_dh_params_cpy (gnutls_dh_params_t dst, gnutls_dh_params_t src) int gnutls_dh_params_cpy(gnutls_dh_params_t dst, gnutls_dh_params_t src);
;
/* Session stuff /* Session stuff
*/ */
typedef struct typedef struct {
{ void *iov_base; /* Starting address */
void *iov_base; /* Starting address */ size_t iov_len; /* Number of bytes to transfer */
size_t iov_len; /* Number of bytes to transfer */ } giovec_t;
} giovec_t;
typedef ssize_t (*gnutls_pull_func) (gnutls_transport_ptr_t, void *, typedef ssize_t(*gnutls_pull_func) (gnutls_transport_ptr_t, void *,
size_t); size_t);
typedef ssize_t (*gnutls_push_func) (gnutls_transport_ptr_t, const void * typedef ssize_t(*gnutls_push_func) (gnutls_transport_ptr_t, const void *,
, size_t);
size_t);
typedef int (*gnutls_pull_timeout_func) (gnutls_transport_ptr_t, unsigned typedef int (*gnutls_pull_timeout_func) (gnutls_transport_ptr_t,
int ms); unsigned int ms);
typedef ssize_t (*gnutls_vec_push_func) (gnutls_transport_ptr_t, typedef ssize_t(*gnutls_vec_push_func) (gnutls_transport_ptr_t,
const giovec_t * iov, int iovcnt const giovec_t * iov, int iovcnt);
);
typedef int (*gnutls_errno_func) (gnutls_transport_ptr_t); typedef int (*gnutls_errno_func) (gnutls_transport_ptr_t);
/* This will be defined as macro. #if 0
/* This will be defined as macro. */
void gnutls_transport_set_int (gnutls_session_t session, int r); void gnutls_transport_set_int (gnutls_session_t session, int r);
*/ #endif
void gnutls_transport_set_int2 (gnutls_session_t session, int r, int s);
#define gnutls_transport_set_int(s, i) gnutls_transport_set_int2(s, i, i)
void gnutls_transport_get_int2 (gnutls_session_t session, int * r, int *s void gnutls_transport_set_int2(gnutls_session_t session, int r, int s);
); #define gnutls_transport_set_int(s, i) gnutls_transport_set_int2(s, i, i)
int gnutls_transport_get_int (gnutls_session_t session);
void gnutls_transport_set_ptr (gnutls_session_t session, void gnutls_transport_get_int2(gnutls_session_t session, int *r, int *s);
gnutls_transport_ptr_t ptr); int gnutls_transport_get_int(gnutls_session_t session);
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_set_ptr(gnutls_session_t session,
); gnutls_transport_ptr_t ptr);
void gnutls_transport_get_ptr2 (gnutls_session_t session, void gnutls_transport_set_ptr2(gnutls_session_t session,
gnutls_transport_ptr_t * recv_ptr, gnutls_transport_ptr_t recv_ptr,
gnutls_transport_ptr_t * send_ptr); gnutls_transport_ptr_t send_ptr);
void gnutls_transport_set_vec_push_function (gnutls_session_t session, gnutls_transport_ptr_t gnutls_transport_get_ptr(gnutls_session_t session);
gnutls_vec_push_func vec_func); void gnutls_transport_get_ptr2(gnutls_session_t session,
void gnutls_transport_set_push_function (gnutls_session_t session, gnutls_transport_ptr_t * recv_ptr,
gnutls_push_func push_func); gnutls_transport_ptr_t * send_ptr);
void gnutls_transport_set_pull_function (gnutls_session_t session,
gnutls_pull_func pull_func);
void gnutls_transport_set_pull_timeout_function (gnutls_session_t session void gnutls_transport_set_vec_push_function(gnutls_session_t session,
, gnutls_vec_push_func vec_func);
gnutls_pull_timeout_func func); 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_function (gnutls_session_t session, void gnutls_transport_set_pull_timeout_function(gnutls_session_t session,
gnutls_errno_func errno_func); gnutls_pull_timeout_func
func);
void gnutls_transport_set_errno (gnutls_session_t session, int err); void gnutls_transport_set_errno_function(gnutls_session_t session,
gnutls_errno_func errno_func);
void gnutls_transport_set_errno(gnutls_session_t session, int err);
/* session specific /* session specific
*/ */
void gnutls_session_set_ptr (gnutls_session_t session, void *ptr); void gnutls_session_set_ptr(gnutls_session_t session, void *ptr);
void *gnutls_session_get_ptr (gnutls_session_t session); void *gnutls_session_get_ptr(gnutls_session_t session);
void gnutls_openpgp_send_cert (gnutls_session_t session, void gnutls_openpgp_send_cert(gnutls_session_t session,
gnutls_openpgp_crt_status_t status); gnutls_openpgp_crt_status_t status);
/* This function returns the hash of the given data. /* This function returns the hash of the given data.
*/ */
int gnutls_fingerprint (gnutls_digest_algorithm_t algo, int gnutls_fingerprint(gnutls_digest_algorithm_t algo,
const gnutls_datum_t * data, void *result, const gnutls_datum_t * data, void *result,
size_t * result_size); size_t * result_size);
/** /**
* gnutls_random_art_t: * gnutls_random_art_t:
* @GNUTLS_RANDOM_ART_OPENSSH: OpenSSH-style random art. * @GNUTLS_RANDOM_ART_OPENSSH: OpenSSH-style random art.
* *
* Enumeration of different random art types. * Enumeration of different random art types.
*/ */
typedef enum gnutls_random_art typedef enum gnutls_random_art {
{ GNUTLS_RANDOM_ART_OPENSSH = 1,
GNUTLS_RANDOM_ART_OPENSSH=1, } gnutls_random_art_t;
} gnutls_random_art_t;
int gnutls_random_art (gnutls_random_art_t type, int gnutls_random_art(gnutls_random_art_t type,
const char* key_type, unsigned int key_size, const char *key_type, unsigned int key_size,
void * fpr, size_t fpr_size, void *fpr, size_t fpr_size, gnutls_datum_t * art);
gnutls_datum_t* art);
/* SRP /* SRP
*/ */
typedef struct gnutls_srp_server_credentials_st typedef struct gnutls_srp_server_credentials_st
*gnutls_srp_server_credentials_t; *gnutls_srp_server_credentials_t;
typedef struct gnutls_srp_client_credentials_st typedef struct gnutls_srp_client_credentials_st
*gnutls_srp_client_credentials_t; *gnutls_srp_client_credentials_t;
void void
gnutls_srp_free_client_credentials (gnutls_srp_client_credentials_t sc) gnutls_srp_free_client_credentials(gnutls_srp_client_credentials_t sc);
; int
int gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials_t *
gnutls_srp_allocate_client_credentials (gnutls_srp_client_credentials_t sc);
* int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials_t res,
sc); const char *username,
int gnutls_srp_set_client_credentials (gnutls_srp_client_credentials_t re const char *password);
s,
const char *username,
const char *password);
void void
gnutls_srp_free_server_credentials (gnutls_srp_server_credentials_t sc) gnutls_srp_free_server_credentials(gnutls_srp_server_credentials_t sc);
; int
int gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials_t *
gnutls_srp_allocate_server_credentials (gnutls_srp_server_credentials_t sc);
* int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials_t
sc); res, const char *password_file,
int gnutls_srp_set_server_credentials_file (gnutls_srp_server_credentials const char *password_conf_file);
_t
res, const char *password_fil
e,
const char *password_conf_fil
e);
const char *gnutls_srp_server_get_username (gnutls_session_t session); const char *gnutls_srp_server_get_username(gnutls_session_t session);
extern void gnutls_srp_set_prime_bits (gnutls_session_t session, void gnutls_srp_set_prime_bits(gnutls_session_t session,
unsigned int bits); unsigned int bits);
int gnutls_srp_verifier (const char *username, int gnutls_srp_verifier(const char *username,
const char *password, const char *password,
const gnutls_datum_t * salt, const gnutls_datum_t * salt,
const gnutls_datum_t * generator, const gnutls_datum_t * generator,
const gnutls_datum_t * prime, const gnutls_datum_t * prime,
gnutls_datum_t * res); gnutls_datum_t * res);
/* The static parameters defined in draft-ietf-tls-srp-05 /* The static parameters defined in draft-ietf-tls-srp-05
* Those should be used as input to gnutls_srp_verifier(). * Those should be used as input to gnutls_srp_verifier().
*/ */
extern const gnutls_datum_t gnutls_srp_4096_group_prime; extern const gnutls_datum_t gnutls_srp_4096_group_prime;
extern const gnutls_datum_t gnutls_srp_4096_group_generator; extern const gnutls_datum_t gnutls_srp_4096_group_generator;
extern const gnutls_datum_t gnutls_srp_3072_group_prime; extern const gnutls_datum_t gnutls_srp_3072_group_prime;
extern const gnutls_datum_t gnutls_srp_3072_group_generator; extern const gnutls_datum_t gnutls_srp_3072_group_generator;
extern const gnutls_datum_t gnutls_srp_2048_group_prime; 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_2048_group_generator;
extern const gnutls_datum_t gnutls_srp_1536_group_prime; 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_1536_group_generator;
extern const gnutls_datum_t gnutls_srp_1024_group_prime; extern const gnutls_datum_t gnutls_srp_1024_group_prime;
extern const gnutls_datum_t gnutls_srp_1024_group_generator; extern const gnutls_datum_t gnutls_srp_1024_group_generator;
typedef int gnutls_srp_server_credentials_function (gnutls_session_t, typedef int gnutls_srp_server_credentials_function(gnutls_session_t,
const char *username, const char *username,
gnutls_datum_t * salt gnutls_datum_t * salt,
, gnutls_datum_t *
gnutls_datum_t * verifier,
verifier, gnutls_datum_t *
gnutls_datum_t * generator,
generator, gnutls_datum_t * prime);
gnutls_datum_t * prim void
e); gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials_t
void cred,
gnutls_srp_set_server_credentials_function ( gnutls_srp_server_credentials_fun
gnutls_srp_server_credentials_t cred, ction
gnutls_srp_server_credentials_function * func); * func);
typedef int gnutls_srp_client_credentials_function (gnutls_session_t, typedef int gnutls_srp_client_credentials_function(gnutls_session_t,
char **, char **); char **, char **);
void void
gnutls_srp_set_client_credentials_function ( gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials_t
gnutls_srp_client_credentials_t cred, cred,
gnutls_srp_client_credentials_function * func); gnutls_srp_client_credentials_fun
ction
* func);
int gnutls_srp_base64_encode (const gnutls_datum_t * data, char *result, int gnutls_srp_base64_encode(const gnutls_datum_t * data, char *result,
size_t * result_size); size_t * result_size);
int gnutls_srp_base64_encode_alloc (const gnutls_datum_t * data, int gnutls_srp_base64_encode_alloc(const gnutls_datum_t * data,
gnutls_datum_t * result); gnutls_datum_t * result);
int gnutls_srp_base64_decode (const gnutls_datum_t * b64_data, char *resu int gnutls_srp_base64_decode(const gnutls_datum_t * b64_data, char *result,
lt, size_t * result_size);
size_t * result_size); int gnutls_srp_base64_decode_alloc(const gnutls_datum_t * b64_data,
int gnutls_srp_base64_decode_alloc (const gnutls_datum_t * b64_data, gnutls_datum_t * result);
gnutls_datum_t * result);
/* PSK stuff */ /* PSK stuff */
typedef struct gnutls_psk_server_credentials_st typedef struct gnutls_psk_server_credentials_st
*gnutls_psk_server_credentials_t; *gnutls_psk_server_credentials_t;
typedef struct gnutls_psk_client_credentials_st typedef struct gnutls_psk_client_credentials_st
*gnutls_psk_client_credentials_t; *gnutls_psk_client_credentials_t;
/** /**
* gnutls_psk_key_flags: * gnutls_psk_key_flags:
* @GNUTLS_PSK_KEY_RAW: PSK-key in raw format. * @GNUTLS_PSK_KEY_RAW: PSK-key in raw format.
* @GNUTLS_PSK_KEY_HEX: PSK-key in hex format. * @GNUTLS_PSK_KEY_HEX: PSK-key in hex format.
* *
* Enumeration of different PSK key flags. * Enumeration of different PSK key flags.
*/ */
typedef enum gnutls_psk_key_flags typedef enum gnutls_psk_key_flags {
{ GNUTLS_PSK_KEY_RAW = 0,
GNUTLS_PSK_KEY_RAW = 0, GNUTLS_PSK_KEY_HEX
GNUTLS_PSK_KEY_HEX } gnutls_psk_key_flags;
} gnutls_psk_key_flags;
void void
gnutls_psk_free_client_credentials (gnutls_psk_client_credentials_t sc) gnutls_psk_free_client_credentials(gnutls_psk_client_credentials_t sc);
; int
int gnutls_psk_allocate_client_credentials(gnutls_psk_client_credentials_t *
gnutls_psk_allocate_client_credentials (gnutls_psk_client_credentials_t sc);
* int gnutls_psk_set_client_credentials(gnutls_psk_client_credentials_t res,
sc); const char *username,
int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t re const gnutls_datum_t * key,
s, gnutls_psk_key_flags flags);
const char *username,
const gnutls_datum_t * key,
gnutls_psk_key_flags flags);
void void
gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t sc) gnutls_psk_free_server_credentials(gnutls_psk_server_credentials_t sc);
; int
int gnutls_psk_allocate_server_credentials(gnutls_psk_server_credentials_t *
gnutls_psk_allocate_server_credentials (gnutls_psk_server_credentials_t sc);
* int gnutls_psk_set_server_credentials_file(gnutls_psk_server_credentials_t
sc); res, const char *password_file);
int gnutls_psk_set_server_credentials_file (gnutls_psk_server_credentials
_t
res, const char *password_fil
e);
int int
gnutls_psk_set_server_credentials_hint (gnutls_psk_server_credentials_t gnutls_psk_set_server_credentials_hint(gnutls_psk_server_credentials_t
res, const char *hint); res, const char *hint);
const char *gnutls_psk_server_get_username (gnutls_session_t session); const char *gnutls_psk_server_get_username(gnutls_session_t session);
const char *gnutls_psk_client_get_hint (gnutls_session_t session); const char *gnutls_psk_client_get_hint(gnutls_session_t session);
typedef int gnutls_psk_server_credentials_function (gnutls_session_t, typedef int gnutls_psk_server_credentials_function(gnutls_session_t,
const char *username, const char *username,
gnutls_datum_t * key) gnutls_datum_t * key);
; void
void gnutls_psk_set_server_credentials_function(gnutls_psk_server_credentials_t
gnutls_psk_set_server_credentials_function ( cred,
gnutls_psk_server_credentials_t cred, gnutls_psk_server_credentials_fun
gnutls_psk_server_credentials_function * func); ction
* func);
typedef int gnutls_psk_client_credentials_function (gnutls_session_t, typedef int gnutls_psk_client_credentials_function(gnutls_session_t,
char **username, char **username,
gnutls_datum_t * key) gnutls_datum_t * key);
; void
void gnutls_psk_set_client_credentials_function(gnutls_psk_client_credentials_t
gnutls_psk_set_client_credentials_function ( cred,
gnutls_psk_client_credentials_t cred, gnutls_psk_client_credentials_fun
gnutls_psk_client_credentials_function * func); ction
* func);
int gnutls_hex_encode (const gnutls_datum_t * data, char *result, int gnutls_hex_encode(const gnutls_datum_t * data, char *result,
size_t * result_size); size_t * result_size);
int gnutls_hex_decode (const gnutls_datum_t * hex_data, void *result, int gnutls_hex_decode(const gnutls_datum_t * hex_data, void *result,
size_t * result_size); size_t * result_size);
void void
gnutls_psk_set_server_dh_params (gnutls_psk_server_credentials_t res, gnutls_psk_set_server_dh_params(gnutls_psk_server_credentials_t res,
gnutls_dh_params_t dh_params); gnutls_dh_params_t dh_params);
void void
gnutls_psk_set_server_params_function (gnutls_psk_server_credentials_t gnutls_psk_set_server_params_function(gnutls_psk_server_credentials_t
res, res, gnutls_params_function * func);
gnutls_params_function * func);
/** /**
* gnutls_x509_subject_alt_name_t: * gnutls_x509_subject_alt_name_t:
* @GNUTLS_SAN_DNSNAME: DNS-name SAN. * @GNUTLS_SAN_DNSNAME: DNS-name SAN.
* @GNUTLS_SAN_RFC822NAME: E-mail address SAN. * @GNUTLS_SAN_RFC822NAME: E-mail address SAN.
* @GNUTLS_SAN_URI: URI SAN. * @GNUTLS_SAN_URI: URI SAN.
* @GNUTLS_SAN_IPADDRESS: IP address SAN. * @GNUTLS_SAN_IPADDRESS: IP address SAN.
* @GNUTLS_SAN_OTHERNAME: OtherName SAN. * @GNUTLS_SAN_OTHERNAME: OtherName SAN.
* @GNUTLS_SAN_DN: DN SAN. * @GNUTLS_SAN_DN: DN SAN.
* @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by * @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by
* gnutls_x509_crt_get_subject_alt_othername_oid. * gnutls_x509_crt_get_subject_alt_othername_oid.
* *
* Enumeration of different subject alternative names types. * Enumeration of different subject alternative names types.
*/ */
typedef enum gnutls_x509_subject_alt_name_t typedef enum gnutls_x509_subject_alt_name_t {
{ GNUTLS_SAN_DNSNAME = 1,
GNUTLS_SAN_DNSNAME = 1, GNUTLS_SAN_RFC822NAME = 2,
GNUTLS_SAN_RFC822NAME = 2, GNUTLS_SAN_URI = 3,
GNUTLS_SAN_URI = 3, GNUTLS_SAN_IPADDRESS = 4,
GNUTLS_SAN_IPADDRESS = 4, GNUTLS_SAN_OTHERNAME = 5,
GNUTLS_SAN_OTHERNAME = 5, GNUTLS_SAN_DN = 6,
GNUTLS_SAN_DN = 6, /* The following are "virtual" subject alternative name types, in
/* The following are "virtual" subject alternative name types, in that they are represented by an otherName value and an OID.
that they are represented by an otherName value and an OID. Used by gnutls_x509_crt_get_subject_alt_othername_oid. */
Used by gnutls_x509_crt_get_subject_alt_othername_oid. */ GNUTLS_SAN_OTHERNAME_XMPP = 1000
GNUTLS_SAN_OTHERNAME_XMPP = 1000 } gnutls_x509_subject_alt_name_t;
} gnutls_x509_subject_alt_name_t;
struct gnutls_openpgp_crt_int; struct gnutls_openpgp_crt_int;
typedef struct gnutls_openpgp_crt_int *gnutls_openpgp_crt_t; typedef struct gnutls_openpgp_crt_int *gnutls_openpgp_crt_t;
struct gnutls_openpgp_privkey_int; struct gnutls_openpgp_privkey_int;
typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t; typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t;
struct gnutls_pkcs11_privkey_st; struct gnutls_pkcs11_privkey_st;
typedef struct gnutls_pkcs11_privkey_st *gnutls_pkcs11_privkey_t; typedef struct gnutls_pkcs11_privkey_st *gnutls_pkcs11_privkey_t;
/** /**
* gnutls_privkey_type_t: * gnutls_privkey_type_t:
* @GNUTLS_PRIVKEY_X509: X.509 private key, #gnutls_x509_privkey_t. * @GNUTLS_PRIVKEY_X509: X.509 private key, #gnutls_x509_privkey_t.
* @GNUTLS_PRIVKEY_OPENPGP: OpenPGP private key, #gnutls_openpgp_privkey_t. * @GNUTLS_PRIVKEY_OPENPGP: OpenPGP private key, #gnutls_openpgp_privkey_t.
* @GNUTLS_PRIVKEY_PKCS11: PKCS11 private key, #gnutls_pkcs11_privkey_t. * @GNUTLS_PRIVKEY_PKCS11: PKCS11 private key, #gnutls_pkcs11_privkey_t.
* @GNUTLS_PRIVKEY_EXT: External private key, operating using callbacks. * @GNUTLS_PRIVKEY_EXT: External private key, operating using callbacks.
* *
* Enumeration of different private key types. * Enumeration of different private key types.
*/ */
typedef enum typedef enum {
{ GNUTLS_PRIVKEY_X509,
GNUTLS_PRIVKEY_X509, GNUTLS_PRIVKEY_OPENPGP,
GNUTLS_PRIVKEY_OPENPGP, GNUTLS_PRIVKEY_PKCS11,
GNUTLS_PRIVKEY_PKCS11, GNUTLS_PRIVKEY_EXT
GNUTLS_PRIVKEY_EXT } gnutls_privkey_type_t;
} gnutls_privkey_type_t;
typedef struct gnutls_retr2_st typedef struct gnutls_retr2_st {
{ gnutls_certificate_type_t cert_type;
gnutls_certificate_type_t cert_type; gnutls_privkey_type_t key_type;
gnutls_privkey_type_t key_type;
union union {
{ gnutls_x509_crt_t *x509;
gnutls_x509_crt_t *x509; gnutls_openpgp_crt_t pgp;
gnutls_openpgp_crt_t pgp; } cert;
} cert; unsigned int ncerts; /* one for pgp keys */
unsigned int ncerts; /* one for pgp keys */
union union {
{ gnutls_x509_privkey_t x509;
gnutls_x509_privkey_t x509; gnutls_openpgp_privkey_t pgp;
gnutls_openpgp_privkey_t pgp; gnutls_pkcs11_privkey_t pkcs11;
gnutls_pkcs11_privkey_t pkcs11; } key;
} key;
unsigned int deinit_all; /* if non zero all keys will be deinited */ unsigned int deinit_all; /* if non zero all keys will be dein
} gnutls_retr2_st; ited */
} gnutls_retr2_st;
/* Functions that allow auth_info_t structures handling /* Functions that allow auth_info_t structures handling
*/ */
gnutls_credentials_type_t gnutls_auth_get_type (gnutls_session_t session) gnutls_credentials_type_t gnutls_auth_get_type(gnutls_session_t session);
; gnutls_credentials_type_t
gnutls_credentials_type_t gnutls_auth_server_get_type(gnutls_session_t session);
gnutls_auth_server_get_type (gnutls_session_t session); gnutls_credentials_type_t
gnutls_credentials_type_t gnutls_auth_client_get_type(gnutls_session_t session);
gnutls_auth_client_get_type (gnutls_session_t session);
/* DH */ /* DH */
void gnutls_dh_set_prime_bits (gnutls_session_t session, unsigned int bit void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits);
s); int gnutls_dh_get_secret_bits(gnutls_session_t session);
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_peers_public_bits (gnutls_session_t session); int gnutls_dh_get_prime_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_g int gnutls_dh_get_group(gnutls_session_t session, gnutls_datum_t * raw_gen,
en, gnutls_datum_t * raw_prime);
gnutls_datum_t * raw_prime); int gnutls_dh_get_pubkey(gnutls_session_t session,
int gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key);
gnutls_datum_t * raw_key);
/* X509PKI */ /* X509PKI */
/* These are set on the credentials structure. /* These are set on the credentials structure.
*/ */
/* use gnutls_certificate_set_retrieve_function2() in abstract.h /* use gnutls_certificate_set_retrieve_function2() in abstract.h
* instead. It's much more efficient. * instead. It's much more efficient.
*/ */
typedef int gnutls_certificate_retrieve_function (gnutls_session_t, typedef int gnutls_certificate_retrieve_function(gnutls_session_t,
const const
gnutls_datum_t * gnutls_datum_t *
req_ca_rdn, req_ca_rdn,
int nreqs, int nreqs,
const const
gnutls_pk_algorithm_t gnutls_pk_algorithm_t
* pk_algos, * pk_algos,
int int
pk_algos_length, pk_algos_length,
gnutls_retr2_st *); gnutls_retr2_st *);
void gnutls_certificate_set_retrieve_function ( void
gnutls_certificate_credentials_t cred, gnutls_certificate_set_retrieve_function(gnutls_certificate_credentials_t
gnutls_certificate_retrieve_function * func); cred,
gnutls_certificate_retrieve_functio
n
* func);
typedef int gnutls_certificate_verify_function (gnutls_session_t); typedef int gnutls_certificate_verify_function(gnutls_session_t);
void void
gnutls_certificate_set_verify_function (gnutls_certificate_credentials_ gnutls_certificate_set_verify_function(gnutls_certificate_credentials_t
t cred,
cred, gnutls_certificate_verify_function
gnutls_certificate_verify_funct * func);
ion
* func);
void void
gnutls_certificate_server_set_request (gnutls_session_t session, gnutls_certificate_server_set_request(gnutls_session_t session,
gnutls_certificate_request_t req gnutls_certificate_request_t req);
);
/* get data from the session /* get data from the session
*/ */
const gnutls_datum_t *gnutls_certificate_get_peers (gnutls_session_t const gnutls_datum_t *gnutls_certificate_get_peers(gnutls_session_t
session, session, unsigned int
unsigned int *list_size);
*list_size); const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t
const gnutls_datum_t *gnutls_certificate_get_ours (gnutls_session_t session);
session);
int gnutls_certificate_get_peers_subkey_id(gnutls_session_t session, int gnutls_certificate_get_peers_subkey_id(gnutls_session_t session,
gnutls_datum_t *id); gnutls_datum_t * id);
time_t gnutls_certificate_activation_time_peers (gnutls_session_t session time_t gnutls_certificate_activation_time_peers(gnutls_session_t session);
); time_t gnutls_certificate_expiration_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 sessio int gnutls_certificate_client_get_request_status(gnutls_session_t session);
n); int gnutls_certificate_verify_peers2(gnutls_session_t session,
int gnutls_certificate_verify_peers2 (gnutls_session_t session, unsigned int *status);
unsigned int *status); int gnutls_certificate_verify_peers3(gnutls_session_t session,
int gnutls_certificate_verify_peers3 (gnutls_session_t session, const char *hostname,
const char* hostname, unsigned int *status);
unsigned int *status);
int gnutls_certificate_verification_status_print (unsigned int status, int gnutls_certificate_verification_status_print(unsigned int status,
gnutls_certificate_type_t type, gnutls_certificate_type_t
gnutls_datum_t * out, unsigned int flags); type,
gnutls_datum_t * out,
unsigned int flags);
int gnutls_pem_base64_encode (const char *msg, const gnutls_datum_t * dat int gnutls_pem_base64_encode(const char *msg, const gnutls_datum_t * data,
a, char *result, size_t * result_size);
char *result, size_t * result_size); int gnutls_pem_base64_decode(const char *header,
int gnutls_pem_base64_decode (const char *header, const gnutls_datum_t * b64_data,
const gnutls_datum_t * b64_data, unsigned char *result, size_t * result_size);
unsigned char *result, size_t * result_size
);
int gnutls_pem_base64_encode_alloc (const char *msg, int gnutls_pem_base64_encode_alloc(const char *msg,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_datum_t * result); gnutls_datum_t * result);
int gnutls_pem_base64_decode_alloc (const char *header, int gnutls_pem_base64_decode_alloc(const char *header,
const gnutls_datum_t * b64_data, const gnutls_datum_t * b64_data,
gnutls_datum_t * result); gnutls_datum_t * result);
/* key_usage will be an OR of the following values: /* key_usage will be an OR of the following values:
*/ */
/* when the key is to be used for signing: */ /* when the key is to be used for signing: */
#define GNUTLS_KEY_DIGITAL_SIGNATURE 128 #define GNUTLS_KEY_DIGITAL_SIGNATURE 128
#define GNUTLS_KEY_NON_REPUDIATION 64 #define GNUTLS_KEY_NON_REPUDIATION 64
/* when the key is to be used for encryption: */ /* when the key is to be used for encryption: */
#define GNUTLS_KEY_KEY_ENCIPHERMENT 32 #define GNUTLS_KEY_KEY_ENCIPHERMENT 32
#define GNUTLS_KEY_DATA_ENCIPHERMENT 16 #define GNUTLS_KEY_DATA_ENCIPHERMENT 16
#define GNUTLS_KEY_KEY_AGREEMENT 8 #define GNUTLS_KEY_KEY_AGREEMENT 8
#define GNUTLS_KEY_KEY_CERT_SIGN 4 #define GNUTLS_KEY_KEY_CERT_SIGN 4
#define GNUTLS_KEY_CRL_SIGN 2 #define GNUTLS_KEY_CRL_SIGN 2
#define GNUTLS_KEY_ENCIPHER_ONLY 1 #define GNUTLS_KEY_ENCIPHER_ONLY 1
#define GNUTLS_KEY_DECIPHER_ONLY 32768 #define GNUTLS_KEY_DECIPHER_ONLY 32768
void void
gnutls_certificate_set_params_function (gnutls_certificate_credentials_ gnutls_certificate_set_params_function(gnutls_certificate_credentials_t
t res, gnutls_params_function * func);
res, void gnutls_anon_set_params_function(gnutls_anon_server_credentials_t res,
gnutls_params_function * func); gnutls_params_function * func);
void gnutls_anon_set_params_function (gnutls_anon_server_credentials_t re void gnutls_psk_set_params_function(gnutls_psk_server_credentials_t res,
s, gnutls_params_function * func);
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, int gnutls_hex2bin(const char *hex_data, size_t hex_size,
void *bin_data, size_t * bin_size); void *bin_data, size_t * bin_size);
/* Trust on first use (or ssh like) functions */ /* Trust on first use (or ssh like) functions */
/* stores the provided information to a database /* stores the provided information to a database
*/ */
typedef int (*gnutls_tdb_store_func) (const char* db_name, typedef int (*gnutls_tdb_store_func) (const char *db_name,
const char* host, const char *host,
const char* service, const char *service,
time_t expiration, time_t expiration,
const gnutls_datum_t* pubkey); const gnutls_datum_t * pubkey);
typedef int (*gnutls_tdb_store_commitment_func) (const char* db_name, typedef int (*gnutls_tdb_store_commitment_func) (const char *db_name,
const char* host, const char *host,
const char* service, const char *service,
time_t expiration, time_t expiration,
gnutls_digest_algorithm_t hash gnutls_digest_algorithm_t
_algo, hash_algo,
const gnutls_datum_t* hash); const gnutls_datum_t *
hash);
/* searches for the provided host/service pair that match the /* searches for the provided host/service pair that match the
* provided public key in the database. */ * provided public key in the database. */
typedef int (*gnutls_tdb_verify_func) (const char* db_name, typedef int (*gnutls_tdb_verify_func) (const char *db_name,
const char* host, const char *host,
const char* service, const char *service,
const gnutls_datum_t *pubkey); const gnutls_datum_t * pubkey);
struct gnutls_tdb_int; struct gnutls_tdb_int;
typedef struct gnutls_tdb_int *gnutls_tdb_t; typedef struct gnutls_tdb_int *gnutls_tdb_t;
int gnutls_tdb_init (gnutls_tdb_t *tdb); int gnutls_tdb_init(gnutls_tdb_t * tdb);
void gnutls_tdb_set_store_func (gnutls_tdb_t tdb, void gnutls_tdb_set_store_func(gnutls_tdb_t tdb,
gnutls_tdb_store_func store); gnutls_tdb_store_func store);
void gnutls_tdb_set_store_commitment_func (gnutls_tdb_t tdb, void gnutls_tdb_set_store_commitment_func(gnutls_tdb_t tdb,
gnutls_tdb_store_commitment_func cstore gnutls_tdb_store_commitment_func
); cstore);
void gnutls_tdb_set_verify_func (gnutls_tdb_t tdb, void gnutls_tdb_set_verify_func(gnutls_tdb_t tdb,
gnutls_tdb_verify_func verify); gnutls_tdb_verify_func verify);
void gnutls_tdb_deinit (gnutls_tdb_t tdb); void gnutls_tdb_deinit(gnutls_tdb_t tdb);
int gnutls_verify_stored_pubkey (const char* db_name, int gnutls_verify_stored_pubkey(const char *db_name,
gnutls_tdb_t tdb, gnutls_tdb_t tdb,
const char* host, const char *host,
const char* service, const char *service,
gnutls_certificate_type_t cert_type, gnutls_certificate_type_t cert_type,
const gnutls_datum_t * cert, const gnutls_datum_t * cert,
unsigned int flags); unsigned int flags);
int gnutls_store_commitment (const char* db_name, int gnutls_store_commitment(const char *db_name,
gnutls_tdb_t tdb, gnutls_tdb_t tdb,
const char* host, const char *host,
const char* service, const char *service,
gnutls_digest_algorithm_t hash_algo, gnutls_digest_algorithm_t hash_algo,
const gnutls_datum_t* hash, const gnutls_datum_t * hash,
time_t expiration, time_t expiration, unsigned int flags);
unsigned int flags);
int gnutls_store_pubkey (const char* db_name, int gnutls_store_pubkey(const char *db_name,
gnutls_tdb_t tdb, gnutls_tdb_t tdb,
const char* host, const char *host,
const char* service, const char *service,
gnutls_certificate_type_t cert_type, gnutls_certificate_type_t cert_type,
const gnutls_datum_t * cert, const gnutls_datum_t * cert,
time_t expiration, time_t expiration, unsigned int flags);
unsigned int flags);
/* Other helper functions */ /* Other helper functions */
int gnutls_load_file(const char* filename, gnutls_datum_t * data); int gnutls_load_file(const char *filename, gnutls_datum_t * data);
int gnutls_url_is_supported (const char* url); int gnutls_url_is_supported(const char *url);
/* PIN callback */ /* PIN callback */
/** /**
* gnutls_pin_flag_t: * gnutls_pin_flag_t:
* @GNUTLS_PIN_USER: The PIN for the user. * @GNUTLS_PIN_USER: The PIN for the user.
* @GNUTLS_PIN_SO: The PIN for the security officer (admin). * @GNUTLS_PIN_SO: The PIN for the security officer (admin).
* @GNUTLS_PIN_CONTEXT_SPECIFIC: The PIN is for a specific action and key l ike signing. * @GNUTLS_PIN_CONTEXT_SPECIFIC: The PIN is for a specific action and key l ike signing.
* @GNUTLS_PIN_FINAL_TRY: This is the final try before blocking. * @GNUTLS_PIN_FINAL_TRY: This is the final try before blocking.
* @GNUTLS_PIN_COUNT_LOW: Few tries remain before token blocks. * @GNUTLS_PIN_COUNT_LOW: Few tries remain before token blocks.
* @GNUTLS_PIN_WRONG: Last given PIN was not correct. * @GNUTLS_PIN_WRONG: Last given PIN was not correct.
* *
* Enumeration of different flags that are input to the PIN function. * Enumeration of different flags that are input to the PIN function.
*/ */
typedef enum typedef enum {
{ GNUTLS_PIN_USER = (1 << 0),
GNUTLS_PIN_USER = (1 << 0), GNUTLS_PIN_SO = (1 << 1),
GNUTLS_PIN_SO = (1 << 1), GNUTLS_PIN_FINAL_TRY = (1 << 2),
GNUTLS_PIN_FINAL_TRY = (1 << 2), GNUTLS_PIN_COUNT_LOW = (1 << 3),
GNUTLS_PIN_COUNT_LOW = (1 << 3), GNUTLS_PIN_CONTEXT_SPECIFIC = (1 << 4),
GNUTLS_PIN_CONTEXT_SPECIFIC = (1 << 4), GNUTLS_PIN_WRONG = (1 << 5),
GNUTLS_PIN_WRONG = (1 << 5), } gnutls_pin_flag_t;
} gnutls_pin_flag_t;
#define GNUTLS_PKCS11_PIN_USER GNUTLS_PIN_USER #define GNUTLS_PKCS11_PIN_USER GNUTLS_PIN_USER
#define GNUTLS_PKCS11_PIN_SO GNUTLS_PIN_SO #define GNUTLS_PKCS11_PIN_SO GNUTLS_PIN_SO
#define GNUTLS_PKCS11_PIN_FINAL_TRY GNUTLS_PIN_FINAL_TRY #define GNUTLS_PKCS11_PIN_FINAL_TRY GNUTLS_PIN_FINAL_TRY
#define GNUTLS_PKCS11_PIN_COUNT_LOW GNUTLS_PIN_COUNT_LOW #define GNUTLS_PKCS11_PIN_COUNT_LOW GNUTLS_PIN_COUNT_LOW
#define GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC GNUTLS_PIN_CONTEXT_SPECIFIC #define GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC GNUTLS_PIN_CONTEXT_SPECIFIC
#define GNUTLS_PKCS11_PIN_WRONG GNUTLS_PIN_WRONG #define GNUTLS_PKCS11_PIN_WRONG GNUTLS_PIN_WRONG
/** /**
* gnutls_pin_callback_t: * gnutls_pin_callback_t:
skipping to change at line 2058 skipping to change at line 2072
* the callback returns failure, or the token refuses login (e.g. when * the callback returns failure, or the token refuses login (e.g. when
* the token is locked due to too many incorrect PINs!). For the * the token is locked due to too many incorrect PINs!). For the
* first such invocation, the @attempt counter will have value zero; * first such invocation, the @attempt counter will have value zero;
* it will increase by one for each subsequent attempt. * it will increase by one for each subsequent attempt.
* *
* Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code on er ror. * Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code on er ror.
* *
* Since: 2.12.0 * Since: 2.12.0
**/ **/
typedef int (*gnutls_pin_callback_t) (void *userdata, int attempt, typedef int (*gnutls_pin_callback_t) (void *userdata, int attempt,
const char *token_url, const char *token_url,
const char *token_label, const char *token_label,
unsigned int flags, unsigned int flags,
char *pin, size_t pin_max); char *pin, size_t pin_max);
void gnutls_certificate_set_pin_function (gnutls_certificate_credentials_ void gnutls_certificate_set_pin_function(gnutls_certificate_credentials_t,
t, gnutls_pin_callback_t fn,
gnutls_pin_callback_t fn, void void *userdata);
*userdata);
/* Gnutls error codes. The mapping to a TLS alert is also shown in /* Gnutls error codes. The mapping to a TLS alert is also shown in
* comments. * comments.
*/ */
#define GNUTLS_E_SUCCESS 0 #define GNUTLS_E_SUCCESS 0
#define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3 #define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3
#define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6 #define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6
#define GNUTLS_E_LARGE_PACKET -7 #define GNUTLS_E_LARGE_PACKET -7
#define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSIO #define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION
N */ */
#define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW #define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW
*/ */
#define GNUTLS_E_INVALID_SESSION -10 #define GNUTLS_E_INVALID_SESSION -10
#define GNUTLS_E_FATAL_ALERT_RECEIVED -12 #define GNUTLS_E_FATAL_ALERT_RECEIVED -12
#define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */ #define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */
#define GNUTLS_E_WARNING_ALERT_RECEIVED -16 #define GNUTLS_E_WARNING_ALERT_RECEIVED -16
#define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18 #define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18
#define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19 #define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19
#define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAK E_FAILURE */ #define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAK E_FAILURE */
#define GNUTLS_E_UNWANTED_ALGORITHM -22 #define GNUTLS_E_UNWANTED_ALGORITHM -22
#define GNUTLS_E_MPI_SCAN_FAILED -23 #define GNUTLS_E_MPI_SCAN_FAILED -23
#define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUT LS_A_BAD_RECORD_MAC */ #define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTL S_A_BAD_RECORD_MAC */
#define GNUTLS_E_MEMORY_ERROR -25 #define GNUTLS_E_MEMORY_ERROR -25
#define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_F AILURE */ #define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FA ILURE */
#define GNUTLS_E_COMPRESSION_FAILED -27 #define GNUTLS_E_COMPRESSION_FAILED -27
#define GNUTLS_E_AGAIN -28 #define GNUTLS_E_AGAIN -28
#define GNUTLS_E_EXPIRED -29 #define GNUTLS_E_EXPIRED -29
#define GNUTLS_E_DB_ERROR -30 #define GNUTLS_E_DB_ERROR -30
#define GNUTLS_E_SRP_PWD_ERROR -31 #define GNUTLS_E_SRP_PWD_ERROR -31
#define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32 #define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32
#define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ #define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */
#define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS #define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS
#define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */ #define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* f or backwards compatibility only */
#define GNUTLS_E_HASH_FAILED -33 #define GNUTLS_E_HASH_FAILED -33
#define GNUTLS_E_BASE64_DECODING_ERROR -34 #define GNUTLS_E_BASE64_DECODING_ERROR -34
#define GNUTLS_E_MPI_PRINT_FAILED -35 #define GNUTLS_E_MPI_PRINT_FAILED -35
#define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */ #define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */
#define GNUTLS_E_GOT_APPLICATION_DATA -38 #define GNUTLS_E_GOT_APPLICATION_DATA -38
#define GNUTLS_E_RECORD_LIMIT_REACHED -39 #define GNUTLS_E_RECORD_LIMIT_REACHED -39
#define GNUTLS_E_ENCRYPTION_FAILED -40 #define GNUTLS_E_ENCRYPTION_FAILED -40
#define GNUTLS_E_PK_ENCRYPTION_FAILED -44 #define GNUTLS_E_PK_ENCRYPTION_FAILED -44
#define GNUTLS_E_PK_DECRYPTION_FAILED -45 #define GNUTLS_E_PK_DECRYPTION_FAILED -45
#define GNUTLS_E_PK_SIGN_FAILED -46 #define GNUTLS_E_PK_SIGN_FAILED -46
#define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47 #define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47
#define GNUTLS_E_KEY_USAGE_VIOLATION -48 #define GNUTLS_E_KEY_USAGE_VIOLATION -48
#define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */ #define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */
#define GNUTLS_E_INVALID_REQUEST -50 #define GNUTLS_E_INVALID_REQUEST -50
#define GNUTLS_E_SHORT_MEMORY_BUFFER -51 #define GNUTLS_E_SHORT_MEMORY_BUFFER -51
#define GNUTLS_E_INTERRUPTED -52 #define GNUTLS_E_INTERRUPTED -52
#define GNUTLS_E_PUSH_ERROR -53 #define GNUTLS_E_PUSH_ERROR -53
#define GNUTLS_E_PULL_ERROR -54 #define GNUTLS_E_PULL_ERROR -54
#define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMET ER */ #define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_ PARAMETER */
#define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56 #define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56
#define GNUTLS_E_PKCS1_WRONG_PAD -57 #define GNUTLS_E_PKCS1_WRONG_PAD -57
#define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58 #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58
#define GNUTLS_E_INTERNAL_ERROR -59 #define GNUTLS_E_INTERNAL_ERROR -59
#define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63 #define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63
#define GNUTLS_E_FILE_ERROR -64 #define GNUTLS_E_FILE_ERROR -64
#define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78 #define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78
#define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80 #define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80
#define GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS -81 #define GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS -81
skipping to change at line 2161 skipping to change at line 2176
#define GNUTLS_E_ASN1_VALUE_NOT_VALID -72 #define GNUTLS_E_ASN1_VALUE_NOT_VALID -72
#define GNUTLS_E_ASN1_TAG_ERROR -73 #define GNUTLS_E_ASN1_TAG_ERROR -73
#define GNUTLS_E_ASN1_TAG_IMPLICIT -74 #define GNUTLS_E_ASN1_TAG_IMPLICIT -74
#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75 #define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
#define GNUTLS_E_ASN1_SYNTAX_ERROR -76 #define GNUTLS_E_ASN1_SYNTAX_ERROR -76
#define GNUTLS_E_ASN1_DER_OVERFLOW -77 #define GNUTLS_E_ASN1_DER_OVERFLOW -77
#define GNUTLS_E_OPENPGP_UID_REVOKED -79 #define GNUTLS_E_OPENPGP_UID_REVOKED -79
#define GNUTLS_E_CERTIFICATE_ERROR -43 #define GNUTLS_E_CERTIFICATE_ERROR -43
#define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR #define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR
#define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60 #define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60
#define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPO RTED_CERTIFICATE */ #define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPOR TED_CERTIFICATE */
#define GNUTLS_E_X509_UNKNOWN_SAN -62 #define GNUTLS_E_X509_UNKNOWN_SAN -62
#define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94 #define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94
#define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95 #define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95
#define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96 #define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96
#define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97 #define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97
#define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98 #define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98
#define GNUTLS_E_INVALID_PASSWORD -99 #define GNUTLS_E_INVALID_PASSWORD -99
#define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */ #define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */
#define GNUTLS_E_CONSTRAINT_ERROR -101 #define GNUTLS_E_CONSTRAINT_ERROR -101
#define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102 #define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102
#define GNUTLS_E_WARNING_IA_FPHF_RECEIVED -103 #define GNUTLS_E_WARNING_IA_FPHF_RECEIVED -103
#define GNUTLS_E_IA_VERIFY_FAILED -104 #define GNUTLS_E_IA_VERIFY_FAILED -104
#define GNUTLS_E_UNKNOWN_ALGORITHM -105 #define GNUTLS_E_UNKNOWN_ALGORITHM -105
#define GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM -106 #define GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM -106
#define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107 #define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107
#define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108 #define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108
#define GNUTLS_E_UNKNOWN_SRP_USERNAME -109 #define GNUTLS_E_UNKNOWN_SRP_USERNAME -109
#define GNUTLS_E_PREMATURE_TERMINATION -110 #define GNUTLS_E_PREMATURE_TERMINATION -110
#define GNUTLS_E_BASE64_ENCODING_ERROR -201 #define GNUTLS_E_BASE64_ENCODING_ERROR -201
#define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */ #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */
#define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202 #define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202
#define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203 #define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203
#define GNUTLS_E_OPENPGP_KEYRING_ERROR -204 #define GNUTLS_E_OPENPGP_KEYRING_ERROR -204
#define GNUTLS_E_X509_UNSUPPORTED_OID -205 #define GNUTLS_E_X509_UNSUPPORTED_OID -205
#define GNUTLS_E_RANDOM_FAILED -206 #define GNUTLS_E_RANDOM_FAILED -206
#define GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR -207 #define GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR -207
#define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208 #define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208
skipping to change at line 2261 skipping to change at line 2276
#define GNUTLS_E_OCSP_RESPONSE_ERROR -341 #define GNUTLS_E_OCSP_RESPONSE_ERROR -341
#define GNUTLS_E_RANDOM_DEVICE_ERROR -342 #define GNUTLS_E_RANDOM_DEVICE_ERROR -342
#define GNUTLS_E_AUTH_ERROR -343 #define GNUTLS_E_AUTH_ERROR -343
#define GNUTLS_E_NO_APPLICATION_PROTOCOL -344 #define GNUTLS_E_NO_APPLICATION_PROTOCOL -344
#define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250
#define GNUTLS_E_APPLICATION_ERROR_MAX -65000 #define GNUTLS_E_APPLICATION_ERROR_MAX -65000
#define GNUTLS_E_APPLICATION_ERROR_MIN -65500 #define GNUTLS_E_APPLICATION_ERROR_MIN -65500
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#include <gnutls/compat.h> #include <gnutls/compat.h>
#endif /* GNUTLS_H */ #endif /* GNUTLS_H */
 End of changes. 263 change blocks. 
1274 lines changed or deleted 1183 lines changed or added


 gnutlsxx.h (3.2.6)   gnutlsxx.h (3.2.7) 
skipping to change at line 30 skipping to change at line 30
* *
*/ */
#ifndef GNUTLSXX_H #ifndef GNUTLSXX_H
#define GNUTLSXX_H #define GNUTLSXX_H
#include <exception> #include <exception>
#include <vector> #include <vector>
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
namespace gnutls namespace gnutls {
{
class noncopyable
{
protected:
noncopyable ()
{
}
~noncopyable ()
{
}
private: class noncopyable {
// These are non-implemented. protected:
noncopyable (const noncopyable &); noncopyable() {
noncopyable & operator= (const noncopyable &); } ~noncopyable() {
}; } private:
// These are non-implemented.
noncopyable(const noncopyable &);
noncopyable & operator=(const noncopyable &);
};
class exception:public std::exception class exception:public std::exception {
{ public:
public: exception(int x);
exception (int x); const char *what() const throw();
const char *what () const throw (); int get_code();
int get_code (); protected:
protected: int retcode;
int retcode; };
};
class dh_params:private noncopyable class dh_params:private noncopyable {
{ public:
public: dh_params();
dh_params (); ~dh_params();
~dh_params (); void import_raw(const gnutls_datum_t & prime,
void import_raw (const gnutls_datum_t & prime, const gnutls_datum_t & generator);
const gnutls_datum_t & generator); void import_pkcs3(const gnutls_datum_t & pkcs3_params,
void import_pkcs3 (const gnutls_datum_t & pkcs3_params, gnutls_x509_crt_fmt_t format);
gnutls_x509_crt_fmt_t format); void generate(unsigned int bits);
void generate (unsigned int bits);
void export_pkcs3 (gnutls_x509_crt_fmt_t format, void export_pkcs3(gnutls_x509_crt_fmt_t format,
unsigned char *params_data, size_t * params_data_siz unsigned char *params_data,
e); size_t * params_data_size);
void export_raw (gnutls_datum_t & prime, gnutls_datum_t & generator); void export_raw(gnutls_datum_t & prime,
gnutls_datum_t & generator);
gnutls_dh_params_t get_params_t () const; gnutls_dh_params_t get_params_t() const;
dh_params & operator= (const dh_params & src); dh_params & operator=(const dh_params & src);
protected: protected:
gnutls_dh_params_t params; gnutls_dh_params_t params;
}; };
class rsa_params:private noncopyable class rsa_params:private noncopyable {
{ public:
public: rsa_params();
rsa_params (); ~rsa_params();
~rsa_params (); void import_raw(const gnutls_datum_t & m,
void import_raw (const gnutls_datum_t & m, const gnutls_datum_t & e,
const gnutls_datum_t & e, const gnutls_datum_t & d,
const gnutls_datum_t & d, const gnutls_datum_t & p,
const gnutls_datum_t & p, const gnutls_datum_t & q,
const gnutls_datum_t & q, const gnutls_datum_t & u); const gnutls_datum_t & u);
void import_pkcs1 (const gnutls_datum_t & pkcs1_params, void import_pkcs1(const gnutls_datum_t & pkcs1_params,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
void generate (unsigned int bits); void generate(unsigned int bits);
void export_pkcs1 (gnutls_x509_crt_fmt_t format, void export_pkcs1(gnutls_x509_crt_fmt_t format,
unsigned char *params_data, size_t * params_data_siz unsigned char *params_data,
e); size_t * params_data_size);
void export_raw (gnutls_datum_t & m, gnutls_datum_t & e, void export_raw(gnutls_datum_t & m, gnutls_datum_t & e,
gnutls_datum_t & d, gnutls_datum_t & p, gnutls_datum_t & d, gnutls_datum_t & p,
gnutls_datum_t & q, gnutls_datum_t & u); gnutls_datum_t & q, gnutls_datum_t & u);
gnutls_rsa_params_t get_params_t () const; gnutls_rsa_params_t get_params_t() const;
rsa_params & operator= (const rsa_params & src); rsa_params & operator=(const rsa_params & src);
protected: protected:
gnutls_rsa_params_t params; gnutls_rsa_params_t params;
}; };
class session:private noncopyable class session:private noncopyable {
{ protected:
protected: gnutls_session_t s;
gnutls_session_t s; public:
public: session(unsigned int);
session (unsigned int); virtual ~ session();
virtual ~ session ();
int bye (gnutls_close_request_t how); int bye(gnutls_close_request_t how);
int handshake (); int handshake();
gnutls_alert_description_t get_alert () const; gnutls_alert_description_t get_alert() const;
int send_alert (gnutls_alert_level_t level, int send_alert(gnutls_alert_level_t level,
gnutls_alert_description_t desc); gnutls_alert_description_t desc);
int send_appropriate_alert (int err); int send_appropriate_alert(int err);
gnutls_cipher_algorithm_t get_cipher () const; gnutls_cipher_algorithm_t get_cipher() const;
gnutls_kx_algorithm_t get_kx () const; gnutls_kx_algorithm_t get_kx() const;
gnutls_mac_algorithm_t get_mac () const; gnutls_mac_algorithm_t get_mac() const;
gnutls_compression_method_t get_compression () const; gnutls_compression_method_t get_compression() const;
gnutls_certificate_type_t get_certificate_type () const; gnutls_certificate_type_t get_certificate_type() const;
// for the handshake // for the handshake
void set_private_extensions (bool allow); void set_private_extensions(bool allow);
gnutls_handshake_description_t get_handshake_last_out () const; gnutls_handshake_description_t get_handshake_last_out()
gnutls_handshake_description_t get_handshake_last_in () const; const;
gnutls_handshake_description_t get_handshake_last_in()
const;
ssize_t send (const void *data, size_t sizeofdata); ssize_t send(const void *data, size_t sizeofdata);
ssize_t recv (void *data, size_t sizeofdata); ssize_t recv(void *data, size_t sizeofdata);
bool get_record_direction () const; bool get_record_direction() const;
// maximum packet size // maximum packet size
size_t get_max_size () const; size_t get_max_size() const;
void set_max_size (size_t size); void set_max_size(size_t size);
size_t check_pending () const; size_t check_pending() const;
void prf (size_t label_size, const char *label, void prf(size_t label_size, const char *label,
int server_random_first, int server_random_first,
size_t extra_size, const char *extra, size_t extra_size, const char *extra,
size_t outsize, char *out); size_t outsize, char *out);
void prf_raw (size_t label_size, const char *label, void prf_raw(size_t label_size, const char *label,
size_t seed_size, const char *seed, size_t seed_size, const char *seed,
size_t outsize, char *out); size_t outsize, char *out);
/* if you just want some defaults, use the following. /* if you just want some defaults, use the following.
*/ */
void set_priority (const char *prio, const char **err_pos); void set_priority(const char *prio, const char **err_pos);
void set_priority (gnutls_priority_t p); void set_priority(gnutls_priority_t p);
gnutls_protocol_t get_protocol_version () const; gnutls_protocol_t get_protocol_version() const;
// for resuming sessions // for resuming sessions
void set_data (const void *session_data, size_t session_data_size); void set_data(const void *session_data,
void get_data (void *session_data, size_t * session_data_size) const; size_t session_data_size);
void get_data (gnutls_session_t session, gnutls_datum_t & data) const; void get_data(void *session_data,
void get_id (void *session_id, size_t * session_id_size) const; size_t * session_data_size) const;
void get_data(gnutls_session_t session,
gnutls_datum_t & data) const;
void get_id(void *session_id,
size_t * session_id_size) const;
bool is_resumed () const; bool is_resumed() const;
void set_max_handshake_packet_length (size_t max); void set_max_handshake_packet_length(size_t max);
void clear_credentials (); void clear_credentials();
void set_credentials (class credentials & cred); void set_credentials(class credentials & cred);
void set_transport_ptr (gnutls_transport_ptr_t ptr); void set_transport_ptr(gnutls_transport_ptr_t ptr);
void set_transport_ptr (gnutls_transport_ptr_t recv_ptr, void set_transport_ptr(gnutls_transport_ptr_t recv_ptr,
gnutls_transport_ptr_t send_ptr); gnutls_transport_ptr_t send_ptr);
gnutls_transport_ptr_t get_transport_ptr () const; gnutls_transport_ptr_t get_transport_ptr() const;
void get_transport_ptr (gnutls_transport_ptr_t & recv_ptr, void get_transport_ptr(gnutls_transport_ptr_t & recv_ptr,
gnutls_transport_ptr_t & send_ptr) const; gnutls_transport_ptr_t & send_ptr)
const;
void set_transport_lowat (size_t num); void set_transport_lowat(size_t num);
void set_transport_push_function (gnutls_push_func push_func); void set_transport_push_function(gnutls_push_func
void set_transport_vec_push_function (gnutls_vec_push_func vec_push_fun push_func);
c); void set_transport_vec_push_function(gnutls_vec_push_func
void set_transport_pull_function (gnutls_pull_func pull_func); vec_push_func);
void set_transport_pull_function(gnutls_pull_func
pull_func);
void set_user_ptr (void *ptr); void set_user_ptr(void *ptr);
void *get_user_ptr () const; void *get_user_ptr() const;
void send_openpgp_cert (gnutls_openpgp_crt_status_t status); void send_openpgp_cert(gnutls_openpgp_crt_status_t status);
gnutls_credentials_type_t get_auth_type () const; gnutls_credentials_type_t get_auth_type() const;
gnutls_credentials_type_t get_server_auth_type () const; gnutls_credentials_type_t get_server_auth_type() const;
gnutls_credentials_type_t get_client_auth_type () const; gnutls_credentials_type_t get_client_auth_type() const;
// informational stuff // informational stuff
void set_dh_prime_bits (unsigned int bits); void set_dh_prime_bits(unsigned int bits);
unsigned int get_dh_secret_bits () const; unsigned int get_dh_secret_bits() const;
unsigned int get_dh_peers_public_bits () const; unsigned int get_dh_peers_public_bits() const;
unsigned int get_dh_prime_bits () const; unsigned int get_dh_prime_bits() const;
void get_dh_group (gnutls_datum_t & gen, gnutls_datum_t & prime) const; void get_dh_group(gnutls_datum_t & gen,
void get_dh_pubkey (gnutls_datum_t & raw_key) const; gnutls_datum_t & prime) const;
void get_rsa_export_pubkey (gnutls_datum_t & exponent, void get_dh_pubkey(gnutls_datum_t & raw_key) const;
gnutls_datum_t & modulus) const; void get_rsa_export_pubkey(gnutls_datum_t & exponent,
unsigned int get_rsa_export_modulus_bits () const; gnutls_datum_t & modulus) const;
unsigned int get_rsa_export_modulus_bits() const;
void get_our_certificate (gnutls_datum_t & cert) const; void get_our_certificate(gnutls_datum_t & cert) const;
bool get_peers_certificate (std::vector < gnutls_datum_t > bool get_peers_certificate(std::vector < gnutls_datum_t >
&out_certs) const; &out_certs) const;
bool get_peers_certificate (const gnutls_datum_t ** certs, bool get_peers_certificate(const gnutls_datum_t ** certs,
unsigned int *certs_size) const; unsigned int *certs_size) const;
time_t get_peers_certificate_activation_time () const; time_t get_peers_certificate_activation_time() const;
time_t get_peers_certificate_expiration_time () const; time_t get_peers_certificate_expiration_time() const;
void verify_peers_certificate (unsigned int &status) const; void verify_peers_certificate(unsigned int &status) const;
}; };
// interface for databases // interface for databases
class DB:private noncopyable class DB:private noncopyable {
{ public:
public: virtual ~ DB() = 0;
virtual ~ DB () = 0; virtual bool store(const gnutls_datum_t & key,
virtual bool store (const gnutls_datum_t & key, const gnutls_datum_t & data) = 0;
const gnutls_datum_t & data) = 0; virtual bool retrieve(const gnutls_datum_t & key,
virtual bool retrieve (const gnutls_datum_t & key, gnutls_datum_t & data) = 0;
gnutls_datum_t & data) = 0; virtual bool remove(const gnutls_datum_t & key) = 0;
virtual bool remove (const gnutls_datum_t & key) = 0; };
};
class server_session:public session class server_session:public session {
{ public:
public: server_session();
server_session (); ~server_session();
~server_session (); void db_remove() const;
void db_remove () const;
void set_db_cache_expiration (unsigned int seconds); void set_db_cache_expiration(unsigned int seconds);
void set_db (const DB & db); void set_db(const DB & db);
// returns true if session is expired // returns true if session is expired
bool db_check_entry (gnutls_datum_t & session_data) const; bool db_check_entry(gnutls_datum_t & session_data) const;
// server side only // server side only
const char *get_srp_username () const; const char *get_srp_username() const;
const char *get_psk_username () const; const char *get_psk_username() const;
void get_server_name (void *data, size_t * data_length, void get_server_name(void *data, size_t * data_length,
unsigned int *type, unsigned int indx) const; unsigned int *type,
unsigned int indx) const;
int rehandshake (); int rehandshake();
void set_certificate_request (gnutls_certificate_request_t); void set_certificate_request(gnutls_certificate_request_t);
}; };
class client_session:public session class client_session:public session {
{ public:
public: client_session();
client_session (); ~client_session();
~client_session ();
void set_server_name (gnutls_server_name_type_t type, void set_server_name(gnutls_server_name_type_t type,
const void *name, size_t name_length); const void *name, size_t name_length);
bool get_request_status (); bool get_request_status();
}; };
class credentials:private noncopyable class credentials:private noncopyable {
{ public:
public: virtual ~ credentials() {
virtual ~ credentials () } gnutls_credentials_type_t get_type() const;
{ protected:
} friend class session;
gnutls_credentials_type_t get_type () const; credentials(gnutls_credentials_type_t t);
protected: void *ptr() const;
friend class session; void set_ptr(void *ptr);
credentials (gnutls_credentials_type_t t); gnutls_credentials_type_t type;
void *ptr () const; private:
void set_ptr (void *ptr); void *cred;
gnutls_credentials_type_t type; };
private:
void *cred;
};
class certificate_credentials:public credentials class certificate_credentials:public credentials {
{ public:
public: ~certificate_credentials();
~certificate_credentials (); certificate_credentials();
certificate_credentials ();
void free_keys (); void free_keys();
void free_cas (); void free_cas();
void free_ca_names (); void free_ca_names();
void free_crls (); void free_crls();
void set_dh_params (const dh_params & params); void set_dh_params(const dh_params & params);
void set_rsa_export_params (const rsa_params & params); void set_rsa_export_params(const rsa_params & params);
void set_verify_flags (unsigned int flags); void set_verify_flags(unsigned int flags);
void set_verify_limits (unsigned int max_bits, unsigned int max_depth); void set_verify_limits(unsigned int max_bits,
unsigned int max_depth);
void set_x509_trust_file (const char *cafile, gnutls_x509_crt_fmt_t typ void set_x509_trust_file(const char *cafile,
e); gnutls_x509_crt_fmt_t type);
void set_x509_trust (const gnutls_datum_t & CA, void set_x509_trust(const gnutls_datum_t & CA,
gnutls_x509_crt_fmt_t type); gnutls_x509_crt_fmt_t type);
// FIXME: use classes instead of gnutls_x509_crt_t // FIXME: use classes instead of gnutls_x509_crt_t
void set_x509_trust (gnutls_x509_crt_t * ca_list, int ca_list_size); void set_x509_trust(gnutls_x509_crt_t * ca_list,
int ca_list_size);
void set_x509_crl_file (const char *crlfile, gnutls_x509_crt_fmt_t type void set_x509_crl_file(const char *crlfile,
); gnutls_x509_crt_fmt_t type);
void set_x509_crl (const gnutls_datum_t & CRL, void set_x509_crl(const gnutls_datum_t & CRL,
gnutls_x509_crt_fmt_t type); gnutls_x509_crt_fmt_t type);
void set_x509_crl (gnutls_x509_crl_t * crl_list, int crl_list_size); void set_x509_crl(gnutls_x509_crl_t * crl_list,
int crl_list_size);
void set_x509_key_file (const char *certfile, const char *KEYFILE, void set_x509_key_file(const char *certfile,
gnutls_x509_crt_fmt_t type); const char *KEYFILE,
void set_x509_key (const gnutls_datum_t & CERT, gnutls_x509_crt_fmt_t type);
const gnutls_datum_t & KEY, void set_x509_key(const gnutls_datum_t & CERT,
gnutls_x509_crt_fmt_t type); const gnutls_datum_t & KEY,
// FIXME: use classes gnutls_x509_crt_fmt_t type);
void set_x509_key (gnutls_x509_crt_t * cert_list, int cert_list_size, // FIXME: use classes
gnutls_x509_privkey_t key); void set_x509_key(gnutls_x509_crt_t * cert_list,
int cert_list_size,
gnutls_x509_privkey_t key);
void set_simple_pkcs12_file (const char *pkcs12file, void set_simple_pkcs12_file(const char *pkcs12file,
gnutls_x509_crt_fmt_t type, gnutls_x509_crt_fmt_t type,
const char *password); const char *password);
void set_retrieve_function (gnutls_certificate_retrieve_function * func void set_retrieve_function
); (gnutls_certificate_retrieve_function * func);
protected: protected:
gnutls_certificate_credentials_t cred; gnutls_certificate_credentials_t cred;
}; };
class certificate_server_credentials:public certificate_credentials class certificate_server_credentials:public certificate_credentials
{ {
public: public:
void set_params_function (gnutls_params_function * func); void set_params_function(gnutls_params_function * func);
}; };
class certificate_client_credentials:public certificate_credentials class certificate_client_credentials:public certificate_credentials
{ {
public: public:
}; };
class anon_server_credentials:public credentials class anon_server_credentials:public credentials {
{ public:
public: anon_server_credentials();
anon_server_credentials (); ~anon_server_credentials();
~anon_server_credentials (); void set_dh_params(const dh_params & params);
void set_dh_params (const dh_params & params); void set_params_function(gnutls_params_function * func);
void set_params_function (gnutls_params_function * func); protected:
protected: gnutls_anon_server_credentials_t cred;
gnutls_anon_server_credentials_t cred; };
};
class anon_client_credentials:public credentials class anon_client_credentials:public credentials {
{ public:
public: anon_client_credentials();
anon_client_credentials (); ~anon_client_credentials();
~anon_client_credentials (); protected:
protected: gnutls_anon_client_credentials_t cred;
gnutls_anon_client_credentials_t cred; };
};
class srp_server_credentials:public credentials class srp_server_credentials:public credentials {
{ public:
public: srp_server_credentials();
srp_server_credentials (); ~srp_server_credentials();
~srp_server_credentials (); void set_credentials_file(const char *password_file,
void set_credentials_file (const char *password_file, const char *password_conf_file);
const char *password_conf_file); void set_credentials_function
void set_credentials_function (gnutls_srp_server_credentials_function * (gnutls_srp_server_credentials_function * func);
func); protected:
protected: gnutls_srp_server_credentials_t cred;
gnutls_srp_server_credentials_t cred; };
};
class srp_client_credentials:public credentials class srp_client_credentials:public credentials {
{ public:
public: srp_client_credentials();
srp_client_credentials (); ~srp_client_credentials();
~srp_client_credentials (); void set_credentials(const char *username,
void set_credentials (const char *username, const char *password); const char *password);
void set_credentials_function (gnutls_srp_client_credentials_function * void set_credentials_function
func); (gnutls_srp_client_credentials_function * func);
protected: protected:
gnutls_srp_client_credentials_t cred; gnutls_srp_client_credentials_t cred;
}; };
class psk_server_credentials:public credentials class psk_server_credentials:public credentials {
{ public:
public: psk_server_credentials();
psk_server_credentials (); ~psk_server_credentials();
~psk_server_credentials (); void set_credentials_file(const char *password_file);
void set_credentials_file (const char *password_file); void set_credentials_function
void set_credentials_function (gnutls_psk_server_credentials_function * (gnutls_psk_server_credentials_function * func);
func); void set_dh_params(const dh_params & params);
void set_dh_params (const dh_params & params); void set_params_function(gnutls_params_function * func);
void set_params_function (gnutls_params_function * func); protected:
protected: gnutls_psk_server_credentials_t cred;
gnutls_psk_server_credentials_t cred; };
};
class psk_client_credentials:public credentials class psk_client_credentials:public credentials {
{ public:
public: psk_client_credentials();
psk_client_credentials (); ~psk_client_credentials();
~psk_client_credentials (); void set_credentials(const char *username,
void set_credentials (const char *username, const gnutls_datum_t & key, const gnutls_datum_t & key,
gnutls_psk_key_flags flags); gnutls_psk_key_flags flags);
void set_credentials_function (gnutls_psk_client_credentials_function * void set_credentials_function
func); (gnutls_psk_client_credentials_function * func);
protected: protected:
gnutls_psk_client_credentials_t cred; gnutls_psk_client_credentials_t cred;
}; };
} /* namespace */ } /* namespace */
#endif /* GNUTLSXX_H */ #endif /* GNUTLSXX_H */
 End of changes. 67 change blocks. 
324 lines changed or deleted 320 lines changed or added


 ocsp.h (3.2.6)   ocsp.h (3.2.7) 
skipping to change at line 32 skipping to change at line 32
/* Online Certificate Status Protocol - RFC 2560 /* Online Certificate Status Protocol - RFC 2560
*/ */
#ifndef GNUTLS_OCSP_H #ifndef GNUTLS_OCSP_H
#define GNUTLS_OCSP_H #define GNUTLS_OCSP_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
#define GNUTLS_OCSP_NONCE "1.3.6.1.5.5.7.48.1.2" #define GNUTLS_OCSP_NONCE "1.3.6.1.5.5.7.48.1.2"
/** /**
* gnutls_ocsp_print_formats_t: * gnutls_ocsp_print_formats_t:
* @GNUTLS_OCSP_PRINT_FULL: Full information about OCSP request/response. * @GNUTLS_OCSP_PRINT_FULL: Full information about OCSP request/response.
* @GNUTLS_OCSP_PRINT_COMPACT: More compact information about OCSP request/ response. * @GNUTLS_OCSP_PRINT_COMPACT: More compact information about OCSP request/ response.
* *
* Enumeration of different OCSP printing variants. * Enumeration of different OCSP printing variants.
*/ */
typedef enum gnutls_ocsp_print_formats_t typedef enum gnutls_ocsp_print_formats_t {
{ GNUTLS_OCSP_PRINT_FULL = 0,
GNUTLS_OCSP_PRINT_FULL = 0, GNUTLS_OCSP_PRINT_COMPACT = 1,
GNUTLS_OCSP_PRINT_COMPACT = 1, } gnutls_ocsp_print_formats_t;
} gnutls_ocsp_print_formats_t;
/** /**
* gnutls_ocsp_resp_status_t: * gnutls_ocsp_resp_status_t:
* @GNUTLS_OCSP_RESP_SUCCESSFUL: Response has valid confirmations. * @GNUTLS_OCSP_RESP_SUCCESSFUL: Response has valid confirmations.
* @GNUTLS_OCSP_RESP_MALFORMEDREQUEST: Illegal confirmation request * @GNUTLS_OCSP_RESP_MALFORMEDREQUEST: Illegal confirmation request
* @GNUTLS_OCSP_RESP_INTERNALERROR: Internal error in issuer * @GNUTLS_OCSP_RESP_INTERNALERROR: Internal error in issuer
* @GNUTLS_OCSP_RESP_TRYLATER: Try again later * @GNUTLS_OCSP_RESP_TRYLATER: Try again later
* @GNUTLS_OCSP_RESP_SIGREQUIRED: Must sign the request * @GNUTLS_OCSP_RESP_SIGREQUIRED: Must sign the request
* @GNUTLS_OCSP_RESP_UNAUTHORIZED: Request unauthorized * @GNUTLS_OCSP_RESP_UNAUTHORIZED: Request unauthorized
* *
* Enumeration of different OCSP response status codes. * Enumeration of different OCSP response status codes.
*/ */
typedef enum gnutls_ocsp_resp_status_t typedef enum gnutls_ocsp_resp_status_t {
{ GNUTLS_OCSP_RESP_SUCCESSFUL = 0,
GNUTLS_OCSP_RESP_SUCCESSFUL = 0, GNUTLS_OCSP_RESP_MALFORMEDREQUEST = 1,
GNUTLS_OCSP_RESP_MALFORMEDREQUEST = 1, GNUTLS_OCSP_RESP_INTERNALERROR = 2,
GNUTLS_OCSP_RESP_INTERNALERROR = 2, GNUTLS_OCSP_RESP_TRYLATER = 3,
GNUTLS_OCSP_RESP_TRYLATER = 3, GNUTLS_OCSP_RESP_SIGREQUIRED = 5,
GNUTLS_OCSP_RESP_SIGREQUIRED = 5, GNUTLS_OCSP_RESP_UNAUTHORIZED = 6
GNUTLS_OCSP_RESP_UNAUTHORIZED = 6 } gnutls_ocsp_resp_status_t;
} gnutls_ocsp_resp_status_t;
/** /**
* gnutls_ocsp_cert_status_t: * gnutls_ocsp_cert_status_t:
* @GNUTLS_OCSP_CERT_GOOD: Positive response to status inquiry. * @GNUTLS_OCSP_CERT_GOOD: Positive response to status inquiry.
* @GNUTLS_OCSP_CERT_REVOKED: Certificate has been revoked. * @GNUTLS_OCSP_CERT_REVOKED: Certificate has been revoked.
* @GNUTLS_OCSP_CERT_UNKNOWN: The responder doesn't know about the * @GNUTLS_OCSP_CERT_UNKNOWN: The responder doesn't know about the
* certificate. * certificate.
* *
* Enumeration of different OCSP response certificate status codes. * Enumeration of different OCSP response certificate status codes.
*/ */
typedef enum gnutls_ocsp_cert_status_t typedef enum gnutls_ocsp_cert_status_t {
{ GNUTLS_OCSP_CERT_GOOD = 0,
GNUTLS_OCSP_CERT_GOOD = 0, GNUTLS_OCSP_CERT_REVOKED = 1,
GNUTLS_OCSP_CERT_REVOKED = 1, GNUTLS_OCSP_CERT_UNKNOWN = 2
GNUTLS_OCSP_CERT_UNKNOWN = 2 } gnutls_ocsp_cert_status_t;
} gnutls_ocsp_cert_status_t;
/** /**
* gnutls_x509_crl_reason_t: * gnutls_x509_crl_reason_t:
* @GNUTLS_X509_CRLREASON_UNSPECIFIED: Unspecified reason. * @GNUTLS_X509_CRLREASON_UNSPECIFIED: Unspecified reason.
* @GNUTLS_X509_CRLREASON_KEYCOMPROMISE: Private key compromised. * @GNUTLS_X509_CRLREASON_KEYCOMPROMISE: Private key compromised.
* @GNUTLS_X509_CRLREASON_CACOMPROMISE: CA compromised. * @GNUTLS_X509_CRLREASON_CACOMPROMISE: CA compromised.
* @GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED: Affiliation has changed. * @GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED: Affiliation has changed.
* @GNUTLS_X509_CRLREASON_SUPERSEDED: Certificate superseded. * @GNUTLS_X509_CRLREASON_SUPERSEDED: Certificate superseded.
* @GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION: Operation has ceased. * @GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION: Operation has ceased.
* @GNUTLS_X509_CRLREASON_CERTIFICATEHOLD: Certificate is on hold. * @GNUTLS_X509_CRLREASON_CERTIFICATEHOLD: Certificate is on hold.
* @GNUTLS_X509_CRLREASON_REMOVEFROMCRL: Will be removed from delta CRL. * @GNUTLS_X509_CRLREASON_REMOVEFROMCRL: Will be removed from delta CRL.
* @GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN: Privilege withdrawn. * @GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN: Privilege withdrawn.
* @GNUTLS_X509_CRLREASON_AACOMPROMISE: AA compromised. * @GNUTLS_X509_CRLREASON_AACOMPROMISE: AA compromised.
* *
* Enumeration of different reason codes. Note that this * Enumeration of different reason codes. Note that this
* corresponds to the CRLReason ASN.1 enumeration type, and not the * corresponds to the CRLReason ASN.1 enumeration type, and not the
* ReasonFlags ASN.1 bit string. * ReasonFlags ASN.1 bit string.
*/ */
typedef enum gnutls_x509_crl_reason_t typedef enum gnutls_x509_crl_reason_t {
{ GNUTLS_X509_CRLREASON_UNSPECIFIED = 0,
GNUTLS_X509_CRLREASON_UNSPECIFIED = 0, GNUTLS_X509_CRLREASON_KEYCOMPROMISE = 1,
GNUTLS_X509_CRLREASON_KEYCOMPROMISE = 1, GNUTLS_X509_CRLREASON_CACOMPROMISE = 2,
GNUTLS_X509_CRLREASON_CACOMPROMISE = 2, GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED = 3,
GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED = 3, GNUTLS_X509_CRLREASON_SUPERSEDED = 4,
GNUTLS_X509_CRLREASON_SUPERSEDED = 4, GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION = 5,
GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION = 5, GNUTLS_X509_CRLREASON_CERTIFICATEHOLD = 6,
GNUTLS_X509_CRLREASON_CERTIFICATEHOLD = 6, GNUTLS_X509_CRLREASON_REMOVEFROMCRL = 8,
GNUTLS_X509_CRLREASON_REMOVEFROMCRL = 8, GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN = 9,
GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN = 9, GNUTLS_X509_CRLREASON_AACOMPROMISE = 10
GNUTLS_X509_CRLREASON_AACOMPROMISE = 10 } gnutls_x509_crl_reason_t;
} gnutls_x509_crl_reason_t;
/** /**
* gnutls_ocsp_verify_reason_t: * gnutls_ocsp_verify_reason_t:
* @GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND: Signer cert not found. * @GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND: Signer cert not found.
* @GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR: Signer keyusage bits incorrec t. * @GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR: Signer keyusage bits incorrec t.
* @GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER: Signer is not trusted. * @GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER: Signer is not trusted.
* @GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM: Signature using insecure algorit hm. * @GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM: Signature using insecure algorit hm.
* @GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE: Signature mismatch. * @GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE: Signature mismatch.
* @GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED: Signer cert is not yet activated . * @GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED: Signer cert is not yet activated .
* @GNUTLS_OCSP_VERIFY_CERT_EXPIRED: Signer cert has expired. * @GNUTLS_OCSP_VERIFY_CERT_EXPIRED: Signer cert has expired.
* *
* Enumeration of OCSP verify status codes, used by * Enumeration of OCSP verify status codes, used by
* gnutls_ocsp_resp_verify() and gnutls_ocsp_resp_verify_direct(). * gnutls_ocsp_resp_verify() and gnutls_ocsp_resp_verify_direct().
*/ */
typedef enum gnutls_ocsp_verify_reason_t typedef enum gnutls_ocsp_verify_reason_t {
{ GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND = 1,
GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND = 1, GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR = 2,
GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR = 2, GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER = 4,
GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER = 4, GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM = 8,
GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM = 8, GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE = 16,
GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE = 16, GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED = 32,
GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED = 32, GNUTLS_OCSP_VERIFY_CERT_EXPIRED = 64
GNUTLS_OCSP_VERIFY_CERT_EXPIRED = 64 } gnutls_ocsp_verify_reason_t;
} gnutls_ocsp_verify_reason_t;
struct gnutls_ocsp_req_int; struct gnutls_ocsp_req_int;
typedef struct gnutls_ocsp_req_int *gnutls_ocsp_req_t; typedef struct gnutls_ocsp_req_int *gnutls_ocsp_req_t;
int gnutls_ocsp_req_init (gnutls_ocsp_req_t * req); int gnutls_ocsp_req_init(gnutls_ocsp_req_t * req);
void gnutls_ocsp_req_deinit (gnutls_ocsp_req_t req); void gnutls_ocsp_req_deinit(gnutls_ocsp_req_t req);
int gnutls_ocsp_req_import (gnutls_ocsp_req_t req, int gnutls_ocsp_req_import(gnutls_ocsp_req_t req,
const gnutls_datum_t * data); const gnutls_datum_t * data);
int gnutls_ocsp_req_export (gnutls_ocsp_req_t req, gnutls_datum_t * data) int gnutls_ocsp_req_export(gnutls_ocsp_req_t req, gnutls_datum_t * data);
; int gnutls_ocsp_req_print(gnutls_ocsp_req_t req,
int gnutls_ocsp_req_print (gnutls_ocsp_req_t req, gnutls_ocsp_print_formats_t format,
gnutls_ocsp_print_formats_t format, gnutls_datum_t * out);
gnutls_datum_t * out);
int gnutls_ocsp_req_get_version (gnutls_ocsp_req_t req); int gnutls_ocsp_req_get_version(gnutls_ocsp_req_t req);
int gnutls_ocsp_req_get_cert_id (gnutls_ocsp_req_t req, int gnutls_ocsp_req_get_cert_id(gnutls_ocsp_req_t req,
unsigned indx, unsigned indx,
gnutls_digest_algorithm_t *digest, gnutls_digest_algorithm_t * digest,
gnutls_datum_t *issuer_name_hash, gnutls_datum_t * issuer_name_hash,
gnutls_datum_t *issuer_key_hash, gnutls_datum_t * issuer_key_hash,
gnutls_datum_t *serial_number); gnutls_datum_t * serial_number);
int gnutls_ocsp_req_add_cert_id (gnutls_ocsp_req_t req, int gnutls_ocsp_req_add_cert_id(gnutls_ocsp_req_t req,
gnutls_digest_algorithm_t digest,
const gnutls_datum_t *issuer_name_hash,
const gnutls_datum_t *issuer_key_hash,
const gnutls_datum_t *serial_number);
int gnutls_ocsp_req_add_cert (gnutls_ocsp_req_t req,
gnutls_digest_algorithm_t digest, gnutls_digest_algorithm_t digest,
gnutls_x509_crt_t issuer, const gnutls_datum_t *
gnutls_x509_crt_t cert); issuer_name_hash,
const gnutls_datum_t *
issuer_key_hash,
const gnutls_datum_t * serial_number);
int gnutls_ocsp_req_add_cert(gnutls_ocsp_req_t req,
gnutls_digest_algorithm_t digest,
gnutls_x509_crt_t issuer,
gnutls_x509_crt_t cert);
int gnutls_ocsp_req_get_extension (gnutls_ocsp_req_t req, int gnutls_ocsp_req_get_extension(gnutls_ocsp_req_t req,
unsigned indx, unsigned indx,
gnutls_datum_t *oid, gnutls_datum_t * oid,
unsigned int *critical, unsigned int *critical,
gnutls_datum_t *data); gnutls_datum_t * data);
int gnutls_ocsp_req_set_extension (gnutls_ocsp_req_t req, int gnutls_ocsp_req_set_extension(gnutls_ocsp_req_t req,
const char *oid, const char *oid,
unsigned int critical, unsigned int critical,
const gnutls_datum_t *data); const gnutls_datum_t * data);
int gnutls_ocsp_req_get_nonce (gnutls_ocsp_req_t req, int gnutls_ocsp_req_get_nonce(gnutls_ocsp_req_t req,
unsigned int *critical, unsigned int *critical,
gnutls_datum_t *nonce); gnutls_datum_t * nonce);
int gnutls_ocsp_req_set_nonce (gnutls_ocsp_req_t req, int gnutls_ocsp_req_set_nonce(gnutls_ocsp_req_t req,
unsigned int critical, unsigned int critical,
const gnutls_datum_t *nonce); const gnutls_datum_t * nonce);
int gnutls_ocsp_req_randomize_nonce (gnutls_ocsp_req_t req); int gnutls_ocsp_req_randomize_nonce(gnutls_ocsp_req_t req);
struct gnutls_ocsp_resp_int; struct gnutls_ocsp_resp_int;
typedef struct gnutls_ocsp_resp_int *gnutls_ocsp_resp_t; typedef struct gnutls_ocsp_resp_int *gnutls_ocsp_resp_t;
int gnutls_ocsp_resp_init (gnutls_ocsp_resp_t * resp); int gnutls_ocsp_resp_init(gnutls_ocsp_resp_t * resp);
void gnutls_ocsp_resp_deinit (gnutls_ocsp_resp_t resp); void gnutls_ocsp_resp_deinit(gnutls_ocsp_resp_t resp);
int gnutls_ocsp_resp_import (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_import(gnutls_ocsp_resp_t resp,
const gnutls_datum_t * data); const gnutls_datum_t * data);
int gnutls_ocsp_resp_export (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_export(gnutls_ocsp_resp_t resp,
gnutls_datum_t * data); gnutls_datum_t * data);
int gnutls_ocsp_resp_print (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_print(gnutls_ocsp_resp_t resp,
gnutls_ocsp_print_formats_t format, gnutls_ocsp_print_formats_t format,
gnutls_datum_t * out); gnutls_datum_t * out);
int gnutls_ocsp_resp_get_status (gnutls_ocsp_resp_t resp); int gnutls_ocsp_resp_get_status(gnutls_ocsp_resp_t resp);
int gnutls_ocsp_resp_get_response (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_get_response(gnutls_ocsp_resp_t resp,
gnutls_datum_t *response_type_oid, gnutls_datum_t *
gnutls_datum_t *response); response_type_oid,
gnutls_datum_t * response);
int gnutls_ocsp_resp_get_version (gnutls_ocsp_resp_t resp); int gnutls_ocsp_resp_get_version(gnutls_ocsp_resp_t resp);
int gnutls_ocsp_resp_get_responder (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_get_responder(gnutls_ocsp_resp_t resp,
gnutls_datum_t *dn); gnutls_datum_t * dn);
time_t gnutls_ocsp_resp_get_produced (gnutls_ocsp_resp_t resp); time_t gnutls_ocsp_resp_get_produced(gnutls_ocsp_resp_t resp);
int gnutls_ocsp_resp_get_single (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_get_single(gnutls_ocsp_resp_t resp,
unsigned indx,
gnutls_digest_algorithm_t * digest,
gnutls_datum_t * issuer_name_hash,
gnutls_datum_t * issuer_key_hash,
gnutls_datum_t * serial_number,
unsigned int *cert_status,
time_t * this_update,
time_t * next_update,
time_t * revocation_time,
unsigned int *revocation_reason);
int gnutls_ocsp_resp_get_extension(gnutls_ocsp_resp_t resp,
unsigned indx, unsigned indx,
gnutls_digest_algorithm_t *digest, gnutls_datum_t * oid,
gnutls_datum_t *issuer_name_hash, unsigned int *critical,
gnutls_datum_t *issuer_key_hash, gnutls_datum_t * data);
gnutls_datum_t *serial_number, int gnutls_ocsp_resp_get_nonce(gnutls_ocsp_resp_t resp,
unsigned int *cert_status, unsigned int *critical,
time_t *this_update, gnutls_datum_t * nonce);
time_t *next_update, int gnutls_ocsp_resp_get_signature_algorithm(gnutls_ocsp_resp_t resp);
time_t *revocation_time, int gnutls_ocsp_resp_get_signature(gnutls_ocsp_resp_t resp,
unsigned int *revocation_reason); gnutls_datum_t * sig);
int gnutls_ocsp_resp_get_extension (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_get_certs(gnutls_ocsp_resp_t resp,
unsigned indx, gnutls_x509_crt_t ** certs,
gnutls_datum_t *oid, size_t * ncerts);
unsigned int *critical,
gnutls_datum_t *data);
int gnutls_ocsp_resp_get_nonce (gnutls_ocsp_resp_t resp,
unsigned int *critical,
gnutls_datum_t *nonce);
int gnutls_ocsp_resp_get_signature_algorithm (gnutls_ocsp_resp_t resp);
int gnutls_ocsp_resp_get_signature (gnutls_ocsp_resp_t resp,
gnutls_datum_t *sig);
int gnutls_ocsp_resp_get_certs (gnutls_ocsp_resp_t resp,
gnutls_x509_crt_t ** certs,
size_t *ncerts);
int gnutls_ocsp_resp_verify_direct (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_verify_direct(gnutls_ocsp_resp_t resp,
gnutls_x509_crt_t issuer, gnutls_x509_crt_t issuer,
unsigned int *verify, unsigned int *verify,
unsigned int flags); unsigned int flags);
int gnutls_ocsp_resp_verify (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_verify(gnutls_ocsp_resp_t resp,
gnutls_x509_trust_list_t trustlist, gnutls_x509_trust_list_t trustlist,
unsigned int *verify, unsigned int *verify, unsigned int flags);
unsigned int flags);
int gnutls_ocsp_resp_check_crt (gnutls_ocsp_resp_t resp, int gnutls_ocsp_resp_check_crt(gnutls_ocsp_resp_t resp,
unsigned int indx, unsigned int indx, gnutls_x509_crt_t crt);
gnutls_x509_crt_t crt);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* GNUTLS_OCSP_H */ #endif /* GNUTLS_OCSP_H */
 End of changes. 26 change blocks. 
141 lines changed or deleted 138 lines changed or added


 openpgp.h (3.2.6)   openpgp.h (3.2.7) 
skipping to change at line 33 skipping to change at line 33
/* This file contains the types and prototypes for the OpenPGP /* This file contains the types and prototypes for the OpenPGP
* key and private key parsing functions. * key and private key parsing functions.
*/ */
#ifndef GNUTLS_OPENPGP_H #ifndef GNUTLS_OPENPGP_H
#define GNUTLS_OPENPGP_H #define GNUTLS_OPENPGP_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <limits.h> #include <limits.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
/* Openpgp certificate stuff /* Openpgp certificate stuff
*/ */
/** /**
* gnutls_openpgp_crt_fmt_t: * gnutls_openpgp_crt_fmt_t:
* @GNUTLS_OPENPGP_FMT_RAW: OpenPGP certificate in raw format. * @GNUTLS_OPENPGP_FMT_RAW: OpenPGP certificate in raw format.
* @GNUTLS_OPENPGP_FMT_BASE64: OpenPGP certificate in base64 format. * @GNUTLS_OPENPGP_FMT_BASE64: OpenPGP certificate in base64 format.
* *
* Enumeration of different OpenPGP key formats. * Enumeration of different OpenPGP key formats.
*/ */
typedef enum gnutls_openpgp_crt_fmt typedef enum gnutls_openpgp_crt_fmt {
{ GNUTLS_OPENPGP_FMT_RAW,
GNUTLS_OPENPGP_FMT_RAW, GNUTLS_OPENPGP_FMT_BASE64
GNUTLS_OPENPGP_FMT_BASE64 } gnutls_openpgp_crt_fmt_t;
} gnutls_openpgp_crt_fmt_t;
#define GNUTLS_OPENPGP_KEYID_SIZE 8 #define GNUTLS_OPENPGP_KEYID_SIZE 8
#define GNUTLS_OPENPGP_V4_FINGERPRINT_SIZE 20 #define GNUTLS_OPENPGP_V4_FINGERPRINT_SIZE 20
typedef unsigned char gnutls_openpgp_keyid_t[GNUTLS_OPENPGP_KEYID_SIZE]; typedef unsigned char
gnutls_openpgp_keyid_t[GNUTLS_OPENPGP_KEYID_SIZE];
/* gnutls_openpgp_cert_t should be defined in gnutls.h /* gnutls_openpgp_cert_t should be defined in gnutls.h
*/ */
/* initializes the memory for gnutls_openpgp_crt_t struct */ /* initializes the memory for gnutls_openpgp_crt_t struct */
int gnutls_openpgp_crt_init (gnutls_openpgp_crt_t * key); int gnutls_openpgp_crt_init(gnutls_openpgp_crt_t * key);
/* frees all memory */ /* frees all memory */
void gnutls_openpgp_crt_deinit (gnutls_openpgp_crt_t key); void gnutls_openpgp_crt_deinit(gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_import (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_import(gnutls_openpgp_crt_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format); gnutls_openpgp_crt_fmt_t format);
int gnutls_openpgp_crt_export (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_export(gnutls_openpgp_crt_t key,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t format,
void *output_data, void *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_openpgp_crt_export2 (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_export2(gnutls_openpgp_crt_t key,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t format,
gnutls_datum_t * out); gnutls_datum_t * out);
int gnutls_openpgp_crt_print (gnutls_openpgp_crt_t cert, int gnutls_openpgp_crt_print(gnutls_openpgp_crt_t cert,
gnutls_certificate_print_formats_t format, gnutls_certificate_print_formats_t
gnutls_datum_t * out); format, gnutls_datum_t * out);
/* The key_usage flags are defined in gnutls.h. They are /* The key_usage flags are defined in gnutls.h. They are
* the GNUTLS_KEY_* definitions. * the GNUTLS_KEY_* definitions.
*/ */
#define GNUTLS_OPENPGP_MASTER_KEYID_IDX INT_MAX #define GNUTLS_OPENPGP_MASTER_KEYID_IDX INT_MAX
int gnutls_openpgp_crt_get_key_usage (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_get_key_usage(gnutls_openpgp_crt_t key,
unsigned int *key_usage); unsigned int *key_usage);
int gnutls_openpgp_crt_get_fingerprint (gnutls_openpgp_crt_t key, void *f int gnutls_openpgp_crt_get_fingerprint(gnutls_openpgp_crt_t key,
pr, void *fpr, size_t * fprlen);
size_t * fprlen); int gnutls_openpgp_crt_get_subkey_fingerprint(gnutls_openpgp_crt_t
int gnutls_openpgp_crt_get_subkey_fingerprint (gnutls_openpgp_crt_t key, key,
unsigned int idx, unsigned int idx,
void *fpr, size_t * fprlen void *fpr, size_t * fprlen);
);
int gnutls_openpgp_crt_get_name (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_get_name(gnutls_openpgp_crt_t key,
int idx, char *buf, size_t * sizeof_buf) int idx, char *buf, size_t * sizeof_buf);
;
gnutls_pk_algorithm_t gnutls_pk_algorithm_t
gnutls_openpgp_crt_get_pk_algorithm (gnutls_openpgp_crt_t key, gnutls_openpgp_crt_get_pk_algorithm(gnutls_openpgp_crt_t key,
unsigned int *bits); unsigned int *bits);
int gnutls_openpgp_crt_get_version (gnutls_openpgp_crt_t key); int gnutls_openpgp_crt_get_version(gnutls_openpgp_crt_t key);
time_t gnutls_openpgp_crt_get_creation_time (gnutls_openpgp_crt_t key); time_t gnutls_openpgp_crt_get_creation_time(gnutls_openpgp_crt_t key);
time_t gnutls_openpgp_crt_get_expiration_time (gnutls_openpgp_crt_t key); time_t gnutls_openpgp_crt_get_expiration_time(gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_key_id (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_get_key_id(gnutls_openpgp_crt_t key,
gnutls_openpgp_keyid_t keyid); gnutls_openpgp_keyid_t keyid);
int gnutls_openpgp_crt_check_hostname (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_check_hostname(gnutls_openpgp_crt_t key,
const char *hostname); const char *hostname);
int gnutls_openpgp_crt_get_revoked_status (gnutls_openpgp_crt_t key); int gnutls_openpgp_crt_get_revoked_status(gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_subkey_count (gnutls_openpgp_crt_t key); int gnutls_openpgp_crt_get_subkey_count(gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_subkey_idx (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_get_subkey_idx(gnutls_openpgp_crt_t key,
const gnutls_openpgp_keyid_t keyid const gnutls_openpgp_keyid_t keyid);
); int gnutls_openpgp_crt_get_subkey_revoked_status
int gnutls_openpgp_crt_get_subkey_revoked_status (gnutls_openpgp_crt_t ke (gnutls_openpgp_crt_t key, unsigned int idx);
y, gnutls_pk_algorithm_t
unsigned int idx); gnutls_openpgp_crt_get_subkey_pk_algorithm(gnutls_openpgp_crt_t
gnutls_pk_algorithm_t key,
gnutls_openpgp_crt_get_subkey_pk_algorithm (gnutls_openpgp_crt_t key, unsigned int idx,
unsigned int idx, unsigned int *bits);
unsigned int *bits); time_t
time_t gnutls_openpgp_crt_get_subkey_creation_time (gnutls_openpgp_crt_t gnutls_openpgp_crt_get_subkey_creation_time
key, unsigned int idx (gnutls_openpgp_crt_t key, unsigned int idx);
); time_t
time_t gnutls_openpgp_crt_get_subkey_expiration_time (gnutls_openpgp_crt_ gnutls_openpgp_crt_get_subkey_expiration_time
t (gnutls_openpgp_crt_t key, unsigned int idx);
key, int gnutls_openpgp_crt_get_subkey_id(gnutls_openpgp_crt_t key,
unsigned int idx); unsigned int idx,
int gnutls_openpgp_crt_get_subkey_id (gnutls_openpgp_crt_t key, gnutls_openpgp_keyid_t keyid);
unsigned int idx, int gnutls_openpgp_crt_get_subkey_usage(gnutls_openpgp_crt_t key,
gnutls_openpgp_keyid_t keyid); unsigned int idx,
int gnutls_openpgp_crt_get_subkey_usage (gnutls_openpgp_crt_t key, unsigned int *key_usage);
unsigned int idx,
unsigned int *key_usage);
int gnutls_openpgp_crt_get_subkey_pk_dsa_raw (gnutls_openpgp_crt_t crt, int gnutls_openpgp_crt_get_subkey_pk_dsa_raw(gnutls_openpgp_crt_t
unsigned int idx, crt, unsigned int idx,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * g,
gnutls_datum_t * y); gnutls_datum_t * y);
int gnutls_openpgp_crt_get_subkey_pk_rsa_raw (gnutls_openpgp_crt_t crt, int gnutls_openpgp_crt_get_subkey_pk_rsa_raw(gnutls_openpgp_crt_t
unsigned int idx, crt, unsigned int idx,
gnutls_datum_t * m, gnutls_datum_t * m,
gnutls_datum_t * e); gnutls_datum_t * e);
int gnutls_openpgp_crt_get_pk_dsa_raw (gnutls_openpgp_crt_t crt, int gnutls_openpgp_crt_get_pk_dsa_raw(gnutls_openpgp_crt_t crt,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * g,
gnutls_datum_t * y); gnutls_datum_t * y);
int gnutls_openpgp_crt_get_pk_rsa_raw (gnutls_openpgp_crt_t crt, int gnutls_openpgp_crt_get_pk_rsa_raw(gnutls_openpgp_crt_t crt,
gnutls_datum_t * m, gnutls_datum_t * m,
gnutls_datum_t * e); gnutls_datum_t * e);
int gnutls_openpgp_crt_get_preferred_key_id (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_get_preferred_key_id(gnutls_openpgp_crt_t
gnutls_openpgp_keyid_t keyid key,
); gnutls_openpgp_keyid_t keyid);
int int
gnutls_openpgp_crt_set_preferred_key_id (gnutls_openpgp_crt_t key, gnutls_openpgp_crt_set_preferred_key_id(gnutls_openpgp_crt_t key,
const gnutls_openpgp_keyid_t const
keyid); gnutls_openpgp_keyid_t keyid);
/* privkey stuff. /* privkey stuff.
*/ */
int gnutls_openpgp_privkey_init (gnutls_openpgp_privkey_t * key); int gnutls_openpgp_privkey_init(gnutls_openpgp_privkey_t * key);
void gnutls_openpgp_privkey_deinit (gnutls_openpgp_privkey_t key); void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey_t key);
gnutls_pk_algorithm_t gnutls_pk_algorithm_t
gnutls_openpgp_privkey_get_pk_algorithm (gnutls_openpgp_privkey_t key, gnutls_openpgp_privkey_get_pk_algorithm
unsigned int *bits); (gnutls_openpgp_privkey_t key, unsigned int *bits);
gnutls_sec_param_t gnutls_sec_param_t
gnutls_openpgp_privkey_sec_param (gnutls_openpgp_privkey_t key); gnutls_openpgp_privkey_sec_param(gnutls_openpgp_privkey_t key);
int gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_import(gnutls_openpgp_privkey_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags); unsigned int flags);
int gnutls_openpgp_privkey_get_fingerprint (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_get_fingerprint(gnutls_openpgp_privkey_t
void *fpr, size_t * fprlen); key, void *fpr,
int gnutls_openpgp_privkey_get_subkey_fingerprint (gnutls_openpgp_privkey size_t * fprlen);
_t int gnutls_openpgp_privkey_get_subkey_fingerprint
key, unsigned int idx, (gnutls_openpgp_privkey_t key, unsigned int idx, void *fpr,
void *fpr, size_t * fprlen);
size_t * fprlen); int gnutls_openpgp_privkey_get_key_id(gnutls_openpgp_privkey_t key,
int gnutls_openpgp_privkey_get_key_id (gnutls_openpgp_privkey_t key, gnutls_openpgp_keyid_t keyid);
gnutls_openpgp_keyid_t keyid); int gnutls_openpgp_privkey_get_subkey_count(gnutls_openpgp_privkey_t key);
int gnutls_openpgp_privkey_get_subkey_count (gnutls_openpgp_privkey_t key int gnutls_openpgp_privkey_get_subkey_idx(gnutls_openpgp_privkey_t
); key,
int gnutls_openpgp_privkey_get_subkey_idx (gnutls_openpgp_privkey_t key, const
const gnutls_openpgp_keyid_t gnutls_openpgp_keyid_t keyid);
keyid);
int int gnutls_openpgp_privkey_get_subkey_revoked_status
gnutls_openpgp_privkey_get_subkey_revoked_status (gnutls_openpgp_privke (gnutls_openpgp_privkey_t key, unsigned int idx);
y_t
key, unsigned int idx
);
int gnutls_openpgp_privkey_get_revoked_status (gnutls_openpgp_privkey_t int gnutls_openpgp_privkey_get_revoked_status
key); (gnutls_openpgp_privkey_t key);
gnutls_pk_algorithm_t gnutls_pk_algorithm_t
gnutls_openpgp_privkey_get_subkey_pk_algorithm (gnutls_openpgp_privkey_ gnutls_openpgp_privkey_get_subkey_pk_algorithm
t (gnutls_openpgp_privkey_t key, unsigned int idx, unsigned int *bits);
key, unsigned int idx,
unsigned int *bits);
time_t time_t
gnutls_openpgp_privkey_get_subkey_expiration_time gnutls_openpgp_privkey_get_subkey_expiration_time
(gnutls_openpgp_privkey_t key, unsigned int idx); (gnutls_openpgp_privkey_t key, unsigned int idx);
int gnutls_openpgp_privkey_get_subkey_id (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_get_subkey_id(gnutls_openpgp_privkey_t
unsigned int idx, key, unsigned int idx,
gnutls_openpgp_keyid_t keyid); gnutls_openpgp_keyid_t keyid);
time_t time_t
gnutls_openpgp_privkey_get_subkey_creation_time (gnutls_openpgp_privkey gnutls_openpgp_privkey_get_subkey_creation_time
_t (gnutls_openpgp_privkey_t key, unsigned int idx);
key, unsigned int idx)
;
int int gnutls_openpgp_privkey_export_subkey_dsa_raw
gnutls_openpgp_privkey_export_subkey_dsa_raw (gnutls_openpgp_privkey_t (gnutls_openpgp_privkey_t pkey, unsigned int idx,
pkey, unsigned int idx, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g,
gnutls_datum_t * p, gnutls_datum_t * y, gnutls_datum_t * x);
gnutls_datum_t * q, int gnutls_openpgp_privkey_export_subkey_rsa_raw
gnutls_datum_t * g, (gnutls_openpgp_privkey_t pkey, unsigned int idx,
gnutls_datum_t * y, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d,
gnutls_datum_t * x); gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u);
int gnutls_openpgp_privkey_export_subkey_rsa_raw (gnutls_openpgp_privkey_
t
pkey, unsigned int idx,
gnutls_datum_t * m,
gnutls_datum_t * e,
gnutls_datum_t * d,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * u);
int gnutls_openpgp_privkey_export_dsa_raw (gnutls_openpgp_privkey_t pkey, int gnutls_openpgp_privkey_export_dsa_raw(gnutls_openpgp_privkey_t
gnutls_datum_t * p, pkey, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * g,
gnutls_datum_t * y, gnutls_datum_t * y,
gnutls_datum_t * x); gnutls_datum_t * x);
int gnutls_openpgp_privkey_export_rsa_raw (gnutls_openpgp_privkey_t pkey, int gnutls_openpgp_privkey_export_rsa_raw(gnutls_openpgp_privkey_t
gnutls_datum_t * m, pkey, gnutls_datum_t * m,
gnutls_datum_t * e, gnutls_datum_t * e,
gnutls_datum_t * d, gnutls_datum_t * d,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * u); gnutls_datum_t * u);
int gnutls_openpgp_privkey_export (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_export(gnutls_openpgp_privkey_t key,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags, unsigned int flags,
void *output_data, void *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_openpgp_privkey_export2 (gnutls_openpgp_privkey_t key, int gnutls_openpgp_privkey_export2(gnutls_openpgp_privkey_t key,
gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags, unsigned int flags,
gnutls_datum_t * out); gnutls_datum_t * out);
int int gnutls_openpgp_privkey_set_preferred_key_id
gnutls_openpgp_privkey_set_preferred_key_id (gnutls_openpgp_privkey_t k (gnutls_openpgp_privkey_t key, const gnutls_openpgp_keyid_t keyid);
ey, int gnutls_openpgp_privkey_get_preferred_key_id
const gnutls_openpgp_keyid (gnutls_openpgp_privkey_t key, gnutls_openpgp_keyid_t keyid);
_t
keyid);
int gnutls_openpgp_privkey_get_preferred_key_id (gnutls_openpgp_privkey_t
key,
gnutls_openpgp_keyid_t
keyid);
int gnutls_openpgp_crt_get_auth_subkey (gnutls_openpgp_crt_t crt, int gnutls_openpgp_crt_get_auth_subkey(gnutls_openpgp_crt_t crt,
gnutls_openpgp_keyid_t keyid, gnutls_openpgp_keyid_t
unsigned int flag); keyid, unsigned int flag);
/* Keyring stuff. /* Keyring stuff.
*/ */
int gnutls_openpgp_keyring_init (gnutls_openpgp_keyring_t * keyring); int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring_t * keyring);
void gnutls_openpgp_keyring_deinit (gnutls_openpgp_keyring_t keyring); void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring_t keyring);
int gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t keyring, int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring_t keyring,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format); gnutls_openpgp_crt_fmt_t format);
int gnutls_openpgp_keyring_check_id (gnutls_openpgp_keyring_t ring, int gnutls_openpgp_keyring_check_id(gnutls_openpgp_keyring_t ring,
const gnutls_openpgp_keyid_t keyid, const gnutls_openpgp_keyid_t
unsigned int flags); keyid, unsigned int flags);
int gnutls_openpgp_crt_verify_ring (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_verify_ring(gnutls_openpgp_crt_t key,
gnutls_openpgp_keyring_t keyring, gnutls_openpgp_keyring_t
unsigned int flags, unsigned int *ver keyring, unsigned int flags,
ify unsigned int *verify
/* the output of the verification */ /* the output of the verification */
); );
int gnutls_openpgp_crt_verify_self (gnutls_openpgp_crt_t key, int gnutls_openpgp_crt_verify_self(gnutls_openpgp_crt_t key,
unsigned int flags, unsigned int flags,
unsigned int *verify); unsigned int *verify);
int gnutls_openpgp_keyring_get_crt (gnutls_openpgp_keyring_t ring, int gnutls_openpgp_keyring_get_crt(gnutls_openpgp_keyring_t ring,
unsigned int idx, unsigned int idx,
gnutls_openpgp_crt_t * cert); gnutls_openpgp_crt_t * cert);
int gnutls_openpgp_keyring_get_crt_count (gnutls_openpgp_keyring_t ring); int gnutls_openpgp_keyring_get_crt_count(gnutls_openpgp_keyring_t ring);
/** /**
* gnutls_openpgp_recv_key_func: * gnutls_openpgp_recv_key_func:
* @session: a TLS session * @session: a TLS session
* @keyfpr: key fingerprint * @keyfpr: key fingerprint
* @keyfpr_length: length of key fingerprint * @keyfpr_length: length of key fingerprint
* @key: output key. * @key: output key.
* *
* A callback of this type is used to retrieve OpenPGP keys. Only * A callback of this type is used to retrieve OpenPGP keys. Only
* useful on the server, and will only be used if the peer send a key * useful on the server, and will only be used if the peer send a key
* fingerprint instead of a full key. See also * fingerprint instead of a full key. See also
* gnutls_openpgp_set_recv_key_function(). * gnutls_openpgp_set_recv_key_function().
* *
* The variable @key must be allocated using gnutls_malloc(). * The variable @key must be allocated using gnutls_malloc().
* *
* Returns: On success, %GNUTLS_E_SUCCESS (zero) is returned, * Returns: On success, %GNUTLS_E_SUCCESS (zero) is returned,
* otherwise an error code is returned. * otherwise an error code is returned.
*/ */
typedef int (*gnutls_openpgp_recv_key_func) (gnutls_session_t session, typedef int (*gnutls_openpgp_recv_key_func) (gnutls_session_t
const unsigned char *keyfpr, session,
unsigned int keyfpr_length, const unsigned char
gnutls_datum_t * key); *keyfpr,
unsigned int
keyfpr_length,
gnutls_datum_t * key);
void void
gnutls_openpgp_set_recv_key_function (gnutls_session_t session, gnutls_openpgp_set_recv_key_function(gnutls_session_t session,
gnutls_openpgp_recv_key_func func gnutls_openpgp_recv_key_func func);
);
/* certificate authentication stuff. /* certificate authentication stuff.
*/ */
int gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t int gnutls_certificate_set_openpgp_key
res, (gnutls_certificate_credentials_t res,
gnutls_openpgp_crt_t crt, gnutls_openpgp_crt_t crt, gnutls_openpgp_privkey_t pkey);
gnutls_openpgp_privkey_t pkey);
int int
gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials gnutls_certificate_set_openpgp_key_file
_t (gnutls_certificate_credentials_t res, const char *certfile,
res, const char *certfile, const char *keyfile, gnutls_openpgp_crt_fmt_t format);
const char *keyfile, int gnutls_certificate_set_openpgp_key_mem
gnutls_openpgp_crt_fmt_t forma (gnutls_certificate_credentials_t res,
t); const gnutls_datum_t * cert, const gnutls_datum_t * key,
int gnutls_certificate_set_openpgp_key_mem (gnutls_certificate_credential gnutls_openpgp_crt_fmt_t format);
s_t
res,
const gnutls_datum_t * cert,
const gnutls_datum_t * key,
gnutls_openpgp_crt_fmt_t
format);
int int
gnutls_certificate_set_openpgp_key_file2 (gnutls_certificate_credential gnutls_certificate_set_openpgp_key_file2
s_t (gnutls_certificate_credentials_t res, const char *certfile,
res, const char *certfile, const char *keyfile, const char *subkey_id,
const char *keyfile, gnutls_openpgp_crt_fmt_t format);
const char *subkey_id, int
gnutls_openpgp_crt_fmt_t gnutls_certificate_set_openpgp_key_mem2
format); (gnutls_certificate_credentials_t res,
int const gnutls_datum_t * cert, const gnutls_datum_t * key,
gnutls_certificate_set_openpgp_key_mem2 (gnutls_certificate_credentials const char *subkey_id, gnutls_openpgp_crt_fmt_t format);
_t
res, const gnutls_datum_t * ce
rt,
const gnutls_datum_t * key,
const char *subkey_id,
gnutls_openpgp_crt_fmt_t forma
t);
int gnutls_certificate_set_openpgp_keyring_mem ( int gnutls_certificate_set_openpgp_keyring_mem
gnutls_certificate_credentials_t c, const unsigned char *data, (gnutls_certificate_credentials_t c, const unsigned char *data,
size_t dlen, gnutls_openpgp_crt_fmt_t format); size_t dlen, gnutls_openpgp_crt_fmt_t format);
int gnutls_certificate_set_openpgp_keyring_file ( int gnutls_certificate_set_openpgp_keyring_file
gnutls_certificate_credentials_t c, const char *file, (gnutls_certificate_credentials_t c, const char *file,
gnutls_openpgp_crt_fmt_t format); gnutls_openpgp_crt_fmt_t format);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* GNUTLS_OPENPGP_H */ #endif /* GNUTLS_OPENPGP_H */
 End of changes. 49 change blocks. 
268 lines changed or deleted 231 lines changed or added


 openssl.h (3.2.6)   openssl.h (3.2.7) 
skipping to change at line 38 skipping to change at line 38
* compatibility layer only supports limited OpenSSL functionality. * compatibility layer only supports limited OpenSSL functionality.
* *
* New programs should avoid using this compatibility layer, and use * New programs should avoid using this compatibility layer, and use
* the native GnuTLS API directly. * the native GnuTLS API directly.
*/ */
#ifndef GNUTLS_OPENSSL_H #ifndef GNUTLS_OPENSSL_H
#define GNUTLS_OPENSSL_H #define GNUTLS_OPENSSL_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
/* Extra definitions that no longer exist in gnutls. /* Extra definitions that no longer exist in gnutls.
*/ */
#define GNUTLS_X509_CN_SIZE 256 #define GNUTLS_X509_CN_SIZE 256
#define GNUTLS_X509_C_SIZE 3 #define GNUTLS_X509_C_SIZE 3
#define GNUTLS_X509_O_SIZE 256 #define GNUTLS_X509_O_SIZE 256
#define GNUTLS_X509_OU_SIZE 256 #define GNUTLS_X509_OU_SIZE 256
#define GNUTLS_X509_L_SIZE 256 #define GNUTLS_X509_L_SIZE 256
#define GNUTLS_X509_S_SIZE 256 #define GNUTLS_X509_S_SIZE 256
#define GNUTLS_X509_EMAIL_SIZE 256 #define GNUTLS_X509_EMAIL_SIZE 256
typedef struct typedef struct {
{ char common_name[GNUTLS_X509_CN_SIZE];
char common_name[GNUTLS_X509_CN_SIZE]; char country[GNUTLS_X509_C_SIZE];
char country[GNUTLS_X509_C_SIZE]; char organization[GNUTLS_X509_O_SIZE];
char organization[GNUTLS_X509_O_SIZE]; char organizational_unit_name[GNUTLS_X509_OU_SIZE];
char organizational_unit_name[GNUTLS_X509_OU_SIZE]; char locality_name[GNUTLS_X509_L_SIZE];
char locality_name[GNUTLS_X509_L_SIZE]; char state_or_province_name[GNUTLS_X509_S_SIZE];
char state_or_province_name[GNUTLS_X509_S_SIZE]; char email[GNUTLS_X509_EMAIL_SIZE];
char email[GNUTLS_X509_EMAIL_SIZE]; } gnutls_x509_dn;
} gnutls_x509_dn;
#define OPENSSL_VERSION_NUMBER (0x0090604F) #define OPENSSL_VERSION_NUMBER (0x0090604F)
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
#define OPENSSL_VERSION_TEXT ("GNUTLS " GNUTLS_VERSION " ") #define OPENSSL_VERSION_TEXT ("GNUTLS " GNUTLS_VERSION " ")
#define SSL_ERROR_NONE (0) #define SSL_ERROR_NONE (0)
#define SSL_ERROR_SSL (1) #define SSL_ERROR_SSL (1)
#define SSL_ERROR_WANT_READ (2) #define SSL_ERROR_WANT_READ (2)
#define SSL_ERROR_WANT_WRITE (3) #define SSL_ERROR_WANT_WRITE (3)
#define SSL_ERROR_SYSCALL (5) #define SSL_ERROR_SYSCALL (5)
skipping to change at line 95 skipping to change at line 93
#define SSL_OP_ALL (0x000FFFFF) #define SSL_OP_ALL (0x000FFFFF)
#define SSL_OP_NO_TLSv1 (0x0400000) #define SSL_OP_NO_TLSv1 (0x0400000)
#define SSL_MODE_ENABLE_PARTIAL_WRITE (0x1) #define SSL_MODE_ENABLE_PARTIAL_WRITE (0x1)
#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER (0x2) #define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER (0x2)
#define SSL_MODE_AUTO_RETRY (0x4) #define SSL_MODE_AUTO_RETRY (0x4)
#undef X509_NAME #undef X509_NAME
#undef X509 #undef X509
typedef gnutls_x509_dn X509_NAME; typedef gnutls_x509_dn X509_NAME;
typedef gnutls_datum_t X509; typedef gnutls_datum_t X509;
typedef struct _SSL SSL; typedef struct _SSL SSL;
typedef struct typedef struct {
{ char priority_string[256];
char priority_string[256]; unsigned int connend;
unsigned int connend; } SSL_METHOD;
} SSL_METHOD;
typedef struct typedef struct {
{ gnutls_protocol_t version;
gnutls_protocol_t version; gnutls_cipher_algorithm_t cipher;
gnutls_cipher_algorithm_t cipher; gnutls_kx_algorithm_t kx;
gnutls_kx_algorithm_t kx; gnutls_mac_algorithm_t mac;
gnutls_mac_algorithm_t mac; gnutls_compression_method_t compression;
gnutls_compression_method_t compression; gnutls_certificate_type_t cert;
gnutls_certificate_type_t cert; } SSL_CIPHER;
} SSL_CIPHER;
typedef struct _BIO typedef struct _BIO {
{ gnutls_transport_ptr_t fd;
gnutls_transport_ptr_t fd; } BIO;
} BIO;
typedef struct typedef struct {
{ SSL *ssl;
SSL *ssl; int error;
int error; const gnutls_datum_t *cert_list;
const gnutls_datum_t *cert_list;
#define current_cert cert_list #define current_cert cert_list
} X509_STORE_CTX; } X509_STORE_CTX;
#define X509_STORE_CTX_get_current_cert(ctx) ((ctx)->current_cert) #define X509_STORE_CTX_get_current_cert(ctx) ((ctx)->current_cert)
typedef struct _SSL_CTX typedef struct _SSL_CTX {
{ SSL_METHOD *method;
SSL_METHOD *method; char *certfile;
char *certfile; int certfile_type;
int certfile_type; char *keyfile;
char *keyfile; int keyfile_type;
int keyfile_type; unsigned long options;
unsigned long options;
int (*verify_callback) (int, X509_STORE_CTX *); int (*verify_callback) (int, X509_STORE_CTX *);
int verify_mode; int verify_mode;
} SSL_CTX; } SSL_CTX;
struct _SSL struct _SSL {
{ gnutls_session_t gnutls_state;
gnutls_session_t gnutls_state;
gnutls_certificate_client_credentials gnutls_cred; gnutls_certificate_client_credentials gnutls_cred;
SSL_CTX *ctx; SSL_CTX *ctx;
SSL_CIPHER ciphersuite; SSL_CIPHER ciphersuite;
int last_error; int last_error;
int shutdown; int shutdown;
int state; int state;
unsigned long options; unsigned long options;
int (*verify_callback) (int, X509_STORE_CTX *); int (*verify_callback) (int, X509_STORE_CTX *);
int verify_mode; int verify_mode;
gnutls_transport_ptr_t rfd; gnutls_transport_ptr_t rfd;
gnutls_transport_ptr_t wfd; gnutls_transport_ptr_t wfd;
}; };
#define rbio gnutls_state #define rbio gnutls_state
typedef struct typedef struct {
{ void *handle;
void *handle; } MD_CTX;
} MD_CTX;
struct rsa_st; struct rsa_st;
typedef struct rsa_st RSA; typedef struct rsa_st RSA;
#define MD5_CTX MD_CTX #define MD5_CTX MD_CTX
#define RIPEMD160_CTX MD_CTX #define RIPEMD160_CTX MD_CTX
#define OpenSSL_add_ssl_algorithms() SSL_library_init() #define OpenSSL_add_ssl_algorithms() SSL_library_init()
#define SSLeay_add_ssl_algorithms() SSL_library_init() #define SSLeay_add_ssl_algorithms() SSL_library_init()
#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() #define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms()
#define SSL_get_cipher_name(ssl) SSL_CIPHER_get_name(SSL_get_current_cipher (ssl)) #define SSL_get_cipher_name(ssl) SSL_CIPHER_get_name(SSL_get_current_cipher (ssl))
#define SSL_get_cipher(ssl) SSL_get_cipher_name(ssl) #define SSL_get_cipher(ssl) SSL_get_cipher_name(ssl)
#define SSL_get_cipher_bits(ssl,bp) SSL_CIPHER_get_bits(SSL_get_current_cip her(ssl),(bp)) #define SSL_get_cipher_bits(ssl,bp) SSL_CIPHER_get_bits(SSL_get_current_cip her(ssl),(bp))
#define SSL_get_cipher_version(ssl) SSL_CIPHER_get_version(SSL_get_current_ cipher(ssl)) #define SSL_get_cipher_version(ssl) SSL_CIPHER_get_version(SSL_get_current_ cipher(ssl))
/* Library initialisation functions */ /* Library initialisation functions */
int SSL_library_init (void); int SSL_library_init(void);
void OpenSSL_add_all_algorithms (void); void OpenSSL_add_all_algorithms(void);
/* SSL_CTX structure handling */ /* SSL_CTX structure handling */
SSL_CTX *SSL_CTX_new (SSL_METHOD * method); SSL_CTX *SSL_CTX_new(SSL_METHOD * method);
void SSL_CTX_free (SSL_CTX * ctx); void SSL_CTX_free(SSL_CTX * ctx);
int SSL_CTX_set_default_verify_paths (SSL_CTX * ctx); int SSL_CTX_set_default_verify_paths(SSL_CTX * ctx);
int SSL_CTX_use_certificate_file (SSL_CTX * ctx, const char *certfile, int SSL_CTX_use_certificate_file(SSL_CTX * ctx,
int type); const char *certfile, int type);
int SSL_CTX_use_PrivateKey_file (SSL_CTX * ctx, const char *keyfile, int SSL_CTX_use_PrivateKey_file(SSL_CTX * ctx, const char *keyfile,
int type); int type);
void SSL_CTX_set_verify (SSL_CTX * ctx, int verify_mode, void SSL_CTX_set_verify(SSL_CTX * ctx, int verify_mode,
int (*verify_callback) (int, X509_STORE_CTX *)); int (*verify_callback) (int,
unsigned long SSL_CTX_set_options (SSL_CTX * ctx, unsigned long options); X509_STORE_CTX *));
long SSL_CTX_set_mode (SSL_CTX * ctx, long mode); unsigned long SSL_CTX_set_options(SSL_CTX * ctx,
int SSL_CTX_set_cipher_list (SSL_CTX * ctx, const char *list); unsigned long options);
long SSL_CTX_set_mode(SSL_CTX * ctx, long mode);
int SSL_CTX_set_cipher_list(SSL_CTX * ctx, const char *list);
/* SSL_CTX statistics */ /* SSL_CTX statistics */
long SSL_CTX_sess_number (SSL_CTX * ctx); long SSL_CTX_sess_number(SSL_CTX * ctx);
long SSL_CTX_sess_connect (SSL_CTX * ctx); long SSL_CTX_sess_connect(SSL_CTX * ctx);
long SSL_CTX_sess_connect_good (SSL_CTX * ctx); long SSL_CTX_sess_connect_good(SSL_CTX * ctx);
long SSL_CTX_sess_connect_renegotiate (SSL_CTX * ctx); long SSL_CTX_sess_connect_renegotiate(SSL_CTX * ctx);
long SSL_CTX_sess_accept (SSL_CTX * ctx); long SSL_CTX_sess_accept(SSL_CTX * ctx);
long SSL_CTX_sess_accept_good (SSL_CTX * ctx); long SSL_CTX_sess_accept_good(SSL_CTX * ctx);
long SSL_CTX_sess_accept_renegotiate (SSL_CTX * ctx); long SSL_CTX_sess_accept_renegotiate(SSL_CTX * ctx);
long SSL_CTX_sess_hits (SSL_CTX * ctx); long SSL_CTX_sess_hits(SSL_CTX * ctx);
long SSL_CTX_sess_misses (SSL_CTX * ctx); long SSL_CTX_sess_misses(SSL_CTX * ctx);
long SSL_CTX_sess_timeouts (SSL_CTX * ctx); long SSL_CTX_sess_timeouts(SSL_CTX * ctx);
/* SSL structure handling */ /* SSL structure handling */
SSL *SSL_new (SSL_CTX * ctx); SSL *SSL_new(SSL_CTX * ctx);
void SSL_free (SSL * ssl); void SSL_free(SSL * ssl);
void SSL_load_error_strings (void); void SSL_load_error_strings(void);
int SSL_get_error (SSL * ssl, int ret); int SSL_get_error(SSL * ssl, int ret);
int SSL_set_fd (SSL * ssl, int fd); int SSL_set_fd(SSL * ssl, int fd);
int SSL_set_rfd (SSL * ssl, int fd); int SSL_set_rfd(SSL * ssl, int fd);
int SSL_set_wfd (SSL * ssl, int fd); int SSL_set_wfd(SSL * ssl, int fd);
void SSL_set_bio (SSL * ssl, BIO * rbio, BIO * wbio); void SSL_set_bio(SSL * ssl, BIO * rbio, BIO * wbio);
void SSL_set_connect_state (SSL * ssl); void SSL_set_connect_state(SSL * ssl);
int SSL_pending (SSL * ssl); int SSL_pending(SSL * ssl);
void SSL_set_verify (SSL * ssl, int verify_mode, void SSL_set_verify(SSL * ssl, int verify_mode,
int (*verify_callback) (int, X509_STORE_CTX *)); int (*verify_callback) (int,
const X509 *SSL_get_peer_certificate (SSL * ssl); X509_STORE_CTX *));
const X509 *SSL_get_peer_certificate(SSL * ssl);
/* SSL connection open/close/read/write functions */ /* SSL connection open/close/read/write functions */
int SSL_connect (SSL * ssl); int SSL_connect(SSL * ssl);
int SSL_accept (SSL * ssl); int SSL_accept(SSL * ssl);
int SSL_shutdown (SSL * ssl); int SSL_shutdown(SSL * ssl);
int SSL_read (SSL * ssl, void *buf, int len); int SSL_read(SSL * ssl, void *buf, int len);
int SSL_write (SSL * ssl, const void *buf, int len); int SSL_write(SSL * ssl, const void *buf, int len);
int SSL_want (SSL * ssl); int SSL_want(SSL * ssl);
#define SSL_NOTHING (1) #define SSL_NOTHING (1)
#define SSL_WRITING (2) #define SSL_WRITING (2)
#define SSL_READING (3) #define SSL_READING (3)
#define SSL_X509_LOOKUP (4) #define SSL_X509_LOOKUP (4)
#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) #define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING)
#define SSL_want_read(s) (SSL_want(s) == SSL_READING) #define SSL_want_read(s) (SSL_want(s) == SSL_READING)
#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) #define SSL_want_write(s) (SSL_want(s) == SSL_WRITING)
#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) #define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)
/* SSL_METHOD functions */ /* SSL_METHOD functions */
SSL_METHOD *SSLv23_client_method (void); SSL_METHOD *SSLv23_client_method(void);
SSL_METHOD *SSLv23_server_method (void); SSL_METHOD *SSLv23_server_method(void);
SSL_METHOD *SSLv3_client_method (void); SSL_METHOD *SSLv3_client_method(void);
SSL_METHOD *SSLv3_server_method (void); SSL_METHOD *SSLv3_server_method(void);
SSL_METHOD *TLSv1_client_method (void); SSL_METHOD *TLSv1_client_method(void);
SSL_METHOD *TLSv1_server_method (void); SSL_METHOD *TLSv1_server_method(void);
/* SSL_CIPHER functions */ /* SSL_CIPHER functions */
SSL_CIPHER *SSL_get_current_cipher (SSL * ssl); SSL_CIPHER *SSL_get_current_cipher(SSL * ssl);
const char *SSL_CIPHER_get_name (SSL_CIPHER * cipher); const char *SSL_CIPHER_get_name(SSL_CIPHER * cipher);
int SSL_CIPHER_get_bits (SSL_CIPHER * cipher, int *bits); int SSL_CIPHER_get_bits(SSL_CIPHER * cipher, int *bits);
const char *SSL_CIPHER_get_version (SSL_CIPHER * cipher); const char *SSL_CIPHER_get_version(SSL_CIPHER * cipher);
char *SSL_CIPHER_description (SSL_CIPHER * cipher, char *buf, int size); char *SSL_CIPHER_description(SSL_CIPHER * cipher, char *buf,
int size);
/* X509 functions */ /* X509 functions */
X509_NAME *X509_get_subject_name (const X509 * cert); X509_NAME *X509_get_subject_name(const X509 * cert);
X509_NAME *X509_get_issuer_name (const X509 * cert); X509_NAME *X509_get_issuer_name(const X509 * cert);
char *X509_NAME_oneline (gnutls_x509_dn * name, char *buf, int len); char *X509_NAME_oneline(gnutls_x509_dn * name, char *buf, int len);
void X509_free (const X509 * cert); void X509_free(const X509 * cert);
/* BIO functions */ /* BIO functions */
void BIO_get_fd (gnutls_session_t gnutls_state, int *fd); void BIO_get_fd(gnutls_session_t gnutls_state, int *fd);
BIO *BIO_new_socket (int sock, int close_flag); BIO *BIO_new_socket(int sock, int close_flag);
/* error handling */ /* error handling */
unsigned long ERR_get_error (void); unsigned long ERR_get_error(void);
const char *ERR_error_string (unsigned long e, char *buf); const char *ERR_error_string(unsigned long e, char *buf);
/* RAND functions */ /* RAND functions */
int RAND_status (void); int RAND_status(void);
void RAND_seed (const void *buf, int num); void RAND_seed(const void *buf, int num);
int RAND_bytes (unsigned char *buf, int num); int RAND_bytes(unsigned char *buf, int num);
int RAND_pseudo_bytes (unsigned char *buf, int num); int RAND_pseudo_bytes(unsigned char *buf, int num);
const char *RAND_file_name (char *buf, size_t len); const char *RAND_file_name(char *buf, size_t len);
int RAND_load_file (const char *name, long maxbytes); int RAND_load_file(const char *name, long maxbytes);
int RAND_write_file (const char *name); int RAND_write_file(const char *name);
int RAND_egd_bytes (const char *path, int bytes); int RAND_egd_bytes(const char *path, int bytes);
#define RAND_egd(p) RAND_egd_bytes((p), 255) #define RAND_egd(p) RAND_egd_bytes((p), 255)
/* message digest functions */ /* message digest functions */
#define MD5_DIGEST_LENGTH 16 #define MD5_DIGEST_LENGTH 16
void MD5_Init (MD5_CTX * ctx); void MD5_Init(MD5_CTX * ctx);
void MD5_Update (MD5_CTX * ctx, const void *buf, int len); void MD5_Update(MD5_CTX * ctx, const void *buf, int len);
void MD5_Final (unsigned char *md, MD5_CTX * ctx); void MD5_Final(unsigned char *md, MD5_CTX * ctx);
unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *MD5(const unsigned char *buf, unsigned long len,
unsigned char *md); unsigned char *md);
void RIPEMD160_Init (RIPEMD160_CTX * ctx); void RIPEMD160_Init(RIPEMD160_CTX * ctx);
void RIPEMD160_Update (RIPEMD160_CTX * ctx, const void *buf, int len); void RIPEMD160_Update(RIPEMD160_CTX * ctx, const void *buf,
void RIPEMD160_Final (unsigned char *md, RIPEMD160_CTX * ctx); int len);
unsigned char *RIPEMD160 (const unsigned char *buf, unsigned long len, void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX * ctx);
unsigned char *md); unsigned char *RIPEMD160(const unsigned char *buf,
unsigned long len, unsigned char *md);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 35 change blocks. 
151 lines changed or deleted 147 lines changed or added


 pkcs11.h (3.2.6)   pkcs11.h (3.2.7) 
skipping to change at line 30 skipping to change at line 30
* *
*/ */
#ifndef __GNUTLS_PKCS11_H #ifndef __GNUTLS_PKCS11_H
#define __GNUTLS_PKCS11_H #define __GNUTLS_PKCS11_H
#include <stdarg.h> #include <stdarg.h>
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
#define GNUTLS_PKCS11_MAX_PIN_LEN 32 #define GNUTLS_PKCS11_MAX_PIN_LEN 32
/** /**
* gnutls_pkcs11_token_callback_t: * gnutls_pkcs11_token_callback_t:
* @userdata: user-controlled data from gnutls_pkcs11_set_token_function(). * @userdata: user-controlled data from gnutls_pkcs11_set_token_function().
* @label: token label. * @label: token label.
* @retry: retry counter, initially 0. * @retry: retry counter, initially 0.
* *
* Token callback function. The callback will be used to ask the user * Token callback function. The callback will be used to ask the user
skipping to change at line 55 skipping to change at line 56
* callback should return zero if token has been inserted by user and * callback should return zero if token has been inserted by user and
* a negative error code otherwise. It might be called multiple times * a negative error code otherwise. It might be called multiple times
* if the token is not detected and the retry counter will be * if the token is not detected and the retry counter will be
* increased. * increased.
* *
* Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code * Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code
* on error. * on error.
* *
* Since: 2.12.0 * Since: 2.12.0
**/ **/
typedef int (*gnutls_pkcs11_token_callback_t) (void *const userdata, typedef int (*gnutls_pkcs11_token_callback_t) (void *const
const char *const label, userdata,
unsigned retry); const char *const
label, unsigned retry);
struct gnutls_pkcs11_obj_st; struct gnutls_pkcs11_obj_st;
typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t; typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t;
#define GNUTLS_PKCS11_FLAG_MANUAL 0 /* Manual loading of libraries */ #define GNUTLS_PKCS11_FLAG_MANUAL 0 /* Manual loading of libraries */
#define GNUTLS_PKCS11_FLAG_AUTO 1 /* Automatically load libraries by #define GNUTLS_PKCS11_FLAG_AUTO 1 /* Automatically load libraries by r
reading /etc/gnutls/pkcs11.conf */ eading /etc/gnutls/pkcs11.conf */
/* pkcs11.conf format: /* pkcs11.conf format:
* load = /lib/xxx-pkcs11.so * load = /lib/xxx-pkcs11.so
* load = /lib/yyy-pkcs11.so * load = /lib/yyy-pkcs11.so
*/ */
int gnutls_pkcs11_init (unsigned int flags, const char *deprecated_config_f int gnutls_pkcs11_init(unsigned int flags,
ile); const char *deprecated_config_file);
int gnutls_pkcs11_reinit (void); int gnutls_pkcs11_reinit(void);
void gnutls_pkcs11_deinit (void); void gnutls_pkcs11_deinit(void);
void gnutls_pkcs11_set_token_function (gnutls_pkcs11_token_callback_t fn, void gnutls_pkcs11_set_token_function
void *userdata); (gnutls_pkcs11_token_callback_t fn, void *userdata);
void gnutls_pkcs11_set_pin_function (gnutls_pin_callback_t fn, void gnutls_pkcs11_set_pin_function(gnutls_pin_callback_t fn,
void *userdata); void *userdata);
gnutls_pin_callback_t gnutls_pkcs11_get_pin_function (void **userdata); gnutls_pin_callback_t gnutls_pkcs11_get_pin_function(void
**userdata);
int gnutls_pkcs11_add_provider (const char *name, const char *params); int gnutls_pkcs11_add_provider(const char *name, const char *params);
int gnutls_pkcs11_obj_init (gnutls_pkcs11_obj_t * obj); int gnutls_pkcs11_obj_init(gnutls_pkcs11_obj_t * obj);
void gnutls_pkcs11_obj_set_pin_function (gnutls_pkcs11_obj_t obj, void gnutls_pkcs11_obj_set_pin_function(gnutls_pkcs11_obj_t obj,
gnutls_pin_callback_t fn, gnutls_pin_callback_t fn,
void *userdata); void *userdata);
#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN (1<<0) /* force login in the token #define GNUTLS_PKCS11_OBJ_FLAG_LOGIN (1<<0) /* force login in the token
for the operation */ for the operation */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED (1<<1) /* object marked as #define GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED (1<<1) /* object marked as
trusted */ trusted */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE (1<<2) /* object marked as #define GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE (1<<2) /* object marked as
sensitive (unexportable) */ sensitive (unexportable) */
#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO (1<<3) /* force login as a secu #define GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO (1<<3) /* force login as a security
rity officer in the token for the operation */ officer in the token for the operation */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE (1<<4) /* marked as private (re #define GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE (1<<4) /* marked as private
quires PIN to access) */ (requires PIN to access) */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_PRIVATE (1<<5) /* marked as not pri #define GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_PRIVATE (1<<5) /* marked as not pri
vate */ vate */
/** /**
* gnutls_pkcs11_url_type_t: * gnutls_pkcs11_url_type_t:
* @GNUTLS_PKCS11_URL_GENERIC: A generic-purpose URL. * @GNUTLS_PKCS11_URL_GENERIC: A generic-purpose URL.
* @GNUTLS_PKCS11_URL_LIB: A URL that specifies the library used as well. * @GNUTLS_PKCS11_URL_LIB: A URL that specifies the library used as well.
* @GNUTLS_PKCS11_URL_LIB_VERSION: A URL that specifies the library and its version. * @GNUTLS_PKCS11_URL_LIB_VERSION: A URL that specifies the library and its version.
* *
* Enumeration of different URL extraction flags. * Enumeration of different URL extraction flags.
*/ */
typedef enum typedef enum {
{ GNUTLS_PKCS11_URL_GENERIC, /* URL specifies the object on token
GNUTLS_PKCS11_URL_GENERIC, /* URL specifies the object on token leve level */
l */ GNUTLS_PKCS11_URL_LIB, /* URL specifies the object on module level
GNUTLS_PKCS11_URL_LIB, /* URL specifies the object on module lev */
el */ GNUTLS_PKCS11_URL_LIB_VERSION /* URL specifies the object on modul
GNUTLS_PKCS11_URL_LIB_VERSION /* URL specifies the object on module and e and version level */
version level */ } gnutls_pkcs11_url_type_t;
} gnutls_pkcs11_url_type_t;
int gnutls_pkcs11_obj_import_url (gnutls_pkcs11_obj_t obj, int gnutls_pkcs11_obj_import_url(gnutls_pkcs11_obj_t obj,
const char *url, const char *url, unsigned int flags
unsigned int flags /* GNUTLS_PKCS11_OBJ_FLAG_* */ );
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); int gnutls_pkcs11_obj_export_url(gnutls_pkcs11_obj_t obj,
int gnutls_pkcs11_obj_export_url (gnutls_pkcs11_obj_t obj, gnutls_pkcs11_url_type_t detailed,
gnutls_pkcs11_url_type_t detailed, char **url);
char **url); void gnutls_pkcs11_obj_deinit(gnutls_pkcs11_obj_t obj);
void gnutls_pkcs11_obj_deinit (gnutls_pkcs11_obj_t obj);
int gnutls_pkcs11_obj_export (gnutls_pkcs11_obj_t obj, int gnutls_pkcs11_obj_export(gnutls_pkcs11_obj_t obj,
void *output_data, size_t * output_data_size) void *output_data, size_t * output_data_size);
; int gnutls_pkcs11_obj_export2(gnutls_pkcs11_obj_t obj,
int gnutls_pkcs11_obj_export2 (gnutls_pkcs11_obj_t obj, gnutls_datum_t * out);
gnutls_datum_t *out);
int gnutls_pkcs11_copy_x509_crt (const char *token_url, gnutls_x509_crt_t c int gnutls_pkcs11_obj_export3(gnutls_pkcs11_obj_t obj, gnutls_x509_crt_fmt_
rt, t fmt,
const char *label, unsigned int flags gnutls_datum_t * out);
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_x509_privkey (const char *token_url, gnutls_x509_pri
vkey_t key,
const char *label, unsigned int key_usage /*GNUTLS_KEY_* */, unsigned int
flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_delete_url (const char *object_url, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_secret_key (const char *token_url, int gnutls_pkcs11_get_raw_issuer(const char *url, gnutls_x509_crt_t cert,
gnutls_datum_t * key, const char *label, gnutls_datum_t * issuer,
unsigned int key_usage /* GNUTLS_KEY_* * gnutls_x509_crt_fmt_t fmt,
/ , unsigned int flags);
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); int gnutls_pkcs11_copy_x509_crt(const char *token_url,
gnutls_x509_crt_t crt,
const char *label, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_x509_privkey(const char *token_url,
gnutls_x509_privkey_t key,
const char *label,
unsigned int key_usage
/*GNUTLS_KEY_* */ ,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */
);
int gnutls_pkcs11_delete_url(const char *object_url, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_secret_key(const char *token_url,
gnutls_datum_t * key,
const char *label, unsigned int key_usage
/* GNUTLS_KEY_* */ ,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
/** /**
* gnutls_pkcs11_obj_info_t: * gnutls_pkcs11_obj_info_t:
* @GNUTLS_PKCS11_OBJ_ID_HEX: The object ID in hex. * @GNUTLS_PKCS11_OBJ_ID_HEX: The object ID in hex.
* @GNUTLS_PKCS11_OBJ_LABEL: The object label. * @GNUTLS_PKCS11_OBJ_LABEL: The object label.
* @GNUTLS_PKCS11_OBJ_TOKEN_LABEL: The token's label. * @GNUTLS_PKCS11_OBJ_TOKEN_LABEL: The token's label.
* @GNUTLS_PKCS11_OBJ_TOKEN_SERIAL: The token's serial number. * @GNUTLS_PKCS11_OBJ_TOKEN_SERIAL: The token's serial number.
* @GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER: The token's manufacturer. * @GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER: The token's manufacturer.
* @GNUTLS_PKCS11_OBJ_TOKEN_MODEL: The token's model. * @GNUTLS_PKCS11_OBJ_TOKEN_MODEL: The token's model.
* @GNUTLS_PKCS11_OBJ_ID: The object ID. * @GNUTLS_PKCS11_OBJ_ID: The object ID.
* @GNUTLS_PKCS11_OBJ_LIBRARY_VERSION: The library's used to access the obj ect version. * @GNUTLS_PKCS11_OBJ_LIBRARY_VERSION: The library's used to access the obj ect version.
* @GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION: The library's used to access the object description (name). * @GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION: The library's used to access the object description (name).
* @GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER: The library's used to access th e object manufacturer name. * @GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER: The library's used to access th e object manufacturer name.
* *
* Enumeration of several object information types. * Enumeration of several object information types.
*/ */
typedef enum typedef enum {
{ GNUTLS_PKCS11_OBJ_ID_HEX = 1,
GNUTLS_PKCS11_OBJ_ID_HEX = 1, GNUTLS_PKCS11_OBJ_LABEL,
GNUTLS_PKCS11_OBJ_LABEL, GNUTLS_PKCS11_OBJ_TOKEN_LABEL,
GNUTLS_PKCS11_OBJ_TOKEN_LABEL, GNUTLS_PKCS11_OBJ_TOKEN_SERIAL,
GNUTLS_PKCS11_OBJ_TOKEN_SERIAL, GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER,
GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER, GNUTLS_PKCS11_OBJ_TOKEN_MODEL,
GNUTLS_PKCS11_OBJ_TOKEN_MODEL, GNUTLS_PKCS11_OBJ_ID,
GNUTLS_PKCS11_OBJ_ID, /* the pkcs11 provider library info */
/* the pkcs11 provider library info */ GNUTLS_PKCS11_OBJ_LIBRARY_VERSION,
GNUTLS_PKCS11_OBJ_LIBRARY_VERSION, GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION,
GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION, GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER
GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER } gnutls_pkcs11_obj_info_t;
} gnutls_pkcs11_obj_info_t;
int gnutls_pkcs11_obj_get_info (gnutls_pkcs11_obj_t crt, int gnutls_pkcs11_obj_get_info(gnutls_pkcs11_obj_t crt,
gnutls_pkcs11_obj_info_t itype, void *outpu gnutls_pkcs11_obj_info_t itype,
t, void *output, size_t * output_size);
size_t * output_size);
/** /**
* gnutls_pkcs11_obj_attr_t: * gnutls_pkcs11_obj_attr_t:
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL: Specify all certificates. * @GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL: Specify all certificates.
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED: Specify all certificates marked as trusted. * @GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED: Specify all certificates marked as trusted.
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED_CA: Specify all certificates marked as trusted and are CAs. * @GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED_CA: Specify all certificates marked as trusted and are CAs.
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY: Specify all certificates with a corresponding private key. * @GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY: Specify all certificates with a corresponding private key.
* @GNUTLS_PKCS11_OBJ_ATTR_PUBKEY: Specify all public keys. * @GNUTLS_PKCS11_OBJ_ATTR_PUBKEY: Specify all public keys.
* @GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY: Specify all private keys. * @GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY: Specify all private keys.
* @GNUTLS_PKCS11_OBJ_ATTR_ALL: Specify all objects. * @GNUTLS_PKCS11_OBJ_ATTR_ALL: Specify all objects.
* *
* Enumeration of several attributes for object enumeration. * Enumeration of several attributes for object enumeration.
*/ */
typedef enum typedef enum {
{ GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL = 1, /* all certificates */
GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL = 1, /* all certificates */ GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED, /* certificates marked as tr
GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED, /* certificates marked as trusted usted */
*/ GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY, /* certificates with
GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY, /* certificates with corr corresponding private key */
esponding private key */ GNUTLS_PKCS11_OBJ_ATTR_PUBKEY, /* public keys */
GNUTLS_PKCS11_OBJ_ATTR_PUBKEY, /* public keys */ GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY, /* private keys */
GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY, /* private keys */ GNUTLS_PKCS11_OBJ_ATTR_ALL, /* everything! */
GNUTLS_PKCS11_OBJ_ATTR_ALL, /* everything! */ GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED_CA, /* CAs */
GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED_CA, /* CAs */ } gnutls_pkcs11_obj_attr_t;
} gnutls_pkcs11_obj_attr_t;
/** /**
* gnutls_pkcs11_token_info_t: * gnutls_pkcs11_token_info_t:
* @GNUTLS_PKCS11_TOKEN_LABEL: The token's label * @GNUTLS_PKCS11_TOKEN_LABEL: The token's label
* @GNUTLS_PKCS11_TOKEN_SERIAL: The token's serial number * @GNUTLS_PKCS11_TOKEN_SERIAL: The token's serial number
* @GNUTLS_PKCS11_TOKEN_MANUFACTURER: The token's manufacturer * @GNUTLS_PKCS11_TOKEN_MANUFACTURER: The token's manufacturer
* @GNUTLS_PKCS11_TOKEN_MODEL: The token's model * @GNUTLS_PKCS11_TOKEN_MODEL: The token's model
* *
* Enumeration of types for retrieving token information. * Enumeration of types for retrieving token information.
*/ */
typedef enum typedef enum {
{ GNUTLS_PKCS11_TOKEN_LABEL,
GNUTLS_PKCS11_TOKEN_LABEL, GNUTLS_PKCS11_TOKEN_SERIAL,
GNUTLS_PKCS11_TOKEN_SERIAL, GNUTLS_PKCS11_TOKEN_MANUFACTURER,
GNUTLS_PKCS11_TOKEN_MANUFACTURER, GNUTLS_PKCS11_TOKEN_MODEL
GNUTLS_PKCS11_TOKEN_MODEL } gnutls_pkcs11_token_info_t;
} gnutls_pkcs11_token_info_t;
/** /**
* gnutls_pkcs11_obj_type_t: * gnutls_pkcs11_obj_type_t:
* @GNUTLS_PKCS11_OBJ_UNKNOWN: Unknown PKCS11 object. * @GNUTLS_PKCS11_OBJ_UNKNOWN: Unknown PKCS11 object.
* @GNUTLS_PKCS11_OBJ_X509_CRT: X.509 certificate. * @GNUTLS_PKCS11_OBJ_X509_CRT: X.509 certificate.
* @GNUTLS_PKCS11_OBJ_PUBKEY: Public key. * @GNUTLS_PKCS11_OBJ_PUBKEY: Public key.
* @GNUTLS_PKCS11_OBJ_PRIVKEY: Private key. * @GNUTLS_PKCS11_OBJ_PRIVKEY: Private key.
* @GNUTLS_PKCS11_OBJ_SECRET_KEY: Secret key. * @GNUTLS_PKCS11_OBJ_SECRET_KEY: Secret key.
* @GNUTLS_PKCS11_OBJ_DATA: Data object. * @GNUTLS_PKCS11_OBJ_DATA: Data object.
* *
* Enumeration of object types. * Enumeration of object types.
*/ */
typedef enum typedef enum {
{ GNUTLS_PKCS11_OBJ_UNKNOWN,
GNUTLS_PKCS11_OBJ_UNKNOWN, GNUTLS_PKCS11_OBJ_X509_CRT,
GNUTLS_PKCS11_OBJ_X509_CRT, GNUTLS_PKCS11_OBJ_PUBKEY,
GNUTLS_PKCS11_OBJ_PUBKEY, GNUTLS_PKCS11_OBJ_PRIVKEY,
GNUTLS_PKCS11_OBJ_PRIVKEY, GNUTLS_PKCS11_OBJ_SECRET_KEY,
GNUTLS_PKCS11_OBJ_SECRET_KEY, GNUTLS_PKCS11_OBJ_DATA
GNUTLS_PKCS11_OBJ_DATA } gnutls_pkcs11_obj_type_t;
} gnutls_pkcs11_obj_type_t;
int int
gnutls_pkcs11_token_init (const char *token_url, gnutls_pkcs11_token_init(const char *token_url,
const char *so_pin, const char *label); const char *so_pin, const char *label);
int int
gnutls_pkcs11_token_get_mechanism (const char *url, unsigned int idx, gnutls_pkcs11_token_get_mechanism(const char *url,
unsigned long *mechanism); unsigned int idx,
unsigned long *mechanism);
int gnutls_pkcs11_token_set_pin (const char *token_url, int gnutls_pkcs11_token_set_pin(const char *token_url, const char *oldpin,
const char *oldpin, const char *newpin, unsigned int flags /*gnutls_pin_flag_t */);
const char *newpin,
unsigned int flags /*gnutls_pin_flag_t */
);
int gnutls_pkcs11_token_get_url (unsigned int seq, int gnutls_pkcs11_token_get_url(unsigned int seq,
gnutls_pkcs11_url_type_t detailed, gnutls_pkcs11_url_type_t detailed,
char **url); char **url);
int gnutls_pkcs11_token_get_info (const char *url, int gnutls_pkcs11_token_get_info(const char *url,
gnutls_pkcs11_token_info_t ttype, gnutls_pkcs11_token_info_t ttype,
void *output, size_t * output_size); void *output, size_t * output_size);
#define GNUTLS_PKCS11_TOKEN_HW 1 #define GNUTLS_PKCS11_TOKEN_HW 1
int gnutls_pkcs11_token_get_flags (const char *url, unsigned int *flags); int gnutls_pkcs11_token_get_flags(const char *url, unsigned int *flags);
int gnutls_pkcs11_obj_list_import_url (gnutls_pkcs11_obj_t * p_list, int gnutls_pkcs11_obj_list_import_url(gnutls_pkcs11_obj_t * p_list,
unsigned int *const n_list, unsigned int *const n_list,
const char *url, const char *url,
gnutls_pkcs11_obj_attr_t attrs, gnutls_pkcs11_obj_attr_t
unsigned int flags attrs, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); /* GNUTLS_PKCS11_OBJ_FLAG_* */
);
int int
gnutls_pkcs11_obj_list_import_url2 (gnutls_pkcs11_obj_t ** p_list, gnutls_pkcs11_obj_list_import_url2(gnutls_pkcs11_obj_t ** p_list,
unsigned int *n_list, unsigned int *n_list,
const char *url, const char *url,
gnutls_pkcs11_obj_attr_t attrs, gnutls_pkcs11_obj_attr_t attrs,
unsigned int flags unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); /* GNUTLS_PKCS11_OBJ_FLAG_* */
);
int gnutls_x509_crt_import_pkcs11 (gnutls_x509_crt_t crt, int gnutls_x509_crt_import_pkcs11(gnutls_x509_crt_t crt,
gnutls_pkcs11_obj_t pkcs11_crt); gnutls_pkcs11_obj_t pkcs11_crt);
int gnutls_x509_crt_import_pkcs11_url (gnutls_x509_crt_t crt, const char *u int gnutls_x509_crt_import_pkcs11_url(gnutls_x509_crt_t crt,
rl, const char *url, unsigned int flags
unsigned int flags /* GNUTLS_PKCS11_OBJ_FLAG_* */
/* GNUTLS_PKCS11_OBJ_FLAG_* */ ); );
gnutls_pkcs11_obj_type_t gnutls_pkcs11_obj_get_type (gnutls_pkcs11_obj_t ob gnutls_pkcs11_obj_type_t
j); gnutls_pkcs11_obj_get_type(gnutls_pkcs11_obj_t obj);
const char *gnutls_pkcs11_type_get_name (gnutls_pkcs11_obj_type_t type); const char *gnutls_pkcs11_type_get_name(gnutls_pkcs11_obj_type_t type);
int gnutls_x509_crt_list_import_pkcs11 (gnutls_x509_crt_t * certs, int gnutls_x509_crt_list_import_pkcs11(gnutls_x509_crt_t * certs,
unsigned int cert_max, unsigned int cert_max,
gnutls_pkcs11_obj_t * const objs, gnutls_pkcs11_obj_t *
unsigned int flags /* must be zero const objs, unsigned int flags
*/); /* must be zero */ );
/* private key functions...*/ /* private key functions...*/
int gnutls_pkcs11_privkey_init (gnutls_pkcs11_privkey_t * key); int gnutls_pkcs11_privkey_init(gnutls_pkcs11_privkey_t * key);
void gnutls_pkcs11_privkey_set_pin_function (gnutls_pkcs11_privkey_t key, void gnutls_pkcs11_privkey_set_pin_function(gnutls_pkcs11_privkey_t
gnutls_pin_callback_t fn, key,
void *userdata); gnutls_pin_callback_t
void gnutls_pkcs11_privkey_deinit (gnutls_pkcs11_privkey_t key); fn, void *userdata);
int gnutls_pkcs11_privkey_get_pk_algorithm (gnutls_pkcs11_privkey_t key, void gnutls_pkcs11_privkey_deinit(gnutls_pkcs11_privkey_t key);
unsigned int *bits); int gnutls_pkcs11_privkey_get_pk_algorithm(gnutls_pkcs11_privkey_t
int gnutls_pkcs11_privkey_get_info (gnutls_pkcs11_privkey_t pkey, key, unsigned int *bits);
gnutls_pkcs11_obj_info_t itype, int gnutls_pkcs11_privkey_get_info(gnutls_pkcs11_privkey_t pkey,
void *output, size_t * output_size); gnutls_pkcs11_obj_info_t itype,
void *output, size_t * output_size);
int gnutls_pkcs11_privkey_import_url (gnutls_pkcs11_privkey_t pkey, int gnutls_pkcs11_privkey_import_url(gnutls_pkcs11_privkey_t pkey,
const char *url, unsigned int flags); const char *url, unsigned int flags);
int gnutls_pkcs11_privkey_export_url (gnutls_pkcs11_privkey_t key, int gnutls_pkcs11_privkey_export_url(gnutls_pkcs11_privkey_t key,
gnutls_pkcs11_url_type_t detailed, gnutls_pkcs11_url_type_t
char **url); detailed, char **url);
int gnutls_pkcs11_privkey_status (gnutls_pkcs11_privkey_t key); int gnutls_pkcs11_privkey_status(gnutls_pkcs11_privkey_t key);
int gnutls_pkcs11_privkey_generate (const char* url, int gnutls_pkcs11_privkey_generate(const char *url,
gnutls_pk_algorithm_t pk, gnutls_pk_algorithm_t pk,
unsigned int bits, unsigned int bits,
const char* label, unsigned int flags); const char *label, unsigned int flags);
int int
gnutls_pkcs11_privkey_generate2 (const char* url, gnutls_pk_algorithm_t pk, gnutls_pkcs11_privkey_generate2(const char *url,
unsigned int bits, const char* label, gnutls_pk_algorithm_t pk,
gnutls_x509_crt_fmt_t fmt, unsigned int bits,
gnutls_datum_t * pubkey, const char *label,
unsigned int flags); gnutls_x509_crt_fmt_t fmt,
gnutls_datum_t * pubkey,
unsigned int flags);
int int
gnutls_pkcs11_token_get_random (const char* token_url, gnutls_pkcs11_token_get_random(const char *token_url,
void* data, void *data, size_t len);
size_t len);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif #endif
 End of changes. 38 change blocks. 
190 lines changed or deleted 200 lines changed or added


 pkcs12.h (3.2.6)   pkcs12.h (3.2.7) 
skipping to change at line 28 skipping to change at line 28
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
#ifndef GNUTLS_PKCS12_H #ifndef GNUTLS_PKCS12_H
#define GNUTLS_PKCS12_H #define GNUTLS_PKCS12_H
#include <gnutls/x509.h> #include <gnutls/x509.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
/* PKCS12 structures handling /* PKCS12 structures handling
*/ */
struct gnutls_pkcs12_int; struct gnutls_pkcs12_int;
typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t; typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
struct gnutls_pkcs12_bag_int; struct gnutls_pkcs12_bag_int;
typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t; typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
int gnutls_pkcs12_init (gnutls_pkcs12_t * pkcs12); int gnutls_pkcs12_init(gnutls_pkcs12_t * pkcs12);
void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12); void gnutls_pkcs12_deinit(gnutls_pkcs12_t pkcs12);
int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, int gnutls_pkcs12_import(gnutls_pkcs12_t pkcs12,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int flag gnutls_x509_crt_fmt_t format, unsigned int flags);
s); int gnutls_pkcs12_export(gnutls_pkcs12_t pkcs12,
int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, void *output_data, size_t * output_data_size);
void *output_data, size_t * output_data_size); int gnutls_pkcs12_export2(gnutls_pkcs12_t pkcs12,
int gnutls_pkcs12_export2 (gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
gnutls_datum_t *out);
int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12,
int indx, gnutls_pkcs12_bag_t bag); int indx, gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t ba int gnutls_pkcs12_set_bag(gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag);
g);
int gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass) int gnutls_pkcs12_generate_mac(gnutls_pkcs12_t pkcs12, const char *pass);
; int gnutls_pkcs12_verify_mac(gnutls_pkcs12_t pkcs12, const char *pass);
int gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass);
int gnutls_pkcs12_bag_decrypt (gnutls_pkcs12_bag_t bag, const char *pass) int gnutls_pkcs12_bag_decrypt(gnutls_pkcs12_bag_t bag, const char *pass);
; int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag_t bag,
int gnutls_pkcs12_bag_encrypt (gnutls_pkcs12_bag_t bag, const char *pass, const char *pass, unsigned int flags);
unsigned int flags);
#define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1 #define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1
int gnutls_pkcs12_simple_parse (gnutls_pkcs12_t p12, int gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12,
const char *password, const char *password,
gnutls_x509_privkey_t * key, gnutls_x509_privkey_t * key,
gnutls_x509_crt_t ** chain, gnutls_x509_crt_t ** chain,
unsigned int * chain_len, unsigned int *chain_len,
gnutls_x509_crt_t ** extra_certs, gnutls_x509_crt_t ** extra_certs,
unsigned int * extra_certs_len, unsigned int *extra_certs_len,
gnutls_x509_crl_t * crl, gnutls_x509_crl_t * crl,
unsigned int flags); unsigned int flags);
/** /**
* gnutls_pkcs12_bag_type_t: * gnutls_pkcs12_bag_type_t:
* @GNUTLS_BAG_EMPTY: Empty PKCS-12 bag. * @GNUTLS_BAG_EMPTY: Empty PKCS-12 bag.
* @GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: PKCS-12 bag with PKCS-8 encrypted key. * @GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: PKCS-12 bag with PKCS-8 encrypted key.
* @GNUTLS_BAG_PKCS8_KEY: PKCS-12 bag with PKCS-8 key. * @GNUTLS_BAG_PKCS8_KEY: PKCS-12 bag with PKCS-8 key.
* @GNUTLS_BAG_CERTIFICATE: PKCS-12 bag with certificate. * @GNUTLS_BAG_CERTIFICATE: PKCS-12 bag with certificate.
* @GNUTLS_BAG_CRL: PKCS-12 bag with CRL. * @GNUTLS_BAG_CRL: PKCS-12 bag with CRL.
* @GNUTLS_BAG_SECRET: PKCS-12 bag with secret PKCS-9 keys. * @GNUTLS_BAG_SECRET: PKCS-12 bag with secret PKCS-9 keys.
* @GNUTLS_BAG_ENCRYPTED: Encrypted PKCS-12 bag. * @GNUTLS_BAG_ENCRYPTED: Encrypted PKCS-12 bag.
* @GNUTLS_BAG_UNKNOWN: Unknown PKCS-12 bag. * @GNUTLS_BAG_UNKNOWN: Unknown PKCS-12 bag.
* *
* Enumeration of different PKCS 12 bag types. * Enumeration of different PKCS 12 bag types.
*/ */
typedef enum gnutls_pkcs12_bag_type_t typedef enum gnutls_pkcs12_bag_type_t {
{ GNUTLS_BAG_EMPTY = 0,
GNUTLS_BAG_EMPTY = 0, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1,
GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1, GNUTLS_BAG_PKCS8_KEY = 2,
GNUTLS_BAG_PKCS8_KEY = 2, GNUTLS_BAG_CERTIFICATE = 3,
GNUTLS_BAG_CERTIFICATE = 3, GNUTLS_BAG_CRL = 4,
GNUTLS_BAG_CRL = 4, GNUTLS_BAG_SECRET = 5, /* Secret data. Underspecified in pkcs-12,
GNUTLS_BAG_SECRET = 5, /* Secret data. Underspecified in pkcs-12, * gnutls extension. We use the PKCS-9
* gnutls extension. We use the PKCS-9 * random nonce ID 1.2.840.113549.1.9.25.3
* random nonce ID 1.2.840.113549.1.9.25.3 * to store randomly generated keys.
* to store randomly generated keys. */
*/ GNUTLS_BAG_ENCRYPTED = 10,
GNUTLS_BAG_ENCRYPTED = 10, GNUTLS_BAG_UNKNOWN = 20
GNUTLS_BAG_UNKNOWN = 20 } gnutls_pkcs12_bag_type_t;
} gnutls_pkcs12_bag_type_t;
gnutls_pkcs12_bag_type_t gnutls_pkcs12_bag_type_t
gnutls_pkcs12_bag_get_type (gnutls_pkcs12_bag_t bag, int indx); gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag_t bag, int indx);
int gnutls_pkcs12_bag_get_data (gnutls_pkcs12_bag_t bag, int indx, int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag_t bag, int indx,
gnutls_datum_t * data); gnutls_datum_t * data);
int gnutls_pkcs12_bag_set_data (gnutls_pkcs12_bag_t bag, int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag,
gnutls_pkcs12_bag_type_t type, gnutls_pkcs12_bag_type_t type,
const gnutls_datum_t * data); const gnutls_datum_t * data);
int gnutls_pkcs12_bag_set_crl (gnutls_pkcs12_bag_t bag, int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag_t bag,
gnutls_x509_crl_t crl); gnutls_x509_crl_t crl);
int gnutls_pkcs12_bag_set_crt (gnutls_pkcs12_bag_t bag, int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag_t bag,
gnutls_x509_crt_t crt); gnutls_x509_crt_t crt);
int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t * bag); int gnutls_pkcs12_bag_init(gnutls_pkcs12_bag_t * bag);
void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag); void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_bag_get_count (gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_bag_get_key_id (gnutls_pkcs12_bag_t bag, int indx, int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, int indx,
gnutls_datum_t * id); gnutls_datum_t * id);
int gnutls_pkcs12_bag_set_key_id (gnutls_pkcs12_bag_t bag, int indx, int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, int indx,
const gnutls_datum_t * id); const gnutls_datum_t * id);
int gnutls_pkcs12_bag_get_friendly_name (gnutls_pkcs12_bag_t bag, int ind int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag,
x, int indx, char **name);
char **name); int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag,
int gnutls_pkcs12_bag_set_friendly_name (gnutls_pkcs12_bag_t bag, int ind int indx, const char *name);
x,
const char *name);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* GNUTLS_PKCS12_H */ #endif /* GNUTLS_PKCS12_H */
 End of changes. 17 change blocks. 
79 lines changed or deleted 74 lines changed or added


 tpm.h (3.2.6)   tpm.h (3.2.7) 
skipping to change at line 29 skipping to change at line 29
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
#ifndef __GNUTLS_TPM_H #ifndef __GNUTLS_TPM_H
#define __GNUTLS_TPM_H #define __GNUTLS_TPM_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#include <gnutls/x509.h> #include <gnutls/x509.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
struct tpm_key_list_st; struct tpm_key_list_st;
typedef struct tpm_key_list_st *gnutls_tpm_key_list_t; typedef struct tpm_key_list_st *gnutls_tpm_key_list_t;
#define GNUTLS_TPM_KEY_SIGNING (1<<1) #define GNUTLS_TPM_KEY_SIGNING (1<<1)
#define GNUTLS_TPM_REGISTER_KEY (1<<2) #define GNUTLS_TPM_REGISTER_KEY (1<<2)
#define GNUTLS_TPM_KEY_USER (1<<3) #define GNUTLS_TPM_KEY_USER (1<<3)
/** /**
* gnutls_tpmkey_fmt_t: * gnutls_tpmkey_fmt_t:
* @GNUTLS_TPMKEY_FMT_RAW: The portable data format. * @GNUTLS_TPMKEY_FMT_RAW: The portable data format.
* @GNUTLS_TPMKEY_FMT_DER: An alias for the raw format. * @GNUTLS_TPMKEY_FMT_DER: An alias for the raw format.
* @GNUTLS_TPMKEY_FMT_CTK_PEM: A custom data format used by some TPM tools. * @GNUTLS_TPMKEY_FMT_CTK_PEM: A custom data format used by some TPM tools.
* *
* Enumeration of different certificate encoding formats. * Enumeration of different certificate encoding formats.
*/ */
typedef enum typedef enum {
{ GNUTLS_TPMKEY_FMT_RAW = 0,
GNUTLS_TPMKEY_FMT_RAW = 0, GNUTLS_TPMKEY_FMT_DER = GNUTLS_TPMKEY_FMT_RAW,
GNUTLS_TPMKEY_FMT_DER = GNUTLS_TPMKEY_FMT_RAW, GNUTLS_TPMKEY_FMT_CTK_PEM = 1
GNUTLS_TPMKEY_FMT_CTK_PEM = 1 } gnutls_tpmkey_fmt_t;
} gnutls_tpmkey_fmt_t;
int int
gnutls_tpm_privkey_generate (gnutls_pk_algorithm_t pk, unsigned int bits, gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk,
const char* srk_password, unsigned int bits,
const char* key_password, const char *srk_password,
gnutls_tpmkey_fmt_t format, const char *key_password,
gnutls_x509_crt_fmt_t pub_format, gnutls_tpmkey_fmt_t format,
gnutls_datum_t* privkey, gnutls_x509_crt_fmt_t pub_format,
gnutls_datum_t* pubkey, gnutls_datum_t * privkey,
unsigned int flags); gnutls_datum_t * pubkey, unsigned int flags);
void gnutls_tpm_key_list_deinit (gnutls_tpm_key_list_t list); void gnutls_tpm_key_list_deinit(gnutls_tpm_key_list_t list);
int gnutls_tpm_key_list_get_url (gnutls_tpm_key_list_t list, unsigned int i int gnutls_tpm_key_list_get_url(gnutls_tpm_key_list_t list,
dx, char** url, unsigned int flags); unsigned int idx, char **url,
int gnutls_tpm_get_registered (gnutls_tpm_key_list_t *list); unsigned int flags);
int gnutls_tpm_privkey_delete (const char* url, const char* srk_password); int gnutls_tpm_get_registered(gnutls_tpm_key_list_t * list);
int gnutls_tpm_privkey_delete(const char *url, const char *srk_password);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif #endif
 End of changes. 8 change blocks. 
22 lines changed or deleted 24 lines changed or added


 x509.h (3.2.6)   x509.h (3.2.7) 
skipping to change at line 32 skipping to change at line 32
/* This file contains the types and prototypes for the X.509 /* This file contains the types and prototypes for the X.509
* certificate and CRL handling functions. * certificate and CRL handling functions.
*/ */
#ifndef GNUTLS_X509_H #ifndef GNUTLS_X509_H
#define GNUTLS_X509_H #define GNUTLS_X509_H
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
/* *INDENT-ON* */
/* Some OIDs usually found in Distinguished names, or /* Some OIDs usually found in Distinguished names, or
* in Subject Directory Attribute extensions. * in Subject Directory Attribute extensions.
*/ */
#define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6" #define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6"
#define GNUTLS_OID_X520_ORGANIZATION_NAME "2.5.4.10" #define GNUTLS_OID_X520_ORGANIZATION_NAME "2.5.4.10"
#define GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11" #define GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
#define GNUTLS_OID_X520_COMMON_NAME "2.5.4.3" #define GNUTLS_OID_X520_COMMON_NAME "2.5.4.3"
#define GNUTLS_OID_X520_LOCALITY_NAME "2.5.4.7" #define GNUTLS_OID_X520_LOCALITY_NAME "2.5.4.7"
#define GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8" #define GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8"
skipping to change at line 103 skipping to change at line 104
* gnutls_certificate_import_flags: * gnutls_certificate_import_flags:
* @GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED: Fail if the * @GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED: Fail if the
* certificates in the buffer are more than the space allocated for * certificates in the buffer are more than the space allocated for
* certificates. The error code will be %GNUTLS_E_SHORT_MEMORY_BUFFER. * certificates. The error code will be %GNUTLS_E_SHORT_MEMORY_BUFFER.
* @GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED: Fail if the certificates * @GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED: Fail if the certificates
* in the buffer are not ordered starting from subject to issuer. * in the buffer are not ordered starting from subject to issuer.
* The error code will be %GNUTLS_E_CERTIFICATE_LIST_UNSORTED. * The error code will be %GNUTLS_E_CERTIFICATE_LIST_UNSORTED.
* *
* Enumeration of different certificate import flags. * Enumeration of different certificate import flags.
*/ */
typedef enum gnutls_certificate_import_flags typedef enum gnutls_certificate_import_flags {
{ GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1,
GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1, GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 2
GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 2 } gnutls_certificate_import_flags;
} gnutls_certificate_import_flags;
int gnutls_x509_crt_init (gnutls_x509_crt_t * cert); int gnutls_x509_crt_init(gnutls_x509_crt_t * cert);
void gnutls_x509_crt_deinit (gnutls_x509_crt_t cert); void gnutls_x509_crt_deinit(gnutls_x509_crt_t cert);
int gnutls_x509_crt_import (gnutls_x509_crt_t cert, int gnutls_x509_crt_import(gnutls_x509_crt_t cert,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_x509_crt_list_import2 (gnutls_x509_crt_t ** certs, int gnutls_x509_crt_list_import2(gnutls_x509_crt_t ** certs,
unsigned int * size, unsigned int *size,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int fla gnutls_x509_crt_fmt_t format,
gs); unsigned int flags);
int gnutls_x509_crt_list_import (gnutls_x509_crt_t * certs, int gnutls_x509_crt_list_import(gnutls_x509_crt_t * certs,
unsigned int *cert_max, unsigned int *cert_max,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
unsigned int flags); unsigned int flags);
int gnutls_x509_crt_export (gnutls_x509_crt_t cert, int gnutls_x509_crt_export(gnutls_x509_crt_t cert,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size) void *output_data, size_t * output_data_size);
; int gnutls_x509_crt_export2(gnutls_x509_crt_t cert,
int gnutls_x509_crt_export2 (gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
gnutls_datum_t* out); int gnutls_x509_crt_get_private_key_usage_period(gnutls_x509_crt_t
int gnutls_x509_crt_get_private_key_usage_period (gnutls_x509_crt_t cert, cert,
time_t* activation, time_t* expiration, time_t *
unsigned int *critical); activation,
time_t *
expiration, unsigned int
*critical);
int gnutls_x509_crt_get_issuer_dn (gnutls_x509_crt_t cert, char *buf, int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert,
size_t * buf_size); char *buf, size_t * buf_size);
int gnutls_x509_crt_get_issuer_dn2 (gnutls_x509_crt_t cert, gnutls_datum_ int gnutls_x509_crt_get_issuer_dn2(gnutls_x509_crt_t cert,
t* dn); gnutls_datum_t * dn);
int gnutls_x509_crt_get_issuer_dn_oid (gnutls_x509_crt_t cert, int indx, int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert,
void *oid, size_t * oid_size); int indx, void *oid,
int gnutls_x509_crt_get_issuer_dn_by_oid (gnutls_x509_crt_t cert, size_t * oid_size);
const char *oid, int indx, int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert,
unsigned int raw_flag, const char *oid, int indx,
void *buf, size_t * buf_size); unsigned int raw_flag,
int gnutls_x509_crt_get_dn (gnutls_x509_crt_t cert, char *buf, void *buf, size_t * buf_size);
size_t * buf_size); int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf,
int gnutls_x509_crt_get_dn2 (gnutls_x509_crt_t cert, gnutls_datum_t* dn); size_t * buf_size);
int gnutls_x509_crt_get_dn_oid (gnutls_x509_crt_t cert, int indx, int gnutls_x509_crt_get_dn2(gnutls_x509_crt_t cert, gnutls_datum_t * dn);
void *oid, size_t * oid_size); int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, int indx,
int gnutls_x509_crt_get_dn_by_oid (gnutls_x509_crt_t cert, void *oid, size_t * oid_size);
const char *oid, int indx, int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert,
unsigned int raw_flag, void *buf, const char *oid, int indx,
size_t * buf_size); unsigned int raw_flag, void *buf,
int gnutls_x509_crt_check_hostname (gnutls_x509_crt_t cert, size_t * buf_size);
const char *hostname); int gnutls_x509_crt_check_hostname(gnutls_x509_crt_t cert,
const char *hostname);
int gnutls_x509_crt_get_signature_algorithm (gnutls_x509_crt_t cert); int gnutls_x509_crt_get_signature_algorithm(gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_signature (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_signature(gnutls_x509_crt_t cert,
char *sig, size_t * sizeof_sig); char *sig, size_t * sizeof_sig);
int gnutls_x509_crt_get_version (gnutls_x509_crt_t cert); int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt, int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt,
unsigned int flags, unsigned int flags,
unsigned char *output_data, unsigned char *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_x509_crt_set_private_key_usage_period (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_private_key_usage_period(gnutls_x509_crt_t
time_t activation, crt,
time_t expiration); time_t activation,
int gnutls_x509_crt_set_authority_key_id (gnutls_x509_crt_t cert, time_t expiration);
const void *id, size_t id_size) int gnutls_x509_crt_set_authority_key_id(gnutls_x509_crt_t cert,
; const void *id, size_t id_size);
int gnutls_x509_crt_get_authority_key_id (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_authority_key_id(gnutls_x509_crt_t cert,
void *id, size_t * id_size, void *id,
unsigned int *critical); size_t * id_size,
int gnutls_x509_crt_get_authority_key_gn_serial (gnutls_x509_crt_t cert, unsigned int *critical);
unsigned int seq, int gnutls_x509_crt_get_authority_key_gn_serial(gnutls_x509_crt_t
void *alt, cert,
size_t * alt_size, unsigned int seq,
unsigned int *alt_type, void *alt,
void* serial, size_t * alt_size,
size_t *serial_size, unsigned int
unsigned int *critical); *alt_type,
void *serial,
size_t *
serial_size, unsigned int
*critical);
int gnutls_x509_crt_get_subject_key_id (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt_t cert,
void *ret, size_t * ret_size, void *ret,
unsigned int *critical); size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crt_get_subject_unique_id (gnutls_x509_crt_t crt, char *b int gnutls_x509_crt_get_subject_unique_id(gnutls_x509_crt_t crt,
uf, char *buf, size_t * buf_size);
size_t * buf_size);
int gnutls_x509_crt_get_issuer_unique_id (gnutls_x509_crt_t crt, char *bu int gnutls_x509_crt_get_issuer_unique_id(gnutls_x509_crt_t crt,
f, char *buf, size_t * buf_size);
size_t * buf_size);
void gnutls_x509_crt_set_pin_function (gnutls_x509_crt_t crt, void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt,
gnutls_pin_callback_t fn, void *user gnutls_pin_callback_t fn,
data); void *userdata);
/** /**
* gnutls_info_access_what_t: * gnutls_info_access_what_t:
* @GNUTLS_IA_ACCESSMETHOD_OID: Get accessMethod OID. * @GNUTLS_IA_ACCESSMETHOD_OID: Get accessMethod OID.
* @GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE: Get accessLocation name ty pe. * @GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE: Get accessLocation name ty pe.
* @GNUTLS_IA_URI: Get accessLocation URI value. * @GNUTLS_IA_URI: Get accessLocation URI value.
* @GNUTLS_IA_OCSP_URI: get accessLocation URI value for OCSP. * @GNUTLS_IA_OCSP_URI: get accessLocation URI value for OCSP.
* @GNUTLS_IA_CAISSUERS_URI: get accessLocation URI value for caIssuers. * @GNUTLS_IA_CAISSUERS_URI: get accessLocation URI value for caIssuers.
* *
* Enumeration of types for the @what parameter of * Enumeration of types for the @what parameter of
* gnutls_x509_crt_get_authority_info_access(). * gnutls_x509_crt_get_authority_info_access().
*/ */
typedef enum gnutls_info_access_what_t typedef enum gnutls_info_access_what_t {
{ GNUTLS_IA_ACCESSMETHOD_OID = 1,
GNUTLS_IA_ACCESSMETHOD_OID = 1, GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE = 2,
GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE = 2, /* use 100-108 for the generalName types, populate as needed */
/* use 100-108 for the generalName types, populate as needed */ GNUTLS_IA_URI = 106,
GNUTLS_IA_URI = 106, /* quick-access variants that match both OID and name type. */
/* quick-access variants that match both OID and name type. */ GNUTLS_IA_OCSP_URI = 10006,
GNUTLS_IA_OCSP_URI = 10006, GNUTLS_IA_CAISSUERS_URI = 10106
GNUTLS_IA_CAISSUERS_URI = 10106 } gnutls_info_access_what_t;
} gnutls_info_access_what_t;
int gnutls_x509_crt_get_authority_info_access (gnutls_x509_crt_t crt, int gnutls_x509_crt_get_authority_info_access(gnutls_x509_crt_t
unsigned int seq, crt,
int what, unsigned int seq,
gnutls_datum_t * data, int what,
unsigned int *critical); gnutls_datum_t *
data, unsigned int
*critical);
#define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED, #define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED,
/** /**
* gnutls_x509_crl_reason_flags_t: * gnutls_x509_crl_reason_flags_t:
* @GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN: The privileges were withdrawn from the owner. * @GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN: The privileges were withdrawn from the owner.
* @GNUTLS_CRL_REASON_CERTIFICATE_HOLD: The certificate is on hold. * @GNUTLS_CRL_REASON_CERTIFICATE_HOLD: The certificate is on hold.
* @GNUTLS_CRL_REASON_CESSATION_OF_OPERATION: The end-entity is no longer operating. * @GNUTLS_CRL_REASON_CESSATION_OF_OPERATION: The end-entity is no longer operating.
* @GNUTLS_CRL_REASON_SUPERSEDED: There is a newer certificate of the own er. * @GNUTLS_CRL_REASON_SUPERSEDED: There is a newer certificate of the own er.
* @GNUTLS_CRL_REASON_AFFILIATION_CHANGED: The end-entity affiliation has changed. * @GNUTLS_CRL_REASON_AFFILIATION_CHANGED: The end-entity affiliation has changed.
* @GNUTLS_CRL_REASON_CA_COMPROMISE: The CA was compromised. * @GNUTLS_CRL_REASON_CA_COMPROMISE: The CA was compromised.
* @GNUTLS_CRL_REASON_KEY_COMPROMISE: The certificate's key was compromis ed. * @GNUTLS_CRL_REASON_KEY_COMPROMISE: The certificate's key was compromis ed.
* @GNUTLS_CRL_REASON_UNUSED: The key was never used. * @GNUTLS_CRL_REASON_UNUSED: The key was never used.
* @GNUTLS_CRL_REASON_AA_COMPROMISE: AA compromised. * @GNUTLS_CRL_REASON_AA_COMPROMISE: AA compromised.
* *
* Enumeration of types for the CRL revocation reasons. * Enumeration of types for the CRL revocation reasons.
*/ */
typedef enum gnutls_x509_crl_reason_flags_t typedef enum gnutls_x509_crl_reason_flags_t {
{ GNUTLS_CRL_REASON_UNSPECIFIED = 0,
GNUTLS_CRL_REASON_UNSPECIFIED=0, GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN = 1,
GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN=1, GNUTLS_CRL_REASON_CERTIFICATE_HOLD = 2,
GNUTLS_CRL_REASON_CERTIFICATE_HOLD=2, GNUTLS_CRL_REASON_CESSATION_OF_OPERATION = 4,
GNUTLS_CRL_REASON_CESSATION_OF_OPERATION=4, GNUTLS_CRL_REASON_SUPERSEDED = 8,
GNUTLS_CRL_REASON_SUPERSEDED=8, GNUTLS_CRL_REASON_AFFILIATION_CHANGED = 16,
GNUTLS_CRL_REASON_AFFILIATION_CHANGED=16, GNUTLS_CRL_REASON_CA_COMPROMISE = 32,
GNUTLS_CRL_REASON_CA_COMPROMISE=32, GNUTLS_CRL_REASON_KEY_COMPROMISE = 64,
GNUTLS_CRL_REASON_KEY_COMPROMISE=64, GNUTLS_CRL_REASON_UNUSED = 128,
GNUTLS_CRL_REASON_UNUSED=128, GNUTLS_CRL_REASON_AA_COMPROMISE = 32768
GNUTLS_CRL_REASON_AA_COMPROMISE=32768 } gnutls_x509_crl_reason_flags_t;
} gnutls_x509_crl_reason_flags_t;
int gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt_t cert,
unsigned int seq, void *ret, unsigned int seq,
size_t * ret_size, void *ret,
unsigned int *reason_flags, size_t * ret_size,
unsigned int *critical); unsigned int *reason_flags,
int gnutls_x509_crt_set_crl_dist_points2 (gnutls_x509_crt_t crt, unsigned int *critical);
gnutls_x509_subject_alt_name_t int gnutls_x509_crt_set_crl_dist_points2(gnutls_x509_crt_t crt,
type, const void *data, gnutls_x509_subject_alt_name_t
unsigned int data_size, type, const void *data,
unsigned int reason_flags); unsigned int data_size,
int gnutls_x509_crt_set_crl_dist_points (gnutls_x509_crt_t crt, unsigned int reason_flags);
gnutls_x509_subject_alt_name_t int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt_t crt,
type, const void *data_string, gnutls_x509_subject_alt_name_t
unsigned int reason_flags); type,
int gnutls_x509_crt_cpy_crl_dist_points (gnutls_x509_crt_t dst, const void *data_string,
gnutls_x509_crt_t src); unsigned int reason_flags);
int gnutls_x509_crt_cpy_crl_dist_points(gnutls_x509_crt_t dst,
gnutls_x509_crt_t src);
int gnutls_x509_crl_sign2 (gnutls_x509_crl_t crl, int gnutls_x509_crl_sign2(gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer, gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key, gnutls_x509_privkey_t issuer_key,
gnutls_digest_algorithm_t dig, gnutls_digest_algorithm_t dig,
unsigned int flags); unsigned int flags);
time_t gnutls_x509_crt_get_activation_time (gnutls_x509_crt_t cert); time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt_t cert);
time_t gnutls_x509_crt_get_expiration_time (gnutls_x509_crt_t cert); time_t gnutls_x509_crt_get_expiration_time(gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_serial (gnutls_x509_crt_t cert, void *result, int gnutls_x509_crt_get_serial(gnutls_x509_crt_t cert,
size_t * result_size); void *result, size_t * result_size);
int gnutls_x509_crt_get_pk_algorithm (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt_t cert,
unsigned int *bits); unsigned int *bits);
int gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt, int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt,
gnutls_datum_t * m, gnutls_datum_t * gnutls_datum_t * m, gnutls_datum_t * e);
e); int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt_t crt,
int gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt, gnutls_datum_t * p,
gnutls_datum_t * p, gnutls_datum_t * q,
gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y);
gnutls_datum_t * g, gnutls_datum_t *
y);
int gnutls_x509_crt_get_subject_alt_name (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert,
unsigned int seq, void *san, unsigned int seq,
size_t * san_size, void *san,
unsigned int *critical); size_t * san_size,
int gnutls_x509_crt_get_subject_alt_name2 (gnutls_x509_crt_t cert, unsigned int *critical);
unsigned int seq, void *san, int gnutls_x509_crt_get_subject_alt_name2(gnutls_x509_crt_t cert,
size_t * san_size, unsigned int seq,
unsigned int *san_type, void *san,
unsigned int *critical); size_t * san_size,
unsigned int *san_type,
unsigned int *critical);
int gnutls_x509_crt_get_subject_alt_othername_oid (gnutls_x509_crt_t cert int gnutls_x509_crt_get_subject_alt_othername_oid(gnutls_x509_crt_t
, cert,
unsigned int seq, unsigned int seq,
void *oid, void *oid,
size_t * oid_size); size_t * oid_size);
int gnutls_x509_crt_get_issuer_alt_name (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_issuer_alt_name(gnutls_x509_crt_t cert,
unsigned int seq, void *ian, unsigned int seq,
size_t * ian_size, void *ian,
unsigned int *critical); size_t * ian_size,
int gnutls_x509_crt_get_issuer_alt_name2 (gnutls_x509_crt_t cert, unsigned int *critical);
unsigned int seq, void *ian, int gnutls_x509_crt_get_issuer_alt_name2(gnutls_x509_crt_t cert,
size_t * ian_size, unsigned int seq,
unsigned int *ian_type, void *ian,
unsigned int *critical); size_t * ian_size,
unsigned int *ian_type,
unsigned int *critical);
int gnutls_x509_crt_get_issuer_alt_othername_oid (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_issuer_alt_othername_oid(gnutls_x509_crt_t
unsigned int seq, cert,
void *ret, unsigned int seq,
size_t * ret_size); void *ret,
size_t * ret_size);
int gnutls_x509_crt_get_ca_status (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crt_get_basic_constraints (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_basic_constraints(gnutls_x509_crt_t cert,
unsigned int *critical, unsigned int *critical,
unsigned int *ca, int *pathlen unsigned int *ca, int *pathlen);
);
/* The key_usage flags are defined in gnutls.h. They are the /* The key_usage flags are defined in gnutls.h. They are the
* GNUTLS_KEY_* definitions. * GNUTLS_KEY_* definitions.
*/ */
int gnutls_x509_crt_get_key_usage (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert,
unsigned int *key_usage, unsigned int *key_usage,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crt_set_key_usage (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt,
unsigned int usage); unsigned int usage);
int gnutls_x509_crt_set_authority_info_access (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_authority_info_access(gnutls_x509_crt_t
int what, crt, int what,
gnutls_datum_t * data); gnutls_datum_t * data);
int gnutls_x509_crt_get_proxy (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_proxy(gnutls_x509_crt_t cert,
unsigned int *critical, unsigned int *critical,
int *pathlen, int *pathlen,
char **policyLanguage, char **policyLanguage,
char **policy, size_t * sizeof_policy); char **policy, size_t * sizeof_policy);
#define GNUTLS_MAX_QUALIFIERS 8 #define GNUTLS_MAX_QUALIFIERS 8
/** /**
* gnutls_x509_qualifier_t: * gnutls_x509_qualifier_t:
* @GNUTLS_X509_QUALIFIER_UNKNOWN: Unknown qualifier. * @GNUTLS_X509_QUALIFIER_UNKNOWN: Unknown qualifier.
* @GNUTLS_X509_QUALIFIER_URI: A URL * @GNUTLS_X509_QUALIFIER_URI: A URL
* @GNUTLS_X509_QUALIFIER_NOICE: A text notice. * @GNUTLS_X509_QUALIFIER_NOICE: A text notice.
* *
* Enumeration of types for the X.509 qualifiers, of the certificate poli cy extension. * Enumeration of types for the X.509 qualifiers, of the certificate poli cy extension.
*/ */
typedef enum gnutls_x509_qualifier_t typedef enum gnutls_x509_qualifier_t {
{ GNUTLS_X509_QUALIFIER_UNKNOWN = 0, GNUTLS_X509_QUALIFIER_URI,
GNUTLS_X509_QUALIFIER_UNKNOWN = 0, GNUTLS_X509_QUALIFIER_URI, GNUTLS_X509_QUALIFIER_NOTICE
GNUTLS_X509_QUALIFIER_NOTICE } gnutls_x509_qualifier_t;
} gnutls_x509_qualifier_t;
typedef struct gnutls_x509_policy_st typedef struct gnutls_x509_policy_st {
{ char *oid;
char* oid; unsigned int qualifiers;
unsigned int qualifiers; struct {
struct { gnutls_x509_qualifier_t type;
gnutls_x509_qualifier_t type; char *data;
char* data; unsigned int size;
unsigned int size; } qualifier[GNUTLS_MAX_QUALIFIERS];
} qualifier[GNUTLS_MAX_QUALIFIERS]; } gnutls_x509_policy_st;
} gnutls_x509_policy_st;
void gnutls_x509_policy_release(struct gnutls_x509_policy_st* policy); void gnutls_x509_policy_release(struct gnutls_x509_policy_st
int gnutls_x509_crt_get_policy (gnutls_x509_crt_t crt, int indx, *policy);
struct gnutls_x509_policy_st* policy, int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, int indx, struct gnut
unsigned int * critical); ls_x509_policy_st
int gnutls_x509_crt_set_policy (gnutls_x509_crt_t crt, struct gnutls_x509 *policy, unsigned int *critical);
_policy_st* policy, int gnutls_x509_crt_set_policy(gnutls_x509_crt_t crt, struct gnutls_x509_po
unsigned int critical); licy_st
*policy, unsigned int critical);
int gnutls_x509_dn_oid_known (const char *oid); int gnutls_x509_dn_oid_known(const char *oid);
#define GNUTLS_X509_DN_OID_RETURN_OID 1 #define GNUTLS_X509_DN_OID_RETURN_OID 1
const char* gnutls_x509_dn_oid_name (const char *oid, unsigned int flags) ; const char *gnutls_x509_dn_oid_name(const char *oid, unsigned int flags);
/* Read extensions by OID. */ /* Read extensions by OID. */
int gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert, int indx, int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert,
void *oid, size_t * oid_size); int indx, void *oid,
int gnutls_x509_crt_get_extension_by_oid (gnutls_x509_crt_t cert, size_t * oid_size);
const char *oid, int indx, int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert,
void *buf, size_t * buf_size, const char *oid, int indx,
unsigned int *critical); void *buf,
size_t * buf_size,
unsigned int *critical);
/* Read extensions by sequence number. */ /* Read extensions by sequence number. */
int gnutls_x509_crt_get_extension_info (gnutls_x509_crt_t cert, int indx, int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert,
void *oid, size_t * oid_size, int indx, void *oid,
unsigned int *critical); size_t * oid_size,
int gnutls_x509_crt_get_extension_data (gnutls_x509_crt_t cert, int indx, unsigned int *critical);
void *data, size_t * sizeof_data) int gnutls_x509_crt_get_extension_data(gnutls_x509_crt_t cert,
; int indx, void *data,
size_t * sizeof_data);
int gnutls_x509_crt_set_extension_by_oid (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_extension_by_oid(gnutls_x509_crt_t crt,
const char *oid, const char *oid,
const void *buf, const void *buf,
size_t sizeof_buf, size_t sizeof_buf,
unsigned int critical); unsigned int critical);
/* X.509 Certificate writing. /* X.509 Certificate writing.
*/ */
int gnutls_x509_crt_set_dn (gnutls_x509_crt_t crt, const char *dn, const int gnutls_x509_crt_set_dn(gnutls_x509_crt_t crt, const char *dn,
char** err); const char **err);
int gnutls_x509_crt_set_dn_by_oid (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt,
const char *oid, const char *oid,
unsigned int raw_flag, unsigned int raw_flag,
const void *name, const void *name,
unsigned int sizeof_name); unsigned int sizeof_name);
int gnutls_x509_crt_set_issuer_dn_by_oid (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt_t crt,
const char *oid, const char *oid,
unsigned int raw_flag, unsigned int raw_flag,
const void *name, const void *name,
unsigned int sizeof_name); unsigned int sizeof_name);
int gnutls_x509_crt_set_issuer_dn (gnutls_x509_crt_t crt, const char *dn, int gnutls_x509_crt_set_issuer_dn(gnutls_x509_crt_t crt,
const char** err); const char *dn, const char **err);
int gnutls_x509_crt_set_version (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt,
unsigned int version); unsigned int version);
int gnutls_x509_crt_set_key (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_key(gnutls_x509_crt_t crt,
gnutls_x509_privkey_t key); gnutls_x509_privkey_t key);
int gnutls_x509_crt_set_ca_status (gnutls_x509_crt_t crt, unsigned int ca int gnutls_x509_crt_set_ca_status(gnutls_x509_crt_t crt, unsigned int ca);
); int gnutls_x509_crt_set_basic_constraints(gnutls_x509_crt_t crt,
int gnutls_x509_crt_set_basic_constraints (gnutls_x509_crt_t crt, unsigned int ca,
unsigned int ca, int pathLenConstraint);
int pathLenConstraint); int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt_t
int gnutls_x509_crt_set_subject_alternative_name (gnutls_x509_crt_t crt, crt,
gnutls_x509_subject_alt gnutls_x509_subject_alt_nam
_name_t e_t
type, type, const char
const char *data_string *data_string);
); int gnutls_x509_crt_set_subject_alt_name(gnutls_x509_crt_t crt,
int gnutls_x509_crt_set_subject_alt_name (gnutls_x509_crt_t crt, gnutls_x509_subject_alt_name_t
gnutls_x509_subject_alt_name_t type, const void *data,
type, const void *data, unsigned int data_size,
unsigned int data_size, unsigned int flags);
unsigned int flags); int gnutls_x509_crt_sign(gnutls_x509_crt_t crt,
int gnutls_x509_crt_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer gnutls_x509_crt_t issuer,
, gnutls_x509_privkey_t issuer_key);
gnutls_x509_privkey_t issuer_key); int gnutls_x509_crt_sign2(gnutls_x509_crt_t crt,
int gnutls_x509_crt_sign2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issue gnutls_x509_crt_t issuer,
r, gnutls_x509_privkey_t issuer_key,
gnutls_x509_privkey_t issuer_key, gnutls_digest_algorithm_t dig,
gnutls_digest_algorithm_t dig, unsigned int flags);
unsigned int flags); int gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert,
int gnutls_x509_crt_set_activation_time (gnutls_x509_crt_t cert, time_t act_time);
time_t act_time); int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt_t cert,
int gnutls_x509_crt_set_expiration_time (gnutls_x509_crt_t cert, time_t exp_time);
time_t exp_time); int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert,
int gnutls_x509_crt_set_serial (gnutls_x509_crt_t cert, const void *seria const void *serial, size_t serial_size);
l,
size_t serial_size);
int gnutls_x509_crt_set_subject_key_id (gnutls_x509_crt_t cert, int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt_t cert,
const void *id, size_t id_size); const void *id, size_t id_size);
int gnutls_x509_crt_set_proxy_dn (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_proxy_dn(gnutls_x509_crt_t crt,
gnutls_x509_crt_t eecrt, gnutls_x509_crt_t eecrt,
unsigned int raw_flag, unsigned int raw_flag,
const void *name, const void *name,
unsigned int sizeof_name); unsigned int sizeof_name);
int gnutls_x509_crt_set_proxy (gnutls_x509_crt_t crt, int gnutls_x509_crt_set_proxy(gnutls_x509_crt_t crt,
int pathLenConstraint, int pathLenConstraint,
const char *policyLanguage, const char *policyLanguage,
const char *policy, size_t sizeof_policy); const char *policy, size_t sizeof_policy);
int gnutls_x509_crt_print (gnutls_x509_crt_t cert, int gnutls_x509_crt_print(gnutls_x509_crt_t cert,
gnutls_certificate_print_formats_t format, gnutls_certificate_print_formats_t
gnutls_datum_t * out); format, gnutls_datum_t * out);
int gnutls_x509_crl_print (gnutls_x509_crl_t crl, int gnutls_x509_crl_print(gnutls_x509_crl_t crl,
gnutls_certificate_print_formats_t format, gnutls_certificate_print_formats_t
gnutls_datum_t * out); format, gnutls_datum_t * out);
/* Access to internal Certificate fields. /* Access to internal Certificate fields.
*/ */
int gnutls_x509_crt_get_raw_issuer_dn (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt_t cert,
gnutls_datum_t * start); gnutls_datum_t * start);
int gnutls_x509_crt_get_raw_dn (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert,
gnutls_datum_t * start); gnutls_datum_t * start);
/* RDN handling. /* RDN handling.
*/ */
int gnutls_x509_rdn_get (const gnutls_datum_t * idn, int gnutls_x509_rdn_get(const gnutls_datum_t * idn,
char *buf, size_t * sizeof_buf); char *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn, int gnutls_x509_rdn_get_oid(const gnutls_datum_t * idn,
int indx, void *buf, size_t * sizeof_buf); int indx, void *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn, int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t * idn,
const char *oid, int indx, const char *oid, int indx,
unsigned int raw_flag, void *buf, unsigned int raw_flag, void *buf,
size_t * sizeof_buf); size_t * sizeof_buf);
typedef void *gnutls_x509_dn_t; typedef void *gnutls_x509_dn_t;
typedef struct gnutls_x509_ava_st typedef struct gnutls_x509_ava_st {
{ gnutls_datum_t oid;
gnutls_datum_t oid; gnutls_datum_t value;
gnutls_datum_t value; unsigned long value_tag;
unsigned long value_tag; } gnutls_x509_ava_st;
} gnutls_x509_ava_st;
int gnutls_x509_crt_get_subject (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_subject(gnutls_x509_crt_t cert,
gnutls_x509_dn_t * dn); gnutls_x509_dn_t * dn);
int gnutls_x509_crt_get_issuer (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_issuer(gnutls_x509_crt_t cert,
gnutls_x509_dn_t * dn); gnutls_x509_dn_t * dn);
int gnutls_x509_dn_get_rdn_ava (gnutls_x509_dn_t dn, int irdn, int gnutls_x509_dn_get_rdn_ava(gnutls_x509_dn_t dn, int irdn,
int iava, gnutls_x509_ava_st * ava); int iava, gnutls_x509_ava_st * ava);
int gnutls_x509_dn_init (gnutls_x509_dn_t * dn); int gnutls_x509_dn_init(gnutls_x509_dn_t * dn);
int gnutls_x509_dn_import (gnutls_x509_dn_t dn, int gnutls_x509_dn_import(gnutls_x509_dn_t dn,
const gnutls_datum_t * data); const gnutls_datum_t * data);
int gnutls_x509_dn_export (gnutls_x509_dn_t dn, int gnutls_x509_dn_export(gnutls_x509_dn_t dn,
gnutls_x509_crt_fmt_t format, void *output_dat gnutls_x509_crt_fmt_t format,
a, void *output_data, size_t * output_data_size);
size_t * output_data_size); int gnutls_x509_dn_export2(gnutls_x509_dn_t dn,
int gnutls_x509_dn_export2 (gnutls_x509_dn_t dn, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
gnutls_datum_t * out);
void gnutls_x509_dn_deinit (gnutls_x509_dn_t dn); void gnutls_x509_dn_deinit(gnutls_x509_dn_t dn);
/* CRL handling functions. /* CRL handling functions.
*/ */
int gnutls_x509_crl_init (gnutls_x509_crl_t * crl); int gnutls_x509_crl_init(gnutls_x509_crl_t * crl);
void gnutls_x509_crl_deinit (gnutls_x509_crl_t crl); void gnutls_x509_crl_deinit(gnutls_x509_crl_t crl);
int gnutls_x509_crl_import (gnutls_x509_crl_t crl, int gnutls_x509_crl_import(gnutls_x509_crl_t crl,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_x509_crl_export (gnutls_x509_crl_t crl, int gnutls_x509_crl_export(gnutls_x509_crl_t crl,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size) void *output_data, size_t * output_data_size);
; int gnutls_x509_crl_export2(gnutls_x509_crl_t crl,
int gnutls_x509_crl_export2 (gnutls_x509_crl_t crl, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
gnutls_datum_t *out);
int int
gnutls_x509_crl_get_raw_issuer_dn (gnutls_x509_crl_t crl, gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl,
gnutls_datum_t * dn); gnutls_datum_t * dn);
int gnutls_x509_crl_get_issuer_dn (gnutls_x509_crl_t crl, int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl,
char *buf, size_t * sizeof_buf); char *buf, size_t * sizeof_buf);
int gnutls_x509_crl_get_issuer_dn2 (gnutls_x509_crl_t crl, gnutls_datum_t int gnutls_x509_crl_get_issuer_dn2(gnutls_x509_crl_t crl,
* dn); gnutls_datum_t * dn);
int gnutls_x509_crl_get_issuer_dn_by_oid (gnutls_x509_crl_t crl, int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl,
const char *oid, int indx, const char *oid, int indx,
unsigned int raw_flag, unsigned int raw_flag,
void *buf, size_t * sizeof_buf) void *buf, size_t * sizeof_buf);
; int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, int indx,
int gnutls_x509_crl_get_dn_oid (gnutls_x509_crl_t crl, int indx, void *oid, size_t * sizeof_oid);
void *oid, size_t * sizeof_oid);
int gnutls_x509_crl_get_signature_algorithm (gnutls_x509_crl_t crl); int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_signature (gnutls_x509_crl_t crl, int gnutls_x509_crl_get_signature(gnutls_x509_crl_t crl,
char *sig, size_t * sizeof_sig); char *sig, size_t * sizeof_sig);
int gnutls_x509_crl_get_version (gnutls_x509_crl_t crl); int gnutls_x509_crl_get_version(gnutls_x509_crl_t crl);
time_t gnutls_x509_crl_get_this_update (gnutls_x509_crl_t crl); time_t gnutls_x509_crl_get_this_update(gnutls_x509_crl_t crl);
time_t gnutls_x509_crl_get_next_update (gnutls_x509_crl_t crl); time_t gnutls_x509_crl_get_next_update(gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_crt_count (gnutls_x509_crl_t crl); int gnutls_x509_crl_get_crt_count(gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_crt_serial (gnutls_x509_crl_t crl, int indx, int gnutls_x509_crl_get_crt_serial(gnutls_x509_crl_t crl, int indx,
unsigned char *serial, unsigned char *serial,
size_t * serial_size, time_t * t); size_t * serial_size, time_t * t);
#define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count #define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count
#define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial #define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial
int gnutls_x509_crl_check_issuer (gnutls_x509_crl_t crl, int gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer); gnutls_x509_crt_t issuer);
int gnutls_x509_crl_list_import2 (gnutls_x509_crl_t ** crls, int gnutls_x509_crl_list_import2(gnutls_x509_crl_t ** crls,
unsigned int * size, unsigned int *size,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int fla gnutls_x509_crt_fmt_t format,
gs); unsigned int flags);
int gnutls_x509_crl_list_import (gnutls_x509_crl_t * crls, int gnutls_x509_crl_list_import(gnutls_x509_crl_t * crls,
unsigned int *crl_max, unsigned int *crl_max,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
unsigned int flags); unsigned int flags);
/* CRL writing. /* CRL writing.
*/ */
int gnutls_x509_crl_set_version (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_version(gnutls_x509_crl_t crl,
unsigned int version); unsigned int version);
int gnutls_x509_crl_set_this_update (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_this_update(gnutls_x509_crl_t crl,
time_t act_time); time_t act_time);
int gnutls_x509_crl_set_next_update (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_next_update(gnutls_x509_crl_t crl,
time_t exp_time); time_t exp_time);
int gnutls_x509_crl_set_crt_serial (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl_t crl,
const void *serial, const void *serial,
size_t serial_size, size_t serial_size,
time_t revocation_time); time_t revocation_time);
int gnutls_x509_crl_set_crt (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_crt(gnutls_x509_crl_t crl,
gnutls_x509_crt_t crt, time_t revocation_tim gnutls_x509_crt_t crt, time_t revocation_time);
e);
int gnutls_x509_crl_get_authority_key_id (gnutls_x509_crl_t crl, void *id int gnutls_x509_crl_get_authority_key_id(gnutls_x509_crl_t crl,
, void *id,
size_t * id_size, size_t * id_size,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crl_get_authority_key_gn_serial (gnutls_x509_crl_t crl, int gnutls_x509_crl_get_authority_key_gn_serial(gnutls_x509_crl_t
unsigned int seq, crl,
void *alt, unsigned int seq,
size_t * alt_size, void *alt,
unsigned int *alt_type, size_t * alt_size,
void* serial, unsigned int
size_t *serial_size, *alt_type,
unsigned int *critical); void *serial,
size_t *
serial_size, unsigned int
*critical);
int gnutls_x509_crl_get_number (gnutls_x509_crl_t crl, void *ret, int gnutls_x509_crl_get_number(gnutls_x509_crl_t crl, void *ret,
size_t * ret_size, unsigned int *critical size_t * ret_size, unsigned int *critical);
);
int gnutls_x509_crl_get_extension_oid (gnutls_x509_crl_t crl, int indx, int gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl,
void *oid, size_t * sizeof_oid); int indx, void *oid,
size_t * sizeof_oid);
int gnutls_x509_crl_get_extension_info (gnutls_x509_crl_t crl, int indx, int gnutls_x509_crl_get_extension_info(gnutls_x509_crl_t crl,
void *oid, size_t * sizeof_oid, int indx, void *oid,
unsigned int *critical); size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crl_get_extension_data (gnutls_x509_crl_t crl, int indx, int gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl,
void *data, size_t * sizeof_data) int indx, void *data,
; size_t * sizeof_data);
int gnutls_x509_crl_set_authority_key_id (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_authority_key_id(gnutls_x509_crl_t crl,
const void *id, size_t id_size) const void *id, size_t id_size);
;
int gnutls_x509_crl_set_number (gnutls_x509_crl_t crl, int gnutls_x509_crl_set_number(gnutls_x509_crl_t crl,
const void *nr, size_t nr_size); const void *nr, size_t nr_size);
/* PKCS7 structures handling /* PKCS7 structures handling
*/ */
struct gnutls_pkcs7_int; struct gnutls_pkcs7_int;
typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t; typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t;
int gnutls_pkcs7_init (gnutls_pkcs7_t * pkcs7); int gnutls_pkcs7_init(gnutls_pkcs7_t * pkcs7);
void gnutls_pkcs7_deinit (gnutls_pkcs7_t pkcs7); void gnutls_pkcs7_deinit(gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_import (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_pkcs7_export (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_export(gnutls_pkcs7_t pkcs7,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size); void *output_data, size_t * output_data_size);
int gnutls_pkcs7_export2 (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_export2(gnutls_pkcs7_t pkcs7,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
gnutls_datum_t *out); gnutls_datum_t * out);
int gnutls_pkcs7_get_crt_count (gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_get_crt_raw (gnutls_pkcs7_t pkcs7, int indx, int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, int indx,
void *certificate, size_t * certificate_siz void *certificate, size_t * certificate_size);
e);
int gnutls_pkcs7_set_crt_raw (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * crt); const gnutls_datum_t * crt);
int gnutls_pkcs7_set_crt (gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt); int gnutls_pkcs7_set_crt(gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt);
int gnutls_pkcs7_delete_crt (gnutls_pkcs7_t pkcs7, int indx); int gnutls_pkcs7_delete_crt(gnutls_pkcs7_t pkcs7, int indx);
int gnutls_pkcs7_get_crl_raw (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_get_crl_raw(gnutls_pkcs7_t pkcs7,
int indx, void *crl, size_t * crl_size); int indx, void *crl, size_t * crl_size);
int gnutls_pkcs7_get_crl_count (gnutls_pkcs7_t pkcs7); int gnutls_pkcs7_get_crl_count(gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_set_crl_raw (gnutls_pkcs7_t pkcs7, int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * crl); const gnutls_datum_t * crl);
int gnutls_pkcs7_set_crl (gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl); int gnutls_pkcs7_set_crl(gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl);
int gnutls_pkcs7_delete_crl (gnutls_pkcs7_t pkcs7, int indx); int gnutls_pkcs7_delete_crl(gnutls_pkcs7_t pkcs7, int indx);
/* X.509 Certificate verification functions. /* X.509 Certificate verification functions.
*/ */
/** /**
* gnutls_certificate_verify_flags: * gnutls_certificate_verify_flags:
* @GNUTLS_VERIFY_DISABLE_CA_SIGN: If set a signer does not have to be * @GNUTLS_VERIFY_DISABLE_CA_SIGN: If set a signer does not have to be
* a certificate authority. This flag should normaly be disabled, * a certificate authority. This flag should normaly be disabled,
* unless you know what this means. * unless you know what this means.
* @GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS: If set a signer in the trust ed * @GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS: If set a signer in the trust ed
skipping to change at line 695 skipping to change at line 733
* @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5: Allow certificates to be signed * @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5: Allow certificates to be signed
* using the broken MD5 algorithm. * using the broken MD5 algorithm.
* @GNUTLS_VERIFY_DISABLE_TIME_CHECKS: Disable checking of activation * @GNUTLS_VERIFY_DISABLE_TIME_CHECKS: Disable checking of activation
* and expiration validity periods of certificate chains. Don't set * and expiration validity periods of certificate chains. Don't set
* this unless you understand the security implications. * this unless you understand the security implications.
* @GNUTLS_VERIFY_DISABLE_CRL_CHECKS: Disable checking for validity * @GNUTLS_VERIFY_DISABLE_CRL_CHECKS: Disable checking for validity
* using certificate revocation lists or the available OCSP data. * using certificate revocation lists or the available OCSP data.
* *
* Enumeration of different certificate verify flags. * Enumeration of different certificate verify flags.
*/ */
typedef enum gnutls_certificate_verify_flags typedef enum gnutls_certificate_verify_flags {
{ GNUTLS_VERIFY_DISABLE_CA_SIGN = 1 << 0,
GNUTLS_VERIFY_DISABLE_CA_SIGN = 1<<0, GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT = 1 << 1,
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT = 1<<1, GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 1 << 2,
GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 1<<2, GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 1 << 3,
GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 1<<3, GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 1 << 4,
GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 1<<4, GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 1 << 5,
GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 1<<5, GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 1 << 6,
GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 1<<6, GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 1 << 7,
GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 1<<7, GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 1 << 8,
GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 1<<8, GNUTLS_VERIFY_DISABLE_CRL_CHECKS = 1 << 9,
GNUTLS_VERIFY_DISABLE_CRL_CHECKS = 1<<9, GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN = 1 << 10,
GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN = 1<<10, GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN = 1 << 11,
GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN = 1<<11, } gnutls_certificate_verify_flags;
} gnutls_certificate_verify_flags;
int gnutls_x509_crt_check_issuer (gnutls_x509_crt_t cert, int gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer); gnutls_x509_crt_t issuer);
int gnutls_x509_crt_list_verify (const gnutls_x509_crt_t * cert_list, int gnutls_x509_crt_list_verify(const gnutls_x509_crt_t *
int cert_list_length, cert_list, int cert_list_length,
const gnutls_x509_crt_t * CA_list, const gnutls_x509_crt_t * CA_list,
int CA_list_length, int CA_list_length,
const gnutls_x509_crl_t * CRL_list, const gnutls_x509_crl_t * CRL_list,
int CRL_list_length, int CRL_list_length,
unsigned int flags, unsigned int *verify unsigned int flags, unsigned int *verify);
);
int gnutls_x509_crt_verify (gnutls_x509_crt_t cert, int gnutls_x509_crt_verify(gnutls_x509_crt_t cert,
const gnutls_x509_crt_t * CA_list, const gnutls_x509_crt_t * CA_list,
int CA_list_length, unsigned int flags, int CA_list_length, unsigned int flags,
unsigned int *verify); unsigned int *verify);
int gnutls_x509_crl_verify (gnutls_x509_crl_t crl, int gnutls_x509_crl_verify(gnutls_x509_crl_t crl,
const gnutls_x509_crt_t * CA_list, const gnutls_x509_crt_t * CA_list,
int CA_list_length, unsigned int flags, int CA_list_length, unsigned int flags,
unsigned int *verify); unsigned int *verify);
int gnutls_x509_crt_check_revocation (gnutls_x509_crt_t cert, int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert,
const gnutls_x509_crl_t * const gnutls_x509_crl_t *
crl_list, int crl_list_length); crl_list, int crl_list_length);
int gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert,
gnutls_digest_algorithm_t algo, gnutls_digest_algorithm_t algo,
void *buf, size_t * buf_size); void *buf, size_t * buf_size);
int gnutls_x509_crt_get_key_purpose_oid (gnutls_x509_crt_t cert, int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert,
int indx, void *oid, int indx, void *oid,
size_t * oid_size, size_t * oid_size,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crt_set_key_purpose_oid (gnutls_x509_crt_t cert, int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert,
const void *oid, const void *oid,
unsigned int critical); unsigned int critical);
/* Private key handling. /* Private key handling.
*/ */
/* Flags for the gnutls_x509_privkey_export_pkcs8() function. /* Flags for the gnutls_x509_privkey_export_pkcs8() function.
*/ */
#define GNUTLS_PKCS8_PLAIN GNUTLS_PKCS_PLAIN #define GNUTLS_PKCS8_PLAIN GNUTLS_PKCS_PLAIN
#define GNUTLS_PKCS8_USE_PKCS12_3DES GNUTLS_PKCS_USE_PKCS12_3DES #define GNUTLS_PKCS8_USE_PKCS12_3DES GNUTLS_PKCS_USE_PKCS12_3DES
#define GNUTLS_PKCS8_USE_PKCS12_ARCFOUR GNUTLS_PKCS_USE_PKCS12_ARCFOUR #define GNUTLS_PKCS8_USE_PKCS12_ARCFOUR GNUTLS_PKCS_USE_PKCS12_ARCFOUR
skipping to change at line 772 skipping to change at line 809
* @GNUTLS_PKCS_USE_PKCS12_3DES: PKCS-12 3DES. * @GNUTLS_PKCS_USE_PKCS12_3DES: PKCS-12 3DES.
* @GNUTLS_PKCS_USE_PKCS12_ARCFOUR: PKCS-12 ARCFOUR. * @GNUTLS_PKCS_USE_PKCS12_ARCFOUR: PKCS-12 ARCFOUR.
* @GNUTLS_PKCS_USE_PKCS12_RC2_40: PKCS-12 RC2-40. * @GNUTLS_PKCS_USE_PKCS12_RC2_40: PKCS-12 RC2-40.
* @GNUTLS_PKCS_USE_PBES2_3DES: PBES2 3DES. * @GNUTLS_PKCS_USE_PBES2_3DES: PBES2 3DES.
* @GNUTLS_PKCS_USE_PBES2_AES_128: PBES2 AES-128. * @GNUTLS_PKCS_USE_PBES2_AES_128: PBES2 AES-128.
* @GNUTLS_PKCS_USE_PBES2_AES_192: PBES2 AES-192. * @GNUTLS_PKCS_USE_PBES2_AES_192: PBES2 AES-192.
* @GNUTLS_PKCS_USE_PBES2_AES_256: PBES2 AES-256. * @GNUTLS_PKCS_USE_PBES2_AES_256: PBES2 AES-256.
* *
* Enumeration of different PKCS encryption flags. * Enumeration of different PKCS encryption flags.
*/ */
typedef enum gnutls_pkcs_encrypt_flags_t typedef enum gnutls_pkcs_encrypt_flags_t {
{ GNUTLS_PKCS_PLAIN = 1,
GNUTLS_PKCS_PLAIN = 1, GNUTLS_PKCS_USE_PKCS12_3DES = 2,
GNUTLS_PKCS_USE_PKCS12_3DES = 2, GNUTLS_PKCS_USE_PKCS12_ARCFOUR = 4,
GNUTLS_PKCS_USE_PKCS12_ARCFOUR = 4, GNUTLS_PKCS_USE_PKCS12_RC2_40 = 8,
GNUTLS_PKCS_USE_PKCS12_RC2_40 = 8, GNUTLS_PKCS_USE_PBES2_3DES = 16,
GNUTLS_PKCS_USE_PBES2_3DES = 16, GNUTLS_PKCS_USE_PBES2_AES_128 = 32,
GNUTLS_PKCS_USE_PBES2_AES_128 = 32, GNUTLS_PKCS_USE_PBES2_AES_192 = 64,
GNUTLS_PKCS_USE_PBES2_AES_192 = 64, GNUTLS_PKCS_USE_PBES2_AES_256 = 128,
GNUTLS_PKCS_USE_PBES2_AES_256 = 128, GNUTLS_PKCS_NULL_PASSWORD = 256
GNUTLS_PKCS_NULL_PASSWORD = 256 } gnutls_pkcs_encrypt_flags_t;
} gnutls_pkcs_encrypt_flags_t;
int gnutls_x509_privkey_init (gnutls_x509_privkey_t * key); int gnutls_x509_privkey_init(gnutls_x509_privkey_t * key);
void gnutls_x509_privkey_deinit (gnutls_x509_privkey_t key); void gnutls_x509_privkey_deinit(gnutls_x509_privkey_t key);
gnutls_sec_param_t gnutls_x509_privkey_sec_param (gnutls_x509_privkey_t gnutls_sec_param_t
key); gnutls_x509_privkey_sec_param(gnutls_x509_privkey_t key);
int gnutls_x509_privkey_cpy (gnutls_x509_privkey_t dst, int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst,
gnutls_x509_privkey_t src); gnutls_x509_privkey_t src);
int gnutls_x509_privkey_import (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags); unsigned int flags);
int gnutls_x509_privkey_import_openssl (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_openssl(gnutls_x509_privkey_t key,
const gnutls_datum_t *data, const gnutls_datum_t * data,
const char* password); const char *password);
int gnutls_x509_privkey_import2 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import2(gnutls_x509_privkey_t key,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
const char* password, unsigned int flags const char *password, unsigned int flags);
);
int gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key,
const gnutls_datum_t * m, const gnutls_datum_t * m,
const gnutls_datum_t * e, const gnutls_datum_t * e,
const gnutls_datum_t * d, const gnutls_datum_t * d,
const gnutls_datum_t * p, const gnutls_datum_t * p,
const gnutls_datum_t * q, const gnutls_datum_t * q,
const gnutls_datum_t * u); const gnutls_datum_t * u);
int gnutls_x509_privkey_import_rsa_raw2 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_rsa_raw2(gnutls_x509_privkey_t key,
const gnutls_datum_t * m, const gnutls_datum_t * m,
const gnutls_datum_t * e, const gnutls_datum_t * e,
const gnutls_datum_t * d, const gnutls_datum_t * d,
const gnutls_datum_t * p, const gnutls_datum_t * p,
const gnutls_datum_t * q, const gnutls_datum_t * q,
const gnutls_datum_t * u, const gnutls_datum_t * u,
const gnutls_datum_t * e1, const gnutls_datum_t * e1,
const gnutls_datum_t * e2); const gnutls_datum_t * e2);
int gnutls_x509_privkey_import_ecc_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_ecc_raw(gnutls_x509_privkey_t key,
gnutls_ecc_curve_t curve, gnutls_ecc_curve_t curve,
const gnutls_datum_t * x, const gnutls_datum_t * x,
const gnutls_datum_t * y, const gnutls_datum_t * y,
const gnutls_datum_t * k); const gnutls_datum_t * k);
int gnutls_x509_privkey_fix (gnutls_x509_privkey_t key); int gnutls_x509_privkey_fix(gnutls_x509_privkey_t key);
int gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey_t key,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * g,
gnutls_datum_t * y, gnutls_datum_t * y,
gnutls_datum_t * x); gnutls_datum_t * x);
int gnutls_x509_privkey_import_dsa_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey_t key,
const gnutls_datum_t * p, const gnutls_datum_t * p,
const gnutls_datum_t * q, const gnutls_datum_t * q,
const gnutls_datum_t * g, const gnutls_datum_t * g,
const gnutls_datum_t * y, const gnutls_datum_t * y,
const gnutls_datum_t * x); const gnutls_datum_t * x);
int gnutls_x509_privkey_get_pk_algorithm (gnutls_x509_privkey_t key); int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey_t key);
int gnutls_x509_privkey_get_pk_algorithm2 (gnutls_x509_privkey_t key, uns int gnutls_x509_privkey_get_pk_algorithm2(gnutls_x509_privkey_t
igned int *bits); key, unsigned int *bits);
int gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key, int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key,
unsigned int flags, unsigned int flags,
unsigned char *output_data, unsigned char *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_x509_privkey_generate (gnutls_x509_privkey_t key, int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
gnutls_pk_algorithm_t algo, gnutls_pk_algorithm_t algo,
unsigned int bits, unsigned int flags); unsigned int bits, unsigned int flags);
int gnutls_x509_privkey_verify_params (gnutls_x509_privkey_t key); int gnutls_x509_privkey_verify_params(gnutls_x509_privkey_t key);
int gnutls_x509_privkey_export (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, void *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_x509_privkey_export2 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export2(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
gnutls_datum_t * out); gnutls_datum_t * out);
int gnutls_x509_privkey_export_pkcs8 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags, unsigned int flags,
void *output_data, void *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_x509_privkey_export2_pkcs8 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export2_pkcs8(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
const char *password, const char *password,
unsigned int flags, unsigned int flags,
gnutls_datum_t * out); gnutls_datum_t * out);
int gnutls_x509_privkey_export_rsa_raw2 (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export_rsa_raw2(gnutls_x509_privkey_t key,
gnutls_datum_t * m, gnutls_datum_t * m,
gnutls_datum_t * e, gnutls_datum_t * e,
gnutls_datum_t * d, gnutls_datum_t * d,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * u, gnutls_datum_t * u,
gnutls_datum_t * e1, gnutls_datum_t * e1,
gnutls_datum_t * e2); gnutls_datum_t * e2);
int gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key,
gnutls_datum_t * m, gnutls_datum_t * m,
gnutls_datum_t * e, gnutls_datum_t * e,
gnutls_datum_t * d, gnutls_datum_t * d,
gnutls_datum_t * p, gnutls_datum_t * p,
gnutls_datum_t * q, gnutls_datum_t * q,
gnutls_datum_t * u); gnutls_datum_t * u);
int gnutls_x509_privkey_export_ecc_raw (gnutls_x509_privkey_t key, int gnutls_x509_privkey_export_ecc_raw(gnutls_x509_privkey_t key,
gnutls_ecc_curve_t *curve, gnutls_ecc_curve_t * curve,
gnutls_datum_t * x, gnutls_datum_ gnutls_datum_t * x,
t * y, gnutls_datum_t * y,
gnutls_datum_t* k); gnutls_datum_t * k);
/* Certificate request stuff. /* Certificate request stuff.
*/ */
int gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq, int gnutls_x509_crq_sign2(gnutls_x509_crq_t crq,
gnutls_x509_privkey_t key, gnutls_x509_privkey_t key,
gnutls_digest_algorithm_t dig, gnutls_digest_algorithm_t dig,
unsigned int flags); unsigned int flags);
int gnutls_x509_crq_print (gnutls_x509_crq_t crq, int gnutls_x509_crq_print(gnutls_x509_crq_t crq,
gnutls_certificate_print_formats_t format, gnutls_certificate_print_formats_t
gnutls_datum_t * out); format, gnutls_datum_t * out);
int gnutls_x509_crq_verify (gnutls_x509_crq_t crq, unsigned int flags); int gnutls_x509_crq_verify(gnutls_x509_crq_t crq, unsigned int flags);
int gnutls_x509_crq_init (gnutls_x509_crq_t * crq); int gnutls_x509_crq_init(gnutls_x509_crq_t * crq);
void gnutls_x509_crq_deinit (gnutls_x509_crq_t crq); void gnutls_x509_crq_deinit(gnutls_x509_crq_t crq);
int gnutls_x509_crq_import (gnutls_x509_crq_t crq, int gnutls_x509_crq_import(gnutls_x509_crq_t crq,
const gnutls_datum_t * data, const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format); gnutls_x509_crt_fmt_t format);
int gnutls_x509_crq_get_private_key_usage_period (gnutls_x509_crq_t cert, int gnutls_x509_crq_get_private_key_usage_period(gnutls_x509_crq_t
time_t* activation, time_t* expiration, cert,
unsigned int *critical); time_t *
activation,
time_t *
expiration, unsigned int
*critical);
int gnutls_x509_crq_get_dn (gnutls_x509_crq_t crq, char *buf, int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *buf,
size_t * sizeof_buf); size_t * sizeof_buf);
int gnutls_x509_crq_get_dn2 (gnutls_x509_crq_t crq, gnutls_datum_t* dn); int gnutls_x509_crq_get_dn2(gnutls_x509_crq_t crq, gnutls_datum_t * dn);
int gnutls_x509_crq_get_dn_oid (gnutls_x509_crq_t crq, int indx, int gnutls_x509_crq_get_dn_oid(gnutls_x509_crq_t crq, int indx,
void *oid, size_t * sizeof_oid); void *oid, size_t * sizeof_oid);
int gnutls_x509_crq_get_dn_by_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq,
const char *oid, int indx, const char *oid, int indx,
unsigned int raw_flag, void *buf, unsigned int raw_flag, void *buf,
size_t * sizeof_buf); size_t * sizeof_buf);
int gnutls_x509_crq_set_dn (gnutls_x509_crq_t crq, const char *dn, const int gnutls_x509_crq_set_dn(gnutls_x509_crq_t crq, const char *dn,
char** err); const char **err);
int gnutls_x509_crq_set_dn_by_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq_t crq,
const char *oid, const char *oid,
unsigned int raw_flag, unsigned int raw_flag,
const void *data, const void *data,
unsigned int sizeof_data); unsigned int sizeof_data);
int gnutls_x509_crq_set_version (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_version(gnutls_x509_crq_t crq,
unsigned int version); unsigned int version);
int gnutls_x509_crq_get_version (gnutls_x509_crq_t crq); int gnutls_x509_crq_get_version(gnutls_x509_crq_t crq);
int gnutls_x509_crq_set_key (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_key(gnutls_x509_crq_t crq,
gnutls_x509_privkey_t key); gnutls_x509_privkey_t key);
int gnutls_x509_crq_set_challenge_password (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq_t crq,
const char *pass); const char *pass);
int gnutls_x509_crq_get_challenge_password (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq_t crq,
char *pass, char *pass,
size_t * sizeof_pass); size_t * sizeof_pass);
int gnutls_x509_crq_set_attribute_by_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq,
const char *oid, void *buf, const char *oid,
size_t sizeof_buf); void *buf, size_t sizeof_buf);
int gnutls_x509_crq_get_attribute_by_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_attribute_by_oid(gnutls_x509_crq_t crq,
const char *oid, int indx, const char *oid, int indx,
void *buf, size_t * sizeof_buf) void *buf, size_t * sizeof_buf);
;
int gnutls_x509_crq_export (gnutls_x509_crq_t crq, int gnutls_x509_crq_export(gnutls_x509_crq_t crq,
gnutls_x509_crt_fmt_t format, gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size) void *output_data, size_t * output_data_size);
; int gnutls_x509_crq_export2(gnutls_x509_crq_t crq,
int gnutls_x509_crq_export2 (gnutls_x509_crq_t crq, gnutls_x509_crt_fmt_t format,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
gnutls_datum_t * out);
int gnutls_x509_crt_set_crq (gnutls_x509_crt_t crt, gnutls_x509_crq_t crq int gnutls_x509_crt_set_crq(gnutls_x509_crt_t crt, gnutls_x509_crq_t crq);
); int gnutls_x509_crt_set_crq_extensions(gnutls_x509_crt_t crt,
int gnutls_x509_crt_set_crq_extensions (gnutls_x509_crt_t crt, gnutls_x509_crq_t crq);
gnutls_x509_crq_t crq);
int gnutls_x509_crq_set_private_key_usage_period (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_private_key_usage_period(gnutls_x509_crq_t
time_t activation, crq,
time_t expiration); time_t activation,
int gnutls_x509_crq_set_key_rsa_raw (gnutls_x509_crq_t crq, time_t expiration);
const gnutls_datum_t * m, int gnutls_x509_crq_set_key_rsa_raw(gnutls_x509_crq_t crq,
const gnutls_datum_t * e); const gnutls_datum_t * m,
int gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t crq, const gnutls_datum_t * e);
gnutls_x509_subject_alt_name_t int gnutls_x509_crq_set_subject_alt_name(gnutls_x509_crq_t crq,
nt, gnutls_x509_subject_alt_name_t
const void *data, nt, const void *data,
unsigned int data_size, unsigned int data_size,
unsigned int flags); unsigned int flags);
int gnutls_x509_crq_set_key_usage (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_key_usage(gnutls_x509_crq_t crq,
unsigned int usage); unsigned int usage);
int gnutls_x509_crq_set_basic_constraints (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_basic_constraints(gnutls_x509_crq_t crq,
unsigned int ca, unsigned int ca,
int pathLenConstraint); int pathLenConstraint);
int gnutls_x509_crq_set_key_purpose_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_set_key_purpose_oid(gnutls_x509_crq_t crq,
const void *oid, const void *oid,
unsigned int critical); unsigned int critical);
int gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t crq, int indx, int gnutls_x509_crq_get_key_purpose_oid(gnutls_x509_crq_t crq,
void *oid, size_t * sizeof_oid, int indx, void *oid,
unsigned int *critical); size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crq_get_extension_data (gnutls_x509_crq_t crq, int indx, int gnutls_x509_crq_get_extension_data(gnutls_x509_crq_t crq,
void *data, size_t * sizeof_data) int indx, void *data,
; size_t * sizeof_data);
int gnutls_x509_crq_get_extension_info (gnutls_x509_crq_t crq, int indx, int gnutls_x509_crq_get_extension_info(gnutls_x509_crq_t crq,
void *oid, size_t * sizeof_oid, int indx, void *oid,
unsigned int *critical); size_t * sizeof_oid,
int gnutls_x509_crq_get_attribute_data (gnutls_x509_crq_t crq, int indx, unsigned int *critical);
void *data, size_t * sizeof_data) int gnutls_x509_crq_get_attribute_data(gnutls_x509_crq_t crq,
; int indx, void *data,
int gnutls_x509_crq_get_attribute_info (gnutls_x509_crq_t crq, int indx, size_t * sizeof_data);
void *oid, size_t * sizeof_oid); int gnutls_x509_crq_get_attribute_info(gnutls_x509_crq_t crq,
int gnutls_x509_crq_get_pk_algorithm (gnutls_x509_crq_t crq, int indx, void *oid,
unsigned int *bits); size_t * sizeof_oid);
int gnutls_x509_crq_get_pk_algorithm(gnutls_x509_crq_t crq,
unsigned int *bits);
int gnutls_x509_crq_get_key_id (gnutls_x509_crq_t crq, unsigned int flags int gnutls_x509_crq_get_key_id(gnutls_x509_crq_t crq,
, unsigned int flags,
unsigned char *output_data, unsigned char *output_data,
size_t * output_data_size); size_t * output_data_size);
int gnutls_x509_crq_get_key_rsa_raw (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_key_rsa_raw(gnutls_x509_crq_t crq,
gnutls_datum_t * m, gnutls_datum_t * m,
gnutls_datum_t * e); gnutls_datum_t * e);
int gnutls_x509_crq_get_key_usage (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_key_usage(gnutls_x509_crq_t crq,
unsigned int *key_usage, unsigned int *key_usage,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crq_get_basic_constraints (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_basic_constraints(gnutls_x509_crq_t crq,
unsigned int *critical, unsigned int *critical,
unsigned int *ca, int *pathlen unsigned int *ca, int *pathlen);
); int gnutls_x509_crq_get_subject_alt_name(gnutls_x509_crq_t crq,
int gnutls_x509_crq_get_subject_alt_name (gnutls_x509_crq_t crq, unsigned int seq,
unsigned int seq, void *ret, void *ret,
size_t * ret_size, size_t * ret_size,
unsigned int *ret_type, unsigned int *ret_type,
unsigned int *critical); unsigned int *critical);
int gnutls_x509_crq_get_subject_alt_othername_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_subject_alt_othername_oid(gnutls_x509_crq_t
unsigned int seq, crq,
void *ret, unsigned int seq,
size_t * ret_size); void *ret,
size_t * ret_size);
int gnutls_x509_crq_get_extension_by_oid (gnutls_x509_crq_t crq, int gnutls_x509_crq_get_extension_by_oid(gnutls_x509_crq_t crq,
const char *oid, int indx, const char *oid, int indx,
void *buf, size_t * sizeof_buf, void *buf,
unsigned int *critical); size_t * sizeof_buf,
unsigned int *critical);
typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t; typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t;
int int
gnutls_x509_trust_list_init (gnutls_x509_trust_list_t * list, unsigned in gnutls_x509_trust_list_init(gnutls_x509_trust_list_t * list,
t size); unsigned int size);
void void
gnutls_x509_trust_list_deinit (gnutls_x509_trust_list_t list, unsigned in gnutls_x509_trust_list_deinit(gnutls_x509_trust_list_t list,
t all); unsigned int all);
int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t list, int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t
gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, unsigned int flags); list, gnutls_x509_crt_t cert,
gnutls_x509_crt_t * issuer,
unsigned int flags);
int int
gnutls_x509_trust_list_add_cas (gnutls_x509_trust_list_t list, gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list,
const gnutls_x509_crt_t * clist, int clist_size, unsigned int flags); const gnutls_x509_crt_t * clist,
int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t list, int clist_size, unsigned int flags);
const gnutls_x509_crt_t * clist, int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t
int clist_size); list,
const gnutls_x509_crt_t *
clist, int clist_size);
int gnutls_x509_trust_list_add_named_crt (gnutls_x509_trust_list_t list, int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t
gnutls_x509_crt_t cert, const void* name, size_t name_size, unsigned list,
int flags); gnutls_x509_crt_t cert,
const void *name,
size_t name_size,
unsigned int flags);
#define GNUTLS_TL_VERIFY_CRL 1 #define GNUTLS_TL_VERIFY_CRL 1
int int
gnutls_x509_trust_list_add_crls (gnutls_x509_trust_list_t list, gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list,
const gnutls_x509_crl_t * crl_list, int crl_size, unsigned int flags, const gnutls_x509_crl_t *
unsigned int verification_flags); crl_list, int crl_size,
unsigned int flags,
unsigned int verification_flags);
typedef int gnutls_verify_output_function ( typedef int gnutls_verify_output_function(gnutls_x509_crt_t cert, gnutls_x5
gnutls_x509_crt_t cert, 09_crt_t issuer, /* The issuer if verification failed
gnutls_x509_crt_t issuer, /* The issuer if verification failed
* because of him. might be null. * because of him. might be null.
*/
gnutls_x509_crl_t crl, /* The CRL that caused verification failure */
* if any. Might be null. gnutls_x509_crl_t crl, /* T
*/ he CRL that caused verification failure
unsigned int verification_output); * i
f any. Might be null.
*/
unsigned int
verification_output);
int gnutls_x509_trust_list_verify_named_crt ( int gnutls_x509_trust_list_verify_named_crt
gnutls_x509_trust_list_t list, (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert,
gnutls_x509_crt_t cert, const void *name, size_t name_size, unsigned int flags,
const void * name, size_t name_size, unsigned int *verify, gnutls_verify_output_function func);
unsigned int flags,
unsigned int *verify,
gnutls_verify_output_function func);
int int
gnutls_x509_trust_list_verify_crt ( gnutls_x509_trust_list_verify_crt(gnutls_x509_trust_list_t list,
gnutls_x509_trust_list_t list, gnutls_x509_crt_t * cert_list,
gnutls_x509_crt_t *cert_list, unsigned int cert_list_size,
unsigned int cert_list_size, unsigned int flags,
unsigned int flags, unsigned int *verify,
unsigned int *verify, gnutls_verify_output_function func);
gnutls_verify_output_function func);
/* trust list convenience functions */ /* trust list convenience functions */
int int
gnutls_x509_trust_list_add_trust_mem(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_add_trust_mem(gnutls_x509_trust_list_t
const gnutls_datum_t * cas, list,
const gnutls_datum_t * crls, const gnutls_datum_t * cas,
gnutls_x509_crt_fmt_t type, const gnutls_datum_t * crls,
unsigned int tl_flags, gnutls_x509_crt_fmt_t type,
unsigned int tl_vflags); unsigned int tl_flags,
unsigned int tl_vflags);
int int
gnutls_x509_trust_list_add_trust_file(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_add_trust_file(gnutls_x509_trust_list_t
const char* ca_file, list, const char *ca_file,
const char* crl_file, const char *crl_file,
gnutls_x509_crt_fmt_t type, gnutls_x509_crt_fmt_t type,
unsigned int tl_flags, unsigned int tl_flags,
unsigned int tl_vflags); unsigned int tl_vflags);
int int
gnutls_x509_trust_list_remove_trust_file(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_remove_trust_file(gnutls_x509_trust_list_t
const char* ca_file, list,
gnutls_x509_crt_fmt_t type); const char *ca_file,
gnutls_x509_crt_fmt_t type);
int int
gnutls_x509_trust_list_remove_trust_mem(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_remove_trust_mem(gnutls_x509_trust_list_t
const gnutls_datum_t * cas, list,
gnutls_x509_crt_fmt_t type); const gnutls_datum_t *
cas, gnutls_x509_crt_fmt_t type);
int int
gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t list, gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t
unsigned int tl_flags, unsigned int list,
tl_vflags); unsigned int tl_flags,
unsigned int tl_vflags);
void gnutls_certificate_set_trust_list (gnutls_certificate_credentials_t re void gnutls_certificate_set_trust_list
s, (gnutls_certificate_credentials_t res,
gnutls_x509_trust_list_t tlist, unsigned fl gnutls_x509_trust_list_t tlist, unsigned flags);
ags);
/* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* *INDENT-ON* */
#endif /* GNUTLS_X509_H */ #endif /* GNUTLS_X509_H */
 End of changes. 125 change blocks. 
822 lines changed or deleted 845 lines changed or added


 xssl.h (3.2.6)   xssl.h (3.2.7) 
skipping to change at line 24 skipping to change at line 24
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
*/ */
#ifndef GNUTLS_SBUF_H #ifndef GNUTLS_SBUF_H
#define GNUTLS_SBUF_H #define GNUTLS_SBUF_H
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
/* Buffered session I/O */ /* Buffered session I/O */
typedef struct xssl_st *xssl_t; typedef struct xssl_st *xssl_t;
typedef struct xssl_cred_st *xssl_cred_t; typedef struct xssl_cred_st *xssl_cred_t;
ssize_t xssl_printf (xssl_t sb, const char *fmt, ...) ssize_t xssl_printf(xssl_t sb, const char *fmt, ...)
#ifdef __GNUC__ #ifdef __GNUC__
__attribute__ ((format (printf, 2, 3))) __attribute__ ((format(printf, 2, 3)))
#endif #endif
; ;
ssize_t xssl_write (xssl_t sb, const void *data, ssize_t xssl_write(xssl_t sb, const void *data, size_t data_size);
size_t data_size);
ssize_t xssl_flush (xssl_t sb); ssize_t xssl_flush(xssl_t sb);
ssize_t xssl_read(xssl_t sb, void* data, size_t data_size); ssize_t xssl_read(xssl_t sb, void *data, size_t data_size);
ssize_t ssize_t
xssl_getdelim (xssl_t sbuf, char **lineptr, size_t *n, int delimiter); xssl_getdelim(xssl_t sbuf, char **lineptr, size_t * n, int delimiter);
#define xssl_getline(sbuf, ptr, n) xssl_getdelim(sbuf, ptr, n, '\n') #define xssl_getline(sbuf, ptr, n) xssl_getdelim(sbuf, ptr, n, '\n')
void xssl_deinit(xssl_t sb); void xssl_deinit(xssl_t sb);
#define GNUTLS_SBUF_WRITE_FLUSHES (1<<0) #define GNUTLS_SBUF_WRITE_FLUSHES (1<<0)
int xssl_sinit (xssl_t * isb, gnutls_session_t session, int xssl_sinit(xssl_t * isb, gnutls_session_t session, unsigned int flags);
unsigned int flags);
gnutls_session_t xssl_get_session(xssl_t sb); gnutls_session_t xssl_get_session(xssl_t sb);
int xssl_client_init (xssl_t * isb, const char* hostname, int xssl_client_init(xssl_t * isb, const char *hostname,
const char* service, const char *service,
gnutls_transport_ptr fd, gnutls_transport_ptr fd,
const char* priority, xssl_cred_t cred, const char *priority, xssl_cred_t cred,
unsigned int *status, unsigned int *status, unsigned int flags);
unsigned int flags);
int xssl_server_init (xssl_t * isb, int xssl_server_init(xssl_t * isb,
gnutls_transport_ptr fd, gnutls_transport_ptr fd,
const char* priority, xssl_cred_t cred, const char *priority, xssl_cred_t cred,
unsigned int *status, unsigned int *status, unsigned int flags);
unsigned int flags);
/* High level credential structures */ /* High level credential structures */
typedef enum typedef enum {
{ GNUTLS_VMETHOD_NO_AUTH = 0,
GNUTLS_VMETHOD_NO_AUTH = 0, GNUTLS_VMETHOD_TOFU = 1 << 0,
GNUTLS_VMETHOD_TOFU = 1<<0, GNUTLS_VMETHOD_GIVEN_CAS = 1 << 1,
GNUTLS_VMETHOD_GIVEN_CAS = 1<<1, GNUTLS_VMETHOD_SYSTEM_CAS = 1 << 2
GNUTLS_VMETHOD_SYSTEM_CAS = 1<<2
} gnutls_vmethod_t; } gnutls_vmethod_t;
typedef enum typedef enum {
{ GNUTLS_CINPUT_TYPE_FILE = 0,
GNUTLS_CINPUT_TYPE_FILE = 0, GNUTLS_CINPUT_TYPE_MEM = 1,
GNUTLS_CINPUT_TYPE_MEM = 1, GNUTLS_CINPUT_TYPE_PIN_FUNC = 2,
GNUTLS_CINPUT_TYPE_PIN_FUNC = 2,
} gnutls_cinput_type_t; } gnutls_cinput_type_t;
typedef enum typedef enum {
{ GNUTLS_CINPUT_CAS = 1, /* i1 contains the CAs */
GNUTLS_CINPUT_CAS = 1, /* i1 contains the CAs */ GNUTLS_CINPUT_CRLS = 2, /* i1 contains the CRLs */
GNUTLS_CINPUT_CRLS = 2,/* i1 contains the CRLs */ GNUTLS_CINPUT_TOFU_DB = 3, /* i1 contains the DB filename */
GNUTLS_CINPUT_TOFU_DB = 3, /* i1 contains the DB filename */ GNUTLS_CINPUT_KEYPAIR = 4, /* i1 contains the certificate, i2 t
GNUTLS_CINPUT_KEYPAIR = 4, /* i1 contains the certificate, i2 the key he key
* or i1.pin_fn contains the pin function, * or i1.pin_fn contains the pin fun
* and i2.udata the user pointer */ ction,
* and i2.udata the user pointer */
} gnutls_cinput_contents_t; } gnutls_cinput_contents_t;
typedef struct gnutls_cinput_st { typedef struct gnutls_cinput_st {
gnutls_cinput_type_t type; gnutls_cinput_type_t type;
gnutls_cinput_contents_t contents; gnutls_cinput_contents_t contents;
gnutls_x509_crt_fmt_t fmt; /* if applicable */ gnutls_x509_crt_fmt_t fmt; /* if applicable */
union { union {
gnutls_pin_callback_t pin_fn; gnutls_pin_callback_t pin_fn;
const char* file; const char *file;
gnutls_datum_t mem; gnutls_datum_t mem;
} i1; } i1;
union { union {
void* udata; void *udata;
const char* file; const char *file;
gnutls_datum_t mem; gnutls_datum_t mem;
} i2; } i2;
unsigned long future_pad[8]; unsigned long future_pad[8];
} gnutls_cinput_st; } gnutls_cinput_st;
int xssl_cred_init (xssl_cred_t *c, unsigned vflags, int xssl_cred_init(xssl_cred_t * c, unsigned vflags,
gnutls_cinput_st* aux, gnutls_cinput_st * aux, unsigned aux_size);
unsigned aux_size); void xssl_cred_deinit(xssl_cred_t cred);
void xssl_cred_deinit (xssl_cred_t cred);
#endif /* GNUTLS_SBUF_H */ /* *INDENT-OFF* */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* GNUTLS_SBUF_H */
 End of changes. 20 change blocks. 
58 lines changed or deleted 58 lines changed or added

This html diff was produced by rfcdiff 1.41.The latest version is available from http://tools.ietf.org/tools/rfcdiff/