50 = security\templates
51 = system32\CatRoot
52 = system32\CatRoot2
-53 = system32\gnutls
.InfEnd
"modules/optional/vmx_svga.sys" 2 optional
"modules/optional/wine_gecko-2.34-x86.msi" 4 optional
"boot/bootdata/bootcdregtest/AHKAppTests.cmd" 7 optional
-"modules/optional/gnutls/libgcc_s_sjlj-1.dll" 53 optional
-"modules/optional/gnutls/libgmp-10.dll" 53 optional
-"modules/optional/gnutls/libgnutls-28.dll" 53 optional
-"modules/optional/gnutls/libgnutls-xssl-0.dll" 53 optional
-"modules/optional/gnutls/libhogweed-2-5.dll" 53 optional
-"modules/optional/gnutls/libnettle-4-7.dll" 53 optional
-"modules/optional/gnutls/libp11-kit-0.dll" 53 optional
-"modules/optional/gnutls/libwinpthread-1.dll" 53 optional
-"modules/optional/gnutls/zlib1.dll" 53 optional
; DON'T REMOVE THE FOLLOWING NEW LINE ! THIS MEANS YOU !
+++ /dev/null
-
-#pragma once
-
-#define typeof(_X) __typeof_ ## _X
-
-typedef gnutls_alert_description_t (__cdecl typeof(gnutls_alert_get))(gnutls_session_t session);
-typedef const char* (__cdecl typeof(gnutls_alert_get_name))(gnutls_alert_description_t alert);
-typedef void (__cdecl typeof(gnutls_certificate_free_credentials))(gnutls_certificate_credentials_t sc);
-typedef int (__cdecl typeof(gnutls_certificate_allocate_credentials))(gnutls_certificate_credentials_t
- * res);
-typedef const gnutls_datum_t* (__cdecl typeof(gnutls_certificate_get_peers))(gnutls_session_t
- session, unsigned int
- *list_size);
-typedef gnutls_cipher_algorithm_t (__cdecl typeof(gnutls_cipher_get))(gnutls_session_t session);
-typedef size_t (__cdecl typeof(gnutls_cipher_get_key_size))(gnutls_cipher_algorithm_t algorithm);
-typedef int (__cdecl typeof(gnutls_credentials_set))(gnutls_session_t session,
- gnutls_credentials_type_t type, void *cred);
-typedef void (__cdecl typeof(gnutls_deinit))(gnutls_session_t session);
-typedef int (__cdecl typeof(gnutls_global_init))(void);
-typedef void (__cdecl typeof(gnutls_global_deinit))(void);
-typedef void (__cdecl typeof(gnutls_global_set_log_function))(gnutls_log_func log_func);
-typedef void (__cdecl typeof(gnutls_global_set_log_level))(int level);
-typedef int (__cdecl typeof(gnutls_handshake))(gnutls_session_t session);
-typedef int (__cdecl typeof(gnutls_init))(gnutls_session_t * session, unsigned int flags);
-typedef gnutls_kx_algorithm_t (__cdecl typeof(gnutls_kx_get))(gnutls_session_t session);
-typedef gnutls_mac_algorithm_t (__cdecl typeof(gnutls_mac_get))(gnutls_session_t session);
-typedef size_t (__cdecl typeof(gnutls_mac_get_key_size))(gnutls_mac_algorithm_t algorithm);
-typedef void (__cdecl typeof(gnutls_perror))(int error);
-typedef gnutls_protocol_t (__cdecl typeof(gnutls_protocol_get_version))(gnutls_session_t session);
-typedef int (__cdecl typeof(gnutls_priority_set_direct))(gnutls_session_t session,
- const char *priorities,
- const char **err_pos);
-typedef size_t (__cdecl typeof(gnutls_record_get_max_size))(gnutls_session_t session);
-typedef ssize_t (__cdecl typeof(gnutls_record_recv))(gnutls_session_t session, void *data,
- size_t data_size);
-typedef ssize_t (__cdecl typeof(gnutls_record_send))(gnutls_session_t session, const void *data,
- size_t data_size);
-typedef int (__cdecl typeof(gnutls_server_name_set))(gnutls_session_t session,
- gnutls_server_name_type_t type,
- const void *name, size_t name_length);
-typedef gnutls_transport_ptr_t (__cdecl typeof(gnutls_transport_get_ptr))(gnutls_session_t session);
-typedef void (__cdecl typeof(gnutls_transport_set_errno))(gnutls_session_t session, int err);
-typedef void (__cdecl typeof(gnutls_transport_set_ptr))(gnutls_session_t session,
- gnutls_transport_ptr_t ptr);
-typedef void (__cdecl typeof(gnutls_transport_set_push_function))(gnutls_session_t session,
- gnutls_push_func push_func);
-typedef void (__cdecl typeof(gnutls_transport_set_pull_function))(gnutls_session_t session,
- gnutls_pull_func pull_func);
+++ /dev/null
-/*
- * GnuTLS-based implementation of the schannel (SSL/TLS) provider.
- *
- * Copyright 2005 Juan Lang
- * Copyright 2008 Henri Verbeet
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "precomp.h"
-
-#include <wine/config.h>
-#include <wine/port.h>
-#include <wine/library.h>
-#include <strsafe.h>
-
-#ifdef SONAME_LIBGNUTLS
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
-#endif
-
-#define __wine_dbch_secur32 __wine_dbch_schannel
-
-#if defined(SONAME_LIBGNUTLS) && !defined(HAVE_SECURITY_SECURITY_H) && !defined(SONAME_LIBMBEDTLS)
-
-static void *libgnutls_handle;
-
-#ifdef _MSC_VER
-#include "msvc_typeof_hack.h"
-#endif
-
-#define MAKE_FUNCPTR(f) static typeof(f) * p##f
-MAKE_FUNCPTR(gnutls_alert_get);
-MAKE_FUNCPTR(gnutls_alert_get_name);
-MAKE_FUNCPTR(gnutls_certificate_allocate_credentials);
-MAKE_FUNCPTR(gnutls_certificate_free_credentials);
-MAKE_FUNCPTR(gnutls_certificate_get_peers);
-MAKE_FUNCPTR(gnutls_cipher_get);
-MAKE_FUNCPTR(gnutls_cipher_get_key_size);
-MAKE_FUNCPTR(gnutls_credentials_set);
-MAKE_FUNCPTR(gnutls_deinit);
-MAKE_FUNCPTR(gnutls_global_deinit);
-MAKE_FUNCPTR(gnutls_global_init);
-MAKE_FUNCPTR(gnutls_global_set_log_function);
-MAKE_FUNCPTR(gnutls_global_set_log_level);
-MAKE_FUNCPTR(gnutls_handshake);
-MAKE_FUNCPTR(gnutls_init);
-MAKE_FUNCPTR(gnutls_kx_get);
-MAKE_FUNCPTR(gnutls_mac_get);
-MAKE_FUNCPTR(gnutls_mac_get_key_size);
-MAKE_FUNCPTR(gnutls_perror);
-MAKE_FUNCPTR(gnutls_protocol_get_version);
-MAKE_FUNCPTR(gnutls_priority_set_direct);
-MAKE_FUNCPTR(gnutls_record_get_max_size);
-MAKE_FUNCPTR(gnutls_record_recv);
-MAKE_FUNCPTR(gnutls_record_send);
-MAKE_FUNCPTR(gnutls_server_name_set);
-MAKE_FUNCPTR(gnutls_transport_get_ptr);
-MAKE_FUNCPTR(gnutls_transport_set_errno);
-MAKE_FUNCPTR(gnutls_transport_set_ptr);
-MAKE_FUNCPTR(gnutls_transport_set_pull_function);
-MAKE_FUNCPTR(gnutls_transport_set_push_function);
-#undef MAKE_FUNCPTR
-
-
-
-static ssize_t schan_pull_adapter(gnutls_transport_ptr_t transport,
- void *buff, size_t buff_len)
-{
- struct schan_transport *t = (struct schan_transport*)transport;
- gnutls_session_t s = (gnutls_session_t)schan_session_for_transport(t);
-
- int ret = schan_pull(transport, buff, &buff_len);
- if (ret)
- {
- pgnutls_transport_set_errno(s, ret);
- return -1;
- }
-
- return buff_len;
-}
-
-static ssize_t schan_push_adapter(gnutls_transport_ptr_t transport,
- const void *buff, size_t buff_len)
-{
- struct schan_transport *t = (struct schan_transport*)transport;
- gnutls_session_t s = (gnutls_session_t)schan_session_for_transport(t);
-
- int ret = schan_push(transport, buff, &buff_len);
- if (ret)
- {
- pgnutls_transport_set_errno(s, ret);
- return -1;
- }
-
- return buff_len;
-}
-
-static const struct {
- DWORD enable_flag;
- const char *gnutls_flag;
-} protocol_priority_flags[] = {
- {SP_PROT_TLS1_2_CLIENT, "VERS-TLS1.2"},
- {SP_PROT_TLS1_1_CLIENT, "VERS-TLS1.1"},
- {SP_PROT_TLS1_0_CLIENT, "VERS-TLS1.0"},
- {SP_PROT_SSL3_CLIENT, "VERS-SSL3.0"}
- /* {SP_PROT_SSL2_CLIENT} is not supported by GnuTLS */
-};
-
-DWORD schan_imp_enabled_protocols(void)
-{
- /* NOTE: No support for SSL 2.0 */
- return SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_2_CLIENT;
-}
-
-BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cred)
-{
- gnutls_session_t *s = (gnutls_session_t*)session;
- char priority[64] = "NORMAL", *p;
- unsigned i;
-
- int err = pgnutls_init(s, cred->credential_use == SECPKG_CRED_INBOUND ? GNUTLS_SERVER : GNUTLS_CLIENT);
- if (err != GNUTLS_E_SUCCESS)
- {
- pgnutls_perror(err);
- return FALSE;
- }
-
- p = priority + strlen(priority);
- for(i=0; i < sizeof(protocol_priority_flags)/sizeof(*protocol_priority_flags); i++) {
- *p++ = ':';
- *p++ = (cred->enabled_protocols & protocol_priority_flags[i].enable_flag) ? '+' : '-';
- strcpy(p, protocol_priority_flags[i].gnutls_flag);
- p += strlen(p);
- }
-
- TRACE("Using %s priority\n", debugstr_a(priority));
- err = pgnutls_priority_set_direct(*s, priority, NULL);
- if (err != GNUTLS_E_SUCCESS)
- {
- pgnutls_perror(err);
- pgnutls_deinit(*s);
- return FALSE;
- }
-
- err = pgnutls_credentials_set(*s, GNUTLS_CRD_CERTIFICATE,
- (gnutls_certificate_credentials_t)cred->credentials);
- if (err != GNUTLS_E_SUCCESS)
- {
- pgnutls_perror(err);
- pgnutls_deinit(*s);
- return FALSE;
- }
-
- pgnutls_transport_set_pull_function(*s, schan_pull_adapter);
- pgnutls_transport_set_push_function(*s, schan_push_adapter);
-
- return TRUE;
-}
-
-void schan_imp_dispose_session(schan_imp_session session)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- pgnutls_deinit(s);
-}
-
-void schan_imp_set_session_transport(schan_imp_session session,
- struct schan_transport *t)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- pgnutls_transport_set_ptr(s, (gnutls_transport_ptr_t)t);
-}
-
-void schan_imp_set_session_target(schan_imp_session session, const char *target)
-{
- gnutls_session_t s = (gnutls_session_t)session;
-
- pgnutls_server_name_set( s, GNUTLS_NAME_DNS, target, strlen(target) );
-}
-
-SECURITY_STATUS schan_imp_handshake(schan_imp_session session)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- int err;
-
- while(1) {
- err = pgnutls_handshake(s);
- switch(err) {
- case GNUTLS_E_SUCCESS:
- TRACE("Handshake completed\n");
- return SEC_E_OK;
-
- case GNUTLS_E_AGAIN:
- TRACE("Continue...\n");
- return SEC_I_CONTINUE_NEEDED;
-
- case GNUTLS_E_WARNING_ALERT_RECEIVED:
- {
- gnutls_alert_description_t alert = pgnutls_alert_get(s);
-
- WARN("WARNING ALERT: %d %s\n", alert, pgnutls_alert_get_name(alert));
-
- switch(alert) {
- case GNUTLS_A_UNRECOGNIZED_NAME:
- TRACE("Ignoring\n");
- continue;
- default:
- return SEC_E_INTERNAL_ERROR;
- }
- }
-
- case GNUTLS_E_FATAL_ALERT_RECEIVED:
- {
- gnutls_alert_description_t alert = pgnutls_alert_get(s);
- WARN("FATAL ALERT: %d %s\n", alert, pgnutls_alert_get_name(alert));
- return SEC_E_INTERNAL_ERROR;
- }
-
- default:
- pgnutls_perror(err);
- return SEC_E_INTERNAL_ERROR;
- }
- }
-
- /* Never reached */
- return SEC_E_OK;
-}
-
-static unsigned int schannel_get_cipher_block_size(gnutls_cipher_algorithm_t cipher)
-{
- const struct
- {
- gnutls_cipher_algorithm_t cipher;
- unsigned int block_size;
- }
- algorithms[] =
- {
- {GNUTLS_CIPHER_3DES_CBC, 8},
- {GNUTLS_CIPHER_AES_128_CBC, 16},
- {GNUTLS_CIPHER_AES_256_CBC, 16},
- {GNUTLS_CIPHER_ARCFOUR_128, 1},
- {GNUTLS_CIPHER_ARCFOUR_40, 1},
- {GNUTLS_CIPHER_DES_CBC, 8},
- {GNUTLS_CIPHER_NULL, 1},
- {GNUTLS_CIPHER_RC2_40_CBC, 8},
- };
- unsigned int i;
-
- for (i = 0; i < sizeof(algorithms) / sizeof(*algorithms); ++i)
- {
- if (algorithms[i].cipher == cipher)
- return algorithms[i].block_size;
- }
-
- FIXME("Unknown cipher %#x, returning 1\n", cipher);
-
- return 1;
-}
-
-static DWORD schannel_get_protocol(gnutls_protocol_t proto)
-{
- /* FIXME: currently schannel only implements client connections, but
- * there's no reason it couldn't be used for servers as well. The
- * context doesn't tell us which it is, so assume client for now.
- */
- switch (proto)
- {
- case GNUTLS_SSL3: return SP_PROT_SSL3_CLIENT;
- case GNUTLS_TLS1_0: return SP_PROT_TLS1_0_CLIENT;
- case GNUTLS_TLS1_1: return SP_PROT_TLS1_1_CLIENT;
- case GNUTLS_TLS1_2: return SP_PROT_TLS1_2_CLIENT;
- default:
- FIXME("unknown protocol %d\n", proto);
- return 0;
- }
-}
-
-static ALG_ID schannel_get_cipher_algid(gnutls_cipher_algorithm_t cipher)
-{
- switch (cipher)
- {
- case GNUTLS_CIPHER_UNKNOWN:
- case GNUTLS_CIPHER_NULL: return 0;
- case GNUTLS_CIPHER_ARCFOUR_40:
- case GNUTLS_CIPHER_ARCFOUR_128: return CALG_RC4;
- case GNUTLS_CIPHER_DES_CBC:
- case GNUTLS_CIPHER_3DES_CBC: return CALG_DES;
- case GNUTLS_CIPHER_AES_128_CBC:
- case GNUTLS_CIPHER_AES_256_CBC: return CALG_AES;
- case GNUTLS_CIPHER_RC2_40_CBC: return CALG_RC2;
- default:
- FIXME("unknown algorithm %d\n", cipher);
- return 0;
- }
-}
-
-static ALG_ID schannel_get_mac_algid(gnutls_mac_algorithm_t mac)
-{
- switch (mac)
- {
- case GNUTLS_MAC_UNKNOWN:
- case GNUTLS_MAC_NULL: return 0;
- case GNUTLS_MAC_MD5: return CALG_MD5;
- case GNUTLS_MAC_SHA1:
- case GNUTLS_MAC_SHA256:
- case GNUTLS_MAC_SHA384:
- case GNUTLS_MAC_SHA512: return CALG_SHA;
- default:
- FIXME("unknown algorithm %d\n", mac);
- return 0;
- }
-}
-
-static ALG_ID schannel_get_kx_algid(gnutls_kx_algorithm_t kx)
-{
- switch (kx)
- {
- case GNUTLS_KX_RSA: return CALG_RSA_KEYX;
- case GNUTLS_KX_DHE_DSS:
- case GNUTLS_KX_DHE_RSA: return CALG_DH_EPHEM;
- default:
- FIXME("unknown algorithm %d\n", kx);
- return 0;
- }
-}
-
-unsigned int schan_imp_get_session_cipher_block_size(schan_imp_session session)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- gnutls_cipher_algorithm_t cipher = pgnutls_cipher_get(s);
- return schannel_get_cipher_block_size(cipher);
-}
-
-unsigned int schan_imp_get_max_message_size(schan_imp_session session)
-{
- return pgnutls_record_get_max_size((gnutls_session_t)session);
-}
-
-SECURITY_STATUS schan_imp_get_connection_info(schan_imp_session session,
- SecPkgContext_ConnectionInfo *info)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- gnutls_protocol_t proto = pgnutls_protocol_get_version(s);
- gnutls_cipher_algorithm_t alg = pgnutls_cipher_get(s);
- gnutls_mac_algorithm_t mac = pgnutls_mac_get(s);
- gnutls_kx_algorithm_t kx = pgnutls_kx_get(s);
-
- info->dwProtocol = schannel_get_protocol(proto);
- info->aiCipher = schannel_get_cipher_algid(alg);
- info->dwCipherStrength = pgnutls_cipher_get_key_size(alg) * 8;
- info->aiHash = schannel_get_mac_algid(mac);
- info->dwHashStrength = pgnutls_mac_get_key_size(mac) * 8;
- info->aiExch = schannel_get_kx_algid(kx);
- /* FIXME: info->dwExchStrength? */
- info->dwExchStrength = 0;
- return SEC_E_OK;
-}
-
-SECURITY_STATUS schan_imp_get_session_peer_certificate(schan_imp_session session, HCERTSTORE store,
- PCCERT_CONTEXT *ret)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- PCCERT_CONTEXT cert = NULL;
- const gnutls_datum_t *datum;
- unsigned list_size, i;
- BOOL res;
-
- datum = pgnutls_certificate_get_peers(s, &list_size);
- if(!datum)
- return SEC_E_INTERNAL_ERROR;
-
- for(i = 0; i < list_size; i++) {
- res = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, datum[i].data, datum[i].size,
- CERT_STORE_ADD_REPLACE_EXISTING, i ? NULL : &cert);
- if(!res) {
- if(i)
- CertFreeCertificateContext(cert);
- return GetLastError();
- }
- }
-
- *ret = cert;
- return SEC_E_OK;
-}
-
-SECURITY_STATUS schan_imp_send(schan_imp_session session, const void *buffer,
- SIZE_T *length)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- ssize_t ret;
-
-again:
- ret = pgnutls_record_send(s, buffer, *length);
-
- if (ret >= 0)
- *length = ret;
- else if (ret == GNUTLS_E_AGAIN)
- {
- struct schan_transport *t = (struct schan_transport *)pgnutls_transport_get_ptr(s);
- SIZE_T count = 0;
-
- if (schan_get_buffer(t, &t->out, &count))
- goto again;
-
- return SEC_I_CONTINUE_NEEDED;
- }
- else
- {
- pgnutls_perror(ret);
- return SEC_E_INTERNAL_ERROR;
- }
-
- return SEC_E_OK;
-}
-
-SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer,
- SIZE_T *length)
-{
- gnutls_session_t s = (gnutls_session_t)session;
- ssize_t ret;
-
-again:
- ret = pgnutls_record_recv(s, buffer, *length);
-
- if (ret >= 0)
- *length = ret;
- else if (ret == GNUTLS_E_AGAIN)
- {
- struct schan_transport *t = (struct schan_transport *)pgnutls_transport_get_ptr(s);
- SIZE_T count = 0;
-
- if (schan_get_buffer(t, &t->in, &count))
- goto again;
-
- return SEC_I_CONTINUE_NEEDED;
- }
- else
- {
- pgnutls_perror(ret);
- return SEC_E_INTERNAL_ERROR;
- }
-
- return SEC_E_OK;
-}
-
-BOOL schan_imp_allocate_certificate_credentials(schan_credentials *c)
-{
- int ret = pgnutls_certificate_allocate_credentials((gnutls_certificate_credentials_t*)&c->credentials);
- if (ret != GNUTLS_E_SUCCESS)
- pgnutls_perror(ret);
- return (ret == GNUTLS_E_SUCCESS);
-}
-
-void schan_imp_free_certificate_credentials(schan_credentials *c)
-{
- pgnutls_certificate_free_credentials(c->credentials);
-}
-
-static void schan_gnutls_log(int level, const char *msg)
-{
- TRACE("<%d> %s", level, msg);
-}
-
-BOOL schan_imp_init(void)
-{
- int ret;
-
-#ifndef __REACTOS__
- libgnutls_handle = wine_dlopen(SONAME_LIBGNUTLS, RTLD_NOW, NULL, 0);
- if (!libgnutls_handle)
- {
- WARN("Failed to load libgnutls.\n");
- return FALSE;
- }
-
-#define LOAD_FUNCPTR(f) \
- if (!(p##f = wine_dlsym(libgnutls_handle, #f, NULL, 0))) \
- { \
- ERR("Failed to load %s\n", #f); \
- goto fail; \
- }
-#else
-/*
- static const WCHAR RosSchannelKey[] = L"Software\\ReactOS\\Schannel";
- static const WCHAR PathValue[] = L"GnuTLSPath";
- WCHAR Path[MAX_PATH];
- DWORD PathSize = sizeof(Path), ValueType;
- HKEY Key;
- DWORD Error;
-
- Error = RegOpenKeyW(HKEY_LOCAL_MACHINE, RosSchannelKey, &Key);
- if(Error != ERROR_SUCCESS)
- return FALSE;
-
- Error = RegQueryValueExW(Key, PathValue, NULL, &ValueType, (LPBYTE)Path, &PathSize);
- RegCloseKey(Key);
- if ((Error != ERROR_SUCCESS) || (ValueType != REG_SZ))
- return FALSE;
- wcscat(Path, L"\\");
- wcscat(Path, SONAME_LIBGNUTLS);
-*/
- WCHAR Path[MAX_PATH];
- DWORD PathSize = sizeof(Path);
- PathSize = GetSystemDirectoryW(Path, PathSize);
- if(!PathSize)
- return FALSE;
- wcscat(Path, L"\\");
- wcscat(Path, SONAME_LIBGNUTLS);
-
- libgnutls_handle = LoadLibraryExW(Path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
- if (!libgnutls_handle)
- {
- ERR("Could not load %S.\n", Path);
- return FALSE;
- }
-
-#define LOAD_FUNCPTR(f) \
- if (!(p##f = (void*)GetProcAddress(libgnutls_handle, #f))) \
- { \
- ERR("Failed to load %s\n", #f); \
- goto fail; \
- }
-#endif // __REACTOS__
-
- LOAD_FUNCPTR(gnutls_alert_get)
- LOAD_FUNCPTR(gnutls_alert_get_name)
- LOAD_FUNCPTR(gnutls_certificate_allocate_credentials)
- LOAD_FUNCPTR(gnutls_certificate_free_credentials)
- LOAD_FUNCPTR(gnutls_certificate_get_peers)
- LOAD_FUNCPTR(gnutls_cipher_get)
- LOAD_FUNCPTR(gnutls_cipher_get_key_size)
- LOAD_FUNCPTR(gnutls_credentials_set)
- LOAD_FUNCPTR(gnutls_deinit)
- LOAD_FUNCPTR(gnutls_global_deinit)
- LOAD_FUNCPTR(gnutls_global_init)
- LOAD_FUNCPTR(gnutls_global_set_log_function)
- LOAD_FUNCPTR(gnutls_global_set_log_level)
- LOAD_FUNCPTR(gnutls_handshake)
- LOAD_FUNCPTR(gnutls_init)
- LOAD_FUNCPTR(gnutls_kx_get)
- LOAD_FUNCPTR(gnutls_mac_get)
- LOAD_FUNCPTR(gnutls_mac_get_key_size)
- LOAD_FUNCPTR(gnutls_perror)
- LOAD_FUNCPTR(gnutls_protocol_get_version)
- LOAD_FUNCPTR(gnutls_priority_set_direct)
- LOAD_FUNCPTR(gnutls_record_get_max_size);
- LOAD_FUNCPTR(gnutls_record_recv);
- LOAD_FUNCPTR(gnutls_record_send);
- LOAD_FUNCPTR(gnutls_server_name_set)
- LOAD_FUNCPTR(gnutls_transport_get_ptr)
- LOAD_FUNCPTR(gnutls_transport_set_errno)
- LOAD_FUNCPTR(gnutls_transport_set_ptr)
- LOAD_FUNCPTR(gnutls_transport_set_pull_function)
- LOAD_FUNCPTR(gnutls_transport_set_push_function)
-#undef LOAD_FUNCPTR
-
- ret = pgnutls_global_init();
- if (ret != GNUTLS_E_SUCCESS)
- {
- pgnutls_perror(ret);
- goto fail;
- }
-
- if (TRACE_ON(secur32))
- {
- pgnutls_global_set_log_level(4);
- pgnutls_global_set_log_function(schan_gnutls_log);
- }
-
- return TRUE;
-
-fail:
-#ifndef __REACTOS__
- wine_dlclose(libgnutls_handle, NULL, 0);
-#else
- FreeLibrary(libgnutls_handle);
-#endif
- libgnutls_handle = NULL;
- return FALSE;
-}
-
-void schan_imp_deinit(void)
-{
- pgnutls_global_deinit();
-#ifndef __REACTOS__
- wine_dlclose(libgnutls_handle, NULL, 0);
-#else
- FreeLibrary(libgnutls_handle);
-#endif
- libgnutls_handle = NULL;
-}
-
-#endif /* SONAME_LIBGNUTLS && !HAVE_SECURITY_SECURITY_H && !SONAME_LIBMBEDTLS */
+++ /dev/null
-/* Definitions for GNU multiple precision functions. -*- mode: c -*-
-
-Copyright 1991, 1993-1997, 1999-2014 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-#ifndef __GMP_H__
-
-#if defined (__cplusplus)
-#include <iosfwd> /* for std::istream, std::ostream, std::string */
-#include <cstdio>
-#endif
-
-
-/* Instantiated by configure. */
-#if ! defined (__GMP_WITHIN_CONFIGURE)
-#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
-#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
-#define GMP_LIMB_BITS 32
-#define GMP_NAIL_BITS 0
-#endif
-#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
-#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
-#define GMP_NUMB_MAX GMP_NUMB_MASK
-#define GMP_NAIL_MASK (~ GMP_NUMB_MASK)
-
-
-/* The following (everything under ifndef __GNU_MP__) must be identical in
- gmp.h and mp.h to allow both to be included in an application or during
- the library build. */
-#ifndef __GNU_MP__
-#define __GNU_MP__ 5
-
-#include <stddef.h> /* for size_t */
-
-/* Instantiated by configure. */
-#if ! defined (__GMP_WITHIN_CONFIGURE)
-/* #undef _LONG_LONG_LIMB */
-#define __GMP_LIBGMP_DLL 1
-#endif
-
-
-/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
- all other circumstances.
-
- When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
- or when compiling for an application it's an import directive. The two
- cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
- (and not defined from an application).
-
- __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX
- indicates when building libgmpxx, and in that case libgmpxx functions are
- exports, but libgmp functions which might get called are imports.
-
- Libtool DLL_EXPORT define is not used.
-
- There's no attempt to support GMP built both static and DLL. Doing so
- would mean applications would have to tell us which of the two is going
- to be used when linking, and that seems very tedious and error prone if
- using GMP by hand, and equally tedious from a package since autoconf and
- automake don't give much help.
-
- __GMP_DECLSPEC is required on all documented global functions and
- variables, the various internals in gmp-impl.h etc can be left unadorned.
- But internals used by the test programs or speed measuring programs
- should have __GMP_DECLSPEC, and certainly constants or variables must
- have it or the wrong address will be resolved.
-
- In gcc __declspec can go at either the start or end of a prototype.
-
- In Microsoft C __declspec must go at the start, or after the type like
- void __declspec(...) *foo()". There's no __dllexport or anything to
- guard against someone foolish #defining dllexport. _export used to be
- available, but no longer.
-
- In Borland C _export still exists, but needs to go after the type, like
- "void _export foo();". Would have to change the __GMP_DECLSPEC syntax to
- make use of that. Probably more trouble than it's worth. */
-
-#if defined (__GNUC__)
-#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
-#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
-#endif
-#if defined (_MSC_VER) || defined (__BORLANDC__)
-#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
-#define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
-#endif
-#ifdef __WATCOMC__
-#define __GMP_DECLSPEC_EXPORT __export
-#define __GMP_DECLSPEC_IMPORT __import
-#endif
-#ifdef __IBMC__
-#define __GMP_DECLSPEC_EXPORT _Export
-#define __GMP_DECLSPEC_IMPORT _Import
-#endif
-
-#if __GMP_LIBGMP_DLL
-#ifdef __GMP_WITHIN_GMP
-/* compiling to go into a DLL libgmp */
-#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
-#else
-/* compiling to go into an application which will link to a DLL libgmp */
-#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
-#endif
-#else
-/* all other cases */
-#define __GMP_DECLSPEC
-#endif
-
-
-#ifdef __GMP_SHORT_LIMB
-typedef unsigned int mp_limb_t;
-typedef int mp_limb_signed_t;
-#else
-#ifdef _LONG_LONG_LIMB
-typedef unsigned long long int mp_limb_t;
-typedef long long int mp_limb_signed_t;
-#else
-typedef unsigned long int mp_limb_t;
-typedef long int mp_limb_signed_t;
-#endif
-#endif
-typedef unsigned long int mp_bitcnt_t;
-
-/* For reference, note that the name __mpz_struct gets into C++ mangled
- function names, which means although the "__" suggests an internal, we
- must leave this name for binary compatibility. */
-typedef struct
-{
- int _mp_alloc; /* Number of *limbs* allocated and pointed
- to by the _mp_d field. */
- int _mp_size; /* abs(_mp_size) is the number of limbs the
- last field points to. If _mp_size is
- negative this is a negative number. */
- mp_limb_t *_mp_d; /* Pointer to the limbs. */
-} __mpz_struct;
-
-#endif /* __GNU_MP__ */
-
-
-typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */
-typedef __mpz_struct mpz_t[1];
-
-typedef mp_limb_t * mp_ptr;
-typedef const mp_limb_t * mp_srcptr;
-#if defined (_CRAY) && ! defined (_CRAYMPP)
-/* plain `int' is much faster (48 bits) */
-#define __GMP_MP_SIZE_T_INT 1
-typedef int mp_size_t;
-typedef int mp_exp_t;
-#else
-#define __GMP_MP_SIZE_T_INT 0
-typedef long int mp_size_t;
-typedef long int mp_exp_t;
-#endif
-
-typedef struct
-{
- __mpz_struct _mp_num;
- __mpz_struct _mp_den;
-} __mpq_struct;
-
-typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */
-typedef __mpq_struct mpq_t[1];
-
-typedef struct
-{
- int _mp_prec; /* Max precision, in number of `mp_limb_t's.
- Set by mpf_init and modified by
- mpf_set_prec. The area pointed to by the
- _mp_d field contains `prec' + 1 limbs. */
- int _mp_size; /* abs(_mp_size) is the number of limbs the
- last field points to. If _mp_size is
- negative this is a negative number. */
- mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
- mp_limb_t *_mp_d; /* Pointer to the limbs. */
-} __mpf_struct;
-
-/* typedef __mpf_struct MP_FLOAT; */
-typedef __mpf_struct mpf_t[1];
-
-/* Available random number generation algorithms. */
-typedef enum
-{
- GMP_RAND_ALG_DEFAULT = 0,
- GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */
-} gmp_randalg_t;
-
-/* Random state struct. */
-typedef struct
-{
- mpz_t _mp_seed; /* _mp_d member points to state of the generator. */
- gmp_randalg_t _mp_alg; /* Currently unused. */
- union {
- void *_mp_lc; /* Pointer to function pointers structure. */
- } _mp_algdata;
-} __gmp_randstate_struct;
-typedef __gmp_randstate_struct gmp_randstate_t[1];
-
-/* Types for function declarations in gmp files. */
-/* ??? Should not pollute user name space with these ??? */
-typedef const __mpz_struct *mpz_srcptr;
-typedef __mpz_struct *mpz_ptr;
-typedef const __mpf_struct *mpf_srcptr;
-typedef __mpf_struct *mpf_ptr;
-typedef const __mpq_struct *mpq_srcptr;
-typedef __mpq_struct *mpq_ptr;
-
-
-/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
- section. */
-#if __GMP_LIBGMP_DLL
-#ifdef __GMP_WITHIN_GMPXX
-/* compiling to go into a DLL libgmpxx */
-#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
-#else
-/* compiling to go into a application which will link to a DLL libgmpxx */
-#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT
-#endif
-#else
-/* all other cases */
-#define __GMP_DECLSPEC_XX
-#endif
-
-
-#ifndef __MPN
-#define __MPN(x) __gmpn_##x
-#endif
-
-/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
- <iostream> defines EOF but not FILE. */
-#if defined (FILE) \
- || defined (H_STDIO) \
- || defined (_H_STDIO) /* AIX */ \
- || defined (_STDIO_H) /* glibc, Sun, SCO */ \
- || defined (_STDIO_H_) /* BSD, OSF */ \
- || defined (__STDIO_H) /* Borland */ \
- || defined (__STDIO_H__) /* IRIX */ \
- || defined (_STDIO_INCLUDED) /* HPUX */ \
- || defined (__dj_include_stdio_h_) /* DJGPP */ \
- || defined (_FILE_DEFINED) /* Microsoft */ \
- || defined (__STDIO__) /* Apple MPW MrC */ \
- || defined (_MSL_STDIO_H) /* Metrowerks */ \
- || defined (_STDIO_H_INCLUDED) /* QNX4 */ \
- || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
- || defined (__STDIO_LOADED) /* VMS */
-#define _GMP_H_HAVE_FILE 1
-#endif
-
-/* In ISO C, if a prototype involving "struct obstack *" is given without
- that structure defined, then the struct is scoped down to just the
- prototype, causing a conflict if it's subsequently defined for real. So
- only give prototypes if we've got obstack.h. */
-#if defined (_OBSTACK_H) /* glibc <obstack.h> */
-#define _GMP_H_HAVE_OBSTACK 1
-#endif
-
-/* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
- via an application having included <stdarg.h>. Usually va_list is a typedef
- so can't be tested directly, but C99 specifies that va_start is a macro.
-
- <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
- let's not bother trying to use that since it's not standard and since
- application uses for gmp_vprintf etc will almost certainly require the
- whole <stdarg.h> anyway. */
-
-#ifdef va_start
-#define _GMP_H_HAVE_VA_LIST 1
-#endif
-
-/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
-#if defined (__GNUC__) && defined (__GNUC_MINOR__)
-#define __GMP_GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-#define __GMP_GNUC_PREREQ(maj, min) 0
-#endif
-
-/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically
- it means a function does nothing but examine its arguments and memory
- (global or via arguments) to generate a return value, but changes nothing
- and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets
- tune/common.c etc turn this off when trying to write timing loops. */
-#if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
-#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-#define __GMP_ATTRIBUTE_PURE
-#endif
-
-
-/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
- to "g++ -Wold-style-cast".
-
- Casts in "extern inline" code within an extern "C" block don't induce
- these warnings, so __GMP_CAST only needs to be used on documented
- macros. */
-
-#ifdef __cplusplus
-#define __GMP_CAST(type, expr) (static_cast<type> (expr))
-#else
-#define __GMP_CAST(type, expr) ((type) (expr))
-#endif
-
-
-/* An empty "throw ()" means the function doesn't throw any C++ exceptions,
- this can save some stack frame info in applications.
-
- Currently it's given only on functions which never divide-by-zero etc,
- don't allocate memory, and are expected to never need to allocate memory.
- This leaves open the possibility of a C++ throw from a future GMP
- exceptions scheme.
-
- mpz_set_ui etc are omitted to leave open the lazy allocation scheme
- described in doc/tasks.html. mpz_get_d etc are omitted to leave open
- exceptions for float overflows.
-
- Note that __GMP_NOTHROW must be given on any inlines the same as on their
- prototypes (for g++ at least, where they're used together). Note also
- that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
- __GMP_ATTRIBUTE_PURE. */
-
-#if defined (__cplusplus)
-#define __GMP_NOTHROW throw ()
-#else
-#define __GMP_NOTHROW
-#endif
-
-
-/* PORTME: What other compilers have a useful "extern inline"? "static
- inline" would be an acceptable substitute if the compiler (or linker)
- discards unused statics. */
-
- /* gcc has __inline__ in all modes, including strict ansi. Give a prototype
- for an inline too, so as to correctly specify "dllimport" on windows, in
- case the function is called rather than inlined.
- GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
- inline semantics, unless -fgnu89-inline is used. */
-#ifdef __GNUC__
-#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) \
- || (defined __GNUC_GNU_INLINE__ && defined __cplusplus)
-#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
-#else
-#define __GMP_EXTERN_INLINE extern __inline__
-#endif
-#define __GMP_INLINE_PROTOTYPES 1
-#endif
-
-/* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
- strict ANSI mode. Inlining is done even when not optimizing (ie. -O0
- mode, which is the default), but an unnecessary local copy of foo is
- emitted unless -O is used. "extern __inline" is accepted, but the
- "extern" appears to be ignored, ie. it becomes a plain global function
- but which is inlined within its file. Don't know if all old versions of
- DEC C supported __inline, but as a start let's do the right thing for
- current versions. */
-#ifdef __DECC
-#define __GMP_EXTERN_INLINE static __inline
-#endif
-
-/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
- ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes
- place under -O. Without -O "foo" seems to be emitted whether it's used
- or not, which is wasteful. "extern inline foo()" isn't useful, the
- "extern" is apparently ignored, so foo is inlined if possible but also
- emitted as a global, which causes multiple definition errors when
- building a shared libgmp. */
-#ifdef __SCO_VERSION__
-#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
- && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE static inline
-#endif
-#endif
-
-/* Microsoft's C compiler accepts __inline */
-#ifdef _MSC_VER
-#define __GMP_EXTERN_INLINE __inline
-#endif
-
-/* Recent enough Sun C compilers want "inline" */
-#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \
- && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE inline
-#endif
-
-/* Somewhat older Sun C compilers want "static inline" */
-#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \
- && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE static inline
-#endif
-
-
-/* C++ always has "inline" and since it's a normal feature the linker should
- discard duplicate non-inlined copies, or if it doesn't then that's a
- problem for everyone, not just GMP. */
-#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE inline
-#endif
-
-/* Don't do any inlining within a configure run, since if the compiler ends
- up emitting copies of the code into the object file it can end up
- demanding the various support routines (like mpn_popcount) for linking,
- making the "alloca" test and perhaps others fail. And on hppa ia64 a
- pre-release gcc 3.2 was seen not respecting the "extern" in "extern
- __inline__", triggering this problem too. */
-#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
-#undef __GMP_EXTERN_INLINE
-#endif
-
-/* By default, don't give a prototype when there's going to be an inline
- version. Note in particular that Cray C++ objects to the combination of
- prototype and inline. */
-#ifdef __GMP_EXTERN_INLINE
-#ifndef __GMP_INLINE_PROTOTYPES
-#define __GMP_INLINE_PROTOTYPES 0
-#endif
-#else
-#define __GMP_INLINE_PROTOTYPES 1
-#endif
-
-
-#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
-#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
-
-/* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
- to int by "~". It still needs to have the promoted type. */
-#define __GMP_UINT_MAX (~ (unsigned) 0)
-#define __GMP_ULONG_MAX (~ (unsigned long) 0)
-#define __GMP_USHRT_MAX (0 + (unsigned short) ~0)
-
-
-/* __builtin_expect is in gcc 3.0, and not in 2.95. */
-#if __GMP_GNUC_PREREQ (3,0)
-#define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1)
-#define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0)
-#else
-#define __GMP_LIKELY(cond) (cond)
-#define __GMP_UNLIKELY(cond) (cond)
-#endif
-
-#ifdef _CRAY
-#define __GMP_CRAY_Pragma(str) _Pragma (str)
-#else
-#define __GMP_CRAY_Pragma(str)
-#endif
-
-
-/* Allow direct user access to numerator and denominator of a mpq_t object. */
-#define mpq_numref(Q) (&((Q)->_mp_num))
-#define mpq_denref(Q) (&((Q)->_mp_den))
-
-
-#if defined (__cplusplus)
-extern "C" {
-using std::FILE;
-#endif
-
-#define mp_set_memory_functions __gmp_set_memory_functions
-__GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
- void *(*) (void *, size_t, size_t),
- void (*) (void *, size_t)) __GMP_NOTHROW;
-
-#define mp_get_memory_functions __gmp_get_memory_functions
-__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
- void *(**) (void *, size_t, size_t),
- void (**) (void *, size_t)) __GMP_NOTHROW;
-
-#define mp_bits_per_limb __gmp_bits_per_limb
-__GMP_DECLSPEC extern const int mp_bits_per_limb;
-
-#define gmp_errno __gmp_errno
-__GMP_DECLSPEC extern int gmp_errno;
-
-#define gmp_version __gmp_version
-__GMP_DECLSPEC extern const char * const gmp_version;
-
-
-/**************** Random number routines. ****************/
-
-/* obsolete */
-#define gmp_randinit __gmp_randinit
-__GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...);
-
-#define gmp_randinit_default __gmp_randinit_default
-__GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t);
-
-#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
-__GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
-
-#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
-__GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t);
-
-#define gmp_randinit_mt __gmp_randinit_mt
-__GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t);
-
-#define gmp_randinit_set __gmp_randinit_set
-__GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *);
-
-#define gmp_randseed __gmp_randseed
-__GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr);
-
-#define gmp_randseed_ui __gmp_randseed_ui
-__GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
-
-#define gmp_randclear __gmp_randclear
-__GMP_DECLSPEC void gmp_randclear (gmp_randstate_t);
-
-#define gmp_urandomb_ui __gmp_urandomb_ui
-__GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long);
-
-#define gmp_urandomm_ui __gmp_urandomm_ui
-__GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long);
-
-
-/**************** Formatted output routines. ****************/
-
-#define gmp_asprintf __gmp_asprintf
-__GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...);
-
-#define gmp_fprintf __gmp_fprintf
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...);
-#endif
-
-#define gmp_obstack_printf __gmp_obstack_printf
-#if defined (_GMP_H_HAVE_OBSTACK)
-__GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...);
-#endif
-
-#define gmp_obstack_vprintf __gmp_obstack_vprintf
-#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list);
-#endif
-
-#define gmp_printf __gmp_printf
-__GMP_DECLSPEC int gmp_printf (const char *, ...);
-
-#define gmp_snprintf __gmp_snprintf
-__GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...);
-
-#define gmp_sprintf __gmp_sprintf
-__GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...);
-
-#define gmp_vasprintf __gmp_vasprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list);
-#endif
-
-#define gmp_vfprintf __gmp_vfprintf
-#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list);
-#endif
-
-#define gmp_vprintf __gmp_vprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vprintf (const char *, va_list);
-#endif
-
-#define gmp_vsnprintf __gmp_vsnprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list);
-#endif
-
-#define gmp_vsprintf __gmp_vsprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
-#endif
-
-
-/**************** Formatted input routines. ****************/
-
-#define gmp_fscanf __gmp_fscanf
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...);
-#endif
-
-#define gmp_scanf __gmp_scanf
-__GMP_DECLSPEC int gmp_scanf (const char *, ...);
-
-#define gmp_sscanf __gmp_sscanf
-__GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...);
-
-#define gmp_vfscanf __gmp_vfscanf
-#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list);
-#endif
-
-#define gmp_vscanf __gmp_vscanf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vscanf (const char *, va_list);
-#endif
-
-#define gmp_vsscanf __gmp_vsscanf
-#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
-#endif
-
-
-/**************** Integer (i.e. Z) routines. ****************/
-
-#define _mpz_realloc __gmpz_realloc
-#define mpz_realloc __gmpz_realloc
-__GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t);
-
-#define mpz_abs __gmpz_abs
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
-__GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr);
-#endif
-
-#define mpz_add __gmpz_add
-__GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_add_ui __gmpz_add_ui
-__GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_addmul __gmpz_addmul
-__GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_addmul_ui __gmpz_addmul_ui
-__GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_and __gmpz_and
-__GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_array_init __gmpz_array_init
-__GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t);
-
-#define mpz_bin_ui __gmpz_bin_ui
-__GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_bin_uiui __gmpz_bin_uiui
-__GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int);
-
-#define mpz_cdiv_q __gmpz_cdiv_q
-__GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
-__GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_cdiv_qr __gmpz_cdiv_qr
-__GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_cdiv_r __gmpz_cdiv_r
-__GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
-__GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_cdiv_ui __gmpz_cdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_clear __gmpz_clear
-__GMP_DECLSPEC void mpz_clear (mpz_ptr);
-
-#define mpz_clears __gmpz_clears
-__GMP_DECLSPEC void mpz_clears (mpz_ptr, ...);
-
-#define mpz_clrbit __gmpz_clrbit
-__GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_cmp __gmpz_cmp
-__GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmp_d __gmpz_cmp_d
-__GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
-
-#define _mpz_cmp_si __gmpz_cmp_si
-__GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define _mpz_cmp_ui __gmpz_cmp_ui
-__GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs __gmpz_cmpabs
-__GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs_d __gmpz_cmpabs_d
-__GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs_ui __gmpz_cmpabs_ui
-__GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_com __gmpz_com
-__GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr);
-
-#define mpz_combit __gmpz_combit
-__GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_congruent_p __gmpz_congruent_p
-__GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
-__GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_congruent_ui_p __gmpz_congruent_ui_p
-__GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divexact __gmpz_divexact
-__GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_divexact_ui __gmpz_divexact_ui
-__GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long);
-
-#define mpz_divisible_p __gmpz_divisible_p
-__GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divisible_ui_p __gmpz_divisible_ui_p
-__GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
-__GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_dump __gmpz_dump
-__GMP_DECLSPEC void mpz_dump (mpz_srcptr);
-
-#define mpz_export __gmpz_export
-__GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
-
-#define mpz_fac_ui __gmpz_fac_ui
-__GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int);
-
-#define mpz_2fac_ui __gmpz_2fac_ui
-__GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int);
-
-#define mpz_mfac_uiui __gmpz_mfac_uiui
-__GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int);
-
-#define mpz_primorial_ui __gmpz_primorial_ui
-__GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int);
-
-#define mpz_fdiv_q __gmpz_fdiv_q
-__GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
-__GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_fdiv_qr __gmpz_fdiv_qr
-__GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_fdiv_r __gmpz_fdiv_r
-__GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
-__GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_fdiv_ui __gmpz_fdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fib_ui __gmpz_fib_ui
-__GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int);
-
-#define mpz_fib2_ui __gmpz_fib2_ui
-__GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int);
-
-#define mpz_fits_sint_p __gmpz_fits_sint_p
-__GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_slong_p __gmpz_fits_slong_p
-__GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_sshort_p __gmpz_fits_sshort_p
-__GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_uint_p __gmpz_fits_uint_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
-__GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_fits_ulong_p __gmpz_fits_ulong_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
-__GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_fits_ushort_p __gmpz_fits_ushort_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
-__GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_gcd __gmpz_gcd
-__GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_gcd_ui __gmpz_gcd_ui
-__GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_gcdext __gmpz_gcdext
-__GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_get_d __gmpz_get_d
-__GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_get_d_2exp __gmpz_get_d_2exp
-__GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr);
-
-#define mpz_get_si __gmpz_get_si
-__GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_get_str __gmpz_get_str
-__GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr);
-
-#define mpz_get_ui __gmpz_get_ui
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
-__GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_getlimbn __gmpz_getlimbn
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
-__GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_hamdist __gmpz_hamdist
-__GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_import __gmpz_import
-__GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
-
-#define mpz_init __gmpz_init
-__GMP_DECLSPEC void mpz_init (mpz_ptr);
-
-#define mpz_init2 __gmpz_init2
-__GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_inits __gmpz_inits
-__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...);
-
-#define mpz_init_set __gmpz_init_set
-__GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
-
-#define mpz_init_set_d __gmpz_init_set_d
-__GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double);
-
-#define mpz_init_set_si __gmpz_init_set_si
-__GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int);
-
-#define mpz_init_set_str __gmpz_init_set_str
-__GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int);
-
-#define mpz_init_set_ui __gmpz_init_set_ui
-__GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int);
-
-#define mpz_inp_raw __gmpz_inp_raw
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *);
-#endif
-
-#define mpz_inp_str __gmpz_inp_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int);
-#endif
-
-#define mpz_invert __gmpz_invert
-__GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_ior __gmpz_ior
-__GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_jacobi __gmpz_jacobi
-__GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_kronecker mpz_jacobi /* alias */
-
-#define mpz_kronecker_si __gmpz_kronecker_si
-__GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_kronecker_ui __gmpz_kronecker_ui
-__GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_si_kronecker __gmpz_si_kronecker
-__GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_ui_kronecker __gmpz_ui_kronecker
-__GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_lcm __gmpz_lcm
-__GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_lcm_ui __gmpz_lcm_ui
-__GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long);
-
-#define mpz_legendre mpz_jacobi /* alias */
-
-#define mpz_lucnum_ui __gmpz_lucnum_ui
-__GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int);
-
-#define mpz_lucnum2_ui __gmpz_lucnum2_ui
-__GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int);
-
-#define mpz_millerrabin __gmpz_millerrabin
-__GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_mod __gmpz_mod
-__GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
-
-#define mpz_mul __gmpz_mul
-__GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_mul_2exp __gmpz_mul_2exp
-__GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_mul_si __gmpz_mul_si
-__GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int);
-
-#define mpz_mul_ui __gmpz_mul_ui
-__GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_neg __gmpz_neg
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
-__GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr);
-#endif
-
-#define mpz_nextprime __gmpz_nextprime
-__GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr);
-
-#define mpz_out_raw __gmpz_out_raw
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr);
-#endif
-
-#define mpz_out_str __gmpz_out_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr);
-#endif
-
-#define mpz_perfect_power_p __gmpz_perfect_power_p
-__GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_perfect_square_p __gmpz_perfect_square_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
-__GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_popcount __gmpz_popcount
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_pow_ui __gmpz_pow_ui
-__GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_powm __gmpz_powm
-__GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_powm_sec __gmpz_powm_sec
-__GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_powm_ui __gmpz_powm_ui
-__GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr);
-
-#define mpz_probab_prime_p __gmpz_probab_prime_p
-__GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_random __gmpz_random
-__GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t);
-
-#define mpz_random2 __gmpz_random2
-__GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t);
-
-#define mpz_realloc2 __gmpz_realloc2
-__GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_remove __gmpz_remove
-__GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_root __gmpz_root
-__GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_rootrem __gmpz_rootrem
-__GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_rrandomb __gmpz_rrandomb
-__GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
-
-#define mpz_scan0 __gmpz_scan0
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_scan1 __gmpz_scan1
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_set __gmpz_set
-__GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr);
-
-#define mpz_set_d __gmpz_set_d
-__GMP_DECLSPEC void mpz_set_d (mpz_ptr, double);
-
-#define mpz_set_f __gmpz_set_f
-__GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr);
-
-#define mpz_set_q __gmpz_set_q
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
-__GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
-#endif
-
-#define mpz_set_si __gmpz_set_si
-__GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
-
-#define mpz_set_str __gmpz_set_str
-__GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int);
-
-#define mpz_set_ui __gmpz_set_ui
-__GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int);
-
-#define mpz_setbit __gmpz_setbit
-__GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_size __gmpz_size
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
-__GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_sizeinbase __gmpz_sizeinbase
-__GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_sqrt __gmpz_sqrt
-__GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr);
-
-#define mpz_sqrtrem __gmpz_sqrtrem
-__GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr);
-
-#define mpz_sub __gmpz_sub
-__GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_sub_ui __gmpz_sub_ui
-__GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_ui_sub __gmpz_ui_sub
-__GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr);
-
-#define mpz_submul __gmpz_submul
-__GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_submul_ui __gmpz_submul_ui
-__GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_swap __gmpz_swap
-__GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW;
-
-#define mpz_tdiv_ui __gmpz_tdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_tdiv_q __gmpz_tdiv_q
-__GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
-__GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_tdiv_qr __gmpz_tdiv_qr
-__GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_tdiv_r __gmpz_tdiv_r
-__GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
-__GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
-
-#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
-
-#define mpz_tstbit __gmpz_tstbit
-__GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_ui_pow_ui __gmpz_ui_pow_ui
-__GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int);
-
-#define mpz_urandomb __gmpz_urandomb
-__GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
-
-#define mpz_urandomm __gmpz_urandomm
-__GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
-
-#define mpz_xor __gmpz_xor
-#define mpz_eor __gmpz_xor
-__GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_limbs_read __gmpz_limbs_read
-__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
-
-#define mpz_limbs_write __gmpz_limbs_write
-__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
-
-#define mpz_limbs_modify __gmpz_limbs_modify
-__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
-
-#define mpz_limbs_finish __gmpz_limbs_finish
-__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
-
-#define mpz_roinit_n __gmpz_roinit_n
-__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
-
-#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
-
-/**************** Rational (i.e. Q) routines. ****************/
-
-#define mpq_abs __gmpq_abs
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
-__GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr);
-#endif
-
-#define mpq_add __gmpq_add
-__GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-#define mpq_canonicalize __gmpq_canonicalize
-__GMP_DECLSPEC void mpq_canonicalize (mpq_ptr);
-
-#define mpq_clear __gmpq_clear
-__GMP_DECLSPEC void mpq_clear (mpq_ptr);
-
-#define mpq_clears __gmpq_clears
-__GMP_DECLSPEC void mpq_clears (mpq_ptr, ...);
-
-#define mpq_cmp __gmpq_cmp
-__GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define _mpq_cmp_si __gmpq_cmp_si
-__GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE;
-
-#define _mpq_cmp_ui __gmpq_cmp_ui
-__GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
-
-#define mpq_div __gmpq_div
-__GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-#define mpq_div_2exp __gmpq_div_2exp
-__GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
-
-#define mpq_equal __gmpq_equal
-__GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpq_get_num __gmpq_get_num
-__GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr);
-
-#define mpq_get_den __gmpq_get_den
-__GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr);
-
-#define mpq_get_d __gmpq_get_d
-__GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpq_get_str __gmpq_get_str
-__GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr);
-
-#define mpq_init __gmpq_init
-__GMP_DECLSPEC void mpq_init (mpq_ptr);
-
-#define mpq_inits __gmpq_inits
-__GMP_DECLSPEC void mpq_inits (mpq_ptr, ...);
-
-#define mpq_inp_str __gmpq_inp_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int);
-#endif
-
-#define mpq_inv __gmpq_inv
-__GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr);
-
-#define mpq_mul __gmpq_mul
-__GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-#define mpq_mul_2exp __gmpq_mul_2exp
-__GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
-
-#define mpq_neg __gmpq_neg
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
-__GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr);
-#endif
-
-#define mpq_out_str __gmpq_out_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr);
-#endif
-
-#define mpq_set __gmpq_set
-__GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr);
-
-#define mpq_set_d __gmpq_set_d
-__GMP_DECLSPEC void mpq_set_d (mpq_ptr, double);
-
-#define mpq_set_den __gmpq_set_den
-__GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr);
-
-#define mpq_set_f __gmpq_set_f
-__GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr);
-
-#define mpq_set_num __gmpq_set_num
-__GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr);
-
-#define mpq_set_si __gmpq_set_si
-__GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int);
-
-#define mpq_set_str __gmpq_set_str
-__GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int);
-
-#define mpq_set_ui __gmpq_set_ui
-__GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int);
-
-#define mpq_set_z __gmpq_set_z
-__GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr);
-
-#define mpq_sub __gmpq_sub
-__GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-#define mpq_swap __gmpq_swap
-__GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW;
-
-
-/**************** Float (i.e. F) routines. ****************/
-
-#define mpf_abs __gmpf_abs
-__GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr);
-
-#define mpf_add __gmpf_add
-__GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
-
-#define mpf_add_ui __gmpf_add_ui
-__GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int);
-#define mpf_ceil __gmpf_ceil
-__GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr);
-
-#define mpf_clear __gmpf_clear
-__GMP_DECLSPEC void mpf_clear (mpf_ptr);
-
-#define mpf_clears __gmpf_clears
-__GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
-
-#define mpf_cmp __gmpf_cmp
-__GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_d __gmpf_cmp_d
-__GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_si __gmpf_cmp_si
-__GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_ui __gmpf_cmp_ui
-__GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_div __gmpf_div
-__GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr);
-
-#define mpf_div_2exp __gmpf_div_2exp
-__GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
-
-#define mpf_div_ui __gmpf_div_ui
-__GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int);
-
-#define mpf_dump __gmpf_dump
-__GMP_DECLSPEC void mpf_dump (mpf_srcptr);
-
-#define mpf_eq __gmpf_eq
-__GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_sint_p __gmpf_fits_sint_p
-__GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_slong_p __gmpf_fits_slong_p
-__GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_sshort_p __gmpf_fits_sshort_p
-__GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_uint_p __gmpf_fits_uint_p
-__GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_ulong_p __gmpf_fits_ulong_p
-__GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_ushort_p __gmpf_fits_ushort_p
-__GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_floor __gmpf_floor
-__GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr);
-
-#define mpf_get_d __gmpf_get_d
-__GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_d_2exp __gmpf_get_d_2exp
-__GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr);
-
-#define mpf_get_default_prec __gmpf_get_default_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_prec __gmpf_get_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_si __gmpf_get_si
-__GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_str __gmpf_get_str
-__GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr);
-
-#define mpf_get_ui __gmpf_get_ui
-__GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_init __gmpf_init
-__GMP_DECLSPEC void mpf_init (mpf_ptr);
-
-#define mpf_init2 __gmpf_init2
-__GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t);
-
-#define mpf_inits __gmpf_inits
-__GMP_DECLSPEC void mpf_inits (mpf_ptr, ...);
-
-#define mpf_init_set __gmpf_init_set
-__GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr);
-
-#define mpf_init_set_d __gmpf_init_set_d
-__GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double);
-
-#define mpf_init_set_si __gmpf_init_set_si
-__GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int);
-
-#define mpf_init_set_str __gmpf_init_set_str
-__GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int);
-
-#define mpf_init_set_ui __gmpf_init_set_ui
-__GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int);
-
-#define mpf_inp_str __gmpf_inp_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int);
-#endif
-
-#define mpf_integer_p __gmpf_integer_p
-__GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_mul __gmpf_mul
-__GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr);
-
-#define mpf_mul_2exp __gmpf_mul_2exp
-__GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
-
-#define mpf_mul_ui __gmpf_mul_ui
-__GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int);
-
-#define mpf_neg __gmpf_neg
-__GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr);
-
-#define mpf_out_str __gmpf_out_str
-#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr);
-#endif
-
-#define mpf_pow_ui __gmpf_pow_ui
-__GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int);
-
-#define mpf_random2 __gmpf_random2
-__GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t);
-
-#define mpf_reldiff __gmpf_reldiff
-__GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr);
-
-#define mpf_set __gmpf_set
-__GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr);
-
-#define mpf_set_d __gmpf_set_d
-__GMP_DECLSPEC void mpf_set_d (mpf_ptr, double);
-
-#define mpf_set_default_prec __gmpf_set_default_prec
-__GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW;
-
-#define mpf_set_prec __gmpf_set_prec
-__GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t);
-
-#define mpf_set_prec_raw __gmpf_set_prec_raw
-__GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
-
-#define mpf_set_q __gmpf_set_q
-__GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr);
-
-#define mpf_set_si __gmpf_set_si
-__GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int);
-
-#define mpf_set_str __gmpf_set_str
-__GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int);
-
-#define mpf_set_ui __gmpf_set_ui
-__GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int);
-
-#define mpf_set_z __gmpf_set_z
-__GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr);
-
-#define mpf_size __gmpf_size
-__GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_sqrt __gmpf_sqrt
-__GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr);
-
-#define mpf_sqrt_ui __gmpf_sqrt_ui
-__GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int);
-
-#define mpf_sub __gmpf_sub
-__GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
-
-#define mpf_sub_ui __gmpf_sub_ui
-__GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int);
-
-#define mpf_swap __gmpf_swap
-__GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW;
-
-#define mpf_trunc __gmpf_trunc
-__GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr);
-
-#define mpf_ui_div __gmpf_ui_div
-__GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr);
-
-#define mpf_ui_sub __gmpf_ui_sub
-__GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr);
-
-#define mpf_urandomb __gmpf_urandomb
-__GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
-
-
-/************ Low level positive-integer (i.e. N) routines. ************/
-
-/* This is ugly, but we need to make user calls reach the prefixed function. */
-
-#define mpn_add __MPN(add)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
-__GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-#endif
-
-#define mpn_add_1 __MPN(add_1)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
-#endif
-
-#define mpn_add_n __MPN(add_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_addmul_1 __MPN(addmul_1)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_cmp __MPN(cmp)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
-__GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpn_divexact_by3(dst,src,size) \
- mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
-
-#define mpn_divexact_by3c __MPN(divexact_by3c)
-__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_divmod_1(qp,np,nsize,dlimb) \
- mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
-
-#define mpn_divrem __MPN(divrem)
-__GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_divrem_1 __MPN(divrem_1)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_divrem_2 __MPN(divrem_2)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
-
-#define mpn_div_qr_1 __MPN(div_qr_1)
-__GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_div_qr_2 __MPN(div_qr_2)
-__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-#define mpn_gcd __MPN(gcd)
-__GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-
-#define mpn_gcd_1 __MPN(gcd_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_gcdext_1 __MPN(gcdext_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
-
-#define mpn_gcdext __MPN(gcdext)
-__GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-
-#define mpn_get_str __MPN(get_str)
-__GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
-
-#define mpn_hamdist __MPN(hamdist)
-__GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpn_lshift __MPN(lshift)
-__GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-
-#define mpn_mod_1 __MPN(mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_mul __MPN(mul)
-__GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_mul_1 __MPN(mul_1)
-__GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_mul_n __MPN(mul_n)
-__GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_sqr __MPN(sqr)
-__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
-
-#define mpn_neg __MPN(neg)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
-__GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-
-#define mpn_com __MPN(com)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_com)
-__GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-
-#define mpn_perfect_square_p __MPN(perfect_square_p)
-__GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_perfect_power_p __MPN(perfect_power_p)
-__GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_popcount __MPN(popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpn_pow_1 __MPN(pow_1)
-__GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-
-/* undocumented now, but retained here for upward compatibility */
-#define mpn_preinv_mod_1 __MPN(preinv_mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_random __MPN(random)
-__GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t);
-
-#define mpn_random2 __MPN(random2)
-__GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t);
-
-#define mpn_rshift __MPN(rshift)
-__GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-
-#define mpn_scan0 __MPN(scan0)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_scan1 __MPN(scan1)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_set_str __MPN(set_str)
-__GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
-
-#define mpn_sizeinbase __MPN(sizeinbase)
-__GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
-
-#define mpn_sqrtrem __MPN(sqrtrem)
-__GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
-
-#define mpn_sub __MPN(sub)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
-__GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-#endif
-
-#define mpn_sub_1 __MPN(sub_1)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
-#endif
-
-#define mpn_sub_n __MPN(sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_submul_1 __MPN(submul_1)
-__GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_tdiv_qr __MPN(tdiv_qr)
-__GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_and_n __MPN(and_n)
-__GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_andn_n __MPN(andn_n)
-__GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_nand_n __MPN(nand_n)
-__GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_ior_n __MPN(ior_n)
-__GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_iorn_n __MPN(iorn_n)
-__GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_nior_n __MPN(nior_n)
-__GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_xor_n __MPN(xor_n)
-__GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_xnor_n __MPN(xnor_n)
-__GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_copyi __MPN(copyi)
-__GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
-#define mpn_copyd __MPN(copyd)
-__GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
-#define mpn_zero __MPN(zero)
-__GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
-
-#define mpn_cnd_add_n __MPN(cnd_add_n)
-__GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_cnd_sub_n __MPN(cnd_sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_sec_add_1 __MPN(sec_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-#define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_sub_1 __MPN(sec_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-#define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_mul __MPN(sec_mul)
-__GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sec_mul_itch __MPN(sec_mul_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_sqr __MPN(sec_sqr)
-__GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sec_sqr_itch __MPN(sec_sqr_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_powm __MPN(sec_powm)
-__GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sec_powm_itch __MPN(sec_powm_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_tabselect __MPN(sec_tabselect)
-__GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
-
-#define mpn_sec_div_qr __MPN(sec_div_qr)
-__GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
-#define mpn_sec_div_r __MPN(sec_div_r)
-__GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sec_div_r_itch __MPN(sec_div_r_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_sec_invert __MPN(sec_invert)
-__GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr);
-#define mpn_sec_invert_itch __MPN(sec_invert_itch)
-__GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-
-/**************** mpz inlines ****************/
-
-/* The following are provided as inlines where possible, but always exist as
- library functions too, for binary compatibility.
-
- Within gmp itself this inlining generally isn't relied on, since it
- doesn't get done for all compilers, whereas if something is worth
- inlining then it's worth arranging always.
-
- There are two styles of inlining here. When the same bit of code is
- wanted for the inline as for the library version, then __GMP_FORCE_foo
- arranges for that code to be emitted and the __GMP_EXTERN_INLINE
- directive suppressed, eg. mpz_fits_uint_p. When a different bit of code
- is wanted for the inline than for the library version, then
- __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
-__GMP_EXTERN_INLINE void
-mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
-{
- if (__gmp_w != __gmp_u)
- mpz_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
-}
-#endif
-
-#if GMP_NAIL_BITS == 0
-#define __GMPZ_FITS_UTYPE_P(z,maxval) \
- mp_size_t __gmp_n = z->_mp_size; \
- mp_ptr __gmp_p = z->_mp_d; \
- return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
-#else
-#define __GMPZ_FITS_UTYPE_P(z,maxval) \
- mp_size_t __gmp_n = z->_mp_size; \
- mp_ptr __gmp_p = z->_mp_d; \
- return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \
- || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
-#if ! defined (__GMP_FORCE_mpz_fits_uint_p)
-__GMP_EXTERN_INLINE
-#endif
-int
-mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
-{
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX);
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
-#if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
-__GMP_EXTERN_INLINE
-#endif
-int
-mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
-{
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX);
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
-#if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
-__GMP_EXTERN_INLINE
-#endif
-int
-mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
-{
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX);
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
-#if ! defined (__GMP_FORCE_mpz_get_ui)
-__GMP_EXTERN_INLINE
-#endif
-unsigned long
-mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
-{
- mp_ptr __gmp_p = __gmp_z->_mp_d;
- mp_size_t __gmp_n = __gmp_z->_mp_size;
- mp_limb_t __gmp_l = __gmp_p[0];
- /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
- about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
- C++ 6.0 warnings about condition always true for something like
- "__GMP_ULONG_MAX < GMP_NUMB_MASK". */
-#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
- /* limb==long and no nails, or limb==longlong, one limb is enough */
- return (__gmp_n != 0 ? __gmp_l : 0);
-#else
- /* limb==long and nails, need two limbs when available */
- __gmp_n = __GMP_ABS (__gmp_n);
- if (__gmp_n <= 1)
- return (__gmp_n != 0 ? __gmp_l : 0);
- else
- return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS);
-#endif
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
-#if ! defined (__GMP_FORCE_mpz_getlimbn)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
-{
- mp_limb_t __gmp_result = 0;
- if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
- __gmp_result = __gmp_z->_mp_d[__gmp_n];
- return __gmp_result;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
-__GMP_EXTERN_INLINE void
-mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
-{
- if (__gmp_w != __gmp_u)
- mpz_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_size = - __gmp_w->_mp_size;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
-#if ! defined (__GMP_FORCE_mpz_perfect_square_p)
-__GMP_EXTERN_INLINE
-#endif
-int
-mpz_perfect_square_p (mpz_srcptr __gmp_a)
-{
- mp_size_t __gmp_asize;
- int __gmp_result;
-
- __gmp_asize = __gmp_a->_mp_size;
- __gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */
- if (__GMP_LIKELY (__gmp_asize > 0))
- __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
- return __gmp_result;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
-#if ! defined (__GMP_FORCE_mpz_popcount)
-__GMP_EXTERN_INLINE
-#endif
-mp_bitcnt_t
-mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
-{
- mp_size_t __gmp_usize;
- mp_bitcnt_t __gmp_result;
-
- __gmp_usize = __gmp_u->_mp_size;
- __gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0);
- if (__GMP_LIKELY (__gmp_usize > 0))
- __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
- return __gmp_result;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
-#if ! defined (__GMP_FORCE_mpz_set_q)
-__GMP_EXTERN_INLINE
-#endif
-void
-mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
-{
- mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
-#if ! defined (__GMP_FORCE_mpz_size)
-__GMP_EXTERN_INLINE
-#endif
-size_t
-mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
-{
- return __GMP_ABS (__gmp_z->_mp_size);
-}
-#endif
-
-
-/**************** mpq inlines ****************/
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
-__GMP_EXTERN_INLINE void
-mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
-{
- if (__gmp_w != __gmp_u)
- mpq_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
-__GMP_EXTERN_INLINE void
-mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
-{
- if (__gmp_w != __gmp_u)
- mpq_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
-}
-#endif
-
-
-/**************** mpn inlines ****************/
-
-/* The comments with __GMPN_ADD_1 below apply here too.
-
- The test for FUNCTION returning 0 should predict well. If it's assumed
- {yp,ysize} will usually have a random number of bits then the high limb
- won't be full and a carry out will occur a good deal less than 50% of the
- time.
-
- ysize==0 isn't a documented feature, but is used internally in a few
- places.
-
- Producing cout last stops it using up a register during the main part of
- the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
- doesn't seem able to move the true and false legs of the conditional up
- to the two places cout is generated. */
-
-#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x; \
- \
- /* ASSERT ((ysize) >= 0); */ \
- /* ASSERT ((xsize) >= (ysize)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \
- \
- __gmp_i = (ysize); \
- if (__gmp_i != 0) \
- { \
- if (FUNCTION (wp, xp, yp, __gmp_i)) \
- { \
- do \
- { \
- if (__gmp_i >= (xsize)) \
- { \
- (cout) = 1; \
- goto __gmp_done; \
- } \
- __gmp_x = (xp)[__gmp_i]; \
- } \
- while (TEST); \
- } \
- } \
- if ((wp) != (xp)) \
- __GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \
- (cout) = 0; \
- __gmp_done: \
- ; \
- } while (0)
-
-#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \
- __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \
- (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
-#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \
- __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \
- (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
-
-
-/* The use of __gmp_i indexing is designed to ensure a compile time src==dst
- remains nice and clear to the compiler, so that __GMPN_COPY_REST can
- disappear, and the load/add/store gets a chance to become a
- read-modify-write on CISC CPUs.
-
- Alternatives:
-
- Using a pair of pointers instead of indexing would be possible, but gcc
- isn't able to recognise compile-time src==dst in that case, even when the
- pointers are incremented more or less together. Other compilers would
- very likely have similar difficulty.
-
- gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
- similar to detect a compile-time src==dst. This works nicely on gcc
- 2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
- to be always false, for a pointer p. But the current code form seems
- good enough for src==dst anyway.
-
- gcc on x86 as usual doesn't give particularly good flags handling for the
- carry/borrow detection. It's tempting to want some multi instruction asm
- blocks to help it, and this was tried, but in truth there's only a few
- instructions to save and any gain is all too easily lost by register
- juggling setting up for the asm. */
-
-#if GMP_NAIL_BITS == 0
-#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_r; \
- \
- /* ASSERT ((n) >= 1); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
- \
- __gmp_x = (src)[0]; \
- __gmp_r = __gmp_x OP (v); \
- (dst)[0] = __gmp_r; \
- if (CB (__gmp_r, __gmp_x, (v))) \
- { \
- (cout) = 1; \
- for (__gmp_i = 1; __gmp_i < (n);) \
- { \
- __gmp_x = (src)[__gmp_i]; \
- __gmp_r = __gmp_x OP 1; \
- (dst)[__gmp_i] = __gmp_r; \
- ++__gmp_i; \
- if (!CB (__gmp_r, __gmp_x, 1)) \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, __gmp_i); \
- (cout) = 0; \
- break; \
- } \
- } \
- } \
- else \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, 1); \
- (cout) = 0; \
- } \
- } while (0)
-#endif
-
-#if GMP_NAIL_BITS >= 1
-#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_r; \
- \
- /* ASSERT ((n) >= 1); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
- \
- __gmp_x = (src)[0]; \
- __gmp_r = __gmp_x OP (v); \
- (dst)[0] = __gmp_r & GMP_NUMB_MASK; \
- if (__gmp_r >> GMP_NUMB_BITS != 0) \
- { \
- (cout) = 1; \
- for (__gmp_i = 1; __gmp_i < (n);) \
- { \
- __gmp_x = (src)[__gmp_i]; \
- __gmp_r = __gmp_x OP 1; \
- (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \
- ++__gmp_i; \
- if (__gmp_r >> GMP_NUMB_BITS == 0) \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, __gmp_i); \
- (cout) = 0; \
- break; \
- } \
- } \
- } \
- else \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, 1); \
- (cout) = 0; \
- } \
- } while (0)
-#endif
-
-#define __GMPN_ADDCB(r,x,y) ((r) < (y))
-#define __GMPN_SUBCB(r,x,y) ((x) < (y))
-
-#define __GMPN_ADD_1(cout, dst, src, n, v) \
- __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
-#define __GMPN_SUB_1(cout, dst, src, n, v) \
- __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
-
-
-/* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
- negative. size==0 is allowed. On random data usually only one limb will
- need to be examined to get a result, so it's worth having it inline. */
-#define __GMPN_CMP(result, xp, yp, size) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_y; \
- \
- /* ASSERT ((size) >= 0); */ \
- \
- (result) = 0; \
- __gmp_i = (size); \
- while (--__gmp_i >= 0) \
- { \
- __gmp_x = (xp)[__gmp_i]; \
- __gmp_y = (yp)[__gmp_i]; \
- if (__gmp_x != __gmp_y) \
- { \
- /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \
- (result) = (__gmp_x > __gmp_y ? 1 : -1); \
- break; \
- } \
- } \
- } while (0)
-
-
-#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
-#define __GMPN_COPY_REST(dst, src, size, start) \
- do { \
- /* ASSERT ((start) >= 0); */ \
- /* ASSERT ((start) <= (size)); */ \
- __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
- } while (0)
-#endif
-
-/* Copy {src,size} to {dst,size}, starting at "start". This is designed to
- keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
- __GMPN_ADD, etc. */
-#if ! defined (__GMPN_COPY_REST)
-#define __GMPN_COPY_REST(dst, src, size, start) \
- do { \
- mp_size_t __gmp_j; \
- /* ASSERT ((size) >= 0); */ \
- /* ASSERT ((start) >= 0); */ \
- /* ASSERT ((start) <= (size)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
- __GMP_CRAY_Pragma ("_CRI ivdep"); \
- for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \
- (dst)[__gmp_j] = (src)[__gmp_j]; \
- } while (0)
-#endif
-
-/* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use
- mpn_copyi if there's a native version, and if we don't mind demanding
- binary compatibility for it (on targets which use it). */
-
-#if ! defined (__GMPN_COPY)
-#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0)
-#endif
-
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
-#if ! defined (__GMP_FORCE_mpn_add)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
-{
- mp_limb_t __gmp_c;
- __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
- return __gmp_c;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
-#if ! defined (__GMP_FORCE_mpn_add_1)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
-{
- mp_limb_t __gmp_c;
- __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
- return __gmp_c;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
-#if ! defined (__GMP_FORCE_mpn_cmp)
-__GMP_EXTERN_INLINE
-#endif
-int
-mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
-{
- int __gmp_result;
- __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
- return __gmp_result;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
-#if ! defined (__GMP_FORCE_mpn_sub)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
-{
- mp_limb_t __gmp_c;
- __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
- return __gmp_c;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
-#if ! defined (__GMP_FORCE_mpn_sub_1)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
-{
- mp_limb_t __gmp_c;
- __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
- return __gmp_c;
-}
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg)
-#if ! defined (__GMP_FORCE_mpn_neg)
-__GMP_EXTERN_INLINE
-#endif
-mp_limb_t
-mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
-{
- mp_limb_t __gmp_ul, __gmp_cy;
- __gmp_cy = 0;
- do {
- __gmp_ul = *__gmp_up++;
- *__gmp_rp++ = -__gmp_ul - __gmp_cy;
- __gmp_cy |= __gmp_ul != 0;
- } while (--__gmp_n != 0);
- return __gmp_cy;
-}
-#endif
-
-#if defined (__cplusplus)
-}
-#endif
-
-
-/* Allow faster testing for negative, zero, and positive. */
-#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
-#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
-#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
-
-/* When using GCC, optimize certain common comparisons. */
-#if defined (__GNUC__) && __GNUC__ >= 2
-#define mpz_cmp_ui(Z,UI) \
- (__builtin_constant_p (UI) && (UI) == 0 \
- ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
-#define mpz_cmp_si(Z,SI) \
- (__builtin_constant_p ((SI) >= 0) && (SI) >= 0 \
- ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI)) \
- : _mpz_cmp_si (Z,SI))
-#define mpq_cmp_ui(Q,NUI,DUI) \
- (__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q) \
- : __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI) \
- ? mpz_cmp (mpq_numref (Q), mpq_denref (Q)) \
- : _mpq_cmp_ui (Q,NUI,DUI))
-#define mpq_cmp_si(q,n,d) \
- (__builtin_constant_p ((n) >= 0) && (n) >= 0 \
- ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
- : _mpq_cmp_si (q, n, d))
-#else
-#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
-#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
-#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
-#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d)
-#endif
-
-
-/* Using "&" rather than "&&" means these can come out branch-free. Every
- mpz_t has at least one limb allocated, so fetching the low limb is always
- allowed. */
-#define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
-#define mpz_even_p(z) (! mpz_odd_p (z))
-
-
-/**************** C++ routines ****************/
-
-#ifdef __cplusplus
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
-#endif
-
-
-/* Source-level compatibility with GMP 2 and earlier. */
-#define mpn_divmod(qp,np,nsize,dp,dsize) \
- mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize)
-
-/* Source-level compatibility with GMP 1. */
-#define mpz_mdiv mpz_fdiv_q
-#define mpz_mdivmod mpz_fdiv_qr
-#define mpz_mmod mpz_fdiv_r
-#define mpz_mdiv_ui mpz_fdiv_q_ui
-#define mpz_mdivmod_ui(q,r,n,d) \
- (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
-#define mpz_mmod_ui(r,n,d) \
- (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
-
-/* Useful synonyms, but not quite compatible with GMP 1. */
-#define mpz_div mpz_fdiv_q
-#define mpz_divmod mpz_fdiv_qr
-#define mpz_div_ui mpz_fdiv_q_ui
-#define mpz_divmod_ui mpz_fdiv_qr_ui
-#define mpz_div_2exp mpz_fdiv_q_2exp
-#define mpz_mod_2exp mpz_fdiv_r_2exp
-
-enum
-{
- GMP_ERROR_NONE = 0,
- GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
- GMP_ERROR_DIVISION_BY_ZERO = 2,
- GMP_ERROR_SQRT_OF_NEGATIVE = 4,
- GMP_ERROR_INVALID_ARGUMENT = 8
-};
-
-/* Define CC and CFLAGS which were used to build this version of GMP */
-#define __GMP_CC "i686-w64-mingw32-gcc -std=gnu99"
-#define __GMP_CFLAGS "-m32 -O2 -pedantic -fomit-frame-pointer"
-
-/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
-#define __GNU_MP_VERSION 6
-#define __GNU_MP_VERSION_MINOR 0
-#define __GNU_MP_VERSION_PATCHLEVEL 0
-#define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
-
-#define __GMP_H__
-#endif /* __GMP_H__ */
+++ /dev/null
-/*
- * Copyright (C) 2010-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef __GNUTLS_ABSTRACT_H
-#define __GNUTLS_ABSTRACT_H
-
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-#include <gnutls/pkcs11.h>
-#include <gnutls/openpgp.h>
-#include <gnutls/tpm.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/* Public key operations */
-
-#define GNUTLS_PUBKEY_VERIFY_FLAG_TLS_RSA GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA
-/**
- * gnutls_pubkey_flags:
- * @GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA: This indicates that a (raw) RSA signature is provided
- * as in the TLS 1.0 protocol.
- * @GNUTLS_PUBKEY_DISABLE_CALLBACKS: The following flag disables call to PIN callbacks. Only
- * relevant to TPM keys.
- * @GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT: request an OPENPGP fingerprint instead of the default.
- *
- * Enumeration of different certificate import flags.
- */
-typedef enum gnutls_pubkey_flags {
- GNUTLS_PUBKEY_VERIFY_FLAG_TLS1_RSA = 1,
- GNUTLS_PUBKEY_DISABLE_CALLBACKS = 1 << 2,
- GNUTLS_PUBKEY_GET_OPENPGP_FINGERPRINT = 1 << 3,
-} gnutls_pubkey_flags_t;
-
-typedef int (*gnutls_privkey_sign_func) (gnutls_privkey_t key,
- void *userdata,
- const gnutls_datum_t *
- raw_data,
- gnutls_datum_t * signature);
-typedef int (*gnutls_privkey_decrypt_func) (gnutls_privkey_t key,
- void *userdata,
- const gnutls_datum_t *
- ciphertext,
- gnutls_datum_t * plaintext);
-
-typedef void (*gnutls_privkey_deinit_func) (gnutls_privkey_t key,
- void *userdata);
-
-int gnutls_pubkey_init(gnutls_pubkey_t * key);
-void gnutls_pubkey_deinit(gnutls_pubkey_t key);
-
-void gnutls_pubkey_set_pin_function(gnutls_pubkey_t key,
- gnutls_pin_callback_t fn,
- void *userdata);
-
-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, unsigned int flags);
-int gnutls_pubkey_import_x509_crq(gnutls_pubkey_t key,
- gnutls_x509_crq_t crq,
- unsigned int flags);
-int gnutls_pubkey_import_pkcs11(gnutls_pubkey_t key,
- gnutls_pkcs11_obj_t obj,
- unsigned int flags);
-int gnutls_pubkey_import_openpgp(gnutls_pubkey_t key,
- gnutls_openpgp_crt_t crt,
- unsigned int flags);
-
-int gnutls_pubkey_import_openpgp_raw(gnutls_pubkey_t pkey,
- const gnutls_datum_t * data,
- gnutls_openpgp_crt_fmt_t
- format,
- const gnutls_openpgp_keyid_t
- keyid, unsigned int flags);
-int gnutls_pubkey_import_x509_raw(gnutls_pubkey_t pkey,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-
-int
-gnutls_pubkey_import_privkey(gnutls_pubkey_t key,
- gnutls_privkey_t pkey,
- unsigned int usage, unsigned int flags);
-
-int
-gnutls_pubkey_import_tpm_url(gnutls_pubkey_t pkey,
- const char *url,
- const char *srk_password, unsigned int flags);
-
-int
-gnutls_pubkey_import_url(gnutls_pubkey_t key, const char *url,
- unsigned int flags);
-
-int
-gnutls_pubkey_import_tpm_raw(gnutls_pubkey_t pkey,
- const gnutls_datum_t * fdata,
- gnutls_tpmkey_fmt_t format,
- const char *srk_password, unsigned int flags);
-
-int gnutls_pubkey_get_preferred_hash_algorithm(gnutls_pubkey_t key,
- gnutls_digest_algorithm_t
- * hash, unsigned int *mand);
-
-int gnutls_pubkey_get_pk_rsa_raw(gnutls_pubkey_t key,
- gnutls_datum_t * m, gnutls_datum_t * e);
-int gnutls_pubkey_get_pk_dsa_raw(gnutls_pubkey_t key,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g, gnutls_datum_t * y);
-int gnutls_pubkey_get_pk_ecc_raw(gnutls_pubkey_t key,
- gnutls_ecc_curve_t * curve,
- gnutls_datum_t * x, gnutls_datum_t * y);
-int gnutls_pubkey_get_pk_ecc_x962(gnutls_pubkey_t key,
- gnutls_datum_t * parameters,
- gnutls_datum_t * ecpoint);
-
-int gnutls_pubkey_export(gnutls_pubkey_t key,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-
-int gnutls_pubkey_export2(gnutls_pubkey_t key,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-
-int gnutls_pubkey_get_key_id(gnutls_pubkey_t key,
- unsigned int flags,
- unsigned char *output_data,
- size_t * output_data_size);
-
-int
-gnutls_pubkey_get_openpgp_key_id(gnutls_pubkey_t key,
- unsigned int flags,
- unsigned char *output_data,
- size_t * output_data_size,
- unsigned int *subkey);
-
-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_import(gnutls_pubkey_t key,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-
-
-int gnutls_pubkey_import_pkcs11_url(gnutls_pubkey_t key,
- const char *url, unsigned int flags
- /* GNUTLS_PKCS11_OBJ_FLAG_* */
- );
-int gnutls_pubkey_import_dsa_raw(gnutls_pubkey_t key,
- const gnutls_datum_t * p,
- const gnutls_datum_t * q,
- const gnutls_datum_t * g,
- const gnutls_datum_t * y);
-int gnutls_pubkey_import_rsa_raw(gnutls_pubkey_t key,
- const gnutls_datum_t * m,
- const gnutls_datum_t * e);
-
-int
-gnutls_pubkey_import_ecc_x962(gnutls_pubkey_t key,
- const gnutls_datum_t * parameters,
- const gnutls_datum_t * ecpoint);
-
-int
-gnutls_pubkey_import_ecc_raw(gnutls_pubkey_t key,
- gnutls_ecc_curve_t curve,
- const gnutls_datum_t * x,
- const gnutls_datum_t * y);
-
-int
-gnutls_pubkey_encrypt_data(gnutls_pubkey_t key,
- unsigned int flags,
- 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_crq_set_pubkey(gnutls_x509_crq_t crq, gnutls_pubkey_t key);
-
-int
-gnutls_pubkey_verify_hash2(gnutls_pubkey_t key,
- gnutls_sign_algorithm_t algo,
- unsigned int flags,
- const gnutls_datum_t * hash,
- const gnutls_datum_t * signature);
-
-int
-gnutls_pubkey_get_verify_algorithm(gnutls_pubkey_t key,
- const gnutls_datum_t *
- signature,
- gnutls_digest_algorithm_t * hash);
-
-int
-gnutls_pubkey_verify_data2(gnutls_pubkey_t pubkey,
- gnutls_sign_algorithm_t algo,
- unsigned int flags,
- const gnutls_datum_t * data,
- const gnutls_datum_t * signature);
-
-/* Private key operations */
-
-int gnutls_privkey_init(gnutls_privkey_t * key);
-void gnutls_privkey_deinit(gnutls_privkey_t key);
-
-void gnutls_privkey_set_pin_function(gnutls_privkey_t key,
- gnutls_pin_callback_t fn,
- void *userdata);
-
-int gnutls_privkey_get_pk_algorithm(gnutls_privkey_t key,
- unsigned int *bits);
-gnutls_privkey_type_t gnutls_privkey_get_type(gnutls_privkey_t key);
-int gnutls_privkey_status(gnutls_privkey_t key);
-
-/**
- * gnutls_privkey_flags:
- * @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, automatically
- * release it when the structure it was imported is released.
- * @GNUTLS_PRIVKEY_IMPORT_COPY: Copy required values during import.
- * @GNUTLS_PRIVKEY_DISABLE_CALLBACKS: The following flag disables call to PIN callbacks etc.
- * Only relevant to TPM keys.
- *
- * Enumeration of different certificate import flags.
- */
-typedef enum gnutls_privkey_flags {
- GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE = 1,
- GNUTLS_PRIVKEY_IMPORT_COPY = 1 << 1,
- GNUTLS_PRIVKEY_DISABLE_CALLBACKS = 1 << 2,
- GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA = 1 << 4,
-} gnutls_privkey_flags_t;
-
-int gnutls_privkey_import_pkcs11(gnutls_privkey_t pkey,
- gnutls_pkcs11_privkey_t key,
- unsigned int flags);
-int gnutls_privkey_import_x509(gnutls_privkey_t pkey,
- gnutls_x509_privkey_t key,
- unsigned int flags);
-int gnutls_privkey_import_openpgp(gnutls_privkey_t pkey,
- gnutls_openpgp_privkey_t key,
- unsigned int flags);
-
-int gnutls_privkey_import_openpgp_raw(gnutls_privkey_t pkey,
- const gnutls_datum_t * data,
- gnutls_openpgp_crt_fmt_t
- format,
- const gnutls_openpgp_keyid_t
- keyid, const char *password);
-
-int gnutls_privkey_import_x509_raw(gnutls_privkey_t pkey,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- const char *password,
- unsigned int flags);
-
-int
-gnutls_privkey_import_tpm_raw(gnutls_privkey_t pkey,
- const gnutls_datum_t * fdata,
- gnutls_tpmkey_fmt_t format,
- const char *srk_password,
- const char *key_password,
- unsigned int flags);
-
-int
-gnutls_privkey_import_tpm_url(gnutls_privkey_t pkey,
- const char *url,
- const char *srk_password,
- const char *key_password,
- unsigned int flags);
-
-int gnutls_privkey_import_url(gnutls_privkey_t key,
- const char *url, unsigned int flags);
-
-int gnutls_privkey_import_pkcs11_url(gnutls_privkey_t key,
- const char *url);
-
-int
-gnutls_privkey_import_ext(gnutls_privkey_t pkey,
- gnutls_pk_algorithm_t pk,
- void *userdata,
- gnutls_privkey_sign_func sign_func,
- gnutls_privkey_decrypt_func
- decrypt_func, unsigned int flags);
-
-int
-gnutls_privkey_import_ext2(gnutls_privkey_t pkey,
- gnutls_pk_algorithm_t pk,
- void *userdata,
- gnutls_privkey_sign_func sign_func,
- gnutls_privkey_decrypt_func
- decrypt_func,
- gnutls_privkey_deinit_func deinit_func,
- unsigned int flags);
-
-int gnutls_privkey_sign_data(gnutls_privkey_t signer,
- gnutls_digest_algorithm_t hash,
- unsigned int flags,
- const gnutls_datum_t * data,
- gnutls_datum_t * signature);
-
-int gnutls_privkey_sign_hash(gnutls_privkey_t signer,
- gnutls_digest_algorithm_t hash_algo,
- unsigned int flags,
- const gnutls_datum_t * hash_data,
- gnutls_datum_t * signature);
-
-
-int gnutls_privkey_decrypt_data(gnutls_privkey_t key,
- unsigned int flags,
- const gnutls_datum_t * ciphertext,
- gnutls_datum_t * plaintext);
-
-int gnutls_x509_crt_privkey_sign(gnutls_x509_crt_t crt,
- gnutls_x509_crt_t issuer,
- gnutls_privkey_t issuer_key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-
-int gnutls_x509_crl_privkey_sign(gnutls_x509_crl_t crl,
- gnutls_x509_crt_t issuer,
- gnutls_privkey_t issuer_key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-
-int gnutls_x509_crq_privkey_sign(gnutls_x509_crq_t crq,
- gnutls_privkey_t key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-
-/**
- * gnutls_pcert_st:
- * @pubkey: public key of parsed certificate.
- * @cert: certificate itself of parsed certificate
- * @type: type of certificate, a #gnutls_certificate_type_t type.
- *
- * A parsed certificate.
- */
-typedef struct gnutls_pcert_st {
- gnutls_pubkey_t pubkey;
- gnutls_datum_t cert;
- gnutls_certificate_type_t type;
-} gnutls_pcert_st;
-
-/* Do not initialize the "cert" element of
- * the certificate */
-#define GNUTLS_PCERT_NO_CERT 1
-
-int gnutls_pcert_import_x509(gnutls_pcert_st * pcert,
- gnutls_x509_crt_t crt, unsigned int flags);
-
-int
-gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts,
- unsigned int *pcert_max,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-
-int gnutls_pcert_import_x509_raw(gnutls_pcert_st * pcert,
- const gnutls_datum_t * cert,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-
-int gnutls_pcert_import_openpgp_raw(gnutls_pcert_st * pcert,
- const gnutls_datum_t * cert,
- gnutls_openpgp_crt_fmt_t
- format,
- gnutls_openpgp_keyid_t keyid,
- unsigned int flags);
-
-int gnutls_pcert_import_openpgp(gnutls_pcert_st * pcert,
- gnutls_openpgp_crt_t crt,
- unsigned int flags);
-
-void gnutls_pcert_deinit(gnutls_pcert_st * pcert);
-
-/* For certificate credentials */
- /* This is the same as gnutls_certificate_retrieve_function()
- * but retrieves a gnutls_pcert_st which requires much less processing
- * within the library.
- */
-typedef int gnutls_certificate_retrieve_function2(gnutls_session_t,
- const
- gnutls_datum_t *
- req_ca_rdn,
- int nreqs, const
- gnutls_pk_algorithm_t
- * pk_algos,
- int
- pk_algos_length,
- gnutls_pcert_st
- **, unsigned int
- *pcert_length,
- gnutls_privkey_t
- * privkey);
-
-
-void gnutls_certificate_set_retrieve_function2
- (gnutls_certificate_credentials_t cred,
- gnutls_certificate_retrieve_function2 * func);
-
-int
-gnutls_certificate_set_key(gnutls_certificate_credentials_t res,
- const char **names,
- int names_size,
- gnutls_pcert_st * pcert_list,
- int pcert_list_size, gnutls_privkey_t key);
-
-#include <gnutls/compat.h>
-
-int gnutls_pubkey_verify_data(gnutls_pubkey_t pubkey,
- unsigned int flags,
- const gnutls_datum_t * data,
- const gnutls_datum_t *
- signature) _GNUTLS_GCC_ATTR_DEPRECATED;
-
-int gnutls_pubkey_verify_hash(gnutls_pubkey_t key,
- unsigned int flags,
- const gnutls_datum_t * hash,
- const gnutls_datum_t *
- signature) _GNUTLS_GCC_ATTR_DEPRECATED;
-
-int
-gnutls_pubkey_print(gnutls_pubkey_t pubkey,
- gnutls_certificate_print_formats_t format,
- gnutls_datum_t * out);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2008-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* Typedefs for more compatibility with older GnuTLS. */
-
-#ifndef _GNUTLS_COMPAT_H
-#define _GNUTLS_COMPAT_H
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#ifdef __GNUC__
-
-#define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-
-#if !defined GNUTLS_INTERNAL_BUILD
-#if _GNUTLS_GCC_VERSION >= 30100
-#define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
-#endif
-#endif
-
-#endif /* __GNUC__ */
-
-#ifndef _GNUTLS_GCC_ATTR_DEPRECATED
-#define _GNUTLS_GCC_ATTR_DEPRECATED
-#endif
-
-/* gnutls_connection_end_t was made redundant in 2.99.0 */
-typedef unsigned int gnutls_connection_end_t _GNUTLS_GCC_ATTR_DEPRECATED;
-
-/* Stuff deprected in 2.x */
-typedef gnutls_cipher_algorithm_t gnutls_cipher_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_kx_algorithm_t gnutls_kx_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_mac_algorithm_t gnutls_mac_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_digest_algorithm_t gnutls_digest_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_compression_method_t gnutls_compression_method
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_connection_end_t gnutls_connection_end
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_x509_crt_fmt_t gnutls_x509_crt_fmt
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_pk_algorithm_t gnutls_pk_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_sign_algorithm_t gnutls_sign_algorithm
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_close_request_t gnutls_close_request
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_certificate_request_t gnutls_certificate_request
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_certificate_status_t gnutls_certificate_status
- _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_description_t gnutls_alert_description
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_x509_subject_alt_name_t gnutls_x509_subject_alt_name
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_openpgp_privkey_t gnutls_openpgp_privkey
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_openpgp_keyring_t gnutls_openpgp_keyring
- _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_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_certificate_credentials_t
- gnutls_certificate_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_anon_server_credentials_t
- gnutls_anon_server_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_anon_client_credentials_t
- gnutls_anon_client_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_srp_client_credentials_t
- gnutls_srp_client_credentials _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_srp_server_credentials_t
- gnutls_srp_server_credentials _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_params_type_t gnutls_params_type
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_credentials_type_t gnutls_credentials_type
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_certificate_type_t gnutls_certificate_type
- _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_DEPRECATED;
-
-/* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was
- modified to use the PSK alert. */
-#define GNUTLS_A_MISSING_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. */
-#define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT
-#define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT
-#define gnutls_openpgp_send_key gnutls_openpgp_send_cert
-typedef gnutls_openpgp_crt_status_t gnutls_openpgp_key_status_t
- _GNUTLS_GCC_ATTR_DEPRECATED;
-typedef gnutls_openpgp_crt_t gnutls_openpgp_key_t
- _GNUTLS_GCC_ATTR_DEPRECATED;
-#define gnutls_openpgp_key_init gnutls_openpgp_crt_init
-#define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit
-#define gnutls_openpgp_key_import gnutls_openpgp_crt_import
-#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_fingerprint gnutls_openpgp_crt_get_fingerprint
-#define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algorithm
-#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_creation_time gnutls_openpgp_crt_get_creation_time
-#define gnutls_openpgp_key_get_expiration_time gnutls_openpgp_crt_get_expiration_time
-#define gnutls_openpgp_key_get_id gnutls_openpgp_crt_get_id
-#define gnutls_openpgp_key_check_hostname gnutls_openpgp_crt_check_hostname
-
-/* OpenPGP stuff renamed in 2.3.x. */
-#define gnutls_openpgp_crt_get_id gnutls_openpgp_crt_get_key_id
-
-/* New better names renamed in 2.3.x, add these for backwards
- compatibility with old poor names.*/
-#define GNUTLS_X509_CRT_FULL GNUTLS_CRT_PRINT_FULL
-#define GNUTLS_X509_CRT_ONELINE GNUTLS_CRT_PRINT_ONELINE
-#define GNUTLS_X509_CRT_UNSIGNED_FULL GNUTLS_CRT_PRINT_UNSIGNED_FULL
-
-/* Namespace problems. */
-#define LIBGNUTLS_VERSION GNUTLS_VERSION
-#define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR
-#define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR
-#define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH
-#define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER
-#define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION
-
-/* The gnutls_retr_st was deprecated by gnutls_certificate_retrieve_function()
- * and gnutls_retr2_st.
- */
-typedef struct gnutls_retr_st {
- gnutls_certificate_type_t type;
- union {
- gnutls_x509_crt_t *x509;
- gnutls_openpgp_crt_t pgp;
- } cert;
- unsigned int ncerts; /* one for pgp keys */
-
- union {
- gnutls_x509_privkey_t x509;
- gnutls_openpgp_privkey_t pgp;
- } key;
-
- unsigned int deinit_all; /* if non zero all keys will be deinited */
-} gnutls_retr_st;
-
-typedef int
-gnutls_certificate_client_retrieve_function(gnutls_session_t,
- const
- gnutls_datum_t *
- req_ca_rdn,
- int nreqs, const
- gnutls_pk_algorithm_t
- * pk_algos, int
- pk_algos_length,
- gnutls_retr_st *);
-typedef int
-gnutls_certificate_server_retrieve_function(gnutls_session_t,
- gnutls_retr_st *);
-
-void gnutls_certificate_client_set_retrieve_function
- (gnutls_certificate_credentials_t cred,
- gnutls_certificate_client_retrieve_function *
- func) _GNUTLS_GCC_ATTR_DEPRECATED;
-void
- gnutls_certificate_server_set_retrieve_function
- (gnutls_certificate_credentials_t cred,
- gnutls_certificate_server_retrieve_function *
- func) _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* External signing callback. No longer supported because it
- * was deprecated by the PKCS #11 API or gnutls_privkey_import_ext. */
-typedef int (*gnutls_sign_func) (gnutls_session_t session,
- void *userdata,
- gnutls_certificate_type_t
- cert_type,
- const gnutls_datum_t * cert,
- const gnutls_datum_t * hash,
- gnutls_datum_t * signature);
-
-void
-gnutls_sign_callback_set(gnutls_session_t session,
- gnutls_sign_func sign_func,
- void *userdata) _GNUTLS_GCC_ATTR_DEPRECATED;
-gnutls_sign_func
-gnutls_sign_callback_get(gnutls_session_t session,
- void **userdata) _GNUTLS_GCC_ATTR_DEPRECATED;
-
-/* This is a very dangerous and error-prone function.
- * Use gnutls_privkey_sign_hash() instead.
- */
-int gnutls_x509_privkey_sign_hash(gnutls_x509_privkey_t key,
- const gnutls_datum_t * hash,
- gnutls_datum_t * signature)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-int gnutls_openpgp_privkey_sign_hash(gnutls_openpgp_privkey_t key,
- const gnutls_datum_t * hash,
- gnutls_datum_t * signature)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-/* we support the gnutls_privkey_sign_data() instead.
- */
-int gnutls_x509_privkey_sign_data(gnutls_x509_privkey_t key,
- gnutls_digest_algorithm_t digest,
- unsigned int flags,
- const gnutls_datum_t * data,
- void *signature,
- size_t * signature_size)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* gnutls_pubkey_verify_data() */
-int gnutls_x509_crt_verify_data(gnutls_x509_crt_t crt,
- unsigned int flags,
- const gnutls_datum_t * data,
- const gnutls_datum_t * signature)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-
- /* gnutls_pubkey_verify_hash() */
-int gnutls_x509_crt_verify_hash(gnutls_x509_crt_t crt,
- unsigned int flags,
- const gnutls_datum_t * hash,
- const gnutls_datum_t * signature)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* gnutls_pubkey_get_verify_algorithm() */
-int gnutls_x509_crt_get_verify_algorithm(gnutls_x509_crt_t crt,
- const gnutls_datum_t *
- signature,
- gnutls_digest_algorithm_t
- * hash)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* gnutls_pubkey_get_preferred_hash_algorithm() */
-int gnutls_x509_crt_get_preferred_hash_algorithm(gnutls_x509_crt_t
- crt,
- gnutls_digest_algorithm_t
- * hash, unsigned int
- *mand)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* gnutls_x509_crq_privkey_sign() */
-int gnutls_x509_crq_sign(gnutls_x509_crq_t crq,
- gnutls_x509_privkey_t key)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-
-
- /* gnutls_x509_crl_privkey_sign */
-int gnutls_x509_crl_sign(gnutls_x509_crl_t crl,
- gnutls_x509_crt_t issuer,
- gnutls_x509_privkey_t issuer_key)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* functions to set priority of cipher suites
- */
-int gnutls_cipher_set_priority(gnutls_session_t session,
- const int *list)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_mac_set_priority(gnutls_session_t session,
- const int *list) _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_compression_set_priority(gnutls_session_t session,
- const int *list)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_kx_set_priority(gnutls_session_t session,
- const int *list) _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_protocol_set_priority(gnutls_session_t session,
- const int *list)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_certificate_type_set_priority(gnutls_session_t session,
- const int *list)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-/* RSA params
- */
-int gnutls_rsa_params_init(gnutls_rsa_params_t *
- rsa_params) _GNUTLS_GCC_ATTR_DEPRECATED;
-void gnutls_rsa_params_deinit(gnutls_rsa_params_t rsa_params)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_rsa_params_cpy(gnutls_rsa_params_t dst,
- gnutls_rsa_params_t src)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_rsa_params_import_raw(gnutls_rsa_params_t rsa_params,
- const gnutls_datum_t * m,
- const gnutls_datum_t * e,
- const gnutls_datum_t * d,
- const gnutls_datum_t * p,
- const gnutls_datum_t * q,
- const gnutls_datum_t * u);
-int gnutls_rsa_params_generate2(gnutls_rsa_params_t params,
- unsigned int bits)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_rsa_params_export_raw(gnutls_rsa_params_t rsa,
- gnutls_datum_t * m,
- gnutls_datum_t * e,
- gnutls_datum_t * d,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * u,
- unsigned int *bits)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_rsa_params_export_pkcs1(gnutls_rsa_params_t params,
- gnutls_x509_crt_fmt_t format,
- unsigned char *params_data,
- size_t *
- params_data_size)
- _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,
- gnutls_datum_t * exponent,
- gnutls_datum_t *
- modulus) _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_rsa_export_get_modulus_bits(gnutls_session_t session)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-int gnutls_set_default_export_priority(gnutls_session_t session)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-
-void gnutls_certificate_set_rsa_export_params
- (gnutls_certificate_credentials_t res,
- gnutls_rsa_params_t rsa_params) _GNUTLS_GCC_ATTR_DEPRECATED;
-
- /* use gnutls_privkey_sign_hash() with the GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA flag */
-int gnutls_privkey_sign_raw_data(gnutls_privkey_t key,
- unsigned flags,
- const gnutls_datum_t * data,
- gnutls_datum_t *
- signature) _GNUTLS_GCC_ATTR_DEPRECATED;
-
-#ifdef _ISOC99_SOURCE
-/* we provide older functions for compatibility as inline functions that
- * depend on gnutls_session_get_random. */
-
-static inline const void
-*gnutls_session_get_server_random(gnutls_session_t session)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-static inline const void
-*gnutls_session_get_server_random(gnutls_session_t session)
-{
- gnutls_datum_t rnd;
- gnutls_session_get_random(session, NULL, &rnd); /*doc-skip */
- return rnd.data;
-}
-
-static inline const void
-*gnutls_session_get_client_random(gnutls_session_t session)
- _GNUTLS_GCC_ATTR_DEPRECATED;
-static inline const void
-*gnutls_session_get_client_random(gnutls_session_t session)
-{
- gnutls_datum_t rnd;
- gnutls_session_get_random(session, &rnd, NULL); /*doc-skip */
- return rnd.data;
-}
-#endif
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* _GNUTLS_COMPAT_H */
+++ /dev/null
-/*
- * Copyright (C) 2008-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef GNUTLS_CRYPTO_H
-#define GNUTLS_CRYPTO_H
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-typedef struct api_cipher_hd_st *gnutls_cipher_hd_t;
-
-int gnutls_cipher_init(gnutls_cipher_hd_t * handle,
- gnutls_cipher_algorithm_t cipher,
- const gnutls_datum_t * key,
- const gnutls_datum_t * iv);
-int gnutls_cipher_encrypt(const gnutls_cipher_hd_t handle,
- void *text, size_t textlen);
-int gnutls_cipher_decrypt(const gnutls_cipher_hd_t handle,
- void *ciphertext, size_t ciphertextlen);
-int gnutls_cipher_decrypt2(gnutls_cipher_hd_t handle,
- const void *ciphertext,
- size_t ciphertextlen, void *text,
- size_t textlen);
-int gnutls_cipher_encrypt2(gnutls_cipher_hd_t handle,
- 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 ivlen);
-
-int gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag,
- size_t tag_size);
-int gnutls_cipher_add_auth(gnutls_cipher_hd_t handle,
- const void *text, size_t text_size);
-
-void gnutls_cipher_deinit(gnutls_cipher_hd_t handle);
-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_tag_size(gnutls_cipher_algorithm_t algorithm);
-
-typedef struct hash_hd_st *gnutls_hash_hd_t;
-typedef struct hmac_hd_st *gnutls_hmac_hd_t;
-
-size_t gnutls_mac_get_nonce_size(gnutls_mac_algorithm_t algorithm);
-int gnutls_hmac_init(gnutls_hmac_hd_t * dig,
- gnutls_mac_algorithm_t algorithm,
- const void *key, size_t keylen);
-void gnutls_hmac_set_nonce(gnutls_hmac_hd_t handle,
- const void *nonce, size_t nonce_len);
-int gnutls_hmac(gnutls_hmac_hd_t handle, const void *text, size_t textlen);
-void gnutls_hmac_output(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_fast(gnutls_mac_algorithm_t algorithm,
- const void *key, size_t keylen,
- const void *text, size_t textlen, void *digest);
-
-int gnutls_hash_init(gnutls_hash_hd_t * dig,
- gnutls_digest_algorithm_t algorithm);
-int gnutls_hash(gnutls_hash_hd_t handle, const void *text, size_t textlen);
-void gnutls_hash_output(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_fast(gnutls_digest_algorithm_t algorithm,
- const void *text, size_t textlen, void *digest);
-
-/* register ciphers */
-
-
-/**
- * gnutls_rnd_level_t:
- * @GNUTLS_RND_NONCE: Non-predictable random number. Fatal in parts
- * of session if broken, i.e., vulnerable to statistical analysis.
- * @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number.
- * Fatal in session if broken.
- * @GNUTLS_RND_KEY: Fatal in many sessions if broken.
- *
- * Enumeration of random quality levels.
- */
-typedef enum gnutls_rnd_level {
- GNUTLS_RND_NONCE = 0,
- GNUTLS_RND_RANDOM = 1,
- GNUTLS_RND_KEY = 2
-} gnutls_rnd_level_t;
-
-int gnutls_rnd(gnutls_rnd_level_t level, void *data, size_t len);
-
-void gnutls_rnd_refresh(void);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2011-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* This file contains the types and prototypes for the X.509
- * certificate and CRL handling functions.
- */
-
-#ifndef GNUTLS_DTLS_H
-#define GNUTLS_DTLS_H
-
-#include <gnutls/gnutls.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#define GNUTLS_COOKIE_KEY_SIZE 16
-
-void gnutls_dtls_set_timeouts(gnutls_session_t session,
- unsigned int retrans_timeout,
- unsigned int total_timeout);
-
-unsigned int gnutls_dtls_get_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);
-int gnutls_dtls_set_data_mtu(gnutls_session_t session, unsigned int mtu);
-
-unsigned int gnutls_dtls_get_timeout(gnutls_session_t session);
-
-/**
- * gnutls_dtls_prestate_st:
- * @record_seq: record sequence number
- * @hsk_read_seq: handshake read sequence number
- * @hsk_write_seq: handshake write sequence number
- *
- * DTLS cookie prestate struct. This is usually never modified by
- * the application, it is used to carry the cookie data between
- * gnutls_dtls_cookie_send(), gnutls_dtls_cookie_verify() and
- * gnutls_dtls_prestate_set().
- */
-typedef struct {
- unsigned int record_seq;
- unsigned int hsk_read_seq;
- unsigned int hsk_write_seq;
-} gnutls_dtls_prestate_st;
-
-int gnutls_dtls_cookie_send(gnutls_datum_t * key,
- void *client_data,
- size_t client_data_size,
- gnutls_dtls_prestate_st * prestate,
- gnutls_transport_ptr_t ptr,
- gnutls_push_func push_func);
-
-int gnutls_dtls_cookie_verify(gnutls_datum_t * key,
- void *client_data,
- size_t client_data_size, void *_msg,
- size_t msg_size,
- gnutls_dtls_prestate_st * prestate);
-
-void gnutls_dtls_prestate_set(gnutls_session_t session,
- gnutls_dtls_prestate_st * prestate);
-
-unsigned int gnutls_record_get_discarded(gnutls_session_t session);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif /* GNUTLS_DTLS_H */
+++ /dev/null
-/* -*- c -*-
- * Copyright (C) 2000-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* This file contains the types and prototypes for all the
- * high level functionality of the gnutls main library.
- *
- * If the optional C++ binding was built, it is available in
- * gnutls/gnutlsxx.h.
- *
- * The openssl compatibility layer (which is under the GNU GPL
- * license) is in gnutls/openssl.h.
- *
- * The low level cipher functionality is in gnutls/crypto.h.
- */
-
-
-#ifndef GNUTLS_H
-#define GNUTLS_H
-
-/* Get size_t. */
-#include <stddef.h>
-/* Get ssize_t. */
-#ifndef HAVE_SSIZE_T
-#define HAVE_SSIZE_T
-/* *INDENT-OFF* */
-#include <sys/types.h>
-/* *INDENT-ON* */
-#endif
-/* Get time_t. */
-#include <time.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#define GNUTLS_VERSION "3.2.16"
-
-#define GNUTLS_VERSION_MAJOR 3
-#define GNUTLS_VERSION_MINOR 2
-#define GNUTLS_VERSION_PATCH 16
-
-#define GNUTLS_VERSION_NUMBER 0x030210
-
-#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_CBC GNUTLS_CIPHER_AES_128_CBC
-#define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128
-
-/**
- * gnutls_cipher_algorithm_t:
- * @GNUTLS_CIPHER_UNKNOWN: Unknown algorithm.
- * @GNUTLS_CIPHER_NULL: NULL algorithm.
- * @GNUTLS_CIPHER_ARCFOUR_128: ARCFOUR stream cipher with 128-bit keys.
- * @GNUTLS_CIPHER_3DES_CBC: 3DES in CBC mode.
- * @GNUTLS_CIPHER_AES_128_CBC: AES in CBC mode with 128-bit keys.
- * @GNUTLS_CIPHER_AES_192_CBC: AES in CBC mode with 192-bit keys.
- * @GNUTLS_CIPHER_AES_256_CBC: AES in CBC mode with 256-bit keys.
- * @GNUTLS_CIPHER_ARCFOUR_40: ARCFOUR stream cipher with 40-bit keys.
- * @GNUTLS_CIPHER_CAMELLIA_128_CBC: Camellia in CBC mode with 128-bit keys.
- * @GNUTLS_CIPHER_CAMELLIA_192_CBC: Camellia in CBC mode with 192-bit keys.
- * @GNUTLS_CIPHER_CAMELLIA_256_CBC: Camellia in CBC mode with 256-bit keys.
- * @GNUTLS_CIPHER_RC2_40_CBC: RC2 in CBC mode with 40-bit keys.
- * @GNUTLS_CIPHER_DES_CBC: DES in CBC mode (56-bit keys).
- * @GNUTLS_CIPHER_AES_128_GCM: AES in GCM mode with 128-bit keys.
- * @GNUTLS_CIPHER_AES_256_GCM: AES in GCM mode with 256-bit keys.
- * @GNUTLS_CIPHER_CAMELLIA_128_GCM: CAMELLIA in GCM mode with 128-bit keys.
- * @GNUTLS_CIPHER_CAMELLIA_256_GCM: CAMELLIA in GCM mode with 256-bit keys.
- * @GNUTLS_CIPHER_IDEA_PGP_CFB: IDEA in CFB mode.
- * @GNUTLS_CIPHER_3DES_PGP_CFB: 3DES in CFB mode.
- * @GNUTLS_CIPHER_CAST5_PGP_CFB: CAST5 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 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_AES256_PGP_CFB: AES in CFB mode with 256-bit keys.
- * @GNUTLS_CIPHER_TWOFISH_PGP_CFB: Twofish in CFB mode.
- *
- * Enumeration of different symmetric encryption algorithms.
- */
-typedef enum gnutls_cipher_algorithm {
- GNUTLS_CIPHER_UNKNOWN = 0,
- GNUTLS_CIPHER_NULL = 1,
- GNUTLS_CIPHER_ARCFOUR_128 = 2,
- GNUTLS_CIPHER_3DES_CBC = 3,
- GNUTLS_CIPHER_AES_128_CBC = 4,
- GNUTLS_CIPHER_AES_256_CBC = 5,
- GNUTLS_CIPHER_ARCFOUR_40 = 6,
- GNUTLS_CIPHER_CAMELLIA_128_CBC = 7,
- GNUTLS_CIPHER_CAMELLIA_256_CBC = 8,
- GNUTLS_CIPHER_RC2_40_CBC = 90,
- GNUTLS_CIPHER_DES_CBC = 91,
- GNUTLS_CIPHER_AES_192_CBC = 92,
- GNUTLS_CIPHER_AES_128_GCM = 93,
- GNUTLS_CIPHER_AES_256_GCM = 94,
- GNUTLS_CIPHER_CAMELLIA_192_CBC = 95,
- GNUTLS_CIPHER_SALSA20_256 = 96,
- GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 97,
- GNUTLS_CIPHER_CAMELLIA_128_GCM = 98,
- GNUTLS_CIPHER_CAMELLIA_256_GCM = 99,
-
- /* used only for PGP internals. Ignored in TLS/SSL
- */
- GNUTLS_CIPHER_IDEA_PGP_CFB = 200,
- GNUTLS_CIPHER_3DES_PGP_CFB = 201,
- GNUTLS_CIPHER_CAST5_PGP_CFB = 202,
- GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203,
- GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204,
- GNUTLS_CIPHER_AES128_PGP_CFB = 205,
- GNUTLS_CIPHER_AES192_PGP_CFB = 206,
- GNUTLS_CIPHER_AES256_PGP_CFB = 207,
- GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208
-} gnutls_cipher_algorithm_t;
-
-/**
- * gnutls_kx_algorithm_t:
- * @GNUTLS_KX_UNKNOWN: Unknown key-exchange algorithm.
- * @GNUTLS_KX_RSA: RSA key-exchange algorithm.
- * @GNUTLS_KX_DHE_DSS: DHE-DSS key-exchange algorithm.
- * @GNUTLS_KX_DHE_RSA: DHE-RSA key-exchange algorithm.
- * @GNUTLS_KX_ECDHE_RSA: ECDHE-RSA key-exchange algorithm.
- * @GNUTLS_KX_ECDHE_ECDSA: ECDHE-ECDSA key-exchange algorithm.
- * @GNUTLS_KX_ANON_DH: Anon-DH key-exchange algorithm.
- * @GNUTLS_KX_ANON_ECDH: Anon-ECDH key-exchange algorithm.
- * @GNUTLS_KX_SRP: SRP key-exchange algorithm.
- * @GNUTLS_KX_RSA_EXPORT: RSA-EXPORT key-exchange algorithm (defunc).
- * @GNUTLS_KX_SRP_RSA: SRP-RSA key-exchange algorithm.
- * @GNUTLS_KX_SRP_DSS: SRP-DSS key-exchange algorithm.
- * @GNUTLS_KX_PSK: PSK key-exchange algorithm.
- * @GNUTLS_KX_DHE_PSK: DHE-PSK key-exchange algorithm.
- * @GNUTLS_KX_ECDHE_PSK: ECDHE-PSK key-exchange algorithm.
- * @GNUTLS_KX_RSA_PSK: RSA-PSK key-exchange algorithm.
- *
- * Enumeration of different key exchange algorithms.
- */
-typedef enum {
- GNUTLS_KX_UNKNOWN = 0,
- GNUTLS_KX_RSA = 1,
- GNUTLS_KX_DHE_DSS = 2,
- GNUTLS_KX_DHE_RSA = 3,
- GNUTLS_KX_ANON_DH = 4,
- GNUTLS_KX_SRP = 5,
- GNUTLS_KX_RSA_EXPORT = 6,
- GNUTLS_KX_SRP_RSA = 7,
- GNUTLS_KX_SRP_DSS = 8,
- GNUTLS_KX_PSK = 9,
- GNUTLS_KX_DHE_PSK = 10,
- GNUTLS_KX_ANON_ECDH = 11,
- GNUTLS_KX_ECDHE_RSA = 12,
- GNUTLS_KX_ECDHE_ECDSA = 13,
- GNUTLS_KX_ECDHE_PSK = 14,
- GNUTLS_KX_RSA_PSK = 15,
-} gnutls_kx_algorithm_t;
-
-/**
- * gnutls_params_type_t:
- * @GNUTLS_PARAMS_RSA_EXPORT: Session RSA-EXPORT parameters (defunc).
- * @GNUTLS_PARAMS_DH: Session Diffie-Hellman parameters.
- * @GNUTLS_PARAMS_ECDH: Session Elliptic-Curve Diffie-Hellman parameters.
- *
- * Enumeration of different TLS session parameter types.
- */
-typedef enum {
- GNUTLS_PARAMS_RSA_EXPORT = 1,
- GNUTLS_PARAMS_DH = 2,
- GNUTLS_PARAMS_ECDH = 3,
-} gnutls_params_type_t;
-
-/**
- * gnutls_credentials_type_t:
- * @GNUTLS_CRD_CERTIFICATE: Certificate credential.
- * @GNUTLS_CRD_ANON: Anonymous credential.
- * @GNUTLS_CRD_SRP: SRP credential.
- * @GNUTLS_CRD_PSK: PSK credential.
- * @GNUTLS_CRD_IA: IA credential.
- *
- * Enumeration of different credential types.
- */
-typedef enum {
- GNUTLS_CRD_CERTIFICATE = 1,
- GNUTLS_CRD_ANON,
- GNUTLS_CRD_SRP,
- GNUTLS_CRD_PSK,
- GNUTLS_CRD_IA
-} gnutls_credentials_type_t;
-
-#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1
-#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1
-
-/**
- * gnutls_mac_algorithm_t:
- * @GNUTLS_MAC_UNKNOWN: Unknown MAC algorithm.
- * @GNUTLS_MAC_NULL: NULL MAC algorithm (empty output).
- * @GNUTLS_MAC_MD5: HMAC-MD5 algorithm.
- * @GNUTLS_MAC_SHA1: HMAC-SHA-1 algorithm.
- * @GNUTLS_MAC_RMD160: HMAC-RMD160 algorithm.
- * @GNUTLS_MAC_MD2: HMAC-MD2 algorithm.
- * @GNUTLS_MAC_SHA256: HMAC-SHA-256 algorithm.
- * @GNUTLS_MAC_SHA384: HMAC-SHA-384 algorithm.
- * @GNUTLS_MAC_SHA512: HMAC-SHA-512 algorithm.
- * @GNUTLS_MAC_SHA224: HMAC-SHA-224 algorithm.
- * @GNUTLS_MAC_AEAD: MAC implicit through AEAD cipher.
- * @GNUTLS_MAC_UMAC_96: The UMAC-96 MAC algorithm.
- * @GNUTLS_MAC_UMAC_128: The UMAC-128 MAC algorithm.
- *
- * Enumeration of different Message Authentication Code (MAC)
- * algorithms.
- */
-typedef enum {
- GNUTLS_MAC_UNKNOWN = 0,
- GNUTLS_MAC_NULL = 1,
- GNUTLS_MAC_MD5 = 2,
- GNUTLS_MAC_SHA1 = 3,
- GNUTLS_MAC_RMD160 = 4,
- GNUTLS_MAC_MD2 = 5,
- GNUTLS_MAC_SHA256 = 6,
- GNUTLS_MAC_SHA384 = 7,
- GNUTLS_MAC_SHA512 = 8,
- GNUTLS_MAC_SHA224 = 9,
- /* If you add anything here, make sure you align with
- gnutls_digest_algorithm_t. */
- GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */
- GNUTLS_MAC_UMAC_96 = 201,
- GNUTLS_MAC_UMAC_128 = 202,
-} gnutls_mac_algorithm_t;
-
-/**
- * gnutls_digest_algorithm_t:
- * @GNUTLS_DIG_UNKNOWN: Unknown hash algorithm.
- * @GNUTLS_DIG_NULL: NULL hash algorithm (empty output).
- * @GNUTLS_DIG_MD5: MD5 algorithm.
- * @GNUTLS_DIG_SHA1: SHA-1 algorithm.
- * @GNUTLS_DIG_RMD160: RMD160 algorithm.
- * @GNUTLS_DIG_MD2: MD2 algorithm.
- * @GNUTLS_DIG_SHA256: SHA-256 algorithm.
- * @GNUTLS_DIG_SHA384: SHA-384 algorithm.
- * @GNUTLS_DIG_SHA512: SHA-512 algorithm.
- * @GNUTLS_DIG_SHA224: SHA-224 algorithm.
- *
- * Enumeration of different digest (hash) algorithms.
- */
-typedef enum {
- GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN,
- GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
- GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
- GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
- GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160,
- GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2,
- GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
- GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384,
- GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512,
- GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224
- /* If you add anything here, make sure you align with
- gnutls_mac_algorithm_t. */
-} gnutls_digest_algorithm_t;
-
- /* exported for other gnutls headers. This is the maximum number of
- * algorithms (ciphers, kx or macs).
- */
-#define GNUTLS_MAX_ALGORITHM_NUM 32
-
-/**
- * gnutls_compression_method_t:
- * @GNUTLS_COMP_UNKNOWN: Unknown compression method.
- * @GNUTLS_COMP_NULL: The NULL compression method (no compression).
- * @GNUTLS_COMP_DEFLATE: The DEFLATE compression method from zlib.
- * @GNUTLS_COMP_ZLIB: Same as %GNUTLS_COMP_DEFLATE.
- *
- * Enumeration of different TLS compression methods.
- */
-typedef enum {
- GNUTLS_COMP_UNKNOWN = 0,
- GNUTLS_COMP_NULL = 1,
- GNUTLS_COMP_DEFLATE = 2,
- GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE,
-} gnutls_compression_method_t;
-
- /*
- * Flags for gnutls_init()
- *
- * @GNUTLS_SERVER: Connection end is a server.
- * @GNUTLS_CLIENT: Connection end is a client.
- * @GNUTLS_DATAGRAM: Connection is datagram oriented (DTLS).
- * @GNUTLS_NONBLOCK: Connection should not block (DTLS).
- * @GNUTLS_NO_EXTENSIONS: Do not enable any TLS extensions by default.
- * @GNUTLS_NO_REPLAY_PROTECTION: Disable any replay protection in DTLS.
- *
- */
-#define GNUTLS_SERVER 1
-#define GNUTLS_CLIENT (1<<1)
-#define GNUTLS_DATAGRAM (1<<2)
-#define GNUTLS_NONBLOCK (1<<3)
-#define GNUTLS_NO_EXTENSIONS (1<<4)
-#define GNUTLS_NO_REPLAY_PROTECTION (1<<5)
-
-/**
- * gnutls_alert_level_t:
- * @GNUTLS_AL_WARNING: Alert of warning severity.
- * @GNUTLS_AL_FATAL: Alert of fatal severity.
- *
- * Enumeration of different TLS alert severities.
- */
-typedef enum {
- GNUTLS_AL_WARNING = 1,
- GNUTLS_AL_FATAL
-} gnutls_alert_level_t;
-
-/**
- * gnutls_alert_description_t:
- * @GNUTLS_A_CLOSE_NOTIFY: Close notify.
- * @GNUTLS_A_UNEXPECTED_MESSAGE: Unexpected message.
- * @GNUTLS_A_BAD_RECORD_MAC: Bad record MAC.
- * @GNUTLS_A_DECRYPTION_FAILED: Decryption failed.
- * @GNUTLS_A_RECORD_OVERFLOW: Record overflow.
- * @GNUTLS_A_DECOMPRESSION_FAILURE: Decompression failed.
- * @GNUTLS_A_HANDSHAKE_FAILURE: Handshake failed.
- * @GNUTLS_A_SSL3_NO_CERTIFICATE: No certificate.
- * @GNUTLS_A_BAD_CERTIFICATE: Certificate is bad.
- * @GNUTLS_A_UNSUPPORTED_CERTIFICATE: Certificate is not supported.
- * @GNUTLS_A_CERTIFICATE_REVOKED: Certificate was revoked.
- * @GNUTLS_A_CERTIFICATE_EXPIRED: Certificate is expired.
- * @GNUTLS_A_CERTIFICATE_UNKNOWN: Unknown certificate.
- * @GNUTLS_A_ILLEGAL_PARAMETER: Illegal parameter.
- * @GNUTLS_A_UNKNOWN_CA: CA is unknown.
- * @GNUTLS_A_ACCESS_DENIED: Access was denied.
- * @GNUTLS_A_DECODE_ERROR: Decode error.
- * @GNUTLS_A_DECRYPT_ERROR: Decrypt error.
- * @GNUTLS_A_EXPORT_RESTRICTION: Export restriction.
- * @GNUTLS_A_PROTOCOL_VERSION: Error in protocol version.
- * @GNUTLS_A_INSUFFICIENT_SECURITY: Insufficient security.
- * @GNUTLS_A_USER_CANCELED: User canceled.
- * @GNUTLS_A_INTERNAL_ERROR: Internal error.
- * @GNUTLS_A_NO_RENEGOTIATION: No renegotiation is allowed.
- * @GNUTLS_A_CERTIFICATE_UNOBTAINABLE: Could not retrieve the
- * specified certificate.
- * @GNUTLS_A_UNSUPPORTED_EXTENSION: An unsupported extension was
- * sent.
- * @GNUTLS_A_UNRECOGNIZED_NAME: The server name sent was not
- * recognized.
- * @GNUTLS_A_UNKNOWN_PSK_IDENTITY: The SRP/PSK username is missing
- * or not known.
- *
- * Enumeration of different TLS alerts.
- */
-typedef enum {
- GNUTLS_A_CLOSE_NOTIFY,
- GNUTLS_A_UNEXPECTED_MESSAGE = 10,
- GNUTLS_A_BAD_RECORD_MAC = 20,
- GNUTLS_A_DECRYPTION_FAILED,
- GNUTLS_A_RECORD_OVERFLOW,
- GNUTLS_A_DECOMPRESSION_FAILURE = 30,
- GNUTLS_A_HANDSHAKE_FAILURE = 40,
- GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
- GNUTLS_A_BAD_CERTIFICATE = 42,
- GNUTLS_A_UNSUPPORTED_CERTIFICATE,
- GNUTLS_A_CERTIFICATE_REVOKED,
- GNUTLS_A_CERTIFICATE_EXPIRED,
- GNUTLS_A_CERTIFICATE_UNKNOWN,
- GNUTLS_A_ILLEGAL_PARAMETER,
- GNUTLS_A_UNKNOWN_CA,
- GNUTLS_A_ACCESS_DENIED,
- GNUTLS_A_DECODE_ERROR = 50,
- GNUTLS_A_DECRYPT_ERROR,
- GNUTLS_A_EXPORT_RESTRICTION = 60,
- GNUTLS_A_PROTOCOL_VERSION = 70,
- GNUTLS_A_INSUFFICIENT_SECURITY,
- GNUTLS_A_INTERNAL_ERROR = 80,
- GNUTLS_A_USER_CANCELED = 90,
- GNUTLS_A_NO_RENEGOTIATION = 100,
- GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
- GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
- GNUTLS_A_UNRECOGNIZED_NAME = 112,
- GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
- GNUTLS_A_NO_APPLICATION_PROTOCOL = 120,
-} gnutls_alert_description_t;
-
-/**
- * gnutls_handshake_description_t:
- * @GNUTLS_HANDSHAKE_HELLO_REQUEST: Hello request.
- * @GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST: DTLS Hello verify request.
- * @GNUTLS_HANDSHAKE_CLIENT_HELLO: Client hello.
- * @GNUTLS_HANDSHAKE_SERVER_HELLO: Server hello.
- * @GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: New session ticket.
- * @GNUTLS_HANDSHAKE_CERTIFICATE_PKT: Certificate packet.
- * @GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: Server key exchange.
- * @GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: Certificate request.
- * @GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: Server hello done.
- * @GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: Certificate verify.
- * @GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: Client key exchange.
- * @GNUTLS_HANDSHAKE_FINISHED: Finished.
- * @GNUTLS_HANDSHAKE_CERTIFICATE_STATUS: Certificate status (OCSP).
- * @GNUTLS_HANDSHAKE_SUPPLEMENTAL: Supplemental.
- * @GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC: Change Cipher Spec.
- * @GNUTLS_HANDSHAKE_CLIENT_HELLO_V2: SSLv2 Client Hello.
- *
- * Enumeration of different TLS handshake packets.
- */
-typedef enum {
- GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
- GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
- GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
- GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3,
- GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4,
- GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
- GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
- GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
- GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
- GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
- GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
- GNUTLS_HANDSHAKE_FINISHED = 20,
- GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22,
- GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23,
- GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254,
- GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024,
-} gnutls_handshake_description_t;
-
-#define GNUTLS_HANDSHAKE_ANY ((unsigned int)-1)
-
-const char
- *gnutls_handshake_description_get_name(gnutls_handshake_description_t
- type);
-
-/**
- * gnutls_certificate_status_t:
- * @GNUTLS_CERT_INVALID: The certificate is not signed by one of the
- * 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: The signature verification failed.
- * @GNUTLS_CERT_REVOKED: Certificate is revoked by its authority. In X.509 this will be
- * set only if CRLs are checked.
- * @GNUTLS_CERT_SIGNER_NOT_FOUND: The certificate's issuer is not known.
- * This is the case if the issuer is not included in the trusted certificate list.
- * @GNUTLS_CERT_SIGNER_NOT_CA: The certificate's signer was not a CA. This
- * may happen if this was a version 1 certificate, which is common with
- * some CAs, or a version 3 certificate without the basic constrains extension.
- * @GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE: The certificate's signer constraints were
- * violated.
- * @GNUTLS_CERT_INSECURE_ALGORITHM: The certificate was signed using an insecure
- * algorithm such as MD2 or MD5. These algorithms have been broken and
- * should not be trusted.
- * @GNUTLS_CERT_NOT_ACTIVATED: The certificate is not yet activated.
- * @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_ISSUED_IN_FUTURE: The revocation data have a future issue date.
- * @GNUTLS_CERT_UNEXPECTED_OWNER: The owner is not the expected one.
- * @GNUTLS_CERT_MISMATCH: The certificate presented isn't the expected one (TOFU)
- *
- * Enumeration of certificate status codes. Note that the status
- * bits may have different meanings in OpenPGP keys and X.509
- * certificate verification.
- */
-typedef enum {
- GNUTLS_CERT_INVALID = 1 << 1,
- GNUTLS_CERT_REVOKED = 1 << 5,
- GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6,
- GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7,
- GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8,
- GNUTLS_CERT_NOT_ACTIVATED = 1 << 9,
- GNUTLS_CERT_EXPIRED = 1 << 10,
- GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11,
- GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12,
- GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14,
- GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15,
- GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16,
- GNUTLS_CERT_MISMATCH = 1 << 17,
-} gnutls_certificate_status_t;
-
-/**
- * gnutls_certificate_request_t:
- * @GNUTLS_CERT_IGNORE: Ignore certificate.
- * @GNUTLS_CERT_REQUEST: Request certificate.
- * @GNUTLS_CERT_REQUIRE: Require certificate.
- *
- * Enumeration of certificate request types.
- */
-typedef enum {
- GNUTLS_CERT_IGNORE = 0,
- GNUTLS_CERT_REQUEST = 1,
- GNUTLS_CERT_REQUIRE = 2
-} gnutls_certificate_request_t;
-
-/**
- * gnutls_openpgp_crt_status_t:
- * @GNUTLS_OPENPGP_CERT: Send entire certificate.
- * @GNUTLS_OPENPGP_CERT_FINGERPRINT: Send only certificate fingerprint.
- *
- * Enumeration of ways to send OpenPGP certificate.
- */
-typedef enum {
- GNUTLS_OPENPGP_CERT = 0,
- GNUTLS_OPENPGP_CERT_FINGERPRINT = 1
-} gnutls_openpgp_crt_status_t;
-
-/**
- * gnutls_close_request_t:
- * @GNUTLS_SHUT_RDWR: Disallow further receives/sends.
- * @GNUTLS_SHUT_WR: Disallow further sends.
- *
- * Enumeration of how TLS session should be terminated. See gnutls_bye().
- */
-typedef enum {
- GNUTLS_SHUT_RDWR = 0,
- GNUTLS_SHUT_WR = 1
-} gnutls_close_request_t;
-
-/**
- * gnutls_protocol_t:
- * @GNUTLS_SSL3: SSL version 3.0.
- * @GNUTLS_TLS1_0: TLS version 1.0.
- * @GNUTLS_TLS1: Same as %GNUTLS_TLS1_0.
- * @GNUTLS_TLS1_1: TLS version 1.1.
- * @GNUTLS_TLS1_2: TLS version 1.2.
- * @GNUTLS_DTLS1_0: DTLS version 1.0.
- * @GNUTLS_DTLS1_2: DTLS version 1.2.
- * @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_UNKNOWN: Unknown SSL/TLS version.
- *
- * Enumeration of different SSL/TLS protocol versions.
- */
-typedef enum {
- GNUTLS_SSL3 = 1,
- GNUTLS_TLS1_0 = 2,
- GNUTLS_TLS1 = GNUTLS_TLS1_0,
- GNUTLS_TLS1_1 = 3,
- GNUTLS_TLS1_2 = 4,
- GNUTLS_DTLS0_9 = 6, /* FIXME: at some point change it to 200 */
- GNUTLS_DTLS1_0 = 5, /* 201 */
- GNUTLS_DTLS1_2 = 202,
- GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS1_0,
- GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2,
- GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_2,
- GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */
-} gnutls_protocol_t;
-
-/**
- * gnutls_certificate_type_t:
- * @GNUTLS_CRT_UNKNOWN: Unknown certificate type.
- * @GNUTLS_CRT_X509: X.509 Certificate.
- * @GNUTLS_CRT_OPENPGP: OpenPGP certificate.
- * @GNUTLS_CRT_RAW: Raw public key (SubjectPublicKey)
- *
- * Enumeration of different certificate types.
- */
-typedef enum {
- GNUTLS_CRT_UNKNOWN = 0,
- GNUTLS_CRT_X509 = 1,
- GNUTLS_CRT_OPENPGP = 2,
- GNUTLS_CRT_RAW = 3
-} gnutls_certificate_type_t;
-
-/**
- * gnutls_x509_crt_fmt_t:
- * @GNUTLS_X509_FMT_DER: X.509 certificate in DER format (binary).
- * @GNUTLS_X509_FMT_PEM: X.509 certificate in PEM format (text).
- *
- * Enumeration of different certificate encoding formats.
- */
-typedef enum {
- GNUTLS_X509_FMT_DER = 0,
- GNUTLS_X509_FMT_PEM = 1
-} gnutls_x509_crt_fmt_t;
-
-/**
- * gnutls_certificate_print_formats_t:
- * @GNUTLS_CRT_PRINT_FULL: Full information about certificate.
- * @GNUTLS_CRT_PRINT_FULL_NUMBERS: Full information about certificate and include easy to parse public key parameters.
- * @GNUTLS_CRT_PRINT_COMPACT: Information about certificate name in one line, plus identification of the public key.
- * @GNUTLS_CRT_PRINT_ONELINE: Information about certificate in one line.
- * @GNUTLS_CRT_PRINT_UNSIGNED_FULL: All info for an unsigned certificate.
- *
- * Enumeration of different certificate printing variants.
- */
-typedef enum gnutls_certificate_print_formats {
- GNUTLS_CRT_PRINT_FULL = 0,
- GNUTLS_CRT_PRINT_ONELINE = 1,
- GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2,
- GNUTLS_CRT_PRINT_COMPACT = 3,
- GNUTLS_CRT_PRINT_FULL_NUMBERS = 4,
-} gnutls_certificate_print_formats_t;
-
-#define GNUTLS_PK_ECC GNUTLS_PK_EC
-/**
- * gnutls_pk_algorithm_t:
- * @GNUTLS_PK_UNKNOWN: Unknown public-key algorithm.
- * @GNUTLS_PK_RSA: RSA public-key algorithm.
- * @GNUTLS_PK_DSA: DSA public-key algorithm.
- * @GNUTLS_PK_DH: Diffie-Hellman algorithm. Used to generate parameters.
- * @GNUTLS_PK_EC: Elliptic curve algorithm. Used to generate parameters.
- *
- * Enumeration of different public-key algorithms.
- */
-typedef enum {
- GNUTLS_PK_UNKNOWN = 0,
- GNUTLS_PK_RSA = 1,
- GNUTLS_PK_DSA = 2,
- GNUTLS_PK_DH = 3,
- GNUTLS_PK_EC = 4,
-} gnutls_pk_algorithm_t;
-
-const char *gnutls_pk_algorithm_get_name(gnutls_pk_algorithm_t algorithm);
-
-/**
- * gnutls_sign_algorithm_t:
- * @GNUTLS_SIGN_UNKNOWN: Unknown signature algorithm.
- * @GNUTLS_SIGN_RSA_SHA1: Digital signature algorithm RSA with SHA-1
- * @GNUTLS_SIGN_RSA_SHA: Same as %GNUTLS_SIGN_RSA_SHA1.
- * @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_SHA256: Digital signature algorithm DSA with SHA-256
- * @GNUTLS_SIGN_DSA_SHA: Same as %GNUTLS_SIGN_DSA_SHA1.
- * @GNUTLS_SIGN_RSA_MD5: Digital signature algorithm RSA with MD5.
- * @GNUTLS_SIGN_RSA_MD2: Digital signature algorithm RSA with MD2.
- * @GNUTLS_SIGN_RSA_RMD160: Digital signature algorithm RSA with RMD-160.
- * @GNUTLS_SIGN_RSA_SHA256: Digital signature algorithm RSA with SHA-256.
- * @GNUTLS_SIGN_RSA_SHA384: Digital signature algorithm RSA with SHA-384.
- * @GNUTLS_SIGN_RSA_SHA512: Digital signature algorithm RSA with SHA-512.
- * @GNUTLS_SIGN_RSA_SHA224: Digital signature algorithm RSA with SHA-224.
- * @GNUTLS_SIGN_ECDSA_SHA1: ECDSA with SHA1.
- * @GNUTLS_SIGN_ECDSA_SHA256: Digital signature algorithm ECDSA with SHA-256.
- * @GNUTLS_SIGN_ECDSA_SHA384: Digital signature algorithm ECDSA with SHA-384.
- * @GNUTLS_SIGN_ECDSA_SHA512: Digital signature algorithm ECDSA with SHA-512.
- * @GNUTLS_SIGN_ECDSA_SHA224: Digital signature algorithm ECDSA with SHA-224.
- *
- * Enumeration of different digital signature algorithms.
- */
-typedef enum {
- GNUTLS_SIGN_UNKNOWN = 0,
- GNUTLS_SIGN_RSA_SHA1 = 1,
- GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1,
- GNUTLS_SIGN_DSA_SHA1 = 2,
- GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1,
- GNUTLS_SIGN_RSA_MD5 = 3,
- GNUTLS_SIGN_RSA_MD2 = 4,
- GNUTLS_SIGN_RSA_RMD160 = 5,
- GNUTLS_SIGN_RSA_SHA256 = 6,
- GNUTLS_SIGN_RSA_SHA384 = 7,
- GNUTLS_SIGN_RSA_SHA512 = 8,
- GNUTLS_SIGN_RSA_SHA224 = 9,
- GNUTLS_SIGN_DSA_SHA224 = 10,
- GNUTLS_SIGN_DSA_SHA256 = 11,
- GNUTLS_SIGN_ECDSA_SHA1 = 12,
- GNUTLS_SIGN_ECDSA_SHA224 = 13,
- GNUTLS_SIGN_ECDSA_SHA256 = 14,
- GNUTLS_SIGN_ECDSA_SHA384 = 15,
- GNUTLS_SIGN_ECDSA_SHA512 = 16,
-} gnutls_sign_algorithm_t;
-
-/**
- * gnutls_ecc_curve_t:
- * @GNUTLS_ECC_CURVE_INVALID: Cannot be known
- * @GNUTLS_ECC_CURVE_SECP192R1: the SECP192R1 curve
- * @GNUTLS_ECC_CURVE_SECP224R1: the SECP224R1 curve
- * @GNUTLS_ECC_CURVE_SECP256R1: the SECP256R1 curve
- * @GNUTLS_ECC_CURVE_SECP384R1: the SECP384R1 curve
- * @GNUTLS_ECC_CURVE_SECP521R1: the SECP521R1 curve
- *
- * Enumeration of ECC curves.
- */
-typedef enum {
- GNUTLS_ECC_CURVE_INVALID = 0,
- GNUTLS_ECC_CURVE_SECP224R1,
- GNUTLS_ECC_CURVE_SECP256R1,
- GNUTLS_ECC_CURVE_SECP384R1,
- GNUTLS_ECC_CURVE_SECP521R1,
- GNUTLS_ECC_CURVE_SECP192R1,
-} 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_UNKNOWN: Cannot be known
- * @GNUTLS_SEC_PARAM_INSECURE: Less than 42 bits of security
- * @GNUTLS_SEC_PARAM_EXPORT: 42 bits of security
- * @GNUTLS_SEC_PARAM_VERY_WEAK: 64 bits of security
- * @GNUTLS_SEC_PARAM_WEAK: 72 bits of security
- * @GNUTLS_SEC_PARAM_LOW: 80 bits of security
- * @GNUTLS_SEC_PARAM_LEGACY: 96 bits of security
- * @GNUTLS_SEC_PARAM_NORMAL: 112 bits of security
- * @GNUTLS_SEC_PARAM_HIGH: 128 bits of security
- * @GNUTLS_SEC_PARAM_ULTRA: 192 bits of security
- *
- * Enumeration of security parameters for passive attacks.
- */
-typedef enum {
- GNUTLS_SEC_PARAM_INSECURE = -20,
- GNUTLS_SEC_PARAM_EXPORT = -15,
- GNUTLS_SEC_PARAM_VERY_WEAK = -12,
- GNUTLS_SEC_PARAM_WEAK = -10,
- GNUTLS_SEC_PARAM_UNKNOWN = 0,
- GNUTLS_SEC_PARAM_LOW = 1,
- GNUTLS_SEC_PARAM_LEGACY = 2,
- GNUTLS_SEC_PARAM_NORMAL = 3,
- GNUTLS_SEC_PARAM_HIGH = 4,
- GNUTLS_SEC_PARAM_ULTRA = 5,
-} gnutls_sec_param_t;
-
-/**
- * gnutls_channel_binding_t:
- * @GNUTLS_CB_TLS_UNIQUE: "tls-unique" (RFC 5929) channel binding
- *
- * Enumeration of support channel binding types.
- */
-typedef enum {
- GNUTLS_CB_TLS_UNIQUE
-} gnutls_channel_binding_t;
-
-
-/* If you want to change this, then also change the define in
- * gnutls_int.h, and recompile.
- */
-typedef void *gnutls_transport_ptr_t;
-
-struct gnutls_session_int;
-typedef struct gnutls_session_int *gnutls_session_t;
-
-struct gnutls_dh_params_int;
-typedef struct gnutls_dh_params_int *gnutls_dh_params_t;
-
-struct gnutls_ecdh_params_int;
-typedef struct gnutls_ecdh_params_int *gnutls_ecdh_params_t;
-
- /* XXX ugly. */
-struct gnutls_x509_privkey_int;
-typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t;
-
-struct gnutls_priority_st;
-typedef struct gnutls_priority_st *gnutls_priority_t;
-
-typedef struct {
- unsigned char *data;
- unsigned int size;
-} gnutls_datum_t;
-
-
-typedef struct gnutls_params_st {
- gnutls_params_type_t type;
- union params {
- gnutls_dh_params_t dh;
- gnutls_ecdh_params_t ecdh;
- gnutls_rsa_params_t rsa_export;
- } params;
- int deinit;
-} gnutls_params_st;
-
-typedef int gnutls_params_function(gnutls_session_t, gnutls_params_type_t,
- gnutls_params_st *);
-
-/* internal functions */
-
-int gnutls_init(gnutls_session_t * session, unsigned int flags);
-void gnutls_deinit(gnutls_session_t session);
-#define _gnutls_deinit(x) gnutls_deinit(x)
-
-int gnutls_bye(gnutls_session_t session, gnutls_close_request_t how);
-
-int gnutls_handshake(gnutls_session_t session);
-
-#define GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT ((unsigned int)-1)
-void gnutls_handshake_set_timeout(gnutls_session_t session,
- unsigned int ms);
-int gnutls_rehandshake(gnutls_session_t session);
-
-gnutls_alert_description_t gnutls_alert_get(gnutls_session_t session);
-int gnutls_alert_send(gnutls_session_t session,
- gnutls_alert_level_t level,
- gnutls_alert_description_t desc);
-int gnutls_alert_send_appropriate(gnutls_session_t session, int err);
-const char *gnutls_alert_get_name(gnutls_alert_description_t alert);
-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 algo,
- unsigned int bits);
-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,
- gnutls_sec_param_t param);
-
-/* Elliptic curves */
-const char *gnutls_ecc_curve_get_name(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);
-
-/* get information on the current session */
-gnutls_cipher_algorithm_t gnutls_cipher_get(gnutls_session_t session);
-gnutls_kx_algorithm_t gnutls_kx_get(gnutls_session_t session);
-gnutls_mac_algorithm_t gnutls_mac_get(gnutls_session_t session);
-gnutls_compression_method_t
-gnutls_compression_get(gnutls_session_t session);
-gnutls_certificate_type_t
-gnutls_certificate_type_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_requested(gnutls_session_t session,
- size_t indx,
- gnutls_sign_algorithm_t * algo);
-
-/* the name of the specified algorithms */
-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_digest_get_name(gnutls_digest_algorithm_t algorithm);
-const char *gnutls_compression_get_name(gnutls_compression_method_t
- algorithm);
-const char *gnutls_kx_get_name(gnutls_kx_algorithm_t algorithm);
-const char *gnutls_certificate_type_get_name(gnutls_certificate_type_t
- type);
-const char *gnutls_pk_get_name(gnutls_pk_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_mac_get_key_size(gnutls_mac_algorithm_t algorithm);
-
-int gnutls_sign_is_secure(gnutls_sign_algorithm_t algorithm);
-gnutls_digest_algorithm_t
-gnutls_sign_get_hash_algorithm(gnutls_sign_algorithm_t sign);
-gnutls_pk_algorithm_t
-gnutls_sign_get_pk_algorithm(gnutls_sign_algorithm_t sign);
-gnutls_sign_algorithm_t
-gnutls_pk_to_sign(gnutls_pk_algorithm_t pk,
- gnutls_digest_algorithm_t hash);
-
-#define gnutls_sign_algorithm_get_name gnutls_sign_get_name
-
-gnutls_mac_algorithm_t gnutls_mac_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_cipher_algorithm_t gnutls_cipher_get_id(const char *name);
-gnutls_kx_algorithm_t gnutls_kx_get_id(const char *name);
-gnutls_protocol_t gnutls_protocol_get_id(const char *name);
-gnutls_certificate_type_t gnutls_certificate_type_get_id(const char *name);
-gnutls_pk_algorithm_t gnutls_pk_get_id(const char *name);
-gnutls_sign_algorithm_t gnutls_sign_get_id(const char *name);
-
- /* list supported algorithms */
-const gnutls_ecc_curve_t *gnutls_ecc_curve_list(void);
-const gnutls_cipher_algorithm_t *gnutls_cipher_list(void);
-const gnutls_mac_algorithm_t *gnutls_mac_list(void);
-const gnutls_digest_algorithm_t *gnutls_digest_list(void);
-const gnutls_compression_method_t *gnutls_compression_list(void);
-const gnutls_protocol_t *gnutls_protocol_list(void);
-const gnutls_certificate_type_t *gnutls_certificate_type_list(void);
-const gnutls_kx_algorithm_t *gnutls_kx_list(void);
-const gnutls_pk_algorithm_t *gnutls_pk_list(void);
-const gnutls_sign_algorithm_t *gnutls_sign_list(void);
-const char *gnutls_cipher_suite_info(size_t idx,
- unsigned char *cs_id,
- gnutls_kx_algorithm_t * kx,
- gnutls_cipher_algorithm_t * cipher,
- gnutls_mac_algorithm_t * mac,
- gnutls_protocol_t * min_version);
-
- /* error functions */
-int gnutls_error_is_fatal(int error);
-int gnutls_error_to_alert(int err, int *level);
-
-void gnutls_perror(int error);
-const char *gnutls_strerror(int error);
-const char *gnutls_strerror_name(int error);
-
-/* Semi-internal functions.
- */
-void gnutls_handshake_set_private_extensions(gnutls_session_t session,
- int allow);
-int gnutls_handshake_set_random(gnutls_session_t session,
- const gnutls_datum_t * random);
-
-gnutls_handshake_description_t
-gnutls_handshake_get_last_out(gnutls_session_t session);
-gnutls_handshake_description_t
-gnutls_handshake_get_last_in(gnutls_session_t session);
-
-/* Record layer functions.
- */
-#define GNUTLS_HEARTBEAT_WAIT 1
-int gnutls_heartbeat_ping(gnutls_session_t session, size_t data_size,
- unsigned int max_tries, 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_disable_padding(gnutls_session_t session);
-
-void gnutls_record_cork(gnutls_session_t session);
-#define GNUTLS_RECORD_WAIT 1
-int gnutls_record_uncork(gnutls_session_t session, unsigned int flags);
-
-typedef struct {
- size_t low;
- size_t high;
-} gnutls_range_st;
-
-int gnutls_range_split(gnutls_session_t session,
- const gnutls_range_st * orig,
- gnutls_range_st * small_range,
- gnutls_range_st * rem_range);
-
-ssize_t gnutls_record_send(gnutls_session_t session, const void *data,
- size_t data_size);
-ssize_t gnutls_record_send_range(gnutls_session_t session,
- const void *data, size_t data_size,
- const gnutls_range_st * range);
-ssize_t gnutls_record_recv(gnutls_session_t session, void *data,
- size_t data_size);
-#define gnutls_read gnutls_record_recv
-#define gnutls_write gnutls_record_send
-ssize_t gnutls_record_recv_seq(gnutls_session_t session, void *data,
- size_t data_size, unsigned char *seq);
-
-size_t gnutls_record_overhead_size(gnutls_session_t session);
-
-size_t gnutls_est_record_overhead_size(gnutls_protocol_t version,
- gnutls_cipher_algorithm_t cipher,
- gnutls_mac_algorithm_t mac,
- gnutls_compression_method_t comp,
- unsigned int flags);
-
-void gnutls_session_enable_compatibility_mode(gnutls_session_t session);
-void gnutls_record_set_max_empty_records(gnutls_session_t session,
- const unsigned int i);
-
-int gnutls_record_can_use_length_hiding(gnutls_session_t session);
-
-int gnutls_record_get_direction(gnutls_session_t session);
-
-size_t gnutls_record_get_max_size(gnutls_session_t session);
-ssize_t gnutls_record_set_max_size(gnutls_session_t session, size_t size);
-
-size_t gnutls_record_check_pending(gnutls_session_t session);
-size_t gnutls_record_check_corked(gnutls_session_t session);
-
-void gnutls_session_force_valid(gnutls_session_t session);
-
-int gnutls_prf(gnutls_session_t session,
- size_t label_size, const char *label,
- int server_random_first,
- size_t extra_size, const char *extra,
- size_t outsize, char *out);
-
-int gnutls_prf_raw(gnutls_session_t session,
- size_t label_size, const char *label,
- size_t seed_size, const char *seed,
- size_t outsize, char *out);
-
-/**
- * gnutls_server_name_type_t:
- * @GNUTLS_NAME_DNS: Domain Name System name type.
- *
- * Enumeration of different server name types.
- */
-typedef enum {
- GNUTLS_NAME_DNS = 1
-} gnutls_server_name_type_t;
-
-int gnutls_server_name_set(gnutls_session_t session,
- gnutls_server_name_type_t type,
- const void *name, size_t name_length);
-
-int gnutls_server_name_get(gnutls_session_t session,
- void *data, size_t * data_length,
- unsigned int *type, unsigned int indx);
-
-unsigned int gnutls_heartbeat_get_timeout(gnutls_session_t session);
-void gnutls_heartbeat_set_timeouts(gnutls_session_t session,
- unsigned int retrans_timeout,
- unsigned int total_timeout);
-
-#define GNUTLS_HB_PEER_ALLOWED_TO_SEND (1)
-#define GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND (1<<1)
-
- /* Heartbeat */
-void gnutls_heartbeat_enable(gnutls_session_t session, unsigned int type);
-
-#define GNUTLS_HB_LOCAL_ALLOWED_TO_SEND (1<<2)
-int gnutls_heartbeat_allowed(gnutls_session_t session, unsigned int type);
-
- /* Safe renegotiation */
-int gnutls_safe_renegotiation_status(gnutls_session_t session);
-
-/**
- * gnutls_supplemental_data_format_type_t:
- * @GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA: Supplemental user mapping data.
- *
- * Enumeration of different supplemental data types (RFC 4680).
- */
-typedef enum {
- GNUTLS_SUPPLEMENTAL_USER_MAPPING_DATA = 0
-} gnutls_supplemental_data_format_type_t;
-
-const char
-*gnutls_supplemental_get_name(gnutls_supplemental_data_format_type_t type);
-
- /* SessionTicket, RFC 5077. */
-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_server(gnutls_session_t session,
- const gnutls_datum_t * key);
-
- /* SRTP, RFC 5764 */
-
-/**
- * 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_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_32: NULL cipher with a 32 bit HMAC-SHA1
- *
- * Enumeration of different SRTP protection profiles.
- */
-typedef enum {
- GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001,
- GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002,
- GNUTLS_SRTP_NULL_HMAC_SHA1_80 = 0x0005,
- GNUTLS_SRTP_NULL_HMAC_SHA1_32 = 0x0006
-} gnutls_srtp_profile_t;
-
-int gnutls_srtp_set_profile(gnutls_session_t session,
- gnutls_srtp_profile_t profile);
-int gnutls_srtp_set_profile_direct(gnutls_session_t session,
- const char *profiles,
- const char **err_pos);
-int gnutls_srtp_get_selected_profile(gnutls_session_t session,
- 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,
- gnutls_srtp_profile_t * profile);
-int gnutls_srtp_get_keys(gnutls_session_t session,
- void *key_material,
- unsigned int key_material_size,
- gnutls_datum_t * client_key,
- gnutls_datum_t * client_salt,
- gnutls_datum_t * server_key,
- gnutls_datum_t * server_salt);
-
-int gnutls_srtp_set_mki(gnutls_session_t session,
- const gnutls_datum_t * mki);
-int gnutls_srtp_get_mki(gnutls_session_t session, gnutls_datum_t * mki);
-
-/* ALPN TLS extension */
-#define GNUTLS_ALPN_MAND 1
-int gnutls_alpn_get_selected_protocol(gnutls_session_t session,
- gnutls_datum_t * protocol);
-int gnutls_alpn_set_protocols(gnutls_session_t session,
- const gnutls_datum_t * protocols,
- unsigned protocols_size, unsigned flags);
-
-int gnutls_key_generate(gnutls_datum_t * key, unsigned int key_size);
-
-/* if you just want some defaults, use the following.
- */
-int gnutls_priority_init(gnutls_priority_t * priority_cache,
- const char *priorities, const char **err_pos);
-void gnutls_priority_deinit(gnutls_priority_t priority_cache);
-int gnutls_priority_get_cipher_suite_index(gnutls_priority_t pcache,
- unsigned int idx,
- unsigned int *sidx);
-
-int gnutls_priority_set(gnutls_session_t session,
- gnutls_priority_t priority);
-int gnutls_priority_set_direct(gnutls_session_t session,
- const char *priorities,
- const char **err_pos);
-
-int gnutls_priority_certificate_type_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_sign_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_protocol_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_compression_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_ecc_curve_list(gnutls_priority_t pcache,
- const unsigned int **list);
-
-int gnutls_priority_kx_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_cipher_list(gnutls_priority_t pcache,
- const unsigned int **list);
-int gnutls_priority_mac_list(gnutls_priority_t pcache,
- const unsigned int **list);
-
- /* for compatibility
- */
-int gnutls_set_default_priority(gnutls_session_t session);
-
-/* Returns the name of a cipher suite */
-const char *gnutls_cipher_suite_get_name(gnutls_kx_algorithm_t
- kx_algorithm,
- gnutls_cipher_algorithm_t
- cipher_algorithm,
- gnutls_mac_algorithm_t
- mac_algorithm);
-
-/* get the currently used protocol version */
-gnutls_protocol_t gnutls_protocol_get_version(gnutls_session_t session);
-
-const char *gnutls_protocol_get_name(gnutls_protocol_t version);
-
-
-/* get/set session
- */
-int gnutls_session_set_data(gnutls_session_t session,
- const void *session_data,
- size_t session_data_size);
-int gnutls_session_get_data(gnutls_session_t session, void *session_data,
- size_t * session_data_size);
-int gnutls_session_get_data2(gnutls_session_t session,
- gnutls_datum_t * data);
-void gnutls_session_get_random(gnutls_session_t session,
- gnutls_datum_t * client,
- gnutls_datum_t * server);
-char *gnutls_session_get_desc(gnutls_session_t session);
-
-int gnutls_session_set_premaster(gnutls_session_t session,
- unsigned int entity,
- gnutls_protocol_t version,
- gnutls_kx_algorithm_t kx,
- gnutls_cipher_algorithm_t cipher,
- gnutls_mac_algorithm_t mac,
- gnutls_compression_method_t comp,
- const gnutls_datum_t * master,
- const gnutls_datum_t * session_id);
-
-/* returns the session ID */
-#define GNUTLS_MAX_SESSION_ID 32
-int gnutls_session_get_id(gnutls_session_t session, void *session_id,
- size_t * session_id_size);
-int gnutls_session_get_id2(gnutls_session_t session,
- gnutls_datum_t * session_id);
-
-int gnutls_session_set_id(gnutls_session_t session,
- const gnutls_datum_t * sid);
-
-int gnutls_session_channel_binding(gnutls_session_t session,
- gnutls_channel_binding_t cbtype,
- gnutls_datum_t * cb);
-
-/* checks if this session is a resumed one
- */
-int gnutls_session_is_resumed(gnutls_session_t session);
-int gnutls_session_resumption_requested(gnutls_session_t session);
-
-typedef int (*gnutls_db_store_func) (void *, gnutls_datum_t key,
- gnutls_datum_t data);
-typedef int (*gnutls_db_remove_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 seconds);
-unsigned gnutls_db_get_default_cache_expiration(void);
-
-void gnutls_db_remove_session(gnutls_session_t session);
-void gnutls_db_set_retrieve_function(gnutls_session_t session,
- gnutls_db_retr_func retr_func);
-void gnutls_db_set_remove_function(gnutls_session_t session,
- gnutls_db_remove_func rem_func);
-void gnutls_db_set_store_function(gnutls_session_t session,
- gnutls_db_store_func store_func);
-void gnutls_db_set_ptr(gnutls_session_t session, void *ptr);
-void *gnutls_db_get_ptr(gnutls_session_t session);
-int gnutls_db_check_entry(gnutls_session_t session,
- gnutls_datum_t session_entry);
-time_t gnutls_db_check_entry_time(gnutls_datum_t * entry);
-
- /**
- * gnutls_handshake_hook_func:
- * @session: the current session
- * @htype: the type of the handshake message (%gnutls_handshake_description_t)
- * @post: non zero if this is a post-process/generation call and zero otherwise
- * @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
- * gnutls_handshake_set_hook_function().
- *
- * Returns: Non zero on error.
- */
-#define GNUTLS_HOOK_POST (1)
-#define GNUTLS_HOOK_PRE (0)
-#define GNUTLS_HOOK_BOTH (-1)
-
-typedef int (*gnutls_handshake_hook_func) (gnutls_session_t,
- unsigned int htype,
- unsigned post,
- unsigned int incoming);
-void gnutls_handshake_set_hook_function(gnutls_session_t session,
- unsigned int htype, int post,
- gnutls_handshake_hook_func func);
-
-typedef int (*gnutls_handshake_post_client_hello_func) (gnutls_session_t);
-void
-gnutls_handshake_set_post_client_hello_function(gnutls_session_t session,
- gnutls_handshake_post_client_hello_func
- func);
-
-void gnutls_handshake_set_max_packet_length(gnutls_session_t session,
- size_t max);
-
-/* returns libgnutls version (call it with a NULL argument)
- */
-const char *gnutls_check_version(const char *req_version);
-
-/* Functions for setting/clearing credentials
- */
-void gnutls_credentials_clear(gnutls_session_t session);
-
-/* cred is a structure defined by the kx algorithm
- */
-int gnutls_credentials_set(gnutls_session_t session,
- gnutls_credentials_type_t type, void *cred);
-#define gnutls_cred_set gnutls_credentials_set
-
-/* x.509 types */
-
-struct gnutls_pubkey_st;
-typedef struct gnutls_pubkey_st *gnutls_pubkey_t;
-
-struct gnutls_privkey_st;
-typedef struct gnutls_privkey_st *gnutls_privkey_t;
-
-struct gnutls_x509_privkey_int;
-typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t;
-
-struct gnutls_x509_crl_int;
-typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t;
-
-struct gnutls_x509_crt_int;
-typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t;
-
-struct gnutls_x509_crq_int;
-typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t;
-
-struct gnutls_openpgp_keyring_int;
-typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t;
-
-
-/* Credential structures - used in gnutls_credentials_set(); */
-
-struct gnutls_certificate_credentials_st;
-typedef struct gnutls_certificate_credentials_st
-*gnutls_certificate_credentials_t;
-typedef gnutls_certificate_credentials_t
- gnutls_certificate_server_credentials;
-typedef gnutls_certificate_credentials_t
- gnutls_certificate_client_credentials;
-
-typedef struct gnutls_anon_server_credentials_st
-*gnutls_anon_server_credentials_t;
-typedef struct gnutls_anon_client_credentials_st
-*gnutls_anon_client_credentials_t;
-
-void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t
- sc);
-int
-gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t
- * sc);
-
-void gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials_t res,
- gnutls_dh_params_t dh_params);
-
-void
-gnutls_anon_set_server_params_function(gnutls_anon_server_credentials_t
- res, gnutls_params_function * func);
-
-void
-gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t sc);
-int
-gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials_t
- * sc);
-
-/* CERTFILE is an x509 certificate in PEM form.
- * KEYFILE is a pkcs-1 private key in PEM form (for RSA keys).
- */
-void
-gnutls_certificate_free_credentials(gnutls_certificate_credentials_t sc);
-int
-gnutls_certificate_allocate_credentials(gnutls_certificate_credentials_t
- * res);
-
-int
-gnutls_certificate_get_issuer(gnutls_certificate_credentials_t sc,
- gnutls_x509_crt_t cert,
- gnutls_x509_crt_t * issuer,
- unsigned int flags);
-
-int gnutls_certificate_get_crt_raw(gnutls_certificate_credentials_t sc,
- unsigned idx1, unsigned idx2,
- gnutls_datum_t * cert);
-
-void gnutls_certificate_free_keys(gnutls_certificate_credentials_t sc);
-void gnutls_certificate_free_cas(gnutls_certificate_credentials_t sc);
-void gnutls_certificate_free_ca_names(gnutls_certificate_credentials_t sc);
-void gnutls_certificate_free_crls(gnutls_certificate_credentials_t sc);
-
-void gnutls_certificate_set_dh_params(gnutls_certificate_credentials_t res,
- gnutls_dh_params_t dh_params);
-void gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t
- res, unsigned int flags);
-void gnutls_certificate_set_verify_limits(gnutls_certificate_credentials_t
- res, unsigned int max_bits,
- unsigned int max_depth);
-
-int
-gnutls_certificate_set_x509_system_trust(gnutls_certificate_credentials_t
- cred);
-
-int
-gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials_t
- cred, const char *cafile,
- gnutls_x509_crt_fmt_t type);
-int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t
- res, const gnutls_datum_t * ca,
- gnutls_x509_crt_fmt_t type);
-
-int
-gnutls_certificate_set_x509_crl_file(gnutls_certificate_credentials_t
- res, const char *crlfile,
- gnutls_x509_crt_fmt_t type);
-int gnutls_certificate_set_x509_crl_mem(gnutls_certificate_credentials_t
- res, const gnutls_datum_t * CRL,
- gnutls_x509_crt_fmt_t type);
-
-int
-gnutls_certificate_set_x509_key_file(gnutls_certificate_credentials_t
- res, const char *certfile,
- const char *keyfile,
- gnutls_x509_crt_fmt_t type);
-
-int
-gnutls_certificate_set_x509_key_file2(gnutls_certificate_credentials_t
- res, const char *certfile,
- const char *keyfile,
- gnutls_x509_crt_fmt_t type,
- const char *pass,
- unsigned int flags);
-
-int gnutls_certificate_set_x509_key_mem(gnutls_certificate_credentials_t
- res, const gnutls_datum_t * cert,
- const gnutls_datum_t * key,
- gnutls_x509_crt_fmt_t type);
-
-int gnutls_certificate_set_x509_key_mem2(gnutls_certificate_credentials_t
- res, const gnutls_datum_t * cert,
- const gnutls_datum_t * key,
- gnutls_x509_crt_fmt_t type,
- const char *pass,
- unsigned int flags);
-
-void gnutls_certificate_send_x509_rdn_sequence(gnutls_session_t session,
- int status);
-
-int
-gnutls_certificate_set_x509_simple_pkcs12_file
-(gnutls_certificate_credentials_t res, const char *pkcs12file,
- gnutls_x509_crt_fmt_t type, const char *password);
-int
-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.
- */
-
-int gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res,
- gnutls_x509_crt_t * cert_list,
- int cert_list_size,
- gnutls_x509_privkey_t key);
-int gnutls_certificate_set_x509_trust(gnutls_certificate_credentials_t res,
- gnutls_x509_crt_t * ca_list,
- int ca_list_size);
-int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res,
- gnutls_x509_crl_t * crl_list,
- int crl_list_size);
-
- /* OCSP status request extension, RFC 6066 */
-typedef int (*gnutls_status_request_ocsp_func)
- (gnutls_session_t session, void *ptr, gnutls_datum_t * ocsp_response);
-
-void
-gnutls_certificate_set_ocsp_status_request_function
-(gnutls_certificate_credentials_t res,
-gnutls_status_request_ocsp_func ocsp_func, void *ptr);
-
-int
-gnutls_certificate_set_ocsp_status_request_file
-(gnutls_certificate_credentials_t res, const char *response_file,
- unsigned int flags);
-
-int gnutls_ocsp_status_request_enable_client(gnutls_session_t session,
- gnutls_datum_t * responder_id,
- size_t responder_id_size,
- gnutls_datum_t *
- request_extensions);
-
-int gnutls_ocsp_status_request_get(gnutls_session_t session,
- gnutls_datum_t * response);
-
-int gnutls_ocsp_status_request_is_checked(gnutls_session_t session,
- unsigned int flags);
-
-/* global state functions
- */
-int gnutls_global_init(void);
-void gnutls_global_deinit(void);
-
- /**
- * gnutls_time_func:
- * @t: where to store time.
- *
- * Function prototype for time()-like function. Set with
- * gnutls_global_set_time_function().
- *
- * Returns: Number of seconds since the epoch, or (time_t)-1 on errors.
- */
-typedef time_t(*gnutls_time_func) (time_t * t);
-
-typedef int (*mutex_init_func) (void **mutex);
-typedef int (*mutex_lock_func) (void **mutex);
-typedef int (*mutex_unlock_func) (void **mutex);
-typedef int (*mutex_deinit_func) (void **mutex);
-
-void gnutls_global_set_mutex(mutex_init_func init,
- mutex_deinit_func deinit,
- mutex_lock_func lock,
- mutex_unlock_func unlock);
-
-typedef void *(*gnutls_alloc_function) (size_t);
-typedef void *(*gnutls_calloc_function) (size_t, size_t);
-typedef int (*gnutls_is_secure_function) (const void *);
-typedef void (*gnutls_free_function) (void *);
-typedef void *(*gnutls_realloc_function) (void *, size_t);
-
-void
-gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func,
- gnutls_alloc_function secure_alloc_func,
- gnutls_is_secure_function is_secure_func,
- gnutls_realloc_function realloc_func,
- gnutls_free_function free_func);
-
-void gnutls_global_set_time_function(gnutls_time_func time_func);
-
-/* For use in callbacks */
-extern gnutls_alloc_function gnutls_malloc;
-extern gnutls_alloc_function gnutls_secure_malloc;
-extern gnutls_realloc_function gnutls_realloc;
-extern gnutls_calloc_function gnutls_calloc;
-extern gnutls_free_function gnutls_free;
-
-extern char *(*gnutls_strdup) (const char *);
-
-typedef void (*gnutls_log_func) (int, 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_audit_log_function(gnutls_audit_log_func log_func);
-void gnutls_global_set_log_level(int level);
-
-/* Diffie-Hellman parameter handling.
- */
-int gnutls_dh_params_init(gnutls_dh_params_t * dh_params);
-void gnutls_dh_params_deinit(gnutls_dh_params_t dh_params);
-int gnutls_dh_params_import_raw(gnutls_dh_params_t dh_params,
- const gnutls_datum_t * prime,
- const gnutls_datum_t * generator);
-int gnutls_dh_params_import_pkcs3(gnutls_dh_params_t params,
- const gnutls_datum_t * pkcs3_params,
- gnutls_x509_crt_fmt_t format);
-int gnutls_dh_params_generate2(gnutls_dh_params_t params,
- unsigned int bits);
-int gnutls_dh_params_export_pkcs3(gnutls_dh_params_t params,
- gnutls_x509_crt_fmt_t format,
- unsigned char *params_data,
- size_t * params_data_size);
-int gnutls_dh_params_export2_pkcs3(gnutls_dh_params_t params,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-int gnutls_dh_params_export_raw(gnutls_dh_params_t params,
- gnutls_datum_t * prime,
- gnutls_datum_t * generator,
- unsigned int *bits);
-int gnutls_dh_params_cpy(gnutls_dh_params_t dst, gnutls_dh_params_t src);
-
-
-
-/* Session stuff
- */
-typedef struct {
- void *iov_base; /* Starting address */
- size_t iov_len; /* Number of bytes to transfer */
-} giovec_t;
-
-typedef ssize_t(*gnutls_pull_func) (gnutls_transport_ptr_t, void *,
- size_t);
-typedef ssize_t(*gnutls_push_func) (gnutls_transport_ptr_t, const void *,
- size_t);
-
-typedef int (*gnutls_pull_timeout_func) (gnutls_transport_ptr_t,
- unsigned int ms);
-
-typedef ssize_t(*gnutls_vec_push_func) (gnutls_transport_ptr_t,
- const giovec_t * iov, int iovcnt);
-
-typedef int (*gnutls_errno_func) (gnutls_transport_ptr_t);
-
-#if 0
- /* This will be defined as macro. */
- 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);
-int gnutls_transport_get_int(gnutls_session_t session);
-
-void gnutls_transport_set_ptr(gnutls_session_t session,
- gnutls_transport_ptr_t ptr);
-void gnutls_transport_set_ptr2(gnutls_session_t session,
- gnutls_transport_ptr_t recv_ptr,
- gnutls_transport_ptr_t send_ptr);
-
-gnutls_transport_ptr_t gnutls_transport_get_ptr(gnutls_session_t session);
-void gnutls_transport_get_ptr2(gnutls_session_t session,
- gnutls_transport_ptr_t * recv_ptr,
- gnutls_transport_ptr_t * send_ptr);
-
-void gnutls_transport_set_vec_push_function(gnutls_session_t session,
- gnutls_vec_push_func vec_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_pull_timeout_function(gnutls_session_t session,
- gnutls_pull_timeout_func
- func);
-
-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
- */
-void gnutls_session_set_ptr(gnutls_session_t session, void *ptr);
-void *gnutls_session_get_ptr(gnutls_session_t session);
-
-void gnutls_openpgp_send_cert(gnutls_session_t session,
- gnutls_openpgp_crt_status_t status);
-
-/* This function returns the hash of the given data.
- */
-int gnutls_fingerprint(gnutls_digest_algorithm_t algo,
- const gnutls_datum_t * data, void *result,
- size_t * result_size);
-
- /**
- * gnutls_random_art_t:
- * @GNUTLS_RANDOM_ART_OPENSSH: OpenSSH-style random art.
- *
- * Enumeration of different random art types.
- */
-typedef enum gnutls_random_art {
- GNUTLS_RANDOM_ART_OPENSSH = 1,
-} gnutls_random_art_t;
-
-int gnutls_random_art(gnutls_random_art_t type,
- const char *key_type, unsigned int key_size,
- void *fpr, size_t fpr_size, gnutls_datum_t * art);
-
-/* SRP
- */
-
-typedef struct gnutls_srp_server_credentials_st
-*gnutls_srp_server_credentials_t;
-typedef struct gnutls_srp_client_credentials_st
-*gnutls_srp_client_credentials_t;
-
-void
-gnutls_srp_free_client_credentials(gnutls_srp_client_credentials_t sc);
-int
-gnutls_srp_allocate_client_credentials(gnutls_srp_client_credentials_t *
- sc);
-int gnutls_srp_set_client_credentials(gnutls_srp_client_credentials_t res,
- const char *username,
- const char *password);
-
-void
-gnutls_srp_free_server_credentials(gnutls_srp_server_credentials_t sc);
-int
-gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials_t *
- sc);
-int gnutls_srp_set_server_credentials_file(gnutls_srp_server_credentials_t
- res, const char *password_file,
- const char *password_conf_file);
-
-const char *gnutls_srp_server_get_username(gnutls_session_t session);
-
-void gnutls_srp_set_prime_bits(gnutls_session_t session,
- unsigned int bits);
-
-int gnutls_srp_verifier(const char *username,
- const char *password,
- const gnutls_datum_t * salt,
- const gnutls_datum_t * generator,
- const gnutls_datum_t * prime,
- gnutls_datum_t * res);
-
-/* The static parameters defined in draft-ietf-tls-srp-05
- * 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_generator;
-
-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_2048_group_prime;
-extern const gnutls_datum_t gnutls_srp_2048_group_generator;
-
-extern const gnutls_datum_t gnutls_srp_1536_group_prime;
-extern const gnutls_datum_t gnutls_srp_1536_group_generator;
-
-extern const gnutls_datum_t gnutls_srp_1024_group_prime;
-extern const gnutls_datum_t gnutls_srp_1024_group_generator;
-
-typedef int gnutls_srp_server_credentials_function(gnutls_session_t,
- const char *username,
- gnutls_datum_t * salt,
- gnutls_datum_t *
- verifier,
- gnutls_datum_t *
- generator,
- gnutls_datum_t * prime);
-void
-gnutls_srp_set_server_credentials_function(gnutls_srp_server_credentials_t
- cred,
- gnutls_srp_server_credentials_function
- * func);
-
-typedef int gnutls_srp_client_credentials_function(gnutls_session_t,
- char **, char **);
-void
-gnutls_srp_set_client_credentials_function(gnutls_srp_client_credentials_t
- cred,
- gnutls_srp_client_credentials_function
- * func);
-
-int gnutls_srp_base64_encode(const gnutls_datum_t * data, char *result,
- size_t * result_size);
-int gnutls_srp_base64_encode_alloc(const gnutls_datum_t * data,
- gnutls_datum_t * result);
-
-int gnutls_srp_base64_decode(const gnutls_datum_t * b64_data, char *result,
- size_t * result_size);
-int gnutls_srp_base64_decode_alloc(const gnutls_datum_t * b64_data,
- gnutls_datum_t * result);
-
-/* PSK stuff */
-typedef struct gnutls_psk_server_credentials_st
-*gnutls_psk_server_credentials_t;
-typedef struct gnutls_psk_client_credentials_st
-*gnutls_psk_client_credentials_t;
-
-/**
- * gnutls_psk_key_flags:
- * @GNUTLS_PSK_KEY_RAW: PSK-key in raw format.
- * @GNUTLS_PSK_KEY_HEX: PSK-key in hex format.
- *
- * Enumeration of different PSK key flags.
- */
-typedef enum gnutls_psk_key_flags {
- GNUTLS_PSK_KEY_RAW = 0,
- GNUTLS_PSK_KEY_HEX
-} gnutls_psk_key_flags;
-
-void
-gnutls_psk_free_client_credentials(gnutls_psk_client_credentials_t sc);
-int
-gnutls_psk_allocate_client_credentials(gnutls_psk_client_credentials_t *
- sc);
-int gnutls_psk_set_client_credentials(gnutls_psk_client_credentials_t res,
- const char *username,
- const gnutls_datum_t * key,
- gnutls_psk_key_flags flags);
-
-void
-gnutls_psk_free_server_credentials(gnutls_psk_server_credentials_t sc);
-int
-gnutls_psk_allocate_server_credentials(gnutls_psk_server_credentials_t *
- sc);
-int gnutls_psk_set_server_credentials_file(gnutls_psk_server_credentials_t
- res, const char *password_file);
-
-int
-gnutls_psk_set_server_credentials_hint(gnutls_psk_server_credentials_t
- res, const char *hint);
-
-const char *gnutls_psk_server_get_username(gnutls_session_t session);
-const char *gnutls_psk_client_get_hint(gnutls_session_t session);
-
-typedef int gnutls_psk_server_credentials_function(gnutls_session_t,
- const char *username,
- gnutls_datum_t * key);
-void
-gnutls_psk_set_server_credentials_function(gnutls_psk_server_credentials_t
- cred,
- gnutls_psk_server_credentials_function
- * func);
-
-typedef int gnutls_psk_client_credentials_function(gnutls_session_t,
- char **username,
- gnutls_datum_t * key);
-void
-gnutls_psk_set_client_credentials_function(gnutls_psk_client_credentials_t
- cred,
- gnutls_psk_client_credentials_function
- * func);
-
-int gnutls_hex_encode(const gnutls_datum_t * data, char *result,
- size_t * result_size);
-int gnutls_hex_decode(const gnutls_datum_t * hex_data, void *result,
- size_t * result_size);
-
-void
-gnutls_psk_set_server_dh_params(gnutls_psk_server_credentials_t res,
- gnutls_dh_params_t dh_params);
-
-void
-gnutls_psk_set_server_params_function(gnutls_psk_server_credentials_t
- res, gnutls_params_function * func);
-
-/**
- * gnutls_x509_subject_alt_name_t:
- * @GNUTLS_SAN_DNSNAME: DNS-name SAN.
- * @GNUTLS_SAN_RFC822NAME: E-mail address SAN.
- * @GNUTLS_SAN_URI: URI SAN.
- * @GNUTLS_SAN_IPADDRESS: IP address SAN.
- * @GNUTLS_SAN_OTHERNAME: OtherName SAN.
- * @GNUTLS_SAN_DN: DN SAN.
- * @GNUTLS_SAN_OTHERNAME_XMPP: Virtual SAN, used by
- * gnutls_x509_crt_get_subject_alt_othername_oid.
- *
- * Enumeration of different subject alternative names types.
- */
-typedef enum gnutls_x509_subject_alt_name_t {
- GNUTLS_SAN_DNSNAME = 1,
- GNUTLS_SAN_RFC822NAME = 2,
- GNUTLS_SAN_URI = 3,
- GNUTLS_SAN_IPADDRESS = 4,
- GNUTLS_SAN_OTHERNAME = 5,
- GNUTLS_SAN_DN = 6,
- /* The following are "virtual" subject alternative name types, in
- that they are represented by an otherName value and an OID.
- Used by gnutls_x509_crt_get_subject_alt_othername_oid. */
- GNUTLS_SAN_OTHERNAME_XMPP = 1000
-} gnutls_x509_subject_alt_name_t;
-
-struct gnutls_openpgp_crt_int;
-typedef struct gnutls_openpgp_crt_int *gnutls_openpgp_crt_t;
-
-struct gnutls_openpgp_privkey_int;
-typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t;
-
-struct gnutls_pkcs11_privkey_st;
-typedef struct gnutls_pkcs11_privkey_st *gnutls_pkcs11_privkey_t;
-
-/**
- * gnutls_privkey_type_t:
- * @GNUTLS_PRIVKEY_X509: X.509 private key, #gnutls_x509_privkey_t.
- * @GNUTLS_PRIVKEY_OPENPGP: OpenPGP private key, #gnutls_openpgp_privkey_t.
- * @GNUTLS_PRIVKEY_PKCS11: PKCS11 private key, #gnutls_pkcs11_privkey_t.
- * @GNUTLS_PRIVKEY_EXT: External private key, operating using callbacks.
- *
- * Enumeration of different private key types.
- */
-typedef enum {
- GNUTLS_PRIVKEY_X509,
- GNUTLS_PRIVKEY_OPENPGP,
- GNUTLS_PRIVKEY_PKCS11,
- GNUTLS_PRIVKEY_EXT
-} gnutls_privkey_type_t;
-
-typedef struct gnutls_retr2_st {
- gnutls_certificate_type_t cert_type;
- gnutls_privkey_type_t key_type;
-
- union {
- gnutls_x509_crt_t *x509;
- gnutls_openpgp_crt_t pgp;
- } cert;
- unsigned int ncerts; /* one for pgp keys */
-
- union {
- gnutls_x509_privkey_t x509;
- gnutls_openpgp_privkey_t pgp;
- gnutls_pkcs11_privkey_t pkcs11;
- } key;
-
- unsigned int deinit_all; /* if non zero all keys will be deinited */
-} gnutls_retr2_st;
-
-
- /* 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_server_get_type(gnutls_session_t session);
-gnutls_credentials_type_t
-gnutls_auth_client_get_type(gnutls_session_t session);
-
- /* DH */
-
-void gnutls_dh_set_prime_bits(gnutls_session_t session, unsigned int bits);
-int gnutls_dh_get_secret_bits(gnutls_session_t session);
-int gnutls_dh_get_peers_public_bits(gnutls_session_t session);
-int gnutls_dh_get_prime_bits(gnutls_session_t session);
-
-int gnutls_dh_get_group(gnutls_session_t session, gnutls_datum_t * raw_gen,
- gnutls_datum_t * raw_prime);
-int gnutls_dh_get_pubkey(gnutls_session_t session,
- gnutls_datum_t * raw_key);
-
- /* X509PKI */
-
-
- /* These are set on the credentials structure.
- */
-
- /* use gnutls_certificate_set_retrieve_function2() in abstract.h
- * instead. It's much more efficient.
- */
-
-typedef int gnutls_certificate_retrieve_function(gnutls_session_t,
- const
- gnutls_datum_t *
- req_ca_rdn,
- int nreqs,
- const
- gnutls_pk_algorithm_t
- * pk_algos,
- int
- pk_algos_length,
- gnutls_retr2_st *);
-
-
-void
-gnutls_certificate_set_retrieve_function(gnutls_certificate_credentials_t
- cred,
- gnutls_certificate_retrieve_function
- * func);
-
-typedef int gnutls_certificate_verify_function(gnutls_session_t);
-void
-gnutls_certificate_set_verify_function(gnutls_certificate_credentials_t
- cred,
- gnutls_certificate_verify_function
- * func);
-
-void
-gnutls_certificate_server_set_request(gnutls_session_t session,
- gnutls_certificate_request_t req);
-
- /* get data from the session
- */
-const gnutls_datum_t *gnutls_certificate_get_peers(gnutls_session_t
- session, unsigned int
- *list_size);
-const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t
- session);
-
-int gnutls_certificate_get_peers_subkey_id(gnutls_session_t session,
- gnutls_datum_t * id);
-
-time_t gnutls_certificate_activation_time_peers(gnutls_session_t session);
-time_t gnutls_certificate_expiration_time_peers(gnutls_session_t session);
-
-int gnutls_certificate_client_get_request_status(gnutls_session_t session);
-int gnutls_certificate_verify_peers2(gnutls_session_t session,
- unsigned int *status);
-int gnutls_certificate_verify_peers3(gnutls_session_t session,
- const char *hostname,
- unsigned int *status);
-
-int gnutls_certificate_verification_status_print(unsigned int status,
- gnutls_certificate_type_t
- type,
- gnutls_datum_t * out,
- unsigned int flags);
-
-int gnutls_pem_base64_encode(const char *msg, const gnutls_datum_t * data,
- char *result, size_t * result_size);
-int gnutls_pem_base64_decode(const char *header,
- const gnutls_datum_t * b64_data,
- unsigned char *result, size_t * result_size);
-
-int gnutls_pem_base64_encode_alloc(const char *msg,
- const gnutls_datum_t * data,
- gnutls_datum_t * result);
-int gnutls_pem_base64_decode_alloc(const char *header,
- const gnutls_datum_t * b64_data,
- gnutls_datum_t * result);
-
- /* key_usage will be an OR of the following values:
- */
-
- /* when the key is to be used for signing: */
-#define GNUTLS_KEY_DIGITAL_SIGNATURE 128
-#define GNUTLS_KEY_NON_REPUDIATION 64
- /* when the key is to be used for encryption: */
-#define GNUTLS_KEY_KEY_ENCIPHERMENT 32
-#define GNUTLS_KEY_DATA_ENCIPHERMENT 16
-#define GNUTLS_KEY_KEY_AGREEMENT 8
-#define GNUTLS_KEY_KEY_CERT_SIGN 4
-#define GNUTLS_KEY_CRL_SIGN 2
-#define GNUTLS_KEY_ENCIPHER_ONLY 1
-#define GNUTLS_KEY_DECIPHER_ONLY 32768
-
-void
-gnutls_certificate_set_params_function(gnutls_certificate_credentials_t
- res, gnutls_params_function * func);
-void gnutls_anon_set_params_function(gnutls_anon_server_credentials_t res,
- gnutls_params_function * func);
-void gnutls_psk_set_params_function(gnutls_psk_server_credentials_t res,
- gnutls_params_function * func);
-
-int gnutls_hex2bin(const char *hex_data, size_t hex_size,
- void *bin_data, size_t * bin_size);
-
- /* Trust on first use (or ssh like) functions */
-
- /* stores the provided information to a database
- */
-typedef int (*gnutls_tdb_store_func) (const char *db_name,
- const char *host,
- const char *service,
- time_t expiration,
- const gnutls_datum_t * pubkey);
-
-typedef int (*gnutls_tdb_store_commitment_func) (const char *db_name,
- const char *host,
- const char *service,
- time_t expiration,
- gnutls_digest_algorithm_t
- hash_algo,
- const gnutls_datum_t *
- hash);
-
- /* searches for the provided host/service pair that match the
- * provided public key in the database. */
-typedef int (*gnutls_tdb_verify_func) (const char *db_name,
- const char *host,
- const char *service,
- const gnutls_datum_t * pubkey);
-
-
-struct gnutls_tdb_int;
-typedef struct gnutls_tdb_int *gnutls_tdb_t;
-
-int gnutls_tdb_init(gnutls_tdb_t * tdb);
-void gnutls_tdb_set_store_func(gnutls_tdb_t tdb,
- gnutls_tdb_store_func store);
-void gnutls_tdb_set_store_commitment_func(gnutls_tdb_t tdb,
- gnutls_tdb_store_commitment_func
- cstore);
-void gnutls_tdb_set_verify_func(gnutls_tdb_t tdb,
- gnutls_tdb_verify_func verify);
-void gnutls_tdb_deinit(gnutls_tdb_t tdb);
-
-int gnutls_verify_stored_pubkey(const char *db_name,
- gnutls_tdb_t tdb,
- const char *host,
- const char *service,
- gnutls_certificate_type_t cert_type,
- const gnutls_datum_t * cert,
- unsigned int flags);
-
-int gnutls_store_commitment(const char *db_name,
- gnutls_tdb_t tdb,
- const char *host,
- const char *service,
- gnutls_digest_algorithm_t hash_algo,
- const gnutls_datum_t * hash,
- time_t expiration, unsigned int flags);
-
-int gnutls_store_pubkey(const char *db_name,
- gnutls_tdb_t tdb,
- const char *host,
- const char *service,
- gnutls_certificate_type_t cert_type,
- const gnutls_datum_t * cert,
- time_t expiration, unsigned int flags);
-
- /* Other helper functions */
-int gnutls_load_file(const char *filename, gnutls_datum_t * data);
-
-int gnutls_url_is_supported(const char *url);
-
- /* PIN callback */
-
-/**
- * gnutls_pin_flag_t:
- * @GNUTLS_PIN_USER: The PIN for the user.
- * @GNUTLS_PIN_SO: The PIN for the security officer (admin).
- * @GNUTLS_PIN_CONTEXT_SPECIFIC: The PIN is for a specific action and key like signing.
- * @GNUTLS_PIN_FINAL_TRY: This is the final try before blocking.
- * @GNUTLS_PIN_COUNT_LOW: Few tries remain before token blocks.
- * @GNUTLS_PIN_WRONG: Last given PIN was not correct.
- *
- * Enumeration of different flags that are input to the PIN function.
- */
-typedef enum {
- GNUTLS_PIN_USER = (1 << 0),
- GNUTLS_PIN_SO = (1 << 1),
- GNUTLS_PIN_FINAL_TRY = (1 << 2),
- GNUTLS_PIN_COUNT_LOW = (1 << 3),
- GNUTLS_PIN_CONTEXT_SPECIFIC = (1 << 4),
- GNUTLS_PIN_WRONG = (1 << 5),
-} gnutls_pin_flag_t;
-
-#define GNUTLS_PKCS11_PIN_USER GNUTLS_PIN_USER
-#define GNUTLS_PKCS11_PIN_SO GNUTLS_PIN_SO
-#define GNUTLS_PKCS11_PIN_FINAL_TRY GNUTLS_PIN_FINAL_TRY
-#define GNUTLS_PKCS11_PIN_COUNT_LOW GNUTLS_PIN_COUNT_LOW
-#define GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC GNUTLS_PIN_CONTEXT_SPECIFIC
-#define GNUTLS_PKCS11_PIN_WRONG GNUTLS_PIN_WRONG
-
-/**
- * gnutls_pin_callback_t:
- * @userdata: user-controlled data from gnutls_pkcs11_set_pin_function().
- * @attempt: pin-attempt counter, initially 0.
- * @token_url: URL of token.
- * @token_label: label of token.
- * @flags: a #gnutls_pin_flag_t flag.
- * @pin: buffer to hold PIN, of size @pin_max.
- * @pin_max: size of @pin buffer.
- *
- * Callback function type for PKCS#11 or TPM PIN entry. It is set by
- * functions like gnutls_pkcs11_set_pin_function().
- *
- * The callback should provides the PIN code to unlock the token with
- * label @token_label, specified by the URL @token_url.
- *
- * The PIN code, as a NUL-terminated ASCII string, should be copied
- * into the @pin buffer (of maximum size @pin_max), and return 0 to
- * indicate success. Alternatively, the callback may return a
- * negative gnutls error code to indicate failure and cancel PIN entry
- * (in which case, the contents of the @pin parameter are ignored).
- *
- * When a PIN is required, the callback will be invoked repeatedly
- * (and indefinitely) until either the returned PIN code is correct,
- * the callback returns failure, or the token refuses login (e.g. when
- * the token is locked due to too many incorrect PINs!). For the
- * first such invocation, the @attempt counter will have value zero;
- * it will increase by one for each subsequent attempt.
- *
- * Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code on error.
- *
- * Since: 2.12.0
- **/
-typedef int (*gnutls_pin_callback_t) (void *userdata, int attempt,
- const char *token_url,
- const char *token_label,
- unsigned int flags,
- char *pin, size_t pin_max);
-
-void gnutls_certificate_set_pin_function(gnutls_certificate_credentials_t,
- gnutls_pin_callback_t fn,
- void *userdata);
-
- /* Gnutls error codes. The mapping to a TLS alert is also shown in
- * comments.
- */
-
-#define GNUTLS_E_SUCCESS 0
-#define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3
-#define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6
-#define GNUTLS_E_LARGE_PACKET -7
-#define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION */
-#define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW */
-#define GNUTLS_E_INVALID_SESSION -10
-#define GNUTLS_E_FATAL_ALERT_RECEIVED -12
-#define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */
-#define GNUTLS_E_WARNING_ALERT_RECEIVED -16
-#define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18
-#define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19
-#define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAKE_FAILURE */
-#define GNUTLS_E_UNWANTED_ALGORITHM -22
-#define GNUTLS_E_MPI_SCAN_FAILED -23
-#define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_BAD_RECORD_MAC */
-#define GNUTLS_E_MEMORY_ERROR -25
-#define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FAILURE */
-#define GNUTLS_E_COMPRESSION_FAILED -27
-#define GNUTLS_E_AGAIN -28
-#define GNUTLS_E_EXPIRED -29
-#define GNUTLS_E_DB_ERROR -30
-#define GNUTLS_E_SRP_PWD_ERROR -31
-#define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32
-#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_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */
-
-#define GNUTLS_E_HASH_FAILED -33
-#define GNUTLS_E_BASE64_DECODING_ERROR -34
-
-#define GNUTLS_E_MPI_PRINT_FAILED -35
-#define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */
-#define GNUTLS_E_GOT_APPLICATION_DATA -38
-#define GNUTLS_E_RECORD_LIMIT_REACHED -39
-#define GNUTLS_E_ENCRYPTION_FAILED -40
-
-#define GNUTLS_E_PK_ENCRYPTION_FAILED -44
-#define GNUTLS_E_PK_DECRYPTION_FAILED -45
-#define GNUTLS_E_PK_SIGN_FAILED -46
-#define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47
-#define GNUTLS_E_KEY_USAGE_VIOLATION -48
-#define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */
-#define GNUTLS_E_INVALID_REQUEST -50
-#define GNUTLS_E_SHORT_MEMORY_BUFFER -51
-#define GNUTLS_E_INTERRUPTED -52
-#define GNUTLS_E_PUSH_ERROR -53
-#define GNUTLS_E_PULL_ERROR -54
-#define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMETER */
-#define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56
-#define GNUTLS_E_PKCS1_WRONG_PAD -57
-#define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58
-#define GNUTLS_E_INTERNAL_ERROR -59
-#define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63
-#define GNUTLS_E_FILE_ERROR -64
-#define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78
-#define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80
-#define GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS -81
-
- /* returned if you need to generate temporary RSA
- * parameters. These are needed for export cipher suites.
- */
-#define GNUTLS_E_NO_TEMPORARY_RSA_PARAMS -84
-
-#define GNUTLS_E_NO_COMPRESSION_ALGORITHMS -86
-#define GNUTLS_E_NO_CIPHER_SUITES -87
-
-#define GNUTLS_E_OPENPGP_GETKEY_FAILED -88
-#define GNUTLS_E_PK_SIG_VERIFY_FAILED -89
-
-#define GNUTLS_E_ILLEGAL_SRP_USERNAME -90
-#define GNUTLS_E_SRP_PWD_PARSING_ERROR -91
-#define GNUTLS_E_NO_TEMPORARY_DH_PARAMS -93
-
- /* For certificate and key stuff
- */
-#define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67
-#define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68
-#define GNUTLS_E_ASN1_DER_ERROR -69
-#define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70
-#define GNUTLS_E_ASN1_GENERIC_ERROR -71
-#define GNUTLS_E_ASN1_VALUE_NOT_VALID -72
-#define GNUTLS_E_ASN1_TAG_ERROR -73
-#define GNUTLS_E_ASN1_TAG_IMPLICIT -74
-#define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75
-#define GNUTLS_E_ASN1_SYNTAX_ERROR -76
-#define GNUTLS_E_ASN1_DER_OVERFLOW -77
-#define GNUTLS_E_OPENPGP_UID_REVOKED -79
-#define GNUTLS_E_CERTIFICATE_ERROR -43
-#define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR
-#define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60
-#define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */
-#define GNUTLS_E_X509_UNKNOWN_SAN -62
-#define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94
-#define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95
-#define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96
-#define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97
-#define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98
-#define GNUTLS_E_INVALID_PASSWORD -99
-#define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */
-#define GNUTLS_E_CONSTRAINT_ERROR -101
-
-#define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102
-#define GNUTLS_E_WARNING_IA_FPHF_RECEIVED -103
-
-#define GNUTLS_E_IA_VERIFY_FAILED -104
-#define GNUTLS_E_UNKNOWN_ALGORITHM -105
-#define GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM -106
-#define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107
-#define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108
-#define GNUTLS_E_UNKNOWN_SRP_USERNAME -109
-#define GNUTLS_E_PREMATURE_TERMINATION -110
-
-#define GNUTLS_E_BASE64_ENCODING_ERROR -201
-#define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */
-#define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202
-#define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203
-
-#define GNUTLS_E_OPENPGP_KEYRING_ERROR -204
-#define GNUTLS_E_X509_UNSUPPORTED_OID -205
-
-#define GNUTLS_E_RANDOM_FAILED -206
-#define GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR -207
-
-#define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208
-
-#define GNUTLS_E_CRYPTO_ALREADY_REGISTERED -209
-
-#define GNUTLS_E_HANDSHAKE_TOO_LARGE -210
-
-#define GNUTLS_E_CRYPTODEV_IOCTL_ERROR -211
-#define GNUTLS_E_CRYPTODEV_DEVICE_ERROR -212
-
-#define GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE -213
-#define GNUTLS_E_BAD_COOKIE -214
-#define GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR -215
-#define GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL -216
-
-#define GNUTLS_E_HEARTBEAT_PONG_RECEIVED -292
-#define GNUTLS_E_HEARTBEAT_PING_RECEIVED -293
-
-/* PKCS11 related */
-#define GNUTLS_E_PKCS11_ERROR -300
-#define GNUTLS_E_PKCS11_LOAD_ERROR -301
-#define GNUTLS_E_PARSING_ERROR -302
-#define GNUTLS_E_PKCS11_PIN_ERROR -303
-
-#define GNUTLS_E_PKCS11_SLOT_ERROR -305
-#define GNUTLS_E_LOCKING_ERROR -306
-#define GNUTLS_E_PKCS11_ATTRIBUTE_ERROR -307
-#define GNUTLS_E_PKCS11_DEVICE_ERROR -308
-#define GNUTLS_E_PKCS11_DATA_ERROR -309
-#define GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR -310
-#define GNUTLS_E_PKCS11_KEY_ERROR -311
-#define GNUTLS_E_PKCS11_PIN_EXPIRED -312
-#define GNUTLS_E_PKCS11_PIN_LOCKED -313
-#define GNUTLS_E_PKCS11_SESSION_ERROR -314
-#define GNUTLS_E_PKCS11_SIGNATURE_ERROR -315
-#define GNUTLS_E_PKCS11_TOKEN_ERROR -316
-#define GNUTLS_E_PKCS11_USER_ERROR -317
-
-#define GNUTLS_E_CRYPTO_INIT_FAILED -318
-#define GNUTLS_E_TIMEDOUT -319
-#define GNUTLS_E_USER_ERROR -320
-#define GNUTLS_E_ECC_NO_SUPPORTED_CURVES -321
-#define GNUTLS_E_ECC_UNSUPPORTED_CURVE -322
-#define GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE -323
-#define GNUTLS_E_CERTIFICATE_LIST_UNSORTED -324
-#define GNUTLS_E_ILLEGAL_PARAMETER -325
-#define GNUTLS_E_NO_PRIORITIES_WERE_SET -326
-#define GNUTLS_E_X509_UNSUPPORTED_EXTENSION -327
-#define GNUTLS_E_SESSION_EOF -328
-
-#define GNUTLS_E_TPM_ERROR -329
-#define GNUTLS_E_TPM_KEY_PASSWORD_ERROR -330
-#define GNUTLS_E_TPM_SRK_PASSWORD_ERROR -331
-#define GNUTLS_E_TPM_SESSION_ERROR -332
-#define GNUTLS_E_TPM_KEY_NOT_FOUND -333
-#define GNUTLS_E_TPM_UNINITIALIZED -334
-
-#define GNUTLS_E_NO_CERTIFICATE_STATUS -340
-#define GNUTLS_E_OCSP_RESPONSE_ERROR -341
-#define GNUTLS_E_RANDOM_DEVICE_ERROR -342
-#define GNUTLS_E_AUTH_ERROR -343
-#define GNUTLS_E_NO_APPLICATION_PROTOCOL -344
-
-#define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250
-
-
-
-#define GNUTLS_E_APPLICATION_ERROR_MAX -65000
-#define GNUTLS_E_APPLICATION_ERROR_MIN -65500
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#include <gnutls/compat.h>
-
-#endif /* GNUTLS_H */
+++ /dev/null
-/*
- * Copyright (C) 2006-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef GNUTLSXX_H
-#define GNUTLSXX_H
-
-#include <exception>
-#include <vector>
-#include <gnutls/gnutls.h>
-
-namespace gnutls {
-
- class noncopyable {
- protected:
- noncopyable() {
- } ~noncopyable() {
- } private:
- // These are non-implemented.
- noncopyable(const noncopyable &);
- noncopyable & operator=(const noncopyable &);
- };
-
-
- class exception:public std::exception {
- public:
- exception(int x);
- const char *what() const throw();
- int get_code();
- protected:
- int retcode;
- };
-
-
- class dh_params:private noncopyable {
- public:
- dh_params();
- ~dh_params();
- void import_raw(const gnutls_datum_t & prime,
- const gnutls_datum_t & generator);
- void import_pkcs3(const gnutls_datum_t & pkcs3_params,
- gnutls_x509_crt_fmt_t format);
- void generate(unsigned int bits);
-
- void export_pkcs3(gnutls_x509_crt_fmt_t format,
- unsigned char *params_data,
- size_t * params_data_size);
- void export_raw(gnutls_datum_t & prime,
- gnutls_datum_t & generator);
-
- gnutls_dh_params_t get_params_t() const;
- dh_params & operator=(const dh_params & src);
- protected:
- gnutls_dh_params_t params;
- };
-
-
- class rsa_params:private noncopyable {
- public:
- rsa_params();
- ~rsa_params();
- void import_raw(const gnutls_datum_t & m,
- const gnutls_datum_t & e,
- const gnutls_datum_t & d,
- const gnutls_datum_t & p,
- const gnutls_datum_t & q,
- const gnutls_datum_t & u);
- void import_pkcs1(const gnutls_datum_t & pkcs1_params,
- gnutls_x509_crt_fmt_t format);
- void generate(unsigned int bits);
-
- void export_pkcs1(gnutls_x509_crt_fmt_t format,
- unsigned char *params_data,
- size_t * params_data_size);
- void export_raw(gnutls_datum_t & m, gnutls_datum_t & e,
- gnutls_datum_t & d, gnutls_datum_t & p,
- gnutls_datum_t & q, gnutls_datum_t & u);
- gnutls_rsa_params_t get_params_t() const;
- rsa_params & operator=(const rsa_params & src);
-
- protected:
- gnutls_rsa_params_t params;
- };
-
- class session:private noncopyable {
- protected:
- gnutls_session_t s;
- public:
- session(unsigned int);
- virtual ~ session();
-
- int bye(gnutls_close_request_t how);
- int handshake();
-
- gnutls_alert_description_t get_alert() const;
-
- int send_alert(gnutls_alert_level_t level,
- gnutls_alert_description_t desc);
- int send_appropriate_alert(int err);
-
- gnutls_cipher_algorithm_t get_cipher() const;
- gnutls_kx_algorithm_t get_kx() const;
- gnutls_mac_algorithm_t get_mac() const;
- gnutls_compression_method_t get_compression() const;
- gnutls_certificate_type_t get_certificate_type() const;
-
- // for the handshake
- void set_private_extensions(bool allow);
-
- gnutls_handshake_description_t get_handshake_last_out()
- const;
- gnutls_handshake_description_t get_handshake_last_in()
- const;
-
- ssize_t send(const void *data, size_t sizeofdata);
- ssize_t recv(void *data, size_t sizeofdata);
-
- bool get_record_direction() const;
-
- // maximum packet size
- size_t get_max_size() const;
- void set_max_size(size_t size);
-
- size_t check_pending() const;
-
- void prf(size_t label_size, const char *label,
- int server_random_first,
- size_t extra_size, const char *extra,
- size_t outsize, char *out);
-
- void prf_raw(size_t label_size, const char *label,
- size_t seed_size, const char *seed,
- size_t outsize, char *out);
-
- /* if you just want some defaults, use the following.
- */
- void set_priority(const char *prio, const char **err_pos);
- void set_priority(gnutls_priority_t p);
-
- gnutls_protocol_t get_protocol_version() const;
-
- // for resuming sessions
- void set_data(const void *session_data,
- size_t session_data_size);
- void get_data(void *session_data,
- 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;
-
- void set_max_handshake_packet_length(size_t max);
-
- void clear_credentials();
- void set_credentials(class credentials & cred);
-
- void set_transport_ptr(gnutls_transport_ptr_t ptr);
- void set_transport_ptr(gnutls_transport_ptr_t recv_ptr,
- gnutls_transport_ptr_t send_ptr);
- gnutls_transport_ptr_t get_transport_ptr() const;
- void get_transport_ptr(gnutls_transport_ptr_t & recv_ptr,
- gnutls_transport_ptr_t & send_ptr)
- const;
-
- void set_transport_lowat(size_t num);
- void set_transport_push_function(gnutls_push_func
- push_func);
- void set_transport_vec_push_function(gnutls_vec_push_func
- vec_push_func);
- void set_transport_pull_function(gnutls_pull_func
- pull_func);
-
- void set_user_ptr(void *ptr);
- void *get_user_ptr() const;
-
- void send_openpgp_cert(gnutls_openpgp_crt_status_t status);
-
- gnutls_credentials_type_t get_auth_type() const;
- gnutls_credentials_type_t get_server_auth_type() const;
- gnutls_credentials_type_t get_client_auth_type() const;
-
- // informational stuff
- void set_dh_prime_bits(unsigned int bits);
- unsigned int get_dh_secret_bits() const;
- unsigned int get_dh_peers_public_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_pubkey(gnutls_datum_t & raw_key) const;
- void get_rsa_export_pubkey(gnutls_datum_t & exponent,
- gnutls_datum_t & modulus) const;
- unsigned int get_rsa_export_modulus_bits() const;
-
- void get_our_certificate(gnutls_datum_t & cert) const;
- bool get_peers_certificate(std::vector < gnutls_datum_t >
- &out_certs) const;
- bool get_peers_certificate(const gnutls_datum_t ** certs,
- unsigned int *certs_size) const;
-
- time_t get_peers_certificate_activation_time() const;
- time_t get_peers_certificate_expiration_time() const;
- void verify_peers_certificate(unsigned int &status) const;
-
- };
-
-// interface for databases
- class DB:private noncopyable {
- public:
- virtual ~ DB() = 0;
- virtual bool store(const gnutls_datum_t & key,
- const gnutls_datum_t & data) = 0;
- virtual bool retrieve(const gnutls_datum_t & key,
- gnutls_datum_t & data) = 0;
- virtual bool remove(const gnutls_datum_t & key) = 0;
- };
-
- class server_session:public session {
- public:
- server_session();
- ~server_session();
- void db_remove() const;
-
- void set_db_cache_expiration(unsigned int seconds);
- void set_db(const DB & db);
-
- // returns true if session is expired
- bool db_check_entry(gnutls_datum_t & session_data) const;
-
- // server side only
- const char *get_srp_username() const;
- const char *get_psk_username() const;
-
- void get_server_name(void *data, size_t * data_length,
- unsigned int *type,
- unsigned int indx) const;
-
- int rehandshake();
- void set_certificate_request(gnutls_certificate_request_t);
- };
-
- class client_session:public session {
- public:
- client_session();
- ~client_session();
-
- void set_server_name(gnutls_server_name_type_t type,
- const void *name, size_t name_length);
-
- bool get_request_status();
- };
-
-
- class credentials:private noncopyable {
- public:
- virtual ~ credentials() {
- } gnutls_credentials_type_t get_type() const;
- protected:
- friend class session;
- credentials(gnutls_credentials_type_t t);
- void *ptr() const;
- void set_ptr(void *ptr);
- gnutls_credentials_type_t type;
- private:
- void *cred;
- };
-
- class certificate_credentials:public credentials {
- public:
- ~certificate_credentials();
- certificate_credentials();
-
- void free_keys();
- void free_cas();
- void free_ca_names();
- void free_crls();
-
- void set_dh_params(const dh_params & params);
- void set_rsa_export_params(const rsa_params & params);
- void set_verify_flags(unsigned int flags);
- 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 type);
- void set_x509_trust(const gnutls_datum_t & CA,
- gnutls_x509_crt_fmt_t type);
- // 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_crl_file(const char *crlfile,
- gnutls_x509_crt_fmt_t type);
- void set_x509_crl(const gnutls_datum_t & CRL,
- gnutls_x509_crt_fmt_t type);
- 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,
- gnutls_x509_crt_fmt_t type);
- void set_x509_key(const gnutls_datum_t & CERT,
- const gnutls_datum_t & KEY,
- gnutls_x509_crt_fmt_t type);
- // FIXME: use classes
- 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,
- gnutls_x509_crt_fmt_t type,
- const char *password);
-
- void set_retrieve_function
- (gnutls_certificate_retrieve_function * func);
-
- protected:
- gnutls_certificate_credentials_t cred;
- };
-
- class certificate_server_credentials:public certificate_credentials {
- public:
- void set_params_function(gnutls_params_function * func);
- };
-
- class certificate_client_credentials:public certificate_credentials {
- public:
- };
-
-
-
-
- class anon_server_credentials:public credentials {
- public:
- anon_server_credentials();
- ~anon_server_credentials();
- void set_dh_params(const dh_params & params);
- void set_params_function(gnutls_params_function * func);
- protected:
- gnutls_anon_server_credentials_t cred;
- };
-
- class anon_client_credentials:public credentials {
- public:
- anon_client_credentials();
- ~anon_client_credentials();
- protected:
- gnutls_anon_client_credentials_t cred;
- };
-
-
- class srp_server_credentials:public credentials {
- public:
- srp_server_credentials();
- ~srp_server_credentials();
- void set_credentials_file(const char *password_file,
- const char *password_conf_file);
- void set_credentials_function
- (gnutls_srp_server_credentials_function * func);
- protected:
- gnutls_srp_server_credentials_t cred;
- };
-
- class srp_client_credentials:public credentials {
- public:
- srp_client_credentials();
- ~srp_client_credentials();
- void set_credentials(const char *username,
- const char *password);
- void set_credentials_function
- (gnutls_srp_client_credentials_function * func);
- protected:
- gnutls_srp_client_credentials_t cred;
- };
-
-
- class psk_server_credentials:public credentials {
- public:
- psk_server_credentials();
- ~psk_server_credentials();
- void set_credentials_file(const char *password_file);
- void set_credentials_function
- (gnutls_psk_server_credentials_function * func);
- void set_dh_params(const dh_params & params);
- void set_params_function(gnutls_params_function * func);
- protected:
- gnutls_psk_server_credentials_t cred;
- };
-
- class psk_client_credentials:public credentials {
- public:
- psk_client_credentials();
- ~psk_client_credentials();
- void set_credentials(const char *username,
- const gnutls_datum_t & key,
- gnutls_psk_key_flags flags);
- void set_credentials_function
- (gnutls_psk_client_credentials_function * func);
- protected:
- gnutls_psk_client_credentials_t cred;
- };
-
-
-} /* namespace */
-
-#endif /* GNUTLSXX_H */
+++ /dev/null
-/*
- * Copyright (C) 2011-2012 Free Software Foundation, Inc.
- *
- * Author: Simon Josefsson
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* Online Certificate Status Protocol - RFC 2560
- */
-
-#ifndef GNUTLS_OCSP_H
-#define GNUTLS_OCSP_H
-
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#define GNUTLS_OCSP_NONCE "1.3.6.1.5.5.7.48.1.2"
-
-/**
- * gnutls_ocsp_print_formats_t:
- * @GNUTLS_OCSP_PRINT_FULL: Full information about OCSP request/response.
- * @GNUTLS_OCSP_PRINT_COMPACT: More compact information about OCSP request/response.
- *
- * Enumeration of different OCSP printing variants.
- */
-typedef enum gnutls_ocsp_print_formats_t {
- GNUTLS_OCSP_PRINT_FULL = 0,
- GNUTLS_OCSP_PRINT_COMPACT = 1,
-} gnutls_ocsp_print_formats_t;
-
-/**
- * gnutls_ocsp_resp_status_t:
- * @GNUTLS_OCSP_RESP_SUCCESSFUL: Response has valid confirmations.
- * @GNUTLS_OCSP_RESP_MALFORMEDREQUEST: Illegal confirmation request
- * @GNUTLS_OCSP_RESP_INTERNALERROR: Internal error in issuer
- * @GNUTLS_OCSP_RESP_TRYLATER: Try again later
- * @GNUTLS_OCSP_RESP_SIGREQUIRED: Must sign the request
- * @GNUTLS_OCSP_RESP_UNAUTHORIZED: Request unauthorized
- *
- * Enumeration of different OCSP response status codes.
- */
-typedef enum gnutls_ocsp_resp_status_t {
- GNUTLS_OCSP_RESP_SUCCESSFUL = 0,
- GNUTLS_OCSP_RESP_MALFORMEDREQUEST = 1,
- GNUTLS_OCSP_RESP_INTERNALERROR = 2,
- GNUTLS_OCSP_RESP_TRYLATER = 3,
- GNUTLS_OCSP_RESP_SIGREQUIRED = 5,
- GNUTLS_OCSP_RESP_UNAUTHORIZED = 6
-} gnutls_ocsp_resp_status_t;
-
-/**
- * gnutls_ocsp_cert_status_t:
- * @GNUTLS_OCSP_CERT_GOOD: Positive response to status inquiry.
- * @GNUTLS_OCSP_CERT_REVOKED: Certificate has been revoked.
- * @GNUTLS_OCSP_CERT_UNKNOWN: The responder doesn't know about the
- * certificate.
- *
- * Enumeration of different OCSP response certificate status codes.
- */
-typedef enum gnutls_ocsp_cert_status_t {
- GNUTLS_OCSP_CERT_GOOD = 0,
- GNUTLS_OCSP_CERT_REVOKED = 1,
- GNUTLS_OCSP_CERT_UNKNOWN = 2
-} gnutls_ocsp_cert_status_t;
-
-/**
- * gnutls_x509_crl_reason_t:
- * @GNUTLS_X509_CRLREASON_UNSPECIFIED: Unspecified reason.
- * @GNUTLS_X509_CRLREASON_KEYCOMPROMISE: Private key compromised.
- * @GNUTLS_X509_CRLREASON_CACOMPROMISE: CA compromised.
- * @GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED: Affiliation has changed.
- * @GNUTLS_X509_CRLREASON_SUPERSEDED: Certificate superseded.
- * @GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION: Operation has ceased.
- * @GNUTLS_X509_CRLREASON_CERTIFICATEHOLD: Certificate is on hold.
- * @GNUTLS_X509_CRLREASON_REMOVEFROMCRL: Will be removed from delta CRL.
- * @GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN: Privilege withdrawn.
- * @GNUTLS_X509_CRLREASON_AACOMPROMISE: AA compromised.
- *
- * Enumeration of different reason codes. Note that this
- * corresponds to the CRLReason ASN.1 enumeration type, and not the
- * ReasonFlags ASN.1 bit string.
- */
-typedef enum gnutls_x509_crl_reason_t {
- GNUTLS_X509_CRLREASON_UNSPECIFIED = 0,
- GNUTLS_X509_CRLREASON_KEYCOMPROMISE = 1,
- GNUTLS_X509_CRLREASON_CACOMPROMISE = 2,
- GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED = 3,
- GNUTLS_X509_CRLREASON_SUPERSEDED = 4,
- GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION = 5,
- GNUTLS_X509_CRLREASON_CERTIFICATEHOLD = 6,
- GNUTLS_X509_CRLREASON_REMOVEFROMCRL = 8,
- GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN = 9,
- GNUTLS_X509_CRLREASON_AACOMPROMISE = 10
-} gnutls_x509_crl_reason_t;
-
-/**
- * gnutls_ocsp_verify_reason_t:
- * @GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND: Signer cert not found.
- * @GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR: Signer keyusage bits incorrect.
- * @GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER: Signer is not trusted.
- * @GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM: Signature using insecure algorithm.
- * @GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE: Signature mismatch.
- * @GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED: Signer cert is not yet activated.
- * @GNUTLS_OCSP_VERIFY_CERT_EXPIRED: Signer cert has expired.
- *
- * Enumeration of OCSP verify status codes, used by
- * gnutls_ocsp_resp_verify() and gnutls_ocsp_resp_verify_direct().
- */
-typedef enum gnutls_ocsp_verify_reason_t {
- GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND = 1,
- GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR = 2,
- GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER = 4,
- GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM = 8,
- GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE = 16,
- GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED = 32,
- GNUTLS_OCSP_VERIFY_CERT_EXPIRED = 64
-} gnutls_ocsp_verify_reason_t;
-
-struct gnutls_ocsp_req_int;
-typedef struct gnutls_ocsp_req_int *gnutls_ocsp_req_t;
-
-int gnutls_ocsp_req_init(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,
- const 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,
- gnutls_ocsp_print_formats_t format,
- gnutls_datum_t * out);
-
-int gnutls_ocsp_req_get_version(gnutls_ocsp_req_t req);
-
-int gnutls_ocsp_req_get_cert_id(gnutls_ocsp_req_t req,
- unsigned indx,
- gnutls_digest_algorithm_t * digest,
- gnutls_datum_t * issuer_name_hash,
- gnutls_datum_t * issuer_key_hash,
- gnutls_datum_t * serial_number);
-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_x509_crt_t issuer,
- gnutls_x509_crt_t cert);
-
-int gnutls_ocsp_req_get_extension(gnutls_ocsp_req_t req,
- unsigned indx,
- gnutls_datum_t * oid,
- unsigned int *critical,
- gnutls_datum_t * data);
-int gnutls_ocsp_req_set_extension(gnutls_ocsp_req_t req,
- const char *oid,
- unsigned int critical,
- const gnutls_datum_t * data);
-
-int gnutls_ocsp_req_get_nonce(gnutls_ocsp_req_t req,
- unsigned int *critical,
- gnutls_datum_t * nonce);
-int gnutls_ocsp_req_set_nonce(gnutls_ocsp_req_t req,
- unsigned int critical,
- const gnutls_datum_t * nonce);
-int gnutls_ocsp_req_randomize_nonce(gnutls_ocsp_req_t req);
-
-struct gnutls_ocsp_resp_int;
-typedef struct gnutls_ocsp_resp_int *gnutls_ocsp_resp_t;
-
-int gnutls_ocsp_resp_init(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,
- const gnutls_datum_t * data);
-int gnutls_ocsp_resp_export(gnutls_ocsp_resp_t resp,
- gnutls_datum_t * data);
-int gnutls_ocsp_resp_print(gnutls_ocsp_resp_t resp,
- gnutls_ocsp_print_formats_t format,
- gnutls_datum_t * out);
-
-int gnutls_ocsp_resp_get_status(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 * response);
-
-int gnutls_ocsp_resp_get_version(gnutls_ocsp_resp_t resp);
-int gnutls_ocsp_resp_get_responder(gnutls_ocsp_resp_t resp,
- gnutls_datum_t * dn);
-time_t gnutls_ocsp_resp_get_produced(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,
- gnutls_datum_t * oid,
- 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,
- gnutls_x509_crt_t issuer,
- unsigned int *verify,
- unsigned int flags);
-int gnutls_ocsp_resp_verify(gnutls_ocsp_resp_t resp,
- gnutls_x509_trust_list_t trustlist,
- unsigned int *verify, unsigned int flags);
-
-int gnutls_ocsp_resp_check_crt(gnutls_ocsp_resp_t resp,
- unsigned int indx, gnutls_x509_crt_t crt);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif /* GNUTLS_OCSP_H */
+++ /dev/null
-/*
- * Copyright (C) 2003-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* This file contains the types and prototypes for the OpenPGP
- * key and private key parsing functions.
- */
-
-#ifndef GNUTLS_OPENPGP_H
-#define GNUTLS_OPENPGP_H
-
-#include <gnutls/gnutls.h>
-#include <limits.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/* Openpgp certificate stuff
- */
-
-/**
- * gnutls_openpgp_crt_fmt_t:
- * @GNUTLS_OPENPGP_FMT_RAW: OpenPGP certificate in raw format.
- * @GNUTLS_OPENPGP_FMT_BASE64: OpenPGP certificate in base64 format.
- *
- * Enumeration of different OpenPGP key formats.
- */
-typedef enum gnutls_openpgp_crt_fmt {
- GNUTLS_OPENPGP_FMT_RAW,
- GNUTLS_OPENPGP_FMT_BASE64
-} gnutls_openpgp_crt_fmt_t;
-
-#define GNUTLS_OPENPGP_KEYID_SIZE 8
-#define GNUTLS_OPENPGP_V4_FINGERPRINT_SIZE 20
-typedef unsigned char
- gnutls_openpgp_keyid_t[GNUTLS_OPENPGP_KEYID_SIZE];
-
-/* gnutls_openpgp_cert_t should be defined in gnutls.h
- */
-
- /* initializes the memory for gnutls_openpgp_crt_t struct */
-int gnutls_openpgp_crt_init(gnutls_openpgp_crt_t * key);
- /* frees all memory */
-void gnutls_openpgp_crt_deinit(gnutls_openpgp_crt_t key);
-
-int gnutls_openpgp_crt_import(gnutls_openpgp_crt_t key,
- const gnutls_datum_t * data,
- gnutls_openpgp_crt_fmt_t format);
-int gnutls_openpgp_crt_export(gnutls_openpgp_crt_t key,
- gnutls_openpgp_crt_fmt_t format,
- void *output_data,
- size_t * output_data_size);
-int gnutls_openpgp_crt_export2(gnutls_openpgp_crt_t key,
- gnutls_openpgp_crt_fmt_t format,
- gnutls_datum_t * out);
-
-int gnutls_openpgp_crt_print(gnutls_openpgp_crt_t cert,
- gnutls_certificate_print_formats_t
- format, gnutls_datum_t * out);
-
-/* The key_usage flags are defined in gnutls.h. They are
- * the GNUTLS_KEY_* definitions.
- */
-#define GNUTLS_OPENPGP_MASTER_KEYID_IDX INT_MAX
-
-int gnutls_openpgp_crt_get_key_usage(gnutls_openpgp_crt_t key,
- unsigned int *key_usage);
-int gnutls_openpgp_crt_get_fingerprint(gnutls_openpgp_crt_t key,
- void *fpr, size_t * fprlen);
-int gnutls_openpgp_crt_get_subkey_fingerprint(gnutls_openpgp_crt_t
- key,
- unsigned int idx,
- void *fpr, size_t * fprlen);
-
-int gnutls_openpgp_crt_get_name(gnutls_openpgp_crt_t key,
- int idx, char *buf, size_t * sizeof_buf);
-
-gnutls_pk_algorithm_t
-gnutls_openpgp_crt_get_pk_algorithm(gnutls_openpgp_crt_t key,
- unsigned int *bits);
-
-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_expiration_time(gnutls_openpgp_crt_t key);
-
-int gnutls_openpgp_crt_get_key_id(gnutls_openpgp_crt_t key,
- gnutls_openpgp_keyid_t keyid);
-
-int gnutls_openpgp_crt_check_hostname(gnutls_openpgp_crt_t key,
- const char *hostname);
-
-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_idx(gnutls_openpgp_crt_t key,
- const gnutls_openpgp_keyid_t keyid);
-int gnutls_openpgp_crt_get_subkey_revoked_status
- (gnutls_openpgp_crt_t key, unsigned int idx);
-gnutls_pk_algorithm_t
-gnutls_openpgp_crt_get_subkey_pk_algorithm(gnutls_openpgp_crt_t
- key,
- unsigned int idx,
- unsigned int *bits);
-time_t
- gnutls_openpgp_crt_get_subkey_creation_time
- (gnutls_openpgp_crt_t key, unsigned int idx);
-time_t
- gnutls_openpgp_crt_get_subkey_expiration_time
- (gnutls_openpgp_crt_t key, unsigned int idx);
-int gnutls_openpgp_crt_get_subkey_id(gnutls_openpgp_crt_t key,
- unsigned int idx,
- gnutls_openpgp_keyid_t keyid);
-int gnutls_openpgp_crt_get_subkey_usage(gnutls_openpgp_crt_t key,
- unsigned int idx,
- unsigned int *key_usage);
-
-int gnutls_openpgp_crt_get_subkey_pk_dsa_raw(gnutls_openpgp_crt_t
- crt, unsigned int idx,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g,
- gnutls_datum_t * y);
-int gnutls_openpgp_crt_get_subkey_pk_rsa_raw(gnutls_openpgp_crt_t
- crt, unsigned int idx,
- gnutls_datum_t * m,
- gnutls_datum_t * e);
-int gnutls_openpgp_crt_get_pk_dsa_raw(gnutls_openpgp_crt_t crt,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g,
- gnutls_datum_t * y);
-int gnutls_openpgp_crt_get_pk_rsa_raw(gnutls_openpgp_crt_t crt,
- gnutls_datum_t * m,
- gnutls_datum_t * e);
-
-int gnutls_openpgp_crt_get_preferred_key_id(gnutls_openpgp_crt_t
- key,
- gnutls_openpgp_keyid_t keyid);
-int
-gnutls_openpgp_crt_set_preferred_key_id(gnutls_openpgp_crt_t key,
- const
- gnutls_openpgp_keyid_t keyid);
-
-/* privkey stuff.
- */
-int gnutls_openpgp_privkey_init(gnutls_openpgp_privkey_t * key);
-void gnutls_openpgp_privkey_deinit(gnutls_openpgp_privkey_t key);
-gnutls_pk_algorithm_t
- gnutls_openpgp_privkey_get_pk_algorithm
- (gnutls_openpgp_privkey_t key, unsigned int *bits);
-
-gnutls_sec_param_t
-gnutls_openpgp_privkey_sec_param(gnutls_openpgp_privkey_t key);
-int gnutls_openpgp_privkey_import(gnutls_openpgp_privkey_t key,
- const gnutls_datum_t * data,
- gnutls_openpgp_crt_fmt_t format,
- const char *password,
- unsigned int flags);
-
-int gnutls_openpgp_privkey_get_fingerprint(gnutls_openpgp_privkey_t
- key, void *fpr,
- size_t * fprlen);
-int gnutls_openpgp_privkey_get_subkey_fingerprint
- (gnutls_openpgp_privkey_t key, unsigned int idx, void *fpr,
- size_t * fprlen);
-int gnutls_openpgp_privkey_get_key_id(gnutls_openpgp_privkey_t key,
- gnutls_openpgp_keyid_t keyid);
-int gnutls_openpgp_privkey_get_subkey_count(gnutls_openpgp_privkey_t key);
-int gnutls_openpgp_privkey_get_subkey_idx(gnutls_openpgp_privkey_t
- key,
- const
- gnutls_openpgp_keyid_t keyid);
-
-int gnutls_openpgp_privkey_get_subkey_revoked_status
- (gnutls_openpgp_privkey_t key, unsigned int idx);
-
-int gnutls_openpgp_privkey_get_revoked_status
- (gnutls_openpgp_privkey_t key);
-
-gnutls_pk_algorithm_t
- gnutls_openpgp_privkey_get_subkey_pk_algorithm
- (gnutls_openpgp_privkey_t key, unsigned int idx, unsigned int *bits);
-
-time_t
- gnutls_openpgp_privkey_get_subkey_expiration_time
- (gnutls_openpgp_privkey_t key, unsigned int idx);
-
-int gnutls_openpgp_privkey_get_subkey_id(gnutls_openpgp_privkey_t
- key, unsigned int idx,
- gnutls_openpgp_keyid_t keyid);
-
-time_t
- gnutls_openpgp_privkey_get_subkey_creation_time
- (gnutls_openpgp_privkey_t key, unsigned int idx);
-
-int gnutls_openpgp_privkey_export_subkey_dsa_raw
- (gnutls_openpgp_privkey_t pkey, unsigned int idx,
- gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g,
- gnutls_datum_t * y, gnutls_datum_t * x);
-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, gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g,
- gnutls_datum_t * y,
- gnutls_datum_t * x);
-int gnutls_openpgp_privkey_export_rsa_raw(gnutls_openpgp_privkey_t
- pkey, 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(gnutls_openpgp_privkey_t key,
- gnutls_openpgp_crt_fmt_t format,
- const char *password,
- unsigned int flags,
- void *output_data,
- size_t * output_data_size);
-int gnutls_openpgp_privkey_export2(gnutls_openpgp_privkey_t key,
- gnutls_openpgp_crt_fmt_t format,
- const char *password,
- unsigned int flags,
- gnutls_datum_t * out);
-
-int gnutls_openpgp_privkey_set_preferred_key_id
- (gnutls_openpgp_privkey_t key, const gnutls_openpgp_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,
- gnutls_openpgp_keyid_t
- keyid, unsigned int flag);
-
-/* Keyring stuff.
- */
-
-int gnutls_openpgp_keyring_init(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,
- const gnutls_datum_t * data,
- gnutls_openpgp_crt_fmt_t format);
-
-int gnutls_openpgp_keyring_check_id(gnutls_openpgp_keyring_t ring,
- const gnutls_openpgp_keyid_t
- keyid, unsigned int flags);
-
-
-int gnutls_openpgp_crt_verify_ring(gnutls_openpgp_crt_t key,
- gnutls_openpgp_keyring_t
- keyring, unsigned int flags,
- unsigned int *verify
- /* the output of the verification */
- );
-
-int gnutls_openpgp_crt_verify_self(gnutls_openpgp_crt_t key,
- unsigned int flags,
- unsigned int *verify);
-
-int gnutls_openpgp_keyring_get_crt(gnutls_openpgp_keyring_t ring,
- unsigned int idx,
- gnutls_openpgp_crt_t * cert);
-
-int gnutls_openpgp_keyring_get_crt_count(gnutls_openpgp_keyring_t ring);
-
-
-
-/**
- * gnutls_openpgp_recv_key_func:
- * @session: a TLS session
- * @keyfpr: key fingerprint
- * @keyfpr_length: length of key fingerprint
- * @key: output key.
- *
- * 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
- * fingerprint instead of a full key. See also
- * gnutls_openpgp_set_recv_key_function().
- *
- * The variable @key must be allocated using gnutls_malloc().
- *
- * Returns: On success, %GNUTLS_E_SUCCESS (zero) is returned,
- * otherwise an error code is returned.
- */
-typedef int (*gnutls_openpgp_recv_key_func) (gnutls_session_t
- session,
- const unsigned char
- *keyfpr,
- unsigned int
- keyfpr_length,
- gnutls_datum_t * key);
-
-void
-gnutls_openpgp_set_recv_key_function(gnutls_session_t session,
- gnutls_openpgp_recv_key_func func);
-
-
-
-/* certificate authentication stuff.
- */
-int gnutls_certificate_set_openpgp_key
- (gnutls_certificate_credentials_t res,
- gnutls_openpgp_crt_t crt, gnutls_openpgp_privkey_t pkey);
-
-int
- gnutls_certificate_set_openpgp_key_file
- (gnutls_certificate_credentials_t res, const char *certfile,
- const char *keyfile, gnutls_openpgp_crt_fmt_t format);
-int gnutls_certificate_set_openpgp_key_mem
- (gnutls_certificate_credentials_t res,
- const gnutls_datum_t * cert, const gnutls_datum_t * key,
- gnutls_openpgp_crt_fmt_t format);
-
-int
- gnutls_certificate_set_openpgp_key_file2
- (gnutls_certificate_credentials_t res, const char *certfile,
- const char *keyfile, const char *subkey_id,
- gnutls_openpgp_crt_fmt_t format);
-int
- gnutls_certificate_set_openpgp_key_mem2
- (gnutls_certificate_credentials_t res,
- const gnutls_datum_t * cert, const gnutls_datum_t * key,
- const char *subkey_id, gnutls_openpgp_crt_fmt_t format);
-
-int gnutls_certificate_set_openpgp_keyring_mem
- (gnutls_certificate_credentials_t c, const unsigned char *data,
- size_t dlen, gnutls_openpgp_crt_fmt_t format);
-
-int gnutls_certificate_set_openpgp_keyring_file
- (gnutls_certificate_credentials_t c, const char *file,
- gnutls_openpgp_crt_fmt_t format);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif /* GNUTLS_OPENPGP_H */
+++ /dev/null
-/*
- * Copyright (C) 2010-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef __GNUTLS_PKCS11_H
-#define __GNUTLS_PKCS11_H
-
-
-#include <stdarg.h>
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#define GNUTLS_PKCS11_MAX_PIN_LEN 32
-
-/**
- * gnutls_pkcs11_token_callback_t:
- * @userdata: user-controlled data from gnutls_pkcs11_set_token_function().
- * @label: token label.
- * @retry: retry counter, initially 0.
- *
- * Token callback function. The callback will be used to ask the user
- * to re-insert the token with given (null terminated) label. The
- * callback should return zero if token has been inserted by user and
- * a negative error code otherwise. It might be called multiple times
- * if the token is not detected and the retry counter will be
- * increased.
- *
- * Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code
- * on error.
- *
- * Since: 2.12.0
- **/
-typedef int (*gnutls_pkcs11_token_callback_t) (void *const
- userdata,
- const char *const
- label, unsigned retry);
-
-
-struct gnutls_pkcs11_obj_st;
-typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t;
-
-
-#define GNUTLS_PKCS11_FLAG_MANUAL 0 /* Manual loading of libraries */
-#define GNUTLS_PKCS11_FLAG_AUTO 1 /* Automatically load libraries by reading /etc/gnutls/pkcs11.conf */
-
-/* pkcs11.conf format:
- * load = /lib/xxx-pkcs11.so
- * load = /lib/yyy-pkcs11.so
- */
-
-int gnutls_pkcs11_init(unsigned int flags,
- const char *deprecated_config_file);
-int gnutls_pkcs11_reinit(void);
-void gnutls_pkcs11_deinit(void);
-void gnutls_pkcs11_set_token_function
- (gnutls_pkcs11_token_callback_t fn, void *userdata);
-
-void gnutls_pkcs11_set_pin_function(gnutls_pin_callback_t fn,
- 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_obj_init(gnutls_pkcs11_obj_t * obj);
-void gnutls_pkcs11_obj_set_pin_function(gnutls_pkcs11_obj_t obj,
- gnutls_pin_callback_t fn,
- void *userdata);
-
-#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN (1<<0) /* force login in the token for the operation */
-#define GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED (1<<1) /* object marked as trusted */
-#define GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE (1<<2) /* object marked as sensitive (unexportable) */
-#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO (1<<3) /* force login as a security officer in the token for the operation */
-#define GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE (1<<4) /* marked as private (requires PIN to access) */
-#define GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_PRIVATE (1<<5) /* marked as not private */
-#define GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY (1<<6) /* No need for the object to be a trusted one */
-#define GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_TRUSTED (1<<7) /* The object must be marked as trusted
- * in gnutls_pkcs11_crt_is_known() it implies GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_COMPARE */
-#define GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED (1<<8) /* The object must be marked as distrusted */
-#define GNUTLS_PKCS11_OBJ_FLAG_COMPARE (1<<9) /* The object must be fully compared */
-#define GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE (1<<10) /* The object must be present in a marked as trusted module */
-
-/**
- * gnutls_pkcs11_url_type_t:
- * @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_VERSION: A URL that specifies the library and its version.
- *
- * Enumeration of different URL extraction flags.
- */
-typedef enum {
- GNUTLS_PKCS11_URL_GENERIC, /* URL specifies the object on token level */
- GNUTLS_PKCS11_URL_LIB, /* URL specifies the object on module level */
- GNUTLS_PKCS11_URL_LIB_VERSION /* URL specifies the object on module and version level */
-} gnutls_pkcs11_url_type_t;
-
-int gnutls_pkcs11_obj_import_url(gnutls_pkcs11_obj_t obj,
- const char *url, unsigned int flags
- /* GNUTLS_PKCS11_OBJ_FLAG_* */ );
-int gnutls_pkcs11_obj_export_url(gnutls_pkcs11_obj_t obj,
- gnutls_pkcs11_url_type_t detailed,
- char **url);
-void gnutls_pkcs11_obj_deinit(gnutls_pkcs11_obj_t obj);
-
-int gnutls_pkcs11_obj_export(gnutls_pkcs11_obj_t obj,
- void *output_data, size_t * output_data_size);
-int gnutls_pkcs11_obj_export2(gnutls_pkcs11_obj_t obj,
- gnutls_datum_t * out);
-
-int gnutls_pkcs11_obj_export3(gnutls_pkcs11_obj_t obj, gnutls_x509_crt_fmt_t fmt,
- gnutls_datum_t * out);
-
-int gnutls_pkcs11_get_raw_issuer(const char *url, gnutls_x509_crt_t cert,
- gnutls_datum_t * issuer,
- gnutls_x509_crt_fmt_t fmt,
- unsigned int flags);
-
-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_ID_HEX: The object ID in hex.
- * @GNUTLS_PKCS11_OBJ_LABEL: The object label.
- * @GNUTLS_PKCS11_OBJ_TOKEN_LABEL: The token's label.
- * @GNUTLS_PKCS11_OBJ_TOKEN_SERIAL: The token's serial number.
- * @GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER: The token's manufacturer.
- * @GNUTLS_PKCS11_OBJ_TOKEN_MODEL: The token's model.
- * @GNUTLS_PKCS11_OBJ_ID: The object ID.
- * @GNUTLS_PKCS11_OBJ_LIBRARY_VERSION: The library's used to access the object version.
- * @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 the object manufacturer name.
- *
- * Enumeration of several object information types.
- */
-typedef enum {
- GNUTLS_PKCS11_OBJ_ID_HEX = 1,
- GNUTLS_PKCS11_OBJ_LABEL,
- GNUTLS_PKCS11_OBJ_TOKEN_LABEL,
- GNUTLS_PKCS11_OBJ_TOKEN_SERIAL,
- GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER,
- GNUTLS_PKCS11_OBJ_TOKEN_MODEL,
- GNUTLS_PKCS11_OBJ_ID,
- /* the pkcs11 provider library info */
- GNUTLS_PKCS11_OBJ_LIBRARY_VERSION,
- GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION,
- GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER
-} gnutls_pkcs11_obj_info_t;
-
-int gnutls_pkcs11_obj_get_info(gnutls_pkcs11_obj_t crt,
- gnutls_pkcs11_obj_info_t itype,
- void *output, size_t * output_size);
-
-/**
- * gnutls_pkcs11_obj_attr_t:
- * @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_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_PUBKEY: Specify all public keys.
- * @GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY: Specify all private keys.
- * @GNUTLS_PKCS11_OBJ_ATTR_ALL: Specify all objects.
- *
- * Enumeration of several attributes for object enumeration.
- */
-typedef enum {
- GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL = 1, /* all certificates */
- GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED, /* certificates marked as trusted */
- GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY, /* certificates with corresponding private key */
- GNUTLS_PKCS11_OBJ_ATTR_PUBKEY, /* public keys */
- GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY, /* private keys */
- GNUTLS_PKCS11_OBJ_ATTR_ALL, /* everything! */
- GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED_CA, /* CAs */
-} gnutls_pkcs11_obj_attr_t;
-
-/**
- * gnutls_pkcs11_token_info_t:
- * @GNUTLS_PKCS11_TOKEN_LABEL: The token's label (string)
- * @GNUTLS_PKCS11_TOKEN_SERIAL: The token's serial number (string)
- * @GNUTLS_PKCS11_TOKEN_MANUFACTURER: The token's manufacturer (string)
- * @GNUTLS_PKCS11_TOKEN_MODEL: The token's model (string)
- * @GNUTLS_PKCS11_TOKEN_TRUSTED: Whether the token is marked as trusted in p11-kit (unsigned int)
- *
- * Enumeration of types for retrieving token information.
- */
-typedef enum {
- GNUTLS_PKCS11_TOKEN_LABEL,
- GNUTLS_PKCS11_TOKEN_SERIAL,
- GNUTLS_PKCS11_TOKEN_MANUFACTURER,
- GNUTLS_PKCS11_TOKEN_MODEL,
-} gnutls_pkcs11_token_info_t;
-
-/**
- * gnutls_pkcs11_obj_type_t:
- * @GNUTLS_PKCS11_OBJ_UNKNOWN: Unknown PKCS11 object.
- * @GNUTLS_PKCS11_OBJ_X509_CRT: X.509 certificate.
- * @GNUTLS_PKCS11_OBJ_PUBKEY: Public key.
- * @GNUTLS_PKCS11_OBJ_PRIVKEY: Private key.
- * @GNUTLS_PKCS11_OBJ_SECRET_KEY: Secret key.
- * @GNUTLS_PKCS11_OBJ_DATA: Data object.
- *
- * Enumeration of object types.
- */
-typedef enum {
- GNUTLS_PKCS11_OBJ_UNKNOWN,
- GNUTLS_PKCS11_OBJ_X509_CRT,
- GNUTLS_PKCS11_OBJ_PUBKEY,
- GNUTLS_PKCS11_OBJ_PRIVKEY,
- GNUTLS_PKCS11_OBJ_SECRET_KEY,
- GNUTLS_PKCS11_OBJ_DATA
-} gnutls_pkcs11_obj_type_t;
-
-int
-gnutls_pkcs11_token_init(const char *token_url,
- const char *so_pin, const char *label);
-
-int
-gnutls_pkcs11_token_get_mechanism(const char *url,
- unsigned int idx,
- unsigned long *mechanism);
-
-int gnutls_pkcs11_token_set_pin(const char *token_url, const char *oldpin, const char *newpin, unsigned int flags /*gnutls_pin_flag_t */);
-
-int gnutls_pkcs11_token_get_url(unsigned int seq,
- gnutls_pkcs11_url_type_t detailed,
- char **url);
-int gnutls_pkcs11_token_get_info(const char *url,
- gnutls_pkcs11_token_info_t ttype,
- void *output, size_t * output_size);
-
-#define GNUTLS_PKCS11_TOKEN_HW 1
-#define GNUTLS_PKCS11_TOKEN_TRUSTED (1<<1) /* p11-kit trusted */
-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,
- unsigned int *const n_list,
- const char *url,
- gnutls_pkcs11_obj_attr_t
- attrs, unsigned int flags
- /* GNUTLS_PKCS11_OBJ_FLAG_* */
- );
-
-int
-gnutls_pkcs11_obj_list_import_url2(gnutls_pkcs11_obj_t ** p_list,
- unsigned int *n_list,
- const char *url,
- gnutls_pkcs11_obj_attr_t attrs,
- unsigned int flags
- /* GNUTLS_PKCS11_OBJ_FLAG_* */
- );
-
-int gnutls_x509_crt_import_pkcs11(gnutls_x509_crt_t crt,
- gnutls_pkcs11_obj_t pkcs11_crt);
-int gnutls_x509_crt_import_pkcs11_url(gnutls_x509_crt_t crt,
- const char *url, unsigned int flags
- /* GNUTLS_PKCS11_OBJ_FLAG_* */
- );
-
-gnutls_pkcs11_obj_type_t
-gnutls_pkcs11_obj_get_type(gnutls_pkcs11_obj_t obj);
-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,
- unsigned int cert_max,
- gnutls_pkcs11_obj_t *
- const objs, unsigned int flags
- /* must be zero */ );
-
-/* private key functions...*/
-int gnutls_pkcs11_privkey_init(gnutls_pkcs11_privkey_t * key);
-void gnutls_pkcs11_privkey_set_pin_function(gnutls_pkcs11_privkey_t
- key,
- gnutls_pin_callback_t
- fn, void *userdata);
-void gnutls_pkcs11_privkey_deinit(gnutls_pkcs11_privkey_t key);
-int gnutls_pkcs11_privkey_get_pk_algorithm(gnutls_pkcs11_privkey_t
- key, unsigned int *bits);
-int gnutls_pkcs11_privkey_get_info(gnutls_pkcs11_privkey_t pkey,
- gnutls_pkcs11_obj_info_t itype,
- void *output, size_t * output_size);
-
-int gnutls_pkcs11_privkey_import_url(gnutls_pkcs11_privkey_t pkey,
- const char *url, unsigned int flags);
-
-int gnutls_pkcs11_privkey_export_url(gnutls_pkcs11_privkey_t key,
- gnutls_pkcs11_url_type_t
- detailed, char **url);
-int gnutls_pkcs11_privkey_status(gnutls_pkcs11_privkey_t key);
-
-int gnutls_pkcs11_privkey_generate(const char *url,
- gnutls_pk_algorithm_t pk,
- unsigned int bits,
- const char *label, unsigned int flags);
-
-int
-gnutls_pkcs11_privkey_generate2(const char *url,
- gnutls_pk_algorithm_t pk,
- unsigned int bits,
- const char *label,
- gnutls_x509_crt_fmt_t fmt,
- gnutls_datum_t * pubkey,
- unsigned int flags);
-
-int
-gnutls_pkcs11_token_get_random(const char *token_url,
- void *data, size_t len);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef GNUTLS_PKCS12_H
-#define GNUTLS_PKCS12_H
-
-#include <gnutls/x509.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
- /* PKCS12 structures handling
- */
-struct gnutls_pkcs12_int;
-typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
-
-struct gnutls_pkcs12_bag_int;
-typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
-
-int gnutls_pkcs12_init(gnutls_pkcs12_t * pkcs12);
-void gnutls_pkcs12_deinit(gnutls_pkcs12_t pkcs12);
-int gnutls_pkcs12_import(gnutls_pkcs12_t pkcs12,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format, unsigned int flags);
-int gnutls_pkcs12_export(gnutls_pkcs12_t pkcs12,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_pkcs12_export2(gnutls_pkcs12_t pkcs12,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-
-int gnutls_pkcs12_get_bag(gnutls_pkcs12_t pkcs12,
- int indx, gnutls_pkcs12_bag_t bag);
-int gnutls_pkcs12_set_bag(gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag);
-
-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_bag_decrypt(gnutls_pkcs12_bag_t bag, const char *pass);
-int gnutls_pkcs12_bag_encrypt(gnutls_pkcs12_bag_t bag,
- const char *pass, unsigned int flags);
-
-#define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1
-int gnutls_pkcs12_simple_parse(gnutls_pkcs12_t p12,
- const char *password,
- gnutls_x509_privkey_t * key,
- gnutls_x509_crt_t ** chain,
- unsigned int *chain_len,
- gnutls_x509_crt_t ** extra_certs,
- unsigned int *extra_certs_len,
- gnutls_x509_crl_t * crl,
- unsigned int flags);
-
-/**
- * gnutls_pkcs12_bag_type_t:
- * @GNUTLS_BAG_EMPTY: Empty PKCS-12 bag.
- * @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_CERTIFICATE: PKCS-12 bag with certificate.
- * @GNUTLS_BAG_CRL: PKCS-12 bag with CRL.
- * @GNUTLS_BAG_SECRET: PKCS-12 bag with secret PKCS-9 keys.
- * @GNUTLS_BAG_ENCRYPTED: Encrypted PKCS-12 bag.
- * @GNUTLS_BAG_UNKNOWN: Unknown PKCS-12 bag.
- *
- * Enumeration of different PKCS 12 bag types.
- */
-typedef enum gnutls_pkcs12_bag_type_t {
- GNUTLS_BAG_EMPTY = 0,
- GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1,
- GNUTLS_BAG_PKCS8_KEY = 2,
- GNUTLS_BAG_CERTIFICATE = 3,
- GNUTLS_BAG_CRL = 4,
- GNUTLS_BAG_SECRET = 5, /* Secret data. Underspecified in pkcs-12,
- * gnutls extension. We use the PKCS-9
- * random nonce ID 1.2.840.113549.1.9.25.3
- * to store randomly generated keys.
- */
- GNUTLS_BAG_ENCRYPTED = 10,
- GNUTLS_BAG_UNKNOWN = 20
-} gnutls_pkcs12_bag_type_t;
-
-gnutls_pkcs12_bag_type_t
-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,
- gnutls_datum_t * data);
-int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag_t bag,
- gnutls_pkcs12_bag_type_t type,
- const gnutls_datum_t * data);
-int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag_t bag,
- gnutls_x509_crl_t crl);
-int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag_t bag,
- gnutls_x509_crt_t crt);
-
-int gnutls_pkcs12_bag_init(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_key_id(gnutls_pkcs12_bag_t bag, int indx,
- gnutls_datum_t * id);
-int gnutls_pkcs12_bag_set_key_id(gnutls_pkcs12_bag_t bag, int indx,
- const gnutls_datum_t * id);
-
-int gnutls_pkcs12_bag_get_friendly_name(gnutls_pkcs12_bag_t bag,
- int indx, char **name);
-int gnutls_pkcs12_bag_set_friendly_name(gnutls_pkcs12_bag_t bag,
- int indx, const char *name);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif /* GNUTLS_PKCS12_H */
+++ /dev/null
-/*
- * Copyright (C) 2010-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef __GNUTLS_TPM_H
-#define __GNUTLS_TPM_H
-
-#include <gnutls/gnutls.h>
-#include <gnutls/x509.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-struct tpm_key_list_st;
-typedef struct tpm_key_list_st *gnutls_tpm_key_list_t;
-
-#define GNUTLS_TPM_KEY_SIGNING (1<<1)
-#define GNUTLS_TPM_REGISTER_KEY (1<<2)
-#define GNUTLS_TPM_KEY_USER (1<<3)
-
-/**
- * gnutls_tpmkey_fmt_t:
- * @GNUTLS_TPMKEY_FMT_RAW: The portable data 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.
- *
- * Enumeration of different certificate encoding formats.
- */
-typedef enum {
- GNUTLS_TPMKEY_FMT_RAW = 0,
- GNUTLS_TPMKEY_FMT_DER = GNUTLS_TPMKEY_FMT_RAW,
- GNUTLS_TPMKEY_FMT_CTK_PEM = 1
-} gnutls_tpmkey_fmt_t;
-
-int
-gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk,
- unsigned int bits,
- const char *srk_password,
- const char *key_password,
- gnutls_tpmkey_fmt_t format,
- gnutls_x509_crt_fmt_t pub_format,
- gnutls_datum_t * privkey,
- gnutls_datum_t * pubkey, unsigned int flags);
-
-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 idx, char **url,
- unsigned int flags);
-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
-}
-#endif
-/* *INDENT-ON* */
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003-2012 Free Software Foundation, Inc.
- *
- * Author: Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-/* This file contains the types and prototypes for the X.509
- * certificate and CRL handling functions.
- */
-
-#ifndef GNUTLS_X509_H
-#define GNUTLS_X509_H
-
-#include <gnutls/gnutls.h>
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-/* Some OIDs usually found in Distinguished names, or
- * in Subject Directory Attribute extensions.
- */
-#define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6"
-#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_COMMON_NAME "2.5.4.3"
-#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_INITIALS "2.5.4.43"
-#define GNUTLS_OID_X520_GENERATION_QUALIFIER "2.5.4.44"
-#define GNUTLS_OID_X520_SURNAME "2.5.4.4"
-#define GNUTLS_OID_X520_GIVEN_NAME "2.5.4.42"
-#define GNUTLS_OID_X520_TITLE "2.5.4.12"
-#define GNUTLS_OID_X520_DN_QUALIFIER "2.5.4.46"
-#define GNUTLS_OID_X520_PSEUDONYM "2.5.4.65"
-#define GNUTLS_OID_X520_POSTALCODE "2.5.4.17"
-#define GNUTLS_OID_X520_NAME "2.5.4.41"
-
-#define GNUTLS_OID_LDAP_DC "0.9.2342.19200300.100.1.25"
-#define GNUTLS_OID_LDAP_UID "0.9.2342.19200300.100.1.1"
-
-/* The following should not be included in DN.
- */
-#define GNUTLS_OID_PKCS9_EMAIL "1.2.840.113549.1.9.1"
-
-#define GNUTLS_OID_PKIX_DATE_OF_BIRTH "1.3.6.1.5.5.7.9.1"
-#define GNUTLS_OID_PKIX_PLACE_OF_BIRTH "1.3.6.1.5.5.7.9.2"
-#define GNUTLS_OID_PKIX_GENDER "1.3.6.1.5.5.7.9.3"
-#define GNUTLS_OID_PKIX_COUNTRY_OF_CITIZENSHIP "1.3.6.1.5.5.7.9.4"
-#define GNUTLS_OID_PKIX_COUNTRY_OF_RESIDENCE "1.3.6.1.5.5.7.9.5"
-
-/* Key purpose Object Identifiers.
- */
-#define GNUTLS_KP_TLS_WWW_SERVER "1.3.6.1.5.5.7.3.1"
-#define GNUTLS_KP_TLS_WWW_CLIENT "1.3.6.1.5.5.7.3.2"
-#define GNUTLS_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
-#define GNUTLS_KP_MS_SMART_CARD_LOGON "1.3.6.1.4.1.311.20.2.2"
-#define GNUTLS_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
-#define GNUTLS_KP_TIME_STAMPING "1.3.6.1.5.5.7.3.8"
-#define GNUTLS_KP_OCSP_SIGNING "1.3.6.1.5.5.7.3.9"
-#define GNUTLS_KP_IPSEC_IKE "1.3.6.1.5.5.7.3.17"
-#define GNUTLS_KP_ANY "2.5.29.37.0"
-
-#define GNUTLS_OID_AIA "1.3.6.1.5.5.7.1.1"
-#define GNUTLS_OID_AD_OCSP "1.3.6.1.5.5.7.48.1"
-#define GNUTLS_OID_AD_CAISSUERS "1.3.6.1.5.5.7.48.2"
-
-#define GNUTLS_FSAN_SET 0
-#define GNUTLS_FSAN_APPEND 1
-
-/* Certificate handling functions.
- */
-
-/**
- * gnutls_certificate_import_flags:
- * @GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED: Fail if the
- * certificates in the buffer are more than the space allocated for
- * certificates. The error code will be %GNUTLS_E_SHORT_MEMORY_BUFFER.
- * @GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED: Fail if the certificates
- * in the buffer are not ordered starting from subject to issuer.
- * The error code will be %GNUTLS_E_CERTIFICATE_LIST_UNSORTED.
- *
- * Enumeration of different certificate import flags.
- */
-typedef enum gnutls_certificate_import_flags {
- GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1,
- GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 2
-} gnutls_certificate_import_flags;
-
-int gnutls_x509_crt_init(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,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-int gnutls_x509_crt_list_import2(gnutls_x509_crt_t ** certs,
- unsigned int *size,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-int gnutls_x509_crt_list_import(gnutls_x509_crt_t * certs,
- unsigned int *cert_max,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-int gnutls_x509_crt_export(gnutls_x509_crt_t cert,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_x509_crt_export2(gnutls_x509_crt_t cert,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-int gnutls_x509_crt_get_private_key_usage_period(gnutls_x509_crt_t
- cert,
- time_t *
- activation,
- time_t *
- expiration, unsigned int
- *critical);
-
-int gnutls_x509_crt_get_issuer_dn(gnutls_x509_crt_t cert,
- char *buf, size_t * buf_size);
-int gnutls_x509_crt_get_issuer_dn2(gnutls_x509_crt_t cert,
- gnutls_datum_t * dn);
-int gnutls_x509_crt_get_issuer_dn_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
- size_t * oid_size);
-int gnutls_x509_crt_get_issuer_dn_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
- unsigned int raw_flag,
- void *buf, size_t * buf_size);
-int gnutls_x509_crt_get_dn(gnutls_x509_crt_t cert, char *buf,
- size_t * buf_size);
-int gnutls_x509_crt_get_dn2(gnutls_x509_crt_t cert, gnutls_datum_t * dn);
-int gnutls_x509_crt_get_dn_oid(gnutls_x509_crt_t cert, int indx,
- void *oid, size_t * oid_size);
-int gnutls_x509_crt_get_dn_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
- unsigned int raw_flag, void *buf,
- size_t * buf_size);
-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(gnutls_x509_crt_t cert,
- char *sig, size_t * sizeof_sig);
-int gnutls_x509_crt_get_version(gnutls_x509_crt_t cert);
-int gnutls_x509_crt_get_key_id(gnutls_x509_crt_t crt,
- unsigned int flags,
- unsigned char *output_data,
- size_t * output_data_size);
-
-int gnutls_x509_crt_set_private_key_usage_period(gnutls_x509_crt_t
- crt,
- time_t activation,
- time_t expiration);
-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,
- void *id,
- size_t * id_size,
- unsigned int *critical);
-int gnutls_x509_crt_get_authority_key_gn_serial(gnutls_x509_crt_t
- cert,
- unsigned int seq,
- void *alt,
- size_t * alt_size,
- unsigned int
- *alt_type,
- void *serial,
- size_t *
- serial_size, unsigned int
- *critical);
-
-int gnutls_x509_crt_get_subject_key_id(gnutls_x509_crt_t cert,
- void *ret,
- size_t * ret_size,
- unsigned int *critical);
-
-int gnutls_x509_crt_get_subject_unique_id(gnutls_x509_crt_t crt,
- char *buf, size_t * buf_size);
-
-int gnutls_x509_crt_get_issuer_unique_id(gnutls_x509_crt_t crt,
- char *buf, size_t * buf_size);
-
-void gnutls_x509_crt_set_pin_function(gnutls_x509_crt_t crt,
- gnutls_pin_callback_t fn,
- void *userdata);
-
- /**
- * gnutls_info_access_what_t:
- * @GNUTLS_IA_ACCESSMETHOD_OID: Get accessMethod OID.
- * @GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE: Get accessLocation name type.
- * @GNUTLS_IA_URI: Get accessLocation URI value.
- * @GNUTLS_IA_OCSP_URI: get accessLocation URI value for OCSP.
- * @GNUTLS_IA_CAISSUERS_URI: get accessLocation URI value for caIssuers.
- *
- * Enumeration of types for the @what parameter of
- * gnutls_x509_crt_get_authority_info_access().
- */
-typedef enum gnutls_info_access_what_t {
- GNUTLS_IA_ACCESSMETHOD_OID = 1,
- GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE = 2,
- /* use 100-108 for the generalName types, populate as needed */
- GNUTLS_IA_URI = 106,
- /* quick-access variants that match both OID and name type. */
- GNUTLS_IA_OCSP_URI = 10006,
- GNUTLS_IA_CAISSUERS_URI = 10106
-} gnutls_info_access_what_t;
-
-int gnutls_x509_crt_get_authority_info_access(gnutls_x509_crt_t
- crt,
- unsigned int seq,
- int what,
- gnutls_datum_t *
- data, unsigned int
- *critical);
-
-#define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED,
- /**
- * gnutls_x509_crl_reason_flags_t:
- * @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_CESSATION_OF_OPERATION: The end-entity is no longer operating.
- * @GNUTLS_CRL_REASON_SUPERSEDED: There is a newer certificate of the owner.
- * @GNUTLS_CRL_REASON_AFFILIATION_CHANGED: The end-entity affiliation has changed.
- * @GNUTLS_CRL_REASON_CA_COMPROMISE: The CA was compromised.
- * @GNUTLS_CRL_REASON_KEY_COMPROMISE: The certificate's key was compromised.
- * @GNUTLS_CRL_REASON_UNUSED: The key was never used.
- * @GNUTLS_CRL_REASON_AA_COMPROMISE: AA compromised.
- *
- * Enumeration of types for the CRL revocation reasons.
- */
-typedef enum gnutls_x509_crl_reason_flags_t {
- GNUTLS_CRL_REASON_UNSPECIFIED = 0,
- GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN = 1,
- GNUTLS_CRL_REASON_CERTIFICATE_HOLD = 2,
- GNUTLS_CRL_REASON_CESSATION_OF_OPERATION = 4,
- GNUTLS_CRL_REASON_SUPERSEDED = 8,
- GNUTLS_CRL_REASON_AFFILIATION_CHANGED = 16,
- GNUTLS_CRL_REASON_CA_COMPROMISE = 32,
- GNUTLS_CRL_REASON_KEY_COMPROMISE = 64,
- GNUTLS_CRL_REASON_UNUSED = 128,
- GNUTLS_CRL_REASON_AA_COMPROMISE = 32768
-} gnutls_x509_crl_reason_flags_t;
-
-int gnutls_x509_crt_get_crl_dist_points(gnutls_x509_crt_t cert,
- unsigned int seq,
- void *ret,
- size_t * ret_size,
- unsigned int *reason_flags,
- unsigned int *critical);
-int gnutls_x509_crt_set_crl_dist_points2(gnutls_x509_crt_t crt,
- gnutls_x509_subject_alt_name_t
- type, const void *data,
- unsigned int data_size,
- unsigned int reason_flags);
-int gnutls_x509_crt_set_crl_dist_points(gnutls_x509_crt_t crt,
- gnutls_x509_subject_alt_name_t
- type,
- const void *data_string,
- 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,
- gnutls_x509_crt_t issuer,
- gnutls_x509_privkey_t issuer_key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-
-time_t gnutls_x509_crt_get_activation_time(gnutls_x509_crt_t cert);
-
-#define GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION ((time_t)4294197631)
-
-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, size_t * result_size);
-
-int gnutls_x509_crt_get_pk_algorithm(gnutls_x509_crt_t cert,
- unsigned int *bits);
-int gnutls_x509_crt_get_pk_rsa_raw(gnutls_x509_crt_t crt,
- gnutls_datum_t * m, gnutls_datum_t * e);
-int gnutls_x509_crt_get_pk_dsa_raw(gnutls_x509_crt_t crt,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g, gnutls_datum_t * y);
-
-int gnutls_x509_crt_get_subject_alt_name(gnutls_x509_crt_t cert,
- unsigned int seq,
- void *san,
- size_t * san_size,
- unsigned int *critical);
-int gnutls_x509_crt_get_subject_alt_name2(gnutls_x509_crt_t cert,
- unsigned int seq,
- void *san,
- 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,
- unsigned int seq,
- void *oid,
- size_t * oid_size);
-
-int gnutls_x509_crt_get_issuer_alt_name(gnutls_x509_crt_t cert,
- unsigned int seq,
- void *ian,
- size_t * ian_size,
- unsigned int *critical);
-int gnutls_x509_crt_get_issuer_alt_name2(gnutls_x509_crt_t cert,
- unsigned int seq,
- void *ian,
- 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,
- unsigned int seq,
- void *ret,
- size_t * ret_size);
-
-int gnutls_x509_crt_get_ca_status(gnutls_x509_crt_t cert,
- unsigned int *critical);
-int gnutls_x509_crt_get_basic_constraints(gnutls_x509_crt_t cert,
- unsigned int *critical,
- unsigned int *ca, int *pathlen);
-
-/* The key_usage flags are defined in gnutls.h. They are the
- * GNUTLS_KEY_* definitions.
- */
-int gnutls_x509_crt_get_key_usage(gnutls_x509_crt_t cert,
- unsigned int *key_usage,
- unsigned int *critical);
-int gnutls_x509_crt_set_key_usage(gnutls_x509_crt_t crt,
- unsigned int usage);
-int gnutls_x509_crt_set_authority_info_access(gnutls_x509_crt_t
- crt, int what,
- gnutls_datum_t * data);
-
-int gnutls_x509_crt_get_proxy(gnutls_x509_crt_t cert,
- unsigned int *critical,
- int *pathlen,
- char **policyLanguage,
- char **policy, size_t * sizeof_policy);
-
-#define GNUTLS_MAX_QUALIFIERS 8
-
- /**
- * gnutls_x509_qualifier_t:
- * @GNUTLS_X509_QUALIFIER_UNKNOWN: Unknown qualifier.
- * @GNUTLS_X509_QUALIFIER_URI: A URL
- * @GNUTLS_X509_QUALIFIER_NOICE: A text notice.
- *
- * Enumeration of types for the X.509 qualifiers, of the certificate policy extension.
- */
-typedef enum gnutls_x509_qualifier_t {
- GNUTLS_X509_QUALIFIER_UNKNOWN = 0, GNUTLS_X509_QUALIFIER_URI,
- GNUTLS_X509_QUALIFIER_NOTICE
-} gnutls_x509_qualifier_t;
-
-typedef struct gnutls_x509_policy_st {
- char *oid;
- unsigned int qualifiers;
- struct {
- gnutls_x509_qualifier_t type;
- char *data;
- unsigned int size;
- } qualifier[GNUTLS_MAX_QUALIFIERS];
-} gnutls_x509_policy_st;
-
-void gnutls_x509_policy_release(struct gnutls_x509_policy_st
- *policy);
-int gnutls_x509_crt_get_policy(gnutls_x509_crt_t crt, int indx, struct gnutls_x509_policy_st
- *policy, unsigned int *critical);
-int gnutls_x509_crt_set_policy(gnutls_x509_crt_t crt, struct gnutls_x509_policy_st
- *policy, unsigned int critical);
-
-int gnutls_x509_dn_oid_known(const char *oid);
-
-#define GNUTLS_X509_DN_OID_RETURN_OID 1
-const char *gnutls_x509_dn_oid_name(const char *oid, unsigned int flags);
-
- /* Read extensions by OID. */
-int gnutls_x509_crt_get_extension_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
- size_t * oid_size);
-int gnutls_x509_crt_get_extension_by_oid(gnutls_x509_crt_t cert,
- const char *oid, int indx,
- void *buf,
- size_t * buf_size,
- unsigned int *critical);
-
- /* Read extensions by sequence number. */
-int gnutls_x509_crt_get_extension_info(gnutls_x509_crt_t cert,
- int indx, void *oid,
- size_t * oid_size,
- unsigned int *critical);
-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,
- const char *oid,
- const void *buf,
- size_t sizeof_buf,
- unsigned int critical);
-
-/* X.509 Certificate writing.
- */
-int gnutls_x509_crt_set_dn(gnutls_x509_crt_t crt, const char *dn,
- const char **err);
-
-int gnutls_x509_crt_set_dn_by_oid(gnutls_x509_crt_t crt,
- const char *oid,
- unsigned int raw_flag,
- const void *name,
- unsigned int sizeof_name);
-int gnutls_x509_crt_set_issuer_dn_by_oid(gnutls_x509_crt_t crt,
- const char *oid,
- unsigned int raw_flag,
- const void *name,
- unsigned int sizeof_name);
-int gnutls_x509_crt_set_issuer_dn(gnutls_x509_crt_t crt,
- const char *dn, const char **err);
-
-int gnutls_x509_crt_set_version(gnutls_x509_crt_t crt,
- unsigned int version);
-int gnutls_x509_crt_set_key(gnutls_x509_crt_t crt,
- 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_basic_constraints(gnutls_x509_crt_t crt,
- unsigned int ca,
- int pathLenConstraint);
-int gnutls_x509_crt_set_subject_alternative_name(gnutls_x509_crt_t
- crt,
- gnutls_x509_subject_alt_name_t
- type, const char
- *data_string);
-int gnutls_x509_crt_set_subject_alt_name(gnutls_x509_crt_t crt,
- gnutls_x509_subject_alt_name_t
- type, const void *data,
- unsigned int data_size,
- unsigned int flags);
-int gnutls_x509_crt_sign(gnutls_x509_crt_t crt,
- gnutls_x509_crt_t issuer,
- gnutls_x509_privkey_t issuer_key);
-int gnutls_x509_crt_sign2(gnutls_x509_crt_t crt,
- gnutls_x509_crt_t issuer,
- gnutls_x509_privkey_t issuer_key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-int gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert,
- time_t act_time);
-int gnutls_x509_crt_set_expiration_time(gnutls_x509_crt_t cert,
- time_t exp_time);
-int gnutls_x509_crt_set_serial(gnutls_x509_crt_t cert,
- const void *serial, size_t serial_size);
-
-int gnutls_x509_crt_set_subject_key_id(gnutls_x509_crt_t cert,
- const void *id, size_t id_size);
-
-int gnutls_x509_crt_set_proxy_dn(gnutls_x509_crt_t crt,
- gnutls_x509_crt_t eecrt,
- unsigned int raw_flag,
- const void *name,
- unsigned int sizeof_name);
-int gnutls_x509_crt_set_proxy(gnutls_x509_crt_t crt,
- int pathLenConstraint,
- const char *policyLanguage,
- const char *policy, size_t sizeof_policy);
-
-int gnutls_x509_crt_print(gnutls_x509_crt_t cert,
- gnutls_certificate_print_formats_t
- format, gnutls_datum_t * out);
-int gnutls_x509_crl_print(gnutls_x509_crl_t crl,
- gnutls_certificate_print_formats_t
- format, gnutls_datum_t * out);
-
- /* Access to internal Certificate fields.
- */
-int gnutls_x509_crt_get_raw_issuer_dn(gnutls_x509_crt_t cert,
- gnutls_datum_t * start);
-int gnutls_x509_crt_get_raw_dn(gnutls_x509_crt_t cert,
- gnutls_datum_t * start);
-
-/* RDN handling.
- */
-int gnutls_x509_rdn_get(const gnutls_datum_t * idn,
- char *buf, size_t * sizeof_buf);
-int gnutls_x509_rdn_get_oid(const gnutls_datum_t * idn,
- int indx, void *buf, size_t * sizeof_buf);
-
-int gnutls_x509_rdn_get_by_oid(const gnutls_datum_t * idn,
- const char *oid, int indx,
- unsigned int raw_flag, void *buf,
- size_t * sizeof_buf);
-
-typedef void *gnutls_x509_dn_t;
-
-typedef struct gnutls_x509_ava_st {
- gnutls_datum_t oid;
- gnutls_datum_t value;
- unsigned long value_tag;
-} gnutls_x509_ava_st;
-
-int gnutls_x509_crt_get_subject(gnutls_x509_crt_t cert,
- gnutls_x509_dn_t * dn);
-int gnutls_x509_crt_get_issuer(gnutls_x509_crt_t cert,
- gnutls_x509_dn_t * dn);
-int gnutls_x509_dn_get_rdn_ava(gnutls_x509_dn_t dn, int irdn,
- int iava, gnutls_x509_ava_st * ava);
-
-int gnutls_x509_dn_init(gnutls_x509_dn_t * dn);
-
-int gnutls_x509_dn_import(gnutls_x509_dn_t dn,
- const gnutls_datum_t * data);
-
-int gnutls_x509_dn_export(gnutls_x509_dn_t dn,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_x509_dn_export2(gnutls_x509_dn_t dn,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-
-void gnutls_x509_dn_deinit(gnutls_x509_dn_t dn);
-
-
-/* CRL handling functions.
- */
-int gnutls_x509_crl_init(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,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-int gnutls_x509_crl_export(gnutls_x509_crl_t crl,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_x509_crl_export2(gnutls_x509_crl_t crl,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-
-int
-gnutls_x509_crl_get_raw_issuer_dn(gnutls_x509_crl_t crl,
- gnutls_datum_t * dn);
-
-int gnutls_x509_crl_get_issuer_dn(gnutls_x509_crl_t crl,
- char *buf, size_t * sizeof_buf);
-int gnutls_x509_crl_get_issuer_dn2(gnutls_x509_crl_t crl,
- gnutls_datum_t * dn);
-int gnutls_x509_crl_get_issuer_dn_by_oid(gnutls_x509_crl_t crl,
- const char *oid, int indx,
- unsigned int raw_flag,
- void *buf, size_t * sizeof_buf);
-int gnutls_x509_crl_get_dn_oid(gnutls_x509_crl_t crl, int indx,
- void *oid, size_t * sizeof_oid);
-
-int gnutls_x509_crl_get_signature_algorithm(gnutls_x509_crl_t crl);
-int gnutls_x509_crl_get_signature(gnutls_x509_crl_t crl,
- char *sig, size_t * sizeof_sig);
-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_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_serial(gnutls_x509_crl_t crl, int indx,
- unsigned char *serial,
- 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 gnutls_x509_crl_get_crt_serial
-
-int gnutls_x509_crl_check_issuer(gnutls_x509_crl_t crl,
- gnutls_x509_crt_t issuer);
-
-int gnutls_x509_crl_list_import2(gnutls_x509_crl_t ** crls,
- unsigned int *size,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-
-int gnutls_x509_crl_list_import(gnutls_x509_crl_t * crls,
- unsigned int *crl_max,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- unsigned int flags);
-/* CRL writing.
- */
-int gnutls_x509_crl_set_version(gnutls_x509_crl_t crl,
- unsigned int version);
-int gnutls_x509_crl_set_this_update(gnutls_x509_crl_t crl,
- time_t act_time);
-int gnutls_x509_crl_set_next_update(gnutls_x509_crl_t crl,
- time_t exp_time);
-int gnutls_x509_crl_set_crt_serial(gnutls_x509_crl_t crl,
- const void *serial,
- size_t serial_size,
- time_t revocation_time);
-int gnutls_x509_crl_set_crt(gnutls_x509_crl_t crl,
- gnutls_x509_crt_t crt, time_t revocation_time);
-
-int gnutls_x509_crl_get_authority_key_id(gnutls_x509_crl_t crl,
- void *id,
- size_t * id_size,
- unsigned int *critical);
-int gnutls_x509_crl_get_authority_key_gn_serial(gnutls_x509_crl_t
- crl,
- unsigned int seq,
- void *alt,
- size_t * alt_size,
- unsigned int
- *alt_type,
- void *serial,
- size_t *
- serial_size, unsigned int
- *critical);
-
-int gnutls_x509_crl_get_number(gnutls_x509_crl_t crl, void *ret,
- size_t * ret_size, unsigned int *critical);
-
-int gnutls_x509_crl_get_extension_oid(gnutls_x509_crl_t crl,
- int indx, void *oid,
- size_t * sizeof_oid);
-
-int gnutls_x509_crl_get_extension_info(gnutls_x509_crl_t crl,
- int indx, void *oid,
- size_t * sizeof_oid,
- unsigned int *critical);
-
-int gnutls_x509_crl_get_extension_data(gnutls_x509_crl_t crl,
- int indx, void *data,
- size_t * sizeof_data);
-
-int gnutls_x509_crl_set_authority_key_id(gnutls_x509_crl_t crl,
- const void *id, size_t id_size);
-
-int gnutls_x509_crl_set_number(gnutls_x509_crl_t crl,
- const void *nr, size_t nr_size);
-
-
-/* PKCS7 structures handling
- */
-struct gnutls_pkcs7_int;
-typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t;
-
-int gnutls_pkcs7_init(gnutls_pkcs7_t * pkcs7);
-void gnutls_pkcs7_deinit(gnutls_pkcs7_t pkcs7);
-int gnutls_pkcs7_import(gnutls_pkcs7_t pkcs7,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-int gnutls_pkcs7_export(gnutls_pkcs7_t pkcs7,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_pkcs7_export2(gnutls_pkcs7_t pkcs7,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-
-int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7);
-int gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, int indx,
- void *certificate, size_t * certificate_size);
-
-int gnutls_pkcs7_set_crt_raw(gnutls_pkcs7_t pkcs7,
- const gnutls_datum_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_get_crl_raw(gnutls_pkcs7_t pkcs7,
- int indx, void *crl, size_t * crl_size);
-int gnutls_pkcs7_get_crl_count(gnutls_pkcs7_t pkcs7);
-
-int gnutls_pkcs7_set_crl_raw(gnutls_pkcs7_t pkcs7,
- const gnutls_datum_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);
-
-/* X.509 Certificate verification functions.
- */
-
-/**
- * gnutls_certificate_verify_flags:
- * @GNUTLS_VERIFY_DISABLE_CA_SIGN: If set a signer does not have to be
- * a certificate authority. This flag should normally be disabled,
- * unless you know what this means.
- * @GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS: If set a signer in the trusted
- * list is never checked for expiration or activation.
- * @GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT: Allow trusted CA certificates
- * with version 1. This is safer than %GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT,
- * and should be used instead. That way only signers in your trusted list
- * will be allowed to have certificates of version 1. This is the default.
- * @GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT: Do not allow trusted CA
- * certificates that have version 1. This option is to be used
- * to deprecate all certificates of version 1.
- * @GNUTLS_VERIFY_DO_NOT_ALLOW_SAME: If a certificate is not signed by
- * anyone trusted but exists in the trusted CA list do not treat it
- * as trusted.
- * @GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN: A certificate chain is tolerated
- * if unsorted (the case with many TLS servers out there). This is the
- * default since GnuTLS 3.1.4.
- * @GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN: Do not tolerate an unsorted
- * certificate chain.
- * @GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT: Allow CA certificates that
- * have version 1 (both root and intermediate). This might be
- * dangerous since those haven't the basicConstraints
- * extension. Must be used in combination with
- * %GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT.
- * @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2: Allow certificates to be signed
- * using the broken MD2 algorithm.
- * @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5: Allow certificates to be signed
- * using the broken MD5 algorithm.
- * @GNUTLS_VERIFY_DISABLE_TIME_CHECKS: Disable checking of activation
- * and expiration validity periods of certificate chains. Don't set
- * this unless you understand the security implications.
- * @GNUTLS_VERIFY_DISABLE_CRL_CHECKS: Disable checking for validity
- * using certificate revocation lists or the available OCSP data.
- *
- * Enumeration of different certificate verify flags.
- */
-typedef enum gnutls_certificate_verify_flags {
- GNUTLS_VERIFY_DISABLE_CA_SIGN = 1 << 0,
- GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT = 1 << 1,
- GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 1 << 2,
- GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 1 << 3,
- GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 1 << 4,
- GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 1 << 5,
- GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 1 << 6,
- GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 1 << 7,
- GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 1 << 8,
- GNUTLS_VERIFY_DISABLE_CRL_CHECKS = 1 << 9,
- GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN = 1 << 10,
- GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN = 1 << 11,
-} gnutls_certificate_verify_flags;
-
-int gnutls_x509_crt_check_issuer(gnutls_x509_crt_t cert,
- gnutls_x509_crt_t issuer);
-
-int gnutls_x509_crt_list_verify(const gnutls_x509_crt_t *
- cert_list, int cert_list_length,
- const gnutls_x509_crt_t * CA_list,
- int CA_list_length,
- const gnutls_x509_crl_t * CRL_list,
- int CRL_list_length,
- unsigned int flags, unsigned int *verify);
-
-int gnutls_x509_crt_verify(gnutls_x509_crt_t cert,
- const gnutls_x509_crt_t * CA_list,
- int CA_list_length, unsigned int flags,
- unsigned int *verify);
-int gnutls_x509_crl_verify(gnutls_x509_crl_t crl,
- const gnutls_x509_crt_t * CA_list,
- int CA_list_length, unsigned int flags,
- unsigned int *verify);
-
-int gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert,
- const gnutls_x509_crl_t *
- crl_list, int crl_list_length);
-
-int gnutls_x509_crt_get_fingerprint(gnutls_x509_crt_t cert,
- gnutls_digest_algorithm_t algo,
- void *buf, size_t * buf_size);
-
-int gnutls_x509_crt_get_key_purpose_oid(gnutls_x509_crt_t cert,
- int indx, void *oid,
- size_t * oid_size,
- unsigned int *critical);
-int gnutls_x509_crt_set_key_purpose_oid(gnutls_x509_crt_t cert,
- const void *oid,
- unsigned int critical);
-
-/* Private key handling.
- */
-
-/* Flags for the gnutls_x509_privkey_export_pkcs8() function.
- */
-
-#define GNUTLS_PKCS8_PLAIN GNUTLS_PKCS_PLAIN
-#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_RC2_40 GNUTLS_PKCS_USE_PKCS12_RC2_40
-
-/**
- * gnutls_pkcs_encrypt_flags_t:
- * @GNUTLS_PKCS_PLAIN: Unencrypted private key.
- * @GNUTLS_PKCS_NULL_PASSWORD: Some schemas distinguish between an empty and a NULL password.
- * @GNUTLS_PKCS_USE_PKCS12_3DES: PKCS-12 3DES.
- * @GNUTLS_PKCS_USE_PKCS12_ARCFOUR: PKCS-12 ARCFOUR.
- * @GNUTLS_PKCS_USE_PKCS12_RC2_40: PKCS-12 RC2-40.
- * @GNUTLS_PKCS_USE_PBES2_3DES: PBES2 3DES.
- * @GNUTLS_PKCS_USE_PBES2_AES_128: PBES2 AES-128.
- * @GNUTLS_PKCS_USE_PBES2_AES_192: PBES2 AES-192.
- * @GNUTLS_PKCS_USE_PBES2_AES_256: PBES2 AES-256.
- *
- * Enumeration of different PKCS encryption flags.
- */
-typedef enum gnutls_pkcs_encrypt_flags_t {
- GNUTLS_PKCS_PLAIN = 1,
- GNUTLS_PKCS_USE_PKCS12_3DES = 2,
- GNUTLS_PKCS_USE_PKCS12_ARCFOUR = 4,
- GNUTLS_PKCS_USE_PKCS12_RC2_40 = 8,
- GNUTLS_PKCS_USE_PBES2_3DES = 16,
- GNUTLS_PKCS_USE_PBES2_AES_128 = 32,
- GNUTLS_PKCS_USE_PBES2_AES_192 = 64,
- GNUTLS_PKCS_USE_PBES2_AES_256 = 128,
- GNUTLS_PKCS_NULL_PASSWORD = 256
-} gnutls_pkcs_encrypt_flags_t;
-
-int gnutls_x509_privkey_init(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 key);
-int gnutls_x509_privkey_cpy(gnutls_x509_privkey_t dst,
- gnutls_x509_privkey_t src);
-int gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-int gnutls_x509_privkey_import_pkcs8(gnutls_x509_privkey_t key,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- const char *password,
- unsigned int flags);
-int gnutls_x509_privkey_import_openssl(gnutls_x509_privkey_t key,
- const gnutls_datum_t * data,
- const char *password);
-
-int gnutls_x509_privkey_import2(gnutls_x509_privkey_t key,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format,
- const char *password, unsigned int flags);
-
-int gnutls_x509_privkey_import_rsa_raw(gnutls_x509_privkey_t key,
- const gnutls_datum_t * m,
- const gnutls_datum_t * e,
- const gnutls_datum_t * d,
- const gnutls_datum_t * p,
- const gnutls_datum_t * q,
- const gnutls_datum_t * u);
-int gnutls_x509_privkey_import_rsa_raw2(gnutls_x509_privkey_t key,
- const gnutls_datum_t * m,
- const gnutls_datum_t * e,
- const gnutls_datum_t * d,
- const gnutls_datum_t * p,
- const gnutls_datum_t * q,
- const gnutls_datum_t * u,
- const gnutls_datum_t * e1,
- const gnutls_datum_t * e2);
-int gnutls_x509_privkey_import_ecc_raw(gnutls_x509_privkey_t key,
- gnutls_ecc_curve_t curve,
- const gnutls_datum_t * x,
- const gnutls_datum_t * y,
- const gnutls_datum_t * k);
-
-int gnutls_x509_privkey_fix(gnutls_x509_privkey_t key);
-
-int gnutls_x509_privkey_export_dsa_raw(gnutls_x509_privkey_t key,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * g,
- gnutls_datum_t * y,
- gnutls_datum_t * x);
-int gnutls_x509_privkey_import_dsa_raw(gnutls_x509_privkey_t key,
- const gnutls_datum_t * p,
- const gnutls_datum_t * q,
- const gnutls_datum_t * g,
- const gnutls_datum_t * y,
- const gnutls_datum_t * x);
-
-int gnutls_x509_privkey_get_pk_algorithm(gnutls_x509_privkey_t key);
-int gnutls_x509_privkey_get_pk_algorithm2(gnutls_x509_privkey_t
- key, unsigned int *bits);
-int gnutls_x509_privkey_get_key_id(gnutls_x509_privkey_t key,
- unsigned int flags,
- unsigned char *output_data,
- size_t * output_data_size);
-
-int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
- gnutls_pk_algorithm_t algo,
- unsigned int bits, unsigned int flags);
-int gnutls_x509_privkey_verify_params(gnutls_x509_privkey_t key);
-
-int gnutls_x509_privkey_export(gnutls_x509_privkey_t key,
- gnutls_x509_crt_fmt_t format,
- void *output_data,
- size_t * output_data_size);
-int gnutls_x509_privkey_export2(gnutls_x509_privkey_t key,
- gnutls_x509_crt_fmt_t format,
- gnutls_datum_t * out);
-int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key,
- gnutls_x509_crt_fmt_t format,
- const char *password,
- unsigned int flags,
- void *output_data,
- size_t * output_data_size);
-int gnutls_x509_privkey_export2_pkcs8(gnutls_x509_privkey_t key,
- gnutls_x509_crt_fmt_t format,
- const char *password,
- unsigned int flags,
- gnutls_datum_t * out);
-int gnutls_x509_privkey_export_rsa_raw2(gnutls_x509_privkey_t key,
- gnutls_datum_t * m,
- gnutls_datum_t * e,
- gnutls_datum_t * d,
- gnutls_datum_t * p,
- gnutls_datum_t * q,
- gnutls_datum_t * u,
- gnutls_datum_t * e1,
- gnutls_datum_t * e2);
-int gnutls_x509_privkey_export_rsa_raw(gnutls_x509_privkey_t key,
- 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_x509_privkey_export_ecc_raw(gnutls_x509_privkey_t key,
- gnutls_ecc_curve_t * curve,
- gnutls_datum_t * x,
- gnutls_datum_t * y,
- gnutls_datum_t * k);
-/* Certificate request stuff.
- */
-
-int gnutls_x509_crq_sign2(gnutls_x509_crq_t crq,
- gnutls_x509_privkey_t key,
- gnutls_digest_algorithm_t dig,
- unsigned int flags);
-
-int gnutls_x509_crq_print(gnutls_x509_crq_t crq,
- gnutls_certificate_print_formats_t
- format, gnutls_datum_t * out);
-
-int gnutls_x509_crq_verify(gnutls_x509_crq_t crq, unsigned int flags);
-
-int gnutls_x509_crq_init(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,
- const gnutls_datum_t * data,
- gnutls_x509_crt_fmt_t format);
-
-int gnutls_x509_crq_get_private_key_usage_period(gnutls_x509_crq_t
- cert,
- time_t *
- activation,
- time_t *
- expiration, unsigned int
- *critical);
-
-int gnutls_x509_crq_get_dn(gnutls_x509_crq_t crq, char *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_dn_oid(gnutls_x509_crq_t crq, int indx,
- void *oid, size_t * sizeof_oid);
-int gnutls_x509_crq_get_dn_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
- unsigned int raw_flag, void *buf,
- size_t * sizeof_buf);
-int gnutls_x509_crq_set_dn(gnutls_x509_crq_t crq, const char *dn,
- const char **err);
-int gnutls_x509_crq_set_dn_by_oid(gnutls_x509_crq_t crq,
- const char *oid,
- unsigned int raw_flag,
- const void *data,
- unsigned int sizeof_data);
-int gnutls_x509_crq_set_version(gnutls_x509_crq_t crq,
- unsigned int version);
-int gnutls_x509_crq_get_version(gnutls_x509_crq_t crq);
-int gnutls_x509_crq_set_key(gnutls_x509_crq_t crq,
- gnutls_x509_privkey_t key);
-
-int gnutls_x509_crq_set_challenge_password(gnutls_x509_crq_t crq,
- const char *pass);
-int gnutls_x509_crq_get_challenge_password(gnutls_x509_crq_t crq,
- char *pass,
- size_t * sizeof_pass);
-
-int gnutls_x509_crq_set_attribute_by_oid(gnutls_x509_crq_t crq,
- const char *oid,
- void *buf, size_t sizeof_buf);
-int gnutls_x509_crq_get_attribute_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
- void *buf, size_t * sizeof_buf);
-
-int gnutls_x509_crq_export(gnutls_x509_crq_t crq,
- gnutls_x509_crt_fmt_t format,
- void *output_data, size_t * output_data_size);
-int gnutls_x509_crq_export2(gnutls_x509_crq_t crq,
- gnutls_x509_crt_fmt_t format,
- 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_extensions(gnutls_x509_crt_t crt,
- gnutls_x509_crq_t crq);
-
-int gnutls_x509_crq_set_private_key_usage_period(gnutls_x509_crq_t
- crq,
- time_t activation,
- time_t expiration);
-int gnutls_x509_crq_set_key_rsa_raw(gnutls_x509_crq_t crq,
- const gnutls_datum_t * m,
- const gnutls_datum_t * e);
-int gnutls_x509_crq_set_subject_alt_name(gnutls_x509_crq_t crq,
- gnutls_x509_subject_alt_name_t
- nt, const void *data,
- unsigned int data_size,
- unsigned int flags);
-
-int gnutls_x509_crq_set_key_usage(gnutls_x509_crq_t crq,
- unsigned int usage);
-int gnutls_x509_crq_set_basic_constraints(gnutls_x509_crq_t crq,
- unsigned int ca,
- int pathLenConstraint);
-int gnutls_x509_crq_set_key_purpose_oid(gnutls_x509_crq_t crq,
- const void *oid,
- unsigned int critical);
-int gnutls_x509_crq_get_key_purpose_oid(gnutls_x509_crq_t crq,
- int indx, void *oid,
- size_t * sizeof_oid,
- unsigned int *critical);
-
-int gnutls_x509_crq_get_extension_data(gnutls_x509_crq_t crq,
- int indx, void *data,
- size_t * sizeof_data);
-int gnutls_x509_crq_get_extension_info(gnutls_x509_crq_t crq,
- int indx, void *oid,
- size_t * sizeof_oid,
- unsigned int *critical);
-int gnutls_x509_crq_get_attribute_data(gnutls_x509_crq_t crq,
- int indx, void *data,
- size_t * sizeof_data);
-int gnutls_x509_crq_get_attribute_info(gnutls_x509_crq_t crq,
- int indx, void *oid,
- 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,
- unsigned char *output_data,
- size_t * output_data_size);
-int gnutls_x509_crq_get_key_rsa_raw(gnutls_x509_crq_t crq,
- gnutls_datum_t * m,
- gnutls_datum_t * e);
-
-int gnutls_x509_crq_get_key_usage(gnutls_x509_crq_t crq,
- unsigned int *key_usage,
- unsigned int *critical);
-int gnutls_x509_crq_get_basic_constraints(gnutls_x509_crq_t crq,
- unsigned int *critical,
- unsigned int *ca, int *pathlen);
-int gnutls_x509_crq_get_subject_alt_name(gnutls_x509_crq_t crq,
- unsigned int seq,
- void *ret,
- size_t * ret_size,
- unsigned int *ret_type,
- unsigned int *critical);
-int gnutls_x509_crq_get_subject_alt_othername_oid(gnutls_x509_crq_t
- crq,
- unsigned int seq,
- void *ret,
- size_t * ret_size);
-
-int gnutls_x509_crq_get_extension_by_oid(gnutls_x509_crq_t crq,
- const char *oid, int indx,
- void *buf,
- size_t * sizeof_buf,
- unsigned int *critical);
-
-typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t;
-
-int
-gnutls_x509_trust_list_init(gnutls_x509_trust_list_t * list,
- unsigned int size);
-
-void
-gnutls_x509_trust_list_deinit(gnutls_x509_trust_list_t list,
- unsigned int all);
-
-int gnutls_x509_trust_list_get_issuer(gnutls_x509_trust_list_t
- list, gnutls_x509_crt_t cert,
- gnutls_x509_crt_t * issuer,
- unsigned int flags);
-
-int
-gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list,
- const gnutls_x509_crt_t * clist,
- int clist_size, unsigned int flags);
-int gnutls_x509_trust_list_remove_cas(gnutls_x509_trust_list_t
- list,
- const gnutls_x509_crt_t *
- clist, int clist_size);
-
-int gnutls_x509_trust_list_add_named_crt(gnutls_x509_trust_list_t
- list,
- gnutls_x509_crt_t cert,
- const void *name,
- size_t name_size,
- unsigned int flags);
-
-#define GNUTLS_TL_VERIFY_CRL 1
-int
-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,
- unsigned int verification_flags);
-
-typedef int gnutls_verify_output_function(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, /* The issuer if verification failed
- * because of him. might be null.
- */
- gnutls_x509_crl_t crl, /* The CRL that caused verification failure
- * if any. Might be null.
- */
- unsigned int
- verification_output);
-
-int gnutls_x509_trust_list_verify_named_crt
- (gnutls_x509_trust_list_t list, gnutls_x509_crt_t cert,
- const void *name, size_t name_size, unsigned int flags,
- unsigned int *verify, gnutls_verify_output_function func);
-
-int
-gnutls_x509_trust_list_verify_crt(gnutls_x509_trust_list_t list,
- gnutls_x509_crt_t * cert_list,
- unsigned int cert_list_size,
- unsigned int flags,
- unsigned int *verify,
- gnutls_verify_output_function func);
-
- /* trust list convenience functions */
-int
-gnutls_x509_trust_list_add_trust_mem(gnutls_x509_trust_list_t
- list,
- const gnutls_datum_t * cas,
- const gnutls_datum_t * crls,
- gnutls_x509_crt_fmt_t type,
- unsigned int tl_flags,
- unsigned int tl_vflags);
-
-int
-gnutls_x509_trust_list_add_trust_file(gnutls_x509_trust_list_t
- list, const char *ca_file,
- const char *crl_file,
- gnutls_x509_crt_fmt_t type,
- unsigned int tl_flags,
- unsigned int tl_vflags);
-
-int
-gnutls_x509_trust_list_remove_trust_file(gnutls_x509_trust_list_t
- list,
- const char *ca_file,
- gnutls_x509_crt_fmt_t type);
-
-int
-gnutls_x509_trust_list_remove_trust_mem(gnutls_x509_trust_list_t
- list,
- const gnutls_datum_t *
- cas, gnutls_x509_crt_fmt_t type);
-
-int
-gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t
- list,
- unsigned int tl_flags,
- unsigned int tl_vflags);
-
-void gnutls_certificate_set_trust_list
- (gnutls_certificate_credentials_t res,
- gnutls_x509_trust_list_t tlist, unsigned flags);
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-#endif /* GNUTLS_X509_H */
+++ /dev/null
-/* -*- c -*-
- * Copyright (C) 2013 Nikos Mavrogiannopoulos
- *
- * This file is part of GnuTLS.
- *
- * The GnuTLS library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * 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/>
- *
- */
-
-#ifndef GNUTLS_SBUF_H
-#define GNUTLS_SBUF_H
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* *INDENT-ON* */
-
-#include <gnutls/gnutls.h>
-
-/* Buffered session I/O */
-typedef struct xssl_st *xssl_t;
-typedef struct xssl_cred_st *xssl_cred_t;
-
-ssize_t xssl_printf(xssl_t sb, const char *fmt, ...)
-#ifdef __GNUC__
- __attribute__ ((format(printf, 2, 3)))
-#endif
- ;
-
-ssize_t xssl_write(xssl_t sb, const void *data, size_t data_size);
-
-ssize_t xssl_flush(xssl_t sb);
-
-ssize_t xssl_read(xssl_t sb, void *data, size_t data_size);
-
-ssize_t
-xssl_getdelim(xssl_t sbuf, char **lineptr, size_t * n, int delimiter);
-
-#define xssl_getline(sbuf, ptr, n) xssl_getdelim(sbuf, ptr, n, '\n')
-
-void xssl_deinit(xssl_t sb);
-
-#define GNUTLS_SBUF_WRITE_FLUSHES (1<<0)
-int xssl_sinit(xssl_t * isb, gnutls_session_t session, unsigned int flags);
-
-gnutls_session_t xssl_get_session(xssl_t sb);
-
-int xssl_client_init(xssl_t * isb, const char *hostname,
- const char *service,
- gnutls_transport_ptr fd,
- const char *priority, xssl_cred_t cred,
- unsigned int *status, unsigned int flags);
-
-int xssl_server_init(xssl_t * isb,
- gnutls_transport_ptr fd,
- const char *priority, xssl_cred_t cred,
- unsigned int *status, unsigned int flags);
-
-/* High level credential structures */
-typedef enum {
- GNUTLS_VMETHOD_NO_AUTH = 0,
- GNUTLS_VMETHOD_TOFU = 1 << 0,
- GNUTLS_VMETHOD_GIVEN_CAS = 1 << 1,
- GNUTLS_VMETHOD_SYSTEM_CAS = 1 << 2
-} gnutls_vmethod_t;
-
-typedef enum {
- GNUTLS_CINPUT_TYPE_FILE = 0,
- GNUTLS_CINPUT_TYPE_MEM = 1,
- GNUTLS_CINPUT_TYPE_PIN_FUNC = 2,
-} gnutls_cinput_type_t;
-
-typedef enum {
- GNUTLS_CINPUT_CAS = 1, /* i1 contains the CAs */
- GNUTLS_CINPUT_CRLS = 2, /* i1 contains the CRLs */
- GNUTLS_CINPUT_TOFU_DB = 3, /* i1 contains the DB filename */
- GNUTLS_CINPUT_KEYPAIR = 4, /* i1 contains the certificate, i2 the key
- * or i1.pin_fn contains the pin function,
- * and i2.udata the user pointer */
-} gnutls_cinput_contents_t;
-
-typedef struct gnutls_cinput_st {
- gnutls_cinput_type_t type;
- gnutls_cinput_contents_t contents;
- gnutls_x509_crt_fmt_t fmt; /* if applicable */
-
- union {
- gnutls_pin_callback_t pin_fn;
- const char *file;
- gnutls_datum_t mem;
- } i1;
-
- union {
- void *udata;
- const char *file;
- gnutls_datum_t mem;
- } i2;
-
- unsigned long future_pad[8];
-} gnutls_cinput_st;
-
-int xssl_cred_init(xssl_cred_t * c, unsigned vflags,
- gnutls_cinput_st * aux, unsigned aux_size);
-void xssl_cred_deinit(xssl_cred_t cred);
-
-
-/* *INDENT-OFF* */
-#ifdef __cplusplus
-}
-#endif
-/* *INDENT-ON* */
-
-#endif /* GNUTLS_SBUF_H */
+++ /dev/null
-/* aes.h
- *
- * The aes/rijndael block cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_AES_H_INCLUDED
-#define NETTLE_AES_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define aes_set_encrypt_key nettle_aes_set_encrypt_key
-#define aes_set_decrypt_key nettle_aes_set_decrypt_key
-#define aes_invert_key nettle_aes_invert_key
-#define aes_encrypt nettle_aes_encrypt
-#define aes_decrypt nettle_aes_decrypt
-
-#define AES_BLOCK_SIZE 16
-
-/* Variable key size between 128 and 256 bits. But the only valid
- * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
-#define AES_MIN_KEY_SIZE 16
-#define AES_MAX_KEY_SIZE 32
-
-#define AES_KEY_SIZE 32
-
-/* FIXME: Change to put nrounds first, to make it possible to use a
- truncated ctx struct, with less subkeys, for the shorter key
- sizes? */
- struct aes_ctx {
- uint32_t keys[60]; /* maximum size of key schedule */
- unsigned nrounds; /* number of rounds to use for our key size */
- };
-
- void
- aes_set_encrypt_key(struct aes_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- aes_set_decrypt_key(struct aes_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- aes_invert_key(struct aes_ctx *dst, const struct aes_ctx *src);
-
- void
- aes_encrypt(const struct aes_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
- void
- aes_decrypt(const struct aes_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_AES_H_INCLUDED */
+++ /dev/null
-/* arcfour.h
- *
- * The arcfour/rc4 stream cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_ARCFOUR_H_INCLUDED
-#define NETTLE_ARCFOUR_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define arcfour_set_key nettle_arcfour_set_key
-#define arcfour_crypt nettle_arcfour_crypt
-
-/* Minimum and maximum keysizes, and a reasonable default. In
- * octets.*/
-#define ARCFOUR_MIN_KEY_SIZE 1
-#define ARCFOUR_MAX_KEY_SIZE 256
-#define ARCFOUR_KEY_SIZE 16
-
- struct arcfour_ctx {
- uint8_t S[256];
- uint8_t i;
- uint8_t j;
- };
-
- void
- arcfour_set_key(struct arcfour_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- arcfour_crypt(struct arcfour_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ARCFOUR_H_INCLUDED */
+++ /dev/null
-/* arctwo.h
- *
- * The arctwo/rfc2268 block cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2004 Simon Josefsson
- * Copyright (C) 2002, 2004 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_ARCTWO_H_INCLUDED
-#define NETTLE_ARCTWO_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define arctwo_set_key nettle_arctwo_set_key
-#define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
-#define arctwo_encrypt nettle_arctwo_encrypt
-#define arctwo_decrypt nettle_arctwo_decrypt
-#define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
-
-#define ARCTWO_BLOCK_SIZE 8
-
-/* Variable key size from 1 byte to 128 bytes. */
-#define ARCTWO_MIN_KEY_SIZE 1
-#define ARCTWO_MAX_KEY_SIZE 128
-
-#define ARCTWO_KEY_SIZE 8
-
- struct arctwo_ctx {
- uint16_t S[64];
- };
-
-/* Key expansion function that takes the "effective key bits", 1-1024,
- as an explicit argument. 0 means maximum key bits. */
- void
- arctwo_set_key_ekb(struct arctwo_ctx *ctx,
- unsigned length, const uint8_t * key,
- unsigned ekb);
-
-/* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
- void
- arctwo_set_key(struct arctwo_ctx *ctx, unsigned length,
- const uint8_t * key);
-
-/* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
- void
- arctwo_set_key_gutmann(struct arctwo_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- arctwo_encrypt(struct arctwo_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
- void
- arctwo_decrypt(struct arctwo_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ARCTWO_H_INCLUDED */
+++ /dev/null
-/* asn1.h
- *
- * Some very limited asn.1 support.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2005 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_ASN1_H_INCLUDED
-#define NETTLE_ASN1_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define asn1_der_iterator_first nettle_asn1_der_iterator_first
-#define asn1_der_iterator_next nettle_asn1_der_iterator_next
-#define asn1_der_decode_constructed nettle_asn1_der_decode_constructed
-#define asn1_der_decode_constructed_last nettle_asn1_der_decode_constructed_last
-#define asn1_der_decode_bitstring nettle_asn1_der_decode_bitstring
-#define asn1_der_decode_bitstring_last nettle_asn1_der_decode_bitstring_last
-#define asn1_der_get_uint32 nettle_asn1_der_get_uint32
-#define asn1_der_get_bignum nettle_asn1_der_get_bignum
-
-
-/* enum asn1_type keeps the class number and the constructive in bits
- 13-14, and the constructive flag in bit 12. The remaining 14 bits
- are the tag (although currently, only tags in the range 0-30 are
- supported). */
-
- enum {
- ASN1_TYPE_CONSTRUCTED = 1 << 12,
-
- ASN1_CLASS_UNIVERSAL = 0,
- ASN1_CLASS_APPLICATION = 1 << 13,
- ASN1_CLASS_CONTEXT_SPECIFIC = 2 << 13,
- ASN1_CLASS_PRIVATE = 3 << 13,
-
- ASN1_CLASS_MASK = 3 << 13,
- ASN1_CLASS_SHIFT = 13,
- };
-
- enum asn1_type {
- ASN1_BOOLEAN = 1,
- ASN1_INTEGER = 2,
- ASN1_BITSTRING = 3,
- ASN1_OCTETSTRING = 4,
- ASN1_NULL = 5,
- ASN1_IDENTIFIER = 6,
- ASN1_REAL = 9,
- ASN1_ENUMERATED = 10,
- ASN1_UTF8STRING = 12,
- ASN1_SEQUENCE = 16 | ASN1_TYPE_CONSTRUCTED,
- ASN1_SET = 17 | ASN1_TYPE_CONSTRUCTED,
- ASN1_PRINTABLESTRING = 19,
- ASN1_TELETEXSTRING = 20,
- ASN1_IA5STRING = 22,
- ASN1_UTC = 23,
- ASN1_UNIVERSALSTRING = 28,
- ASN1_BMPSTRING = 30,
- };
-
- enum asn1_iterator_result {
- ASN1_ITERATOR_ERROR,
- ASN1_ITERATOR_PRIMITIVE,
- ASN1_ITERATOR_CONSTRUCTED,
- ASN1_ITERATOR_END,
- };
-
-/* Parsing DER objects. */
- struct asn1_der_iterator {
- unsigned buffer_length;
- const uint8_t *buffer;
-
- /* Next object to parse. */
- unsigned pos;
-
- enum asn1_type type;
-
- /* Pointer to the current object */
- unsigned length;
- const uint8_t *data;
- };
-
-/* Initializes the iterator. */
- enum asn1_iterator_result
- asn1_der_iterator_first(struct asn1_der_iterator *iterator,
- unsigned length, const uint8_t * input);
-
- enum asn1_iterator_result
- asn1_der_iterator_next(struct asn1_der_iterator *iterator);
-
-/* Starts parsing of a constructed object. */
- enum asn1_iterator_result
- asn1_der_decode_constructed(struct asn1_der_iterator *i,
- struct asn1_der_iterator *contents);
-
-/* For the common case that we have a sequence at the end of the
- object. Checks that the current object is the final one, and then
- reinitializes the iterator to parse its ontents. */
- enum asn1_iterator_result
- asn1_der_decode_constructed_last(struct asn1_der_iterator *i);
-
- enum asn1_iterator_result
- asn1_der_decode_bitstring(struct asn1_der_iterator *i,
- struct asn1_der_iterator *contents);
-
- enum asn1_iterator_result
- asn1_der_decode_bitstring_last(struct asn1_der_iterator *i);
-
-/* All these functions return 1 on success, 0 on failure */
- int
- asn1_der_get_uint32(struct asn1_der_iterator *i, uint32_t * x);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ASN1_H_INCLUDED */
+++ /dev/null
-/* base16.h
- *
- * Hex encoding and decoding, following spki conventions (i.e.
- * allowing whitespace between digits).
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_BASE16_H_INCLUDED
-#define NETTLE_BASE16_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define base16_encode_single nettle_base16_encode_single
-#define base16_encode_update nettle_base16_encode_update
-#define base16_decode_init nettle_base16_decode_init
-#define base16_decode_single nettle_base16_decode_single
-#define base16_decode_update nettle_base16_decode_update
-#define base16_decode_final nettle_base16_decode_final
-
-/* Base16 encoding */
-
-/* Maximum length of output for base16_encode_update. */
-#define BASE16_ENCODE_LENGTH(length) ((length) * 2)
-
-/* Encodes a single byte. Always stores two digits in dst[0] and dst[1]. */
- void
- base16_encode_single(uint8_t * dst, uint8_t src);
-
-/* Always stores BASE16_ENCODE_LENGTH(length) digits in dst. */
- void
- base16_encode_update(uint8_t * dst,
- unsigned length, const uint8_t * src);
-
-
-/* Base16 decoding */
-
-/* Maximum length of output for base16_decode_update. */
-/* We have at most 4 buffered bits, and a total of (length + 1) * 4 bits. */
-#define BASE16_DECODE_LENGTH(length) (((length) + 1) / 2)
-
- struct base16_decode_ctx {
- unsigned word; /* Leftover bits */
- unsigned bits; /* Number buffered bits */
- };
-
- void
- base16_decode_init(struct base16_decode_ctx *ctx);
-
-/* Decodes a single byte. Returns amount of output (0 or 1), or -1 on
- * errors. */
- int
- base16_decode_single(struct base16_decode_ctx *ctx,
- uint8_t * dst, uint8_t src);
-
-/* Returns 1 on success, 0 on error. DST should point to an area of
- * size at least BASE16_DECODE_LENGTH(length), and for sanity
- * checking, *DST_LENGTH should be initialized to the size of that
- * area before the call. *DST_LENGTH is updated to the amount of
- * decoded output. */
-
-/* Currently results in an assertion failure if *DST_LENGTH is
- * too small. FIXME: Return some error instead? */
- int
- base16_decode_update(struct base16_decode_ctx *ctx,
- unsigned *dst_length,
- uint8_t * dst,
- unsigned src_length, const uint8_t * src);
-
-/* Returns 1 on success. */
- int
- base16_decode_final(struct base16_decode_ctx *ctx);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_BASE16_H_INCLUDED */
+++ /dev/null
-/* base64.h
- *
- * "ASCII armor" codecs.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller, Dan Egnor
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_BASE64_H_INCLUDED
-#define NETTLE_BASE64_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define base64_encode_init nettle_base64_encode_init
-#define base64_encode_single nettle_base64_encode_single
-#define base64_encode_update nettle_base64_encode_update
-#define base64_encode_final nettle_base64_encode_final
-#define base64_encode_raw nettle_base64_encode_raw
-#define base64_encode_group nettle_base64_encode_group
-#define base64_decode_init nettle_base64_decode_init
-#define base64_decode_single nettle_base64_decode_single
-#define base64_decode_update nettle_base64_decode_update
-#define base64_decode_final nettle_base64_decode_final
-
-#define BASE64_BINARY_BLOCK_SIZE 3
-#define BASE64_TEXT_BLOCK_SIZE 4
-
-/* Base64 encoding */
-
-/* Maximum length of output for base64_encode_update. NOTE: Doesn't
- * include any padding that base64_encode_final may add. */
-/* We have at most 4 buffered bits, and a total of (4 + length * 8) bits. */
-#define BASE64_ENCODE_LENGTH(length) (((length) * 8 + 4)/6)
-
-/* Maximum length of output generated by base64_encode_final. */
-#define BASE64_ENCODE_FINAL_LENGTH 3
-
-/* Exact length of output generated by base64_encode_raw, including
- * padding. */
-#define BASE64_ENCODE_RAW_LENGTH(length) ((((length) + 2)/3)*4)
-
- struct base64_encode_ctx {
- unsigned word; /* Leftover bits */
- unsigned bits; /* Number of bits, always 0, 2, or 4. */
- };
-
- void
- base64_encode_init(struct base64_encode_ctx *ctx);
-
-/* Encodes a single byte. Returns amount of output (always 1 or 2). */
- unsigned
- base64_encode_single(struct base64_encode_ctx *ctx,
- uint8_t * dst, uint8_t src);
-
-/* Returns the number of output characters. DST should point to an
- * area of size at least BASE64_ENCODE_LENGTH(length). */
- unsigned
- base64_encode_update(struct base64_encode_ctx *ctx,
- uint8_t * dst,
- unsigned length, const uint8_t * src);
-
-/* DST should point to an area of size at least
- * BASE64_ENCODE_FINAL_LENGTH */
- unsigned
- base64_encode_final(struct base64_encode_ctx *ctx, uint8_t * dst);
-
-/* Lower level functions */
-
-/* Encodes a string in one go, including any padding at the end.
- * Generates exactly BASE64_ENCODE_RAW_LENGTH(length) bytes of output.
- * Supports overlapped operation, if src <= dst. */
- void
- base64_encode_raw(uint8_t * dst, unsigned length,
- const uint8_t * src);
-
- void
- base64_encode_group(uint8_t * dst, uint32_t group);
-
-
-/* Base64 decoding */
-
-/* Maximum length of output for base64_decode_update. */
-/* We have at most 6 buffered bits, and a total of (length + 1) * 6 bits. */
-#define BASE64_DECODE_LENGTH(length) ((((length) + 1) * 6) / 8)
-
- struct base64_decode_ctx {
- unsigned word; /* Leftover bits */
- unsigned bits; /* Number buffered bits */
-
- /* Number of padding characters encountered */
- unsigned padding;
- };
-
- void
- base64_decode_init(struct base64_decode_ctx *ctx);
-
-/* Decodes a single byte. Returns amount of output (0 or 1), or -1 on
- * errors. */
- int
- base64_decode_single(struct base64_decode_ctx *ctx,
- uint8_t * dst, uint8_t src);
-
-/* Returns 1 on success, 0 on error. DST should point to an area of
- * size at least BASE64_DECODE_LENGTH(length), and for sanity
- * checking, *DST_LENGTH should be initialized to the size of that
- * area before the call. *DST_LENGTH is updated to the amount of
- * decoded output. */
-
-/* Currently results in an assertion failure if *DST_LENGTH is
- * too small. FIXME: Return some error instead? */
- int
- base64_decode_update(struct base64_decode_ctx *ctx,
- unsigned *dst_length,
- uint8_t * dst,
- unsigned src_length, const uint8_t * src);
-
-/* Returns 1 on success. */
- int
- base64_decode_final(struct base64_decode_ctx *ctx);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_BASE64_H_INCLUDED */
+++ /dev/null
-/* bignum.h
- *
- * bignum operations that are missing from gmp.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_BIGNUM_H_INCLUDED
-#define NETTLE_BIGNUM_H_INCLUDED
-
-#include "nettle-meta.h"
-
-#include <gmp.h>
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Size needed for signed encoding, including extra sign byte if
- * necessary. */
- unsigned
- nettle_mpz_sizeinbase_256_s(const mpz_t x);
-
-/* Size needed for unsigned encoding */
- unsigned
- nettle_mpz_sizeinbase_256_u(const mpz_t x);
-
-/* Writes an integer as length octets, using big endian byte order,
- * and two's complement for negative numbers. */
- void
- nettle_mpz_get_str_256(unsigned length, uint8_t * s,
- const mpz_t x);
-
-/* Reads a big endian, two's complement, integer. */
- void
- nettle_mpz_set_str_256_s(mpz_t x,
- unsigned length, const uint8_t * s);
-
- void
- nettle_mpz_init_set_str_256_s(mpz_t x,
- unsigned length, const uint8_t * s);
-
-/* Similar, but for unsigned format. These function don't interpret
- * the most significant bit as the sign. */
- void
- nettle_mpz_set_str_256_u(mpz_t x,
- unsigned length, const uint8_t * s);
-
- void
- nettle_mpz_init_set_str_256_u(mpz_t x,
- unsigned length, const uint8_t * s);
-
-/* Returns a uniformly distributed random number 0 <= x < 2^n */
- void
- nettle_mpz_random_size(mpz_t x,
- void *ctx, nettle_random_func * random,
- unsigned bits);
-
-/* Returns a number x, almost uniformly random in the range
- * 0 <= x < n. */
- void
- nettle_mpz_random(mpz_t x,
- void *ctx, nettle_random_func * random,
- const mpz_t n);
-
- void
- nettle_next_prime(mpz_t p, mpz_t n, unsigned count,
- unsigned prime_limit, void *progress_ctx,
- nettle_progress_func * progress);
-
- void
- nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set,
- void *ctx, nettle_random_func * random,
- void *progress_ctx,
- nettle_progress_func * progress);
-
- void
- _nettle_generate_pocklington_prime(mpz_t p, mpz_t r,
- unsigned bits,
- int top_bits_set, void *ctx,
- nettle_random_func * random,
- const mpz_t p0, const mpz_t q,
- const mpz_t p0q);
-
-/* sexp parsing */
- struct sexp_iterator;
-
-/* If LIMIT is non-zero, the number must be at most LIMIT bits.
- * Implies sexp_iterator_next. */
- int
- nettle_mpz_set_sexp(mpz_t x, unsigned limit,
- struct sexp_iterator *i);
-
-
-/* der parsing */
- struct asn1_der_iterator;
-
- int
- nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator,
- mpz_t x, unsigned max_bits);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_BIGNUM_H_INCLUDED */
+++ /dev/null
-/* blowfish.h
- *
- * Blowfish block cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 1998, 2001 FSF, Ray Dassen, Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_BLOWFISH_H_INCLUDED
-#define NETTLE_BLOWFISH_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define blowfish_set_key nettle_blowfish_set_key
-#define blowfish_encrypt nettle_blowfish_encrypt
-#define blowfish_decrypt nettle_blowfish_decrypt
-
-#define BLOWFISH_BLOCK_SIZE 8
-
-/* Variable key size between 64 and 448 bits. */
-#define BLOWFISH_MIN_KEY_SIZE 8
-#define BLOWFISH_MAX_KEY_SIZE 56
-
-/* Default to 128 bits */
-#define BLOWFISH_KEY_SIZE 16
-
-#define _BLOWFISH_ROUNDS 16
-
- struct blowfish_ctx {
- uint32_t s[4][256];
- uint32_t p[_BLOWFISH_ROUNDS + 2];
- };
-
-/* On success, returns 1 and sets ctx->status to BLOWFISH_OK (zero).
- * On error, returns 0 and sets ctx->status to BLOWFISH_WEAK_KEY. */
- int
- blowfish_set_key(struct blowfish_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- blowfish_encrypt(const struct blowfish_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
- void
- blowfish_decrypt(const struct blowfish_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_BLOWFISH_H_INCLUDED */
+++ /dev/null
-/* buffer.h
- *
- * A bare-bones string stream.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_BUFFER_H_INCLUDED
-#define NETTLE_BUFFER_H_INCLUDED
-
-#include "realloc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- struct nettle_buffer {
- uint8_t *contents;
- /* Allocated size */
- unsigned alloc;
-
- void *realloc_ctx;
- nettle_realloc_func *realloc;
-
- /* Current size */
- unsigned size;
- };
-
-/* Initializes a buffer that uses plain realloc */
- void
- nettle_buffer_init(struct nettle_buffer *buffer);
-
- void
- nettle_buffer_init_realloc(struct nettle_buffer *buffer,
- void *realloc_ctx,
- nettle_realloc_func * realloc);
-
-/* Initializes a buffer of fix size */
- void
- nettle_buffer_init_size(struct nettle_buffer *buffer,
- unsigned length, uint8_t * space);
-
- void
- nettle_buffer_clear(struct nettle_buffer *buffer);
-
-/* Resets the buffer, without freeing the buffer space. */
- void
- nettle_buffer_reset(struct nettle_buffer *buffer);
-
- int
- nettle_buffer_grow(struct nettle_buffer *buffer, unsigned length);
-
-#define NETTLE_BUFFER_PUTC(buffer, c) \
-( (((buffer)->size < (buffer)->alloc) || nettle_buffer_grow((buffer), 1)) \
- && ((buffer)->contents[(buffer)->size++] = (c), 1) )
-
- int
- nettle_buffer_write(struct nettle_buffer *buffer,
- unsigned length, const uint8_t * data);
-
-/* Like nettle_buffer_write, but instead of copying data to the
- * buffer, it returns a pointer to the area where the caller can copy
- * the data. The pointer is valid only until the next call that can
- * reallocate the buffer. */
- uint8_t *nettle_buffer_space(struct nettle_buffer *buffer,
- unsigned length);
-
-/* Copy the contents of SRC to the end of DST. */
- int
- nettle_buffer_copy(struct nettle_buffer *dst,
- const struct nettle_buffer *src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_BUFFER_H_INCLUDED */
+++ /dev/null
-/* camellia.h
- *
- * Copyright (C) 2006,2007
- * NTT (Nippon Telegraph and Telephone Corporation).
- *
- * Copyright (C) 2010 Niels Möller
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef NETTLE_CAMELLIA_H_INCLUDED
-#define NETTLE_CAMELLIA_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define camellia_set_encrypt_key nettle_camellia_set_encrypt_key
-#define camellia_set_decrypt_key nettle_camellia_set_decrypt_key
-#define camellia_invert_key nettle_camellia_invert_key
-#define camellia_crypt nettle_camellia_crypt
-#define camellia_crypt nettle_camellia_crypt
-
-#define CAMELLIA_BLOCK_SIZE 16
-/* Valid key sizes are 128, 192 or 256 bits (16, 24 or 32 bytes) */
-#define CAMELLIA_MIN_KEY_SIZE 16
-#define CAMELLIA_MAX_KEY_SIZE 32
-#define CAMELLIA_KEY_SIZE 32
-
- struct camellia_ctx {
- /* Number of subkeys. */
- unsigned nkeys;
-
- /* For 128-bit keys, there are 18 regular rounds, pre- and
- post-whitening, and two FL and FLINV rounds, using a total of 26
- subkeys, each of 64 bit. For 192- and 256-bit keys, there are 6
- additional regular rounds and one additional FL and FLINV, using
- a total of 34 subkeys. */
- /* The clever combination of subkeys imply one of the pre- and
- post-whitening keys is folded with the round keys, so that subkey
- #1 and the last one (#25 or #33) is not used. The result is that
- we have only 24 or 32 subkeys at the end of key setup. */
- uint64_t keys[32];
- };
-
- void
- camellia_set_encrypt_key(struct camellia_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- camellia_set_decrypt_key(struct camellia_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- camellia_invert_key(struct camellia_ctx *dst,
- const struct camellia_ctx *src);
-
- void
- camellia_crypt(const struct camellia_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_CAMELLIA_H_INCLUDED */
+++ /dev/null
-/* cast128.h
- *
- * The CAST-128 block cipher.
- */
-
-/* CAST-128 in C
- * Written by Steve Reid <sreid@sea-to-sky.net>
- * 100% Public Domain - no warranty
- * Released 1997.10.11
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_CAST128_H_INCLUDED
-#define NETTLE_CAST128_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define cast128_set_key nettle_cast128_set_key
-#define cast128_encrypt nettle_cast128_encrypt
-#define cast128_decrypt nettle_cast128_decrypt
-
-#define CAST128_BLOCK_SIZE 8
-
-/* Variable key size between 40 and 128. */
-#define CAST128_MIN_KEY_SIZE 5
-#define CAST128_MAX_KEY_SIZE 16
-
-#define CAST128_KEY_SIZE 16
-
- struct cast128_ctx {
- uint32_t keys[32]; /* Key, after expansion */
- unsigned rounds; /* Number of rounds to use, 12 or 16 */
- };
-
- void
- cast128_set_key(struct cast128_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- cast128_encrypt(const struct cast128_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
- void
- cast128_decrypt(const struct cast128_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_CAST128_H_INCLUDED */
+++ /dev/null
-/* cbc.h
- *
- * Cipher block chaining mode.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_CBC_H_INCLUDED
-#define NETTLE_CBC_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define cbc_encrypt nettle_cbc_encrypt
-#define cbc_decrypt nettle_cbc_decrypt
-
- void
- cbc_encrypt(void *ctx, nettle_crypt_func * f,
- unsigned block_size, uint8_t * iv,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
- void
- cbc_decrypt(void *ctx, nettle_crypt_func * f,
- unsigned block_size, uint8_t * iv,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
-#define CBC_CTX(type, size) \
-{ type ctx; uint8_t iv[size]; }
-
-#define CBC_SET_IV(ctx, data) \
-memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
-
-/* NOTE: Avoid using NULL, as we don't include anything defining it. */
-#define CBC_ENCRYPT(self, f, length, dst, src) \
-(0 ? ((f)(&(self)->ctx, 0, (void *)0, (void *)0)) \
- : cbc_encrypt((void *) &(self)->ctx, \
- (nettle_crypt_func *) (f), \
- sizeof((self)->iv), (self)->iv, \
- (length), (dst), (src)))
-
-#define CBC_DECRYPT(self, f, length, dst, src) \
-(0 ? ((f)(&(self)->ctx, 0, (void *)0, (void *)0)) \
- : cbc_decrypt((void *) &(self)->ctx, \
- (nettle_crypt_func *) (f), \
- sizeof((self)->iv), (self)->iv, \
- (length), (dst), (src)))
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_CBC_H_INCLUDED */
+++ /dev/null
-/* ctr.h
- *
- * Counter mode, using an network byte order incremented counter,
- * matching the testcases of NIST 800-38A.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2005 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_CTR_H_INCLUDED
-#define NETTLE_CTR_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define ctr_crypt nettle_ctr_crypt
-
- void
- ctr_crypt(void *ctx, nettle_crypt_func * f,
- unsigned block_size, uint8_t * ctr,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
-#define CTR_CTX(type, size) \
-{ type ctx; uint8_t ctr[size]; }
-
-#define CTR_SET_COUNTER(ctx, data) \
-memcpy((ctx)->ctr, (data), sizeof((ctx)->ctr))
-
-#define CTR_CRYPT(self, f, length, dst, src) \
-(0 ? ((f)(&(self)->ctx, 0, NULL, NULL)) \
- : ctr_crypt((void *) &(self)->ctx, \
- (nettle_crypt_func *) (f), \
- sizeof((self)->ctr), (self)->ctr, \
- (length), (dst), (src)))
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_CTR_H_INCLUDED */
+++ /dev/null
-/* des-compat.h
- *
- * The des block cipher, libdes/openssl-style interface.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_DES_COMPAT_H_INCLUDED
-#define NETTLE_DES_COMPAT_H_INCLUDED
-
-/* According to Assar, des_set_key, des_set_key_odd_parity,
- * des_is_weak_key, plus the encryption functions (des_*_encrypt and
- * des_cbc_cksum) would be a pretty useful subset. */
-
-/* NOTE: This is quite experimental, and not all functions are
- * implemented. Contributions, in particular test cases are welcome. */
-
-#include "des.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* We use some name mangling, to avoid collisions with either other
- * nettle functions or with libcrypto. */
-
-#define des_ecb3_encrypt nettle_openssl_des_ecb3_encrypt
-#define des_cbc_cksum nettle_openssl_des_cbc_cksum
-#define des_ncbc_encrypt nettle_openssl_des_ncbc_encrypt
-#define des_cbc_encrypt nettle_openssl_des_cbc_encrypt
-#define des_ecb_encrypt nettle_openssl_des_ecb_encrypt
-#define des_ede3_cbc_encrypt nettle_openssl_des_ede3_cbc_encrypt
-#define des_set_odd_parity nettle_openssl_des_set_odd_parity
-#define des_check_key nettle_openssl_des_check_key
-#define des_key_sched nettle_openssl_des_key_sched
-#define des_is_weak_key nettle_openssl_des_is_weak_key
-
-/* An extra alias */
-#undef des_set_key
-#define des_set_key nettle_openssl_des_key_sched
-
- enum { DES_DECRYPT = 0, DES_ENCRYPT = 1 };
-
-/* Types */
- typedef uint32_t DES_LONG;
-
-/* Note: Typedef:ed arrays should be avoided, but they're used here
- * for compatibility. */
- typedef struct des_ctx des_key_schedule[1];
-
- typedef uint8_t des_cblock[DES_BLOCK_SIZE];
-/* Note: The proper definition,
-
- typedef const uint8_t const_des_cblock[DES_BLOCK_SIZE];
-
- would have worked, *if* all the prototypes had used arguments like
- foo(const_des_cblock src, des_cblock dst), letting argument arrays
- "decay" into pointers of type uint8_t * and const uint8_t *.
-
- But since openssl's prototypes use *pointers* const_des_cblock *src,
- des_cblock *dst, this ends up in type conflicts, and the workaround
- is to not use const at all.
-*/
-#define const_des_cblock des_cblock
-
-/* Aliases */
-#define des_ecb2_encrypt(i,o,k1,k2,e) \
- des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
-
-#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
- des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
-
-/* Global flag */
- extern int des_check_key;
-
-/* Prototypes */
-
-/* Typing is a little confusing. Since both des_cblock and
- des_key_schedule are typedef:ed arrays, it automatically decay to
- a pointers.
-
- But the functions are declared taking pointers to des_cblock, i.e.
- pointers to arrays. And on the other hand, they take plain
- des_key_schedule arguments, which is equivalent to pointers to
- struct des_ctx. */
- void
- des_ecb3_encrypt(const_des_cblock * src, des_cblock * dst,
- des_key_schedule k1,
- des_key_schedule k2,
- des_key_schedule k3, int enc);
-
-/* des_cbc_cksum in libdes returns a 32 bit integer, representing the
- * latter half of the output block, using little endian byte order. */
- uint32_t
- des_cbc_cksum(const uint8_t * src, des_cblock * dst,
- long length, des_key_schedule ctx,
- const_des_cblock * iv);
-
-/* NOTE: Doesn't update iv. */
- void
- des_cbc_encrypt(const_des_cblock * src, des_cblock * dst,
- long length, des_key_schedule ctx,
- const_des_cblock * iv, int enc);
-
-/* Similar, but updates iv. */
- void
- des_ncbc_encrypt(const_des_cblock * src, des_cblock * dst,
- long length, des_key_schedule ctx,
- des_cblock * iv, int enc);
-
- void
- des_ecb_encrypt(const_des_cblock * src, des_cblock * dst,
- des_key_schedule ctx, int enc);
-
- void
- des_ede3_cbc_encrypt(const_des_cblock * src, des_cblock * dst,
- long length, des_key_schedule k1,
- des_key_schedule k2, des_key_schedule k3,
- des_cblock * iv, int enc);
-
- int
- des_set_odd_parity(des_cblock * key);
-
- int
- des_key_sched(const_des_cblock * key, des_key_schedule ctx);
-
- int
- des_is_weak_key(const_des_cblock * key);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_DES_COMPAT_H_INCLUDED */
+++ /dev/null
-/* des.h
- *
- * The des block cipher. And triple des.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 1992, 2001, Dana L. How, Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/*
- * des - fast & portable DES encryption & decryption.
- * Copyright (C) 1992 Dana L. How
- * Please see the file `../lib/descore.README' for the complete copyright
- * notice.
- *
- * Slightly edited by Niels Möller, 1997
- */
-
-#ifndef NETTLE_DES_H_INCLUDED
-#define NETTLE_DES_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Namespace mangling */
-#define des_set_key nettle_des_set_key
-#define des_encrypt nettle_des_encrypt
-#define des_decrypt nettle_des_decrypt
-#define des_check_parity nettle_des_check_parity
-#define des_fix_parity nettle_des_fix_parity
-#define des3_set_key nettle_des3_set_key
-#define des3_encrypt nettle_des3_encrypt
-#define des3_decrypt nettle_des3_decrypt
-
-#define DES_KEY_SIZE 8
-#define DES_BLOCK_SIZE 8
-
-/* Expanded key length */
-#define _DES_KEY_LENGTH 32
-
- struct des_ctx {
- uint32_t key[_DES_KEY_LENGTH];
- };
-
-/* Returns 1 for good keys and 0 for weak keys. */
- int
- des_set_key(struct des_ctx *ctx, const uint8_t * key);
-
- void
- des_encrypt(const struct des_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
- void
- des_decrypt(const struct des_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
- int
- des_check_parity(unsigned length, const uint8_t * key);
-
- void
- des_fix_parity(unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#define DES3_KEY_SIZE 24
-#define DES3_BLOCK_SIZE DES_BLOCK_SIZE
-
- struct des3_ctx {
- struct des_ctx des[3];
- };
-
-
-/* Returns 1 for good keys and 0 for weak keys. */
- int
- des3_set_key(struct des3_ctx *ctx, const uint8_t * key);
-
- void
- des3_encrypt(const struct des3_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
- void
- des3_decrypt(const struct des3_ctx *ctx,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_DES_H_INCLUDED */
+++ /dev/null
-/* dsa.h
- *
- * The DSA publickey algorithm.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_DSA_H_INCLUDED
-#define NETTLE_DSA_H_INCLUDED
-
-#include <gmp.h>
-
-#include "nettle-types.h"
-
-#include "sha1.h"
-#include "sha2.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define dsa_public_key_init nettle_dsa_public_key_init
-#define dsa_public_key_clear nettle_dsa_public_key_clear
-#define dsa_private_key_init nettle_dsa_private_key_init
-#define dsa_private_key_clear nettle_dsa_private_key_clear
-#define dsa_signature_init nettle_dsa_signature_init
-#define dsa_signature_clear nettle_dsa_signature_clear
-#define dsa_sha1_sign nettle_dsa_sha1_sign
-#define dsa_sha1_verify nettle_dsa_sha1_verify
-#define dsa_sha256_sign nettle_dsa_sha256_sign
-#define dsa_sha256_verify nettle_dsa_sha256_verify
-#define dsa_sha1_sign_digest nettle_dsa_sha1_sign_digest
-#define dsa_sha1_verify_digest nettle_dsa_sha1_verify_digest
-#define dsa_sha256_sign_digest nettle_dsa_sha256_sign_digest
-#define dsa_sha256_verify_digest nettle_dsa_sha256_verify_digest
-#define dsa_generate_keypair nettle_dsa_generate_keypair
-#define dsa_signature_from_sexp nettle_dsa_signature_from_sexp
-#define dsa_keypair_to_sexp nettle_dsa_keypair_to_sexp
-#define dsa_keypair_from_sexp_alist nettle_dsa_keypair_from_sexp_alist
-#define dsa_sha1_keypair_from_sexp nettle_dsa_sha1_keypair_from_sexp
-#define dsa_sha256_keypair_from_sexp nettle_dsa_sha256_keypair_from_sexp
-#define dsa_params_from_der_iterator nettle_dsa_params_from_der_iterator
-#define dsa_public_key_from_der_iterator nettle_dsa_public_key_from_der_iterator
-#define dsa_openssl_private_key_from_der_iterator nettle_dsa_openssl_private_key_from_der_iterator
-#define dsa_openssl_private_key_from_der nettle_openssl_provate_key_from_der
-#define _dsa_sign _nettle_dsa_sign
-#define _dsa_verify _nettle_dsa_verify
-
-#define DSA_SHA1_MIN_P_BITS 512
-#define DSA_SHA1_Q_OCTETS 20
-#define DSA_SHA1_Q_BITS 160
-
-#define DSA_SHA256_MIN_P_BITS 1024
-#define DSA_SHA256_Q_OCTETS 32
-#define DSA_SHA256_Q_BITS 256
-
- struct dsa_public_key {
- /* Modulo */
- mpz_t p;
-
- /* Group order */
- mpz_t q;
-
- /* Generator */
- mpz_t g;
-
- /* Public value */
- mpz_t y;
- };
-
- struct dsa_private_key {
- /* Unlike an rsa public key, private key operations will need both
- * the private and the public information. */
- mpz_t x;
- };
-
- struct dsa_signature {
- mpz_t r;
- mpz_t s;
- };
-
-/* Signing a message works as follows:
- *
- * Store the private key in a dsa_private_key struct.
- *
- * Initialize a hashing context, by callling
- * sha1_init
- *
- * Hash the message by calling
- * sha1_update
- *
- * Create the signature by calling
- * dsa_sha1_sign
- *
- * The signature is represented as a struct dsa_signature. This call also
- * resets the hashing context.
- *
- * When done with the key and signature, don't forget to call
- * dsa_signature_clear.
- */
-
-/* Calls mpz_init to initialize bignum storage. */
- void
- dsa_public_key_init(struct dsa_public_key *key);
-
-/* Calls mpz_clear to deallocate bignum storage. */
- void
- dsa_public_key_clear(struct dsa_public_key *key);
-
-
-/* Calls mpz_init to initialize bignum storage. */
- void
- dsa_private_key_init(struct dsa_private_key *key);
-
-/* Calls mpz_clear to deallocate bignum storage. */
- void
- dsa_private_key_clear(struct dsa_private_key *key);
-
-/* Calls mpz_init to initialize bignum storage. */
- void
- dsa_signature_init(struct dsa_signature *signature);
-
-/* Calls mpz_clear to deallocate bignum storage. */
- void
- dsa_signature_clear(struct dsa_signature *signature);
-
-
- int
- dsa_sha1_sign(const struct dsa_public_key *pub,
- const struct dsa_private_key *key,
- void *random_ctx, nettle_random_func * random,
- struct sha1_ctx *hash,
- struct dsa_signature *signature);
-
- int
- dsa_sha256_sign(const struct dsa_public_key *pub,
- const struct dsa_private_key *key,
- void *random_ctx, nettle_random_func * random,
- struct sha256_ctx *hash,
- struct dsa_signature *signature);
-
- int
- dsa_sha1_verify(const struct dsa_public_key *key,
- struct sha1_ctx *hash,
- const struct dsa_signature *signature);
-
- int
- dsa_sha256_verify(const struct dsa_public_key *key,
- struct sha256_ctx *hash,
- const struct dsa_signature *signature);
-
- int
- dsa_sha1_sign_digest(const struct dsa_public_key *pub,
- const struct dsa_private_key *key,
- void *random_ctx,
- nettle_random_func * random,
- const uint8_t * digest,
- struct dsa_signature *signature);
- int
- dsa_sha256_sign_digest(const struct dsa_public_key *pub,
- const struct dsa_private_key *key,
- void *random_ctx,
- nettle_random_func * random,
- const uint8_t * digest,
- struct dsa_signature *signature);
-
- int
- dsa_sha1_verify_digest(const struct dsa_public_key *key,
- const uint8_t * digest,
- const struct dsa_signature *signature);
-
- int
- dsa_sha256_verify_digest(const struct dsa_public_key *key,
- const uint8_t * digest,
- const struct dsa_signature *signature);
-
-/* Key generation */
-
- int
- dsa_generate_keypair(struct dsa_public_key *pub,
- struct dsa_private_key *key,
- void *random_ctx,
- nettle_random_func * random,
- void *progress_ctx,
- nettle_progress_func * progress,
- unsigned p_bits, unsigned q_bits);
-
-/* Keys in sexp form. */
-
- struct nettle_buffer;
-
-/* Generates a public-key expression if PRIV is NULL .*/
- int
- dsa_keypair_to_sexp(struct nettle_buffer *buffer, const char *algorithm_name, /* NULL means "dsa" */
- const struct dsa_public_key *pub,
- const struct dsa_private_key *priv);
-
- struct sexp_iterator;
-
- int
- dsa_signature_from_sexp(struct dsa_signature *rs,
- struct sexp_iterator *i, unsigned q_bits);
-
- int
- dsa_keypair_from_sexp_alist(struct dsa_public_key *pub,
- struct dsa_private_key *priv,
- unsigned p_max_bits,
- unsigned q_bits,
- struct sexp_iterator *i);
-
-/* If PRIV is NULL, expect a public-key expression. If PUB is NULL,
- * expect a private key expression and ignore the parts not needed for
- * the public key. */
-/* Keys must be initialized before calling this function, as usual. */
- int
- dsa_sha1_keypair_from_sexp(struct dsa_public_key *pub,
- struct dsa_private_key *priv,
- unsigned p_max_bits,
- unsigned length, const uint8_t * expr);
-
- int
- dsa_sha256_keypair_from_sexp(struct dsa_public_key *pub,
- struct dsa_private_key *priv,
- unsigned p_max_bits,
- unsigned length,
- const uint8_t * expr);
-
-/* Keys in X.509 andd OpenSSL format. */
- struct asn1_der_iterator;
-
- int
- dsa_params_from_der_iterator(struct dsa_public_key *pub,
- unsigned p_max_bits,
- struct asn1_der_iterator *i);
- int
- dsa_public_key_from_der_iterator(struct dsa_public_key *pub,
- unsigned p_max_bits,
- struct asn1_der_iterator *i);
-
- int
- dsa_openssl_private_key_from_der_iterator(struct dsa_public_key
- *pub,
- struct dsa_private_key
- *priv,
- unsigned p_max_bits,
- struct asn1_der_iterator
- *i);
-
- int
- dsa_openssl_private_key_from_der(struct dsa_public_key *pub,
- struct dsa_private_key *priv,
- unsigned p_max_bits,
- unsigned length,
- const uint8_t * data);
-
-
-/* Internal functions. */
- int
- _dsa_sign(const struct dsa_public_key *pub,
- const struct dsa_private_key *key,
- void *random_ctx, nettle_random_func * random,
- unsigned digest_size,
- const uint8_t * digest,
- struct dsa_signature *signature);
-
- int
- _dsa_verify(const struct dsa_public_key *key,
- unsigned digest_size,
- const uint8_t * digest,
- const struct dsa_signature *signature);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_DSA_H_INCLUDED */
+++ /dev/null
-/* ecc-curve.h */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2013 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#ifndef NETTLE_ECC_CURVE_H_INCLUDED
-#define NETTLE_ECC_CURVE_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The contets of this struct is internal. */
- struct ecc_curve;
-
- extern const struct ecc_curve nettle_secp_192r1;
- extern const struct ecc_curve nettle_secp_224r1;
- extern const struct ecc_curve nettle_secp_256r1;
- extern const struct ecc_curve nettle_secp_384r1;
- extern const struct ecc_curve nettle_secp_521r1;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ECC_CURVE_H_INCLUDED */
+++ /dev/null
-/* ecc.h */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2013 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#ifndef NETTLE_ECC_H_INCLUDED
-#define NETTLE_ECC_H_INCLUDED
-
-#include <gmp.h>
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define ecc_point_init nettle_ecc_point_init
-#define ecc_point_clear nettle_ecc_point_clear
-#define ecc_point_set nettle_ecc_point_set
-#define ecc_point_get nettle_ecc_point_get
-#define ecc_point_mul nettle_ecc_point_mul
-#define ecc_point_mul_g nettle_ecc_point_mul_g
-#define ecc_scalar_init nettle_ecc_scalar_init
-#define ecc_scalar_clear nettle_ecc_scalar_clear
-#define ecc_scalar_set nettle_ecc_scalar_set
-#define ecc_scalar_get nettle_ecc_scalar_get
-#define ecc_scalar_random nettle_ecc_scalar_random
-#define ecc_point_mul nettle_ecc_point_mul
-#define ecc_size nettle_ecc_size
-#define ecc_size_a nettle_ecc_size_a
-#define ecc_size_j nettle_ecc_size_j
-#define ecc_a_to_a_itch nettle_ecc_a_to_a_itch
-#define ecc_a_to_a nettle_ecc_a_to_a
-#define ecc_a_to_j nettle_ecc_a_to_j
-#define ecc_j_to_a_itch nettle_ecc_j_to_a_itch
-#define ecc_j_to_a nettle_ecc_j_to_a
-#define ecc_dup_ja_itch nettle_ecc_dup_ja_itch
-#define ecc_dup_ja nettle_ecc_dup_ja
-#define ecc_dup_jj_itch nettle_ecc_dup_jj_itch
-#define ecc_dup_jj nettle_ecc_dup_jj
-#define ecc_add_jja_itch nettle_ecc_add_jja_itch
-#define ecc_add_jja nettle_ecc_add_jja
-#define ecc_add_jjj_itch nettle_ecc_add_jjj_itch
-#define ecc_add_jjj nettle_ecc_add_jjj
-#define ecc_mul_g_itch nettle_ecc_mul_g_itch
-#define ecc_mul_g nettle_ecc_mul_g
-#define ecc_mul_a_itch nettle_ecc_mul_a_itch
-#define ecc_mul_a nettle_ecc_mul_a
-
- struct ecc_curve;
-
-/* High level interface, for ECDSA, DH, etc */
-
-/* Represents a point on the ECC curve */
- struct ecc_point {
- const struct ecc_curve *ecc;
- /* Allocated using the same allocation function as GMP. */
- mp_limb_t *p;
- };
-
-/* Represents a non-zero scalar, an element of Z_q^*, where q is the
- group order of the curve. */
- struct ecc_scalar {
- const struct ecc_curve *ecc;
- /* Allocated using the same allocation function as GMP. */
- mp_limb_t *p;
- };
-
- void
- ecc_point_init(struct ecc_point *p, const struct ecc_curve *ecc);
- void
- ecc_point_clear(struct ecc_point *p);
-
-/* Fails and returns zero if the point is not on the curve. */
- int
- ecc_point_set(struct ecc_point *p, const mpz_t x, const mpz_t y);
- void
- ecc_point_get(const struct ecc_point *p, mpz_t x, mpz_t y);
-
- void
- ecc_scalar_init(struct ecc_scalar *s,
- const struct ecc_curve *ecc);
- void
- ecc_scalar_clear(struct ecc_scalar *s);
-
-/* Fails and returns zero if the scalar is not in the proper range. */
- int
- ecc_scalar_set(struct ecc_scalar *s, const mpz_t z);
- void
- ecc_scalar_get(const struct ecc_scalar *s, mpz_t z);
-/* Generates a random scalar, suitable as an ECDSA private key or a
- ECDH exponent. */
- void
- ecc_scalar_random(struct ecc_scalar *s,
- void *random_ctx, nettle_random_func * random);
-
-/* Computes r = n p */
- void
- ecc_point_mul(struct ecc_point *r, const struct ecc_scalar *n,
- const struct ecc_point *p);
-
-/* Computes r = n g */
- void
- ecc_point_mul_g(struct ecc_point *r, const struct ecc_scalar *n);
-\f
-
-/* Low-level interface */
-
-/* Points on a curve are represented as arrays of mp_limb_t. For some
- curves, point coordinates are represented in montgomery form. We
- use either affine coordinates x,y, or Jacobian coordinates X, Y, Z,
- where x = X/Z^2 and y = X/Z^2.
-
- Since we use additive notation for the groups, the infinity point
- on the curve is denoted 0. The infinity point can be represented
- with x = y = 0 in affine coordinates, and Z = 0 in Jacobian
- coordinates. However, note that most of the ECC functions do *not*
- support infinity as an input or output.
-*/
-
-/* FIXME: Also provided some compile time constants? */
-
-/* Returns the size of a single coordinate. */
- mp_size_t ecc_size(const struct ecc_curve *ecc);
-
-/* Size of a point, using affine coordinates x, y. */
- mp_size_t ecc_size_a(const struct ecc_curve *ecc);
-
-/* Size of a point, using jacobian coordinates X, Y and Z. */
- mp_size_t ecc_size_j(const struct ecc_curve *ecc);
-
-/* FIXME: Rename the low-level (and side-channel silent) functions to
- _ecc_*, and provide public ecc_* functions which handle the
- infinity points properly? */
-
-/* Converts the affine coordinates of a point into montgomery form, if
- used for this curve. */
- mp_size_t ecc_a_to_a_itch(const struct ecc_curve *ecc);
- void
- ecc_a_to_a(const struct ecc_curve *ecc,
- mp_limb_t * r, const mp_limb_t * p,
- mp_limb_t * scratch);
-
-/* Converts a point P in affine coordinates into a point R in jacobian
- coordinates. If INITIAL is non-zero, and the curve uses montgomery
- coordinates, also convert coordinates to montgomery form. */
- void
- ecc_a_to_j(const struct ecc_curve *ecc,
- int initial, mp_limb_t * r, const mp_limb_t * p);
-
-/* Converts a point P in jacobian coordinates into a point R in affine
- coordinates. If FLAGS has bit 0 set, and the curve uses montgomery
- coordinates, also undo the montgomery conversion. If flags has bit
- 1 set, produce x coordinate only. */
- mp_size_t ecc_j_to_a_itch(const struct ecc_curve *ecc);
- void
- ecc_j_to_a(const struct ecc_curve *ecc,
- int flags,
- mp_limb_t * r, const mp_limb_t * p,
- mp_limb_t * scratch);
-
-/* Group operations */
-
-
-/* Point doubling, with jacobian output and affine input. Corner
- cases: Correctly sets R = 0 (r_Z = 0) if p = 0 or 2p = 0. */
- mp_size_t ecc_dup_ja_itch(const struct ecc_curve *ecc);
- void
- ecc_dup_ja(const struct ecc_curve *ecc,
- mp_limb_t * r, const mp_limb_t * p,
- mp_limb_t * scratch);
-
-/* Point doubling, with jacobian input and output. Corner cases:
- Correctly sets R = 0 (r_Z = 0) if p = 0 or 2p = 0. */
- mp_size_t ecc_dup_jj_itch(const struct ecc_curve *ecc);
- void
- ecc_dup_jj(const struct ecc_curve *ecc,
- mp_limb_t * r, const mp_limb_t * p,
- mp_limb_t * scratch);
-
-
-/* Point addition, with jacobian output, one jacobian input and one
- affine input. Corner cases: Fails for the cases
-
- P = Q != 0 Duplication of non-zero point
- P = 0, Q != 0 or P != 0, Q = 0 One input zero
-
- Correctly gives R = 0 if P = Q = 0 or P = -Q. */
- mp_size_t ecc_add_jja_itch(const struct ecc_curve *ecc);
- void
- ecc_add_jja(const struct ecc_curve *ecc,
- mp_limb_t * r, const mp_limb_t * p,
- const mp_limb_t * q, mp_limb_t * scratch);
-
-/* Point addition with Jacobian input and output. */
- mp_size_t ecc_add_jjj_itch(const struct ecc_curve *ecc);
- void
- ecc_add_jjj(const struct ecc_curve *ecc,
- mp_limb_t * r, const mp_limb_t * p,
- const mp_limb_t * q, mp_limb_t * scratch);
-
-
-/* Computes N * the group generator. N is an array of ecc_size()
- limbs. It must be in the range 0 < N < group order, then R != 0,
- and the algorithm can work without any intermediate values getting
- to zero. */
- mp_size_t ecc_mul_g_itch(const struct ecc_curve *ecc);
- void
- ecc_mul_g(const struct ecc_curve *ecc, mp_limb_t * r,
- const mp_limb_t * np, mp_limb_t * scratch);
-
-/* Computes N * P. The scalar N is the same as for ecc_mul_g. P is a
- non-zero point on the curve, in affine coordinates. Pass a non-zero
- INITIAL if the point coordinates have not previously been converted
- to Montgomery representation. Output R is a non-zero point, in
- Jacobian coordinates. */
- mp_size_t ecc_mul_a_itch(const struct ecc_curve *ecc);
- void
- ecc_mul_a(const struct ecc_curve *ecc,
- int initial, mp_limb_t * r,
- const mp_limb_t * np, const mp_limb_t * p,
- mp_limb_t * scratch);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ECC_H_INCLUDED */
+++ /dev/null
-/* ecdsa.h */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2013 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* Development of Nettle's ECC support was funded by the .SE Internet Fund. */
-
-#ifndef NETTLE_ECDSA_H_INCLUDED
-#define NETTLE_ECDSA_H_INCLUDED
-
-#include "ecc.h"
-#include "dsa.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define ecdsa_sign nettle_ecdsa_sign
-#define ecdsa_verify nettle_ecdsa_verify
-#define ecdsa_generate_keypair nettle_ecdsa_generate_keypair
-#define ecc_ecdsa_sign nettle_ecc_ecdsa_sign
-#define ecc_ecdsa_sign_itch nettle_ecc_ecdsa_sign_itch
-#define ecc_ecdsa_verify nettle_ecc_ecdsa_verify
-#define ecc_ecdsa_verify_itch nettle_ecc_ecdsa_verify_itch
-
-/* High level ECDSA functions.
- *
- * A public key is represented as a struct ecc_point, and a private
- * key as a struct ecc_scalar. FIXME: Introduce some aliases? */
- void
- ecdsa_sign(const struct ecc_scalar *key,
- void *random_ctx, nettle_random_func * random,
- unsigned digest_length,
- const uint8_t * digest,
- struct dsa_signature *signature);
-
- int
- ecdsa_verify(const struct ecc_point *pub,
- unsigned length, const uint8_t * digest,
- const struct dsa_signature *signature);
-
- void
- ecdsa_generate_keypair(struct ecc_point *pub,
- struct ecc_scalar *key,
- void *random_ctx,
- nettle_random_func * random);
-
-/* Low-level ECDSA functions. */
- mp_size_t ecc_ecdsa_sign_itch(const struct ecc_curve *ecc);
-
- void
- ecc_ecdsa_sign(const struct ecc_curve *ecc, const mp_limb_t * zp,
- /* Random nonce, must be invertible mod ecc group
- order. */
- const mp_limb_t * kp,
- unsigned length, const uint8_t * digest,
- mp_limb_t * rp, mp_limb_t * sp,
- mp_limb_t * scratch);
-
- mp_size_t ecc_ecdsa_verify_itch(const struct ecc_curve *ecc);
-
- int
- ecc_ecdsa_verify(const struct ecc_curve *ecc, const mp_limb_t * pp, /* Public key */
- unsigned length, const uint8_t * digest,
- const mp_limb_t * rp, const mp_limb_t * sp,
- mp_limb_t * scratch);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_ECDSA_H_INCLUDED */
+++ /dev/null
-/* gcm.h
- *
- * Galois counter mode, specified by NIST,
- * http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
- *
- */
-
-/* NOTE: Tentative interface, subject to change. No effort will be
- made to avoid incompatible changes. */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2011 Niels Möller
- * Copyright (C) 2011 Katholieke Universiteit Leuven
- *
- * Contributed by Nikos Mavrogiannopoulos
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_GCM_H_INCLUDED
-#define NETTLE_GCM_H_INCLUDED
-
-#include "aes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define gcm_set_key nettle_gcm_set_key
-#define gcm_set_iv nettle_gcm_set_iv
-#define gcm_update nettle_gcm_update
-#define gcm_encrypt nettle_gcm_encrypt
-#define gcm_decrypt nettle_gcm_decrypt
-#define gcm_digest nettle_gcm_digest
-
-#define gcm_aes_set_key nettle_gcm_aes_set_key
-#define gcm_aes_set_iv nettle_gcm_aes_set_iv
-#define gcm_aes_update nettle_gcm_aes_update
-#define gcm_aes_encrypt nettle_gcm_aes_encrypt
-#define gcm_aes_decrypt nettle_gcm_aes_decrypt
-#define gcm_aes_digest nettle_gcm_aes_digest
-
-#define GCM_BLOCK_SIZE 16
-#define GCM_IV_SIZE (GCM_BLOCK_SIZE - 4)
-
-#define GCM_TABLE_BITS 8
-
-/* To make sure that we have proper alignment. */
- union gcm_block {
- uint8_t b[GCM_BLOCK_SIZE];
- unsigned long w[GCM_BLOCK_SIZE / sizeof(unsigned long)];
- };
-
-/* Hashing subkey */
- struct gcm_key {
- union gcm_block h[1 << GCM_TABLE_BITS];
- };
-
-/* Per-message state, depending on the iv */
- struct gcm_ctx {
- /* Original counter block */
- union gcm_block iv;
- /* Updated for each block. */
- union gcm_block ctr;
- /* Hashing state */
- union gcm_block x;
- uint64_t auth_size;
- uint64_t data_size;
- };
-
-/* FIXME: Should use const for the cipher context. Then needs const for
- nettle_crypt_func, which also rules out using that abstraction for
- arcfour. */
- void
- gcm_set_key(struct gcm_key *key,
- void *cipher, nettle_crypt_func * f);
-
- void
- gcm_set_iv(struct gcm_ctx *ctx, const struct gcm_key *key,
- unsigned length, const uint8_t * iv);
-
- void
- gcm_update(struct gcm_ctx *ctx, const struct gcm_key *key,
- unsigned length, const uint8_t * data);
-
- void
- gcm_encrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
- void *cipher, nettle_crypt_func * f,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
- void
- gcm_decrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
- void *cipher, nettle_crypt_func * f,
- unsigned length, uint8_t * dst, const uint8_t * src);
-
- void
- gcm_digest(struct gcm_ctx *ctx, const struct gcm_key *key,
- void *cipher, nettle_crypt_func * f,
- unsigned length, uint8_t * digest);
-
-/* Convenience macrology (not sure how useful it is) */
-
-/* All-in-one context, with cipher, hash subkey, and message state. */
-#define GCM_CTX(type) \
-{ type cipher; struct gcm_key key; struct gcm_ctx gcm; }
-
-/* NOTE: Avoid using NULL, as we don't include anything defining it. */
-#define GCM_SET_KEY(ctx, set_key, encrypt, length, data) \
- do { \
- (set_key)(&(ctx)->cipher, (length), (data)); \
- if (0) (encrypt)(&(ctx)->cipher, 0, (void *)0, (void *)0); \
- gcm_set_key(&(ctx)->key, &(ctx)->cipher, \
- (nettle_crypt_func *) (encrypt)); \
- } while (0)
-
-#define GCM_SET_IV(ctx, length, data) \
- gcm_set_iv(&(ctx)->gcm, &(ctx)->key, (length), (data))
-
-#define GCM_UPDATE(ctx, length, data) \
- gcm_update(&(ctx)->gcm, &(ctx)->key, (length), (data))
-
-#define GCM_ENCRYPT(ctx, encrypt, length, dst, src) \
- (0 ? (encrypt)(&(ctx)->cipher, 0, (void *)0, (void *)0) \
- : gcm_encrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
- (nettle_crypt_func *) (encrypt), \
- (length), (dst), (src)))
-
-#define GCM_DECRYPT(ctx, encrypt, length, dst, src) \
- (0 ? (encrypt)(&(ctx)->cipher, 0, (void *)0, (void *)0) \
- : gcm_decrypt(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
- (nettle_crypt_func *) (encrypt), \
- (length), (dst), (src)))
-
-#define GCM_DIGEST(ctx, encrypt, length, digest) \
- (0 ? (encrypt)(&(ctx)->cipher, 0, (void *)0, (void *)0) \
- : gcm_digest(&(ctx)->gcm, &(ctx)->key, &(ctx)->cipher, \
- (nettle_crypt_func *) (encrypt), \
- (length), (digest)))
-
- struct gcm_aes_ctx GCM_CTX(struct aes_ctx);
-
- void
- gcm_aes_set_key(struct gcm_aes_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- gcm_aes_set_iv(struct gcm_aes_ctx *ctx,
- unsigned length, const uint8_t * iv);
-
- void
- gcm_aes_update(struct gcm_aes_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- gcm_aes_encrypt(struct gcm_aes_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
- void
- gcm_aes_decrypt(struct gcm_aes_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
- void
- gcm_aes_digest(struct gcm_aes_ctx *ctx, unsigned length,
- uint8_t * digest);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_GCM_H_INCLUDED */
+++ /dev/null
-/* gosthash94.h
- *
- * The GOST R 34.11-94 hash function, described in RFC 5831.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2012 Nikos Mavrogiannopoulos, Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* Interface based on rhash gost.h. */
-
-/* Copyright: 2009-2012 Aleksey Kravchenko <rhash.admin@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Ported to nettle by Nikos Mavrogiannopoulos.
- */
-
-#ifndef NETTLE_GOSTHASH94_H_INCLUDED
-#define NETTLE_GOSTHASH94_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define gosthash94_init nettle_gosthash94_init
-#define gosthash94_update nettle_gosthash94_update
-#define gosthash94_digest nettle_gosthash94_digest
-
-#define GOSTHASH94_DATA_SIZE 32
-#define GOSTHASH94_DIGEST_SIZE 32
-
- struct gosthash94_ctx {
- uint32_t hash[8]; /* algorithm 256-bit state */
- uint32_t sum[8]; /* sum of processed message blocks */
- uint8_t message[GOSTHASH94_DATA_SIZE]; /* 256-bit buffer for leftovers */
- uint64_t length; /* number of processed bytes */
- };
-
- void gosthash94_init(struct gosthash94_ctx *ctx);
- void gosthash94_update(struct gosthash94_ctx *ctx,
- unsigned length, const uint8_t * msg);
- void gosthash94_digest(struct gosthash94_ctx *ctx,
- unsigned length, uint8_t * result);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_GOSTHASH94_H_INCLUDED */
+++ /dev/null
-/* hmac.h
- *
- * HMAC message authentication code (RFC-2104).
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_HMAC_H_INCLUDED
-#define NETTLE_HMAC_H_INCLUDED
-
-#include "nettle-meta.h"
-
-#include "md5.h"
-#include "ripemd160.h"
-#include "sha1.h"
-#include "sha2.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Namespace mangling */
-#define hmac_set_key nettle_hmac_set_key
-#define hmac_update nettle_hmac_update
-#define hmac_digest nettle_hmac_digest
-#define hmac_md5_set_key nettle_hmac_md5_set_key
-#define hmac_md5_update nettle_hmac_md5_update
-#define hmac_md5_digest nettle_hmac_md5_digest
-#define hmac_ripemd160_set_key nettle_hmac_ripemd160_set_key
-#define hmac_ripemd160_update nettle_hmac_ripemd160_update
-#define hmac_ripemd160_digest nettle_hmac_ripemd160_digest
-#define hmac_sha1_set_key nettle_hmac_sha1_set_key
-#define hmac_sha1_update nettle_hmac_sha1_update
-#define hmac_sha1_digest nettle_hmac_sha1_digest
-#define hmac_sha224_set_key nettle_hmac_sha224_set_key
-#define hmac_sha224_digest nettle_hmac_sha224_digest
-#define hmac_sha256_set_key nettle_hmac_sha256_set_key
-#define hmac_sha256_update nettle_hmac_sha256_update
-#define hmac_sha256_digest nettle_hmac_sha256_digest
-#define hmac_sha384_set_key nettle_hmac_sha384_set_key
-#define hmac_sha384_digest nettle_hmac_sha384_digest
-#define hmac_sha512_set_key nettle_hmac_sha512_set_key
-#define hmac_sha512_update nettle_hmac_sha512_update
-#define hmac_sha512_digest nettle_hmac_sha512_digest
-
- void
- hmac_set_key(void *outer, void *inner, void *state,
- const struct nettle_hash *hash,
- unsigned length, const uint8_t * key);
-
-/* This function is not strictly needed, it's s just the same as the
- * hash update function. */
- void
- hmac_update(void *state,
- const struct nettle_hash *hash,
- unsigned length, const uint8_t * data);
-
- void
- hmac_digest(const void *outer, const void *inner, void *state,
- const struct nettle_hash *hash,
- unsigned length, uint8_t * digest);
-
-
-#define HMAC_CTX(type) \
-{ type outer; type inner; type state; }
-
-#define HMAC_SET_KEY(ctx, hash, length, key) \
- hmac_set_key( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \
- (hash), (length), (key) )
-
-#define HMAC_DIGEST(ctx, hash, length, digest) \
- hmac_digest( &(ctx)->outer, &(ctx)->inner, &(ctx)->state, \
- (hash), (length), (digest) )
-
-/* HMAC using specific hash functions */
-
-/* hmac-md5 */
- struct hmac_md5_ctx HMAC_CTX(struct md5_ctx);
-
- void
- hmac_md5_set_key(struct hmac_md5_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
- void
- hmac_md5_update(struct hmac_md5_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- hmac_md5_digest(struct hmac_md5_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-/* hmac-ripemd160 */
- struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx);
-
- void
- hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
- void
- hmac_ripemd160_update(struct hmac_ripemd160_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-/* hmac-sha1 */
- struct hmac_sha1_ctx HMAC_CTX(struct sha1_ctx);
-
- void
- hmac_sha1_set_key(struct hmac_sha1_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
- void
- hmac_sha1_update(struct hmac_sha1_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- hmac_sha1_digest(struct hmac_sha1_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* hmac-sha256 */
- struct hmac_sha256_ctx HMAC_CTX(struct sha256_ctx);
-
- void
- hmac_sha256_set_key(struct hmac_sha256_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
- void
- hmac_sha256_update(struct hmac_sha256_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* hmac-sha224 */
-#define hmac_sha224_ctx hmac_sha256_ctx
-
- void
- hmac_sha224_set_key(struct hmac_sha224_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
-#define hmac_sha224_update nettle_hmac_sha256_update
-
- void
- hmac_sha224_digest(struct hmac_sha224_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* hmac-sha512 */
- struct hmac_sha512_ctx HMAC_CTX(struct sha512_ctx);
-
- void
- hmac_sha512_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
- void
- hmac_sha512_update(struct hmac_sha512_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- hmac_sha512_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* hmac-sha384 */
-#define hmac_sha384_ctx hmac_sha512_ctx
-
- void
- hmac_sha384_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t * key);
-
-#define hmac_sha384_update nettle_hmac_sha512_update
-
- void
- hmac_sha384_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_HMAC_H_INCLUDED */
+++ /dev/null
-/* knuth-lfib.h
- *
- * A "lagged fibonacci" pseudorandomness generator.
- *
- * Described in Knuth, TAOCP, 3.6
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* NOTE: This generator is totally inappropriate for cryptographic
- * applications. It is useful for generating deterministic but
- * random-looking test data, and is used by the Nettle testsuite. */
-#ifndef NETTLE_KNUTH_LFIB_H_INCLUDED
-#define NETTLE_KNUTH_LFIB_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Namespace mangling */
-#define knuth_lfib_init nettle_knuth_lfib_init
-#define knuth_lfib_get nettle_knuth_lfib_get
-#define knuth_lfib_get_array nettle_knuth_lfib_get_array
-#define knuth_lfib_random nettle_knuth_lfib_random
-
-#define _KNUTH_LFIB_KK 100
-
- struct knuth_lfib_ctx {
- uint32_t x[_KNUTH_LFIB_KK];
- unsigned index;
- };
-
- void
- knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed);
-
-/* Get's a single number in the range 0 ... 2^30-1 */
- uint32_t knuth_lfib_get(struct knuth_lfib_ctx *ctx);
-
-/* Get an array of numbers */
- void
- knuth_lfib_get_array(struct knuth_lfib_ctx *ctx,
- unsigned n, uint32_t * a);
-
-/* Get an array of octets. */
- void
- knuth_lfib_random(struct knuth_lfib_ctx *ctx,
- unsigned n, uint8_t * dst);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_KNUTH_LFIB_H_INCLUDED */
+++ /dev/null
-/* macros.h
- *
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2010 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_MACROS_H_INCLUDED
-#define NETTLE_MACROS_H_INCLUDED
-
-/* Reads a 64-bit integer, in network, big-endian, byte order */
-#define READ_UINT64(p) \
-( (((uint64_t) (p)[0]) << 56) \
- | (((uint64_t) (p)[1]) << 48) \
- | (((uint64_t) (p)[2]) << 40) \
- | (((uint64_t) (p)[3]) << 32) \
- | (((uint64_t) (p)[4]) << 24) \
- | (((uint64_t) (p)[5]) << 16) \
- | (((uint64_t) (p)[6]) << 8) \
- | ((uint64_t) (p)[7]))
-
-#define WRITE_UINT64(p, i) \
-do { \
- (p)[0] = ((i) >> 56) & 0xff; \
- (p)[1] = ((i) >> 48) & 0xff; \
- (p)[2] = ((i) >> 40) & 0xff; \
- (p)[3] = ((i) >> 32) & 0xff; \
- (p)[4] = ((i) >> 24) & 0xff; \
- (p)[5] = ((i) >> 16) & 0xff; \
- (p)[6] = ((i) >> 8) & 0xff; \
- (p)[7] = (i) & 0xff; \
-} while(0)
-
-/* Reads a 32-bit integer, in network, big-endian, byte order */
-#define READ_UINT32(p) \
-( (((uint32_t) (p)[0]) << 24) \
- | (((uint32_t) (p)[1]) << 16) \
- | (((uint32_t) (p)[2]) << 8) \
- | ((uint32_t) (p)[3]))
-
-#define WRITE_UINT32(p, i) \
-do { \
- (p)[0] = ((i) >> 24) & 0xff; \
- (p)[1] = ((i) >> 16) & 0xff; \
- (p)[2] = ((i) >> 8) & 0xff; \
- (p)[3] = (i) & 0xff; \
-} while(0)
-
-/* Analogous macros, for 24 and 16 bit numbers */
-#define READ_UINT24(p) \
-( (((uint32_t) (p)[0]) << 16) \
- | (((uint32_t) (p)[1]) << 8) \
- | ((uint32_t) (p)[2]))
-
-#define WRITE_UINT24(p, i) \
-do { \
- (p)[0] = ((i) >> 16) & 0xff; \
- (p)[1] = ((i) >> 8) & 0xff; \
- (p)[2] = (i) & 0xff; \
-} while(0)
-
-#define READ_UINT16(p) \
-( (((uint32_t) (p)[0]) << 8) \
- | ((uint32_t) (p)[1]))
-
-#define WRITE_UINT16(p, i) \
-do { \
- (p)[0] = ((i) >> 8) & 0xff; \
- (p)[1] = (i) & 0xff; \
-} while(0)
-
-/* And the other, little-endian, byteorder */
-#define LE_READ_UINT64(p) \
-( (((uint64_t) (p)[7]) << 56) \
- | (((uint64_t) (p)[6]) << 48) \
- | (((uint64_t) (p)[5]) << 40) \
- | (((uint64_t) (p)[4]) << 32) \
- | (((uint64_t) (p)[3]) << 24) \
- | (((uint64_t) (p)[2]) << 16) \
- | (((uint64_t) (p)[1]) << 8) \
- | ((uint64_t) (p)[0]))
-
-#define LE_WRITE_UINT64(p, i) \
-do { \
- (p)[7] = ((i) >> 56) & 0xff; \
- (p)[6] = ((i) >> 48) & 0xff; \
- (p)[5] = ((i) >> 40) & 0xff; \
- (p)[4] = ((i) >> 32) & 0xff; \
- (p)[3] = ((i) >> 24) & 0xff; \
- (p)[2] = ((i) >> 16) & 0xff; \
- (p)[1] = ((i) >> 8) & 0xff; \
- (p)[0] = (i) & 0xff; \
-} while (0)
-
-#define LE_READ_UINT32(p) \
-( (((uint32_t) (p)[3]) << 24) \
- | (((uint32_t) (p)[2]) << 16) \
- | (((uint32_t) (p)[1]) << 8) \
- | ((uint32_t) (p)[0]))
-
-#define LE_WRITE_UINT32(p, i) \
-do { \
- (p)[3] = ((i) >> 24) & 0xff; \
- (p)[2] = ((i) >> 16) & 0xff; \
- (p)[1] = ((i) >> 8) & 0xff; \
- (p)[0] = (i) & 0xff; \
-} while(0)
-
-/* Analogous macros, for 16 bit numbers */
-#define LE_READ_UINT16(p) \
- ( (((uint32_t) (p)[1]) << 8) \
- | ((uint32_t) (p)[0]))
-
-#define LE_WRITE_UINT16(p, i) \
- do { \
- (p)[1] = ((i) >> 8) & 0xff; \
- (p)[0] = (i) & 0xff; \
- } while(0)
-
-/* Macro to make it easier to loop over several blocks. */
-#define FOR_BLOCKS(length, dst, src, blocksize) \
- assert( !((length) % (blocksize))); \
- for (; (length); ((length) -= (blocksize), \
- (dst) += (blocksize), \
- (src) += (blocksize)) )
-
-#define ROTL32(n,x) (((x)<<(n)) | ((x)>>(32-(n))))
-
-#define ROTL64(n,x) (((x)<<(n)) | ((x)>>(64-(n))))
-
-/* Requires that size > 0 */
-#define INCREMENT(size, ctr) \
- do { \
- unsigned increment_i = (size) - 1; \
- if (++(ctr)[increment_i] == 0) \
- while (increment_i > 0 \
- && ++(ctr)[--increment_i] == 0 ) \
- ; \
- } while (0)
-
-
-/* Helper macro for Merkle-Damgård hash functions. Assumes the context
- structs includes the following fields:
-
- xxx count_low, count_high; // Two word block count
- uint8_t block[...]; // Buffer holding one block
- unsigned int index; // Index into block
-*/
-
-/* FIXME: Should probably switch to using uint64_t for the count, but
- due to alignment and byte order that may be an ABI change. */
-
-#define MD_INCR(ctx) ((ctx)->count_high += !++(ctx)->count_low)
-
-/* Takes the compression function f as argument. NOTE: also clobbers
- length and data. */
-#define MD_UPDATE(ctx, length, data, f, incr) \
- do { \
- if ((ctx)->index) \
- { \
- /* Try to fill partial block */ \
- unsigned __md_left = sizeof((ctx)->block) - (ctx)->index; \
- if ((length) < __md_left) \
- { \
- memcpy((ctx)->block + (ctx)->index, (data), (length)); \
- (ctx)->index += (length); \
- goto __md_done; /* Finished */ \
- } \
- else \
- { \
- memcpy((ctx)->block + (ctx)->index, (data), __md_left); \
- \
- f((ctx), (ctx)->block); \
- (incr); \
- \
- (data) += __md_left; \
- (length) -= __md_left; \
- } \
- } \
- while ((length) >= sizeof((ctx)->block)) \
- { \
- f((ctx), (data)); \
- (incr); \
- \
- (data) += sizeof((ctx)->block); \
- (length) -= sizeof((ctx)->block); \
- } \
- memcpy ((ctx)->block, (data), (length)); \
- (ctx)->index = (length); \
- __md_done: \
- ; \
- } while (0)
-
-/* Pads the block to a block boundary with the bit pattern 1 0*,
- leaving size octets for the length field at the end. If needed,
- compresses the block and starts a new one. */
-#define MD_PAD(ctx, size, f) \
- do { \
- unsigned __md_i; \
- __md_i = (ctx)->index; \
- \
- /* Set the first char of padding to 0x80. This is safe since there \
- is always at least one byte free */ \
- \
- assert(__md_i < sizeof((ctx)->block)); \
- (ctx)->block[__md_i++] = 0x80; \
- \
- if (__md_i > (sizeof((ctx)->block) - 2*sizeof((ctx)->count_low))) \
- { /* No room for length in this block. Process it and \
- pad with another one */ \
- memset((ctx)->block + __md_i, 0, sizeof((ctx)->block) - __md_i); \
- \
- f((ctx), (ctx)->block); \
- __md_i = 0; \
- } \
- memset((ctx)->block + __md_i, 0, \
- sizeof((ctx)->block) - (size) - __md_i); \
- \
- } while (0)
-
-#endif /* NETTLE_MACROS_H_INCLUDED */
+++ /dev/null
-/* md2.h
- *
- * The MD2 hash function, described in RFC 1319.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2003 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_MD2_H_INCLUDED
-#define NETTLE_MD2_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define md2_init nettle_md2_init
-#define md2_update nettle_md2_update
-#define md2_digest nettle_md2_digest
-
-#define MD2_DIGEST_SIZE 16
-#define MD2_DATA_SIZE 16
-
- struct md2_ctx {
- uint8_t C[MD2_DATA_SIZE];
- uint8_t X[3 * MD2_DATA_SIZE];
- uint8_t block[MD2_DATA_SIZE]; /* Block buffer */
- unsigned index; /* Into buffer */
- };
-
- void
- md2_init(struct md2_ctx *ctx);
-
- void
- md2_update(struct md2_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- md2_digest(struct md2_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_MD2_H_INCLUDED */
+++ /dev/null
-/* md4.h
- *
- * The MD4 hash function, described in RFC 1320.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2003 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_MD4_H_INCLUDED
-#define NETTLE_MD4_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define md4_init nettle_md4_init
-#define md4_update nettle_md4_update
-#define md4_digest nettle_md4_digest
-
-#define MD4_DIGEST_SIZE 16
-#define MD4_DATA_SIZE 64
-
-/* Digest is kept internally as 4 32-bit words. */
-#define _MD4_DIGEST_LENGTH 4
-
-/* FIXME: Identical to md5_ctx */
- struct md4_ctx {
- uint32_t state[_MD4_DIGEST_LENGTH];
- uint32_t count_low, count_high; /* Block count */
- uint8_t block[MD4_DATA_SIZE]; /* Block buffer */
- unsigned index; /* Into buffer */
- };
-
- void
- md4_init(struct md4_ctx *ctx);
-
- void
- md4_update(struct md4_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- md4_digest(struct md4_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_MD4_H_INCLUDED */
+++ /dev/null
-/* md5-compat.h
- *
- * The md5 hash function, RFC 1321-style interface.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_MD5_COMPAT_H_INCLUDED
-#define NETTLE_MD5_COMPAT_H_INCLUDED
-
-#include "md5.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define MD5Init nettle_MD5Init
-#define MD5Update nettle_MD5Update
-#define MD5Final nettle_MD5Final
-
- typedef struct md5_ctx MD5_CTX;
-
- void MD5Init(MD5_CTX * ctx);
- void MD5Update(MD5_CTX * ctx, const unsigned char *data,
- unsigned int length);
- void MD5Final(unsigned char *out, MD5_CTX * ctx);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_MD5_COMPAT_H_INCLUDED */
+++ /dev/null
-/* md5.h
- *
- * The MD5 hash function, described in RFC 1321.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_MD5_H_INCLUDED
-#define NETTLE_MD5_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define md5_init nettle_md5_init
-#define md5_update nettle_md5_update
-#define md5_digest nettle_md5_digest
-
-#define MD5_DIGEST_SIZE 16
-#define MD5_DATA_SIZE 64
-
-/* Digest is kept internally as 4 32-bit words. */
-#define _MD5_DIGEST_LENGTH 4
-
- struct md5_ctx {
- uint32_t state[_MD5_DIGEST_LENGTH];
- uint32_t count_low, count_high; /* Block count */
- uint8_t block[MD5_DATA_SIZE]; /* Block buffer */
- unsigned index; /* Into buffer */
- };
-
- void
- md5_init(struct md5_ctx *ctx);
-
- void
- md5_update(struct md5_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- md5_digest(struct md5_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* Internal compression function. STATE points to 4 uint32_t words,
- and DATA points to 64 bytes of input data, possibly unaligned. */
- void
- _nettle_md5_compress(uint32_t * state, const uint8_t * data);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_MD5_H_INCLUDED */
+++ /dev/null
-/* memxor.h
- *
- */
-
-#ifndef NETTLE_MEMXOR_H_INCLUDED
-#define NETTLE_MEMXOR_H_INCLUDED
-
-#include <stdlib.h>
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- uint8_t *memxor(uint8_t * dst, const uint8_t * src, size_t n);
- uint8_t *memxor3(uint8_t * dst, const uint8_t * a,
- const uint8_t * b, size_t n);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_MEMXOR_H_INCLUDED */
+++ /dev/null
-/* nettle-meta.h
- *
- * Information about algorithms.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_META_H_INCLUDED
-#define NETTLE_META_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
- struct nettle_cipher {
- const char *name;
-
- unsigned context_size;
-
- /* Zero for stream ciphers */
- unsigned block_size;
-
- /* Suggested key size; other sizes are sometimes possible. */
- unsigned key_size;
-
- nettle_set_key_func *set_encrypt_key;
- nettle_set_key_func *set_decrypt_key;
-
- nettle_crypt_func *encrypt;
- nettle_crypt_func *decrypt;
- };
-
-#define _NETTLE_CIPHER(name, NAME, key_size) { \
- #name #key_size, \
- sizeof(struct name##_ctx), \
- NAME##_BLOCK_SIZE, \
- key_size / 8, \
- (nettle_set_key_func *) name##_set_key, \
- (nettle_set_key_func *) name##_set_key, \
- (nettle_crypt_func *) name##_encrypt, \
- (nettle_crypt_func *) name##_decrypt, \
-}
-
-#define _NETTLE_CIPHER_SEP(name, NAME, key_size) { \
- #name #key_size, \
- sizeof(struct name##_ctx), \
- NAME##_BLOCK_SIZE, \
- key_size / 8, \
- (nettle_set_key_func *) name##_set_encrypt_key, \
- (nettle_set_key_func *) name##_set_decrypt_key, \
- (nettle_crypt_func *) name##_encrypt, \
- (nettle_crypt_func *) name##_decrypt, \
-}
-
-#define _NETTLE_CIPHER_SEP_SET_KEY(name, NAME, key_size) {\
- #name #key_size, \
- sizeof(struct name##_ctx), \
- NAME##_BLOCK_SIZE, \
- key_size / 8, \
- (nettle_set_key_func *) name##_set_encrypt_key, \
- (nettle_set_key_func *) name##_set_decrypt_key, \
- (nettle_crypt_func *) name##_crypt, \
- (nettle_crypt_func *) name##_crypt, \
-}
-
-#define _NETTLE_CIPHER_FIX(name, NAME) { \
- #name, \
- sizeof(struct name##_ctx), \
- NAME##_BLOCK_SIZE, \
- NAME##_KEY_SIZE, \
- (nettle_set_key_func *) name##_set_key, \
- (nettle_set_key_func *) name##_set_key, \
- (nettle_crypt_func *) name##_encrypt, \
- (nettle_crypt_func *) name##_decrypt, \
-}
-
-/* null-terminated list of ciphers implemented by this version of nettle */
- extern const struct nettle_cipher *const nettle_ciphers[];
-
- extern const struct nettle_cipher nettle_aes128;
- extern const struct nettle_cipher nettle_aes192;
- extern const struct nettle_cipher nettle_aes256;
-
- extern const struct nettle_cipher nettle_arcfour128;
-
- extern const struct nettle_cipher nettle_camellia128;
- extern const struct nettle_cipher nettle_camellia192;
- extern const struct nettle_cipher nettle_camellia256;
-
- extern const struct nettle_cipher nettle_cast128;
-
- extern const struct nettle_cipher nettle_serpent128;
- extern const struct nettle_cipher nettle_serpent192;
- extern const struct nettle_cipher nettle_serpent256;
-
- extern const struct nettle_cipher nettle_twofish128;
- extern const struct nettle_cipher nettle_twofish192;
- extern const struct nettle_cipher nettle_twofish256;
-
- extern const struct nettle_cipher nettle_arctwo40;
- extern const struct nettle_cipher nettle_arctwo64;
- extern const struct nettle_cipher nettle_arctwo128;
- extern const struct nettle_cipher nettle_arctwo_gutmann128;
-
- struct nettle_hash {
- const char *name;
-
- /* Size of the context struct */
- unsigned context_size;
-
- /* Size of digests */
- unsigned digest_size;
-
- /* Internal block size */
- unsigned block_size;
-
- nettle_hash_init_func *init;
- nettle_hash_update_func *update;
- nettle_hash_digest_func *digest;
- };
-
-#define _NETTLE_HASH(name, NAME) { \
- #name, \
- sizeof(struct name##_ctx), \
- NAME##_DIGEST_SIZE, \
- NAME##_DATA_SIZE, \
- (nettle_hash_init_func *) name##_init, \
- (nettle_hash_update_func *) name##_update, \
- (nettle_hash_digest_func *) name##_digest \
-}
-
-/* null-terminated list of digests implemented by this version of nettle */
- extern const struct nettle_hash *const nettle_hashes[];
-
- extern const struct nettle_hash nettle_md2;
- extern const struct nettle_hash nettle_md4;
- extern const struct nettle_hash nettle_md5;
- extern const struct nettle_hash nettle_gosthash94;
- extern const struct nettle_hash nettle_ripemd160;
- extern const struct nettle_hash nettle_sha1;
- extern const struct nettle_hash nettle_sha224;
- extern const struct nettle_hash nettle_sha256;
- extern const struct nettle_hash nettle_sha384;
- extern const struct nettle_hash nettle_sha512;
- extern const struct nettle_hash nettle_sha3_224;
- extern const struct nettle_hash nettle_sha3_256;
- extern const struct nettle_hash nettle_sha3_384;
- extern const struct nettle_hash nettle_sha3_512;
-
- struct nettle_armor {
- const char *name;
- unsigned encode_context_size;
- unsigned decode_context_size;
-
- unsigned encode_final_length;
-
- nettle_armor_init_func *encode_init;
- nettle_armor_length_func *encode_length;
- nettle_armor_encode_update_func *encode_update;
- nettle_armor_encode_final_func *encode_final;
-
- nettle_armor_init_func *decode_init;
- nettle_armor_length_func *decode_length;
- nettle_armor_decode_update_func *decode_update;
- nettle_armor_decode_final_func *decode_final;
- };
-
-#define _NETTLE_ARMOR(name, NAME) { \
- #name, \
- sizeof(struct name##_encode_ctx), \
- sizeof(struct name##_decode_ctx), \
- NAME##_ENCODE_FINAL_LENGTH, \
- (nettle_armor_init_func *) name##_encode_init, \
- (nettle_armor_length_func *) name##_encode_length, \
- (nettle_armor_encode_update_func *) name##_encode_update, \
- (nettle_armor_encode_final_func *) name##_encode_final, \
- (nettle_armor_init_func *) name##_decode_init, \
- (nettle_armor_length_func *) name##_decode_length, \
- (nettle_armor_decode_update_func *) name##_decode_update, \
- (nettle_armor_decode_final_func *) name##_decode_final, \
-}
-
-#define _NETTLE_ARMOR_0(name, NAME) { \
- #name, \
- 0, \
- sizeof(struct name##_decode_ctx), \
- NAME##_ENCODE_FINAL_LENGTH, \
- (nettle_armor_init_func *) name##_encode_init, \
- (nettle_armor_length_func *) name##_encode_length, \
- (nettle_armor_encode_update_func *) name##_encode_update, \
- (nettle_armor_encode_final_func *) name##_encode_final, \
- (nettle_armor_init_func *) name##_decode_init, \
- (nettle_armor_length_func *) name##_decode_length, \
- (nettle_armor_decode_update_func *) name##_decode_update, \
- (nettle_armor_decode_final_func *) name##_decode_final, \
-}
-
-/* null-terminated list of armor schemes implemented by this version of nettle */
- extern const struct nettle_armor *const nettle_armors[];
-
- extern const struct nettle_armor nettle_base64;
- extern const struct nettle_armor nettle_base16;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_META_H_INCLUDED */
+++ /dev/null
-#ifndef __NETTLE_STDINT_H
-#define __NETTLE_STDINT_H 1
-#ifndef _GENERATED_STDINT_H
-#define _GENERATED_STDINT_H " "
-/* generated using gnu compiler i686-w64-mingw32-gcc (GCC) 4.9.0 */
-#define _STDINT_HAVE_STDINT_H 1
-
-/* ................... shortcircuit part ........................... */
-
-#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
-#include <stdint.h>
-#else
-#include <stddef.h>
-
-/* .................... configured part ............................ */
-
-/* whether we have a C99 compatible stdint header file */
-/* #undef _STDINT_HEADER_INTPTR */
-/* whether we have a C96 compatible inttypes header file */
-/* #undef _STDINT_HEADER_UINT32 */
-/* whether we have a BSD compatible inet types header */
-/* #undef _STDINT_HEADER_U_INT32 */
-
-/* which 64bit typedef has been found */
-/* #undef _STDINT_HAVE_UINT64_T */
-/* #undef _STDINT_HAVE_U_INT64_T */
-
-/* which type model has been detected */
-/* #undef _STDINT_CHAR_MODEL // skipped */
-/* #undef _STDINT_LONG_MODEL // skipped */
-
-/* whether int_least types were detected */
-/* #undef _STDINT_HAVE_INT_LEAST32_T */
-/* whether int_fast types were detected */
-/* #undef _STDINT_HAVE_INT_FAST32_T */
-/* whether intmax_t type was detected */
-/* #undef _STDINT_HAVE_INTMAX_T */
-
-/* .................... detections part ............................ */
-
-/* whether we need to define bitspecific types from compiler base types */
-#ifndef _STDINT_HEADER_INTPTR
-#ifndef _STDINT_HEADER_UINT32
-#ifndef _STDINT_HEADER_U_INT32
-#define _STDINT_NEED_INT_MODEL_T
-#else
-#define _STDINT_HAVE_U_INT_TYPES
-#endif
-#endif
-#endif
-
-#ifdef _STDINT_HAVE_U_INT_TYPES
-#undef _STDINT_NEED_INT_MODEL_T
-#endif
-
-#ifdef _STDINT_CHAR_MODEL
-#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
-#ifndef _STDINT_BYTE_MODEL
-#define _STDINT_BYTE_MODEL 12
-#endif
-#endif
-#endif
-
-#ifndef _STDINT_HAVE_INT_LEAST32_T
-#define _STDINT_NEED_INT_LEAST_T
-#endif
-
-#ifndef _STDINT_HAVE_INT_FAST32_T
-#define _STDINT_NEED_INT_FAST_T
-#endif
-
-#ifndef _STDINT_HEADER_INTPTR
-#define _STDINT_NEED_INTPTR_T
-#ifndef _STDINT_HAVE_INTMAX_T
-#define _STDINT_NEED_INTMAX_T
-#endif
-#endif
-
-
-/* .................... definition part ............................ */
-
-/* some system headers have good uint64_t */
-#ifndef _HAVE_UINT64_T
-#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
-#define _HAVE_UINT64_T
-#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
-#define _HAVE_UINT64_T
-typedef u_int64_t uint64_t;
-#endif
-#endif
-
-#ifndef _HAVE_UINT64_T
-/* .. here are some common heuristics using compiler runtime specifics */
-#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
-#define _HAVE_UINT64_T
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-
-#elif !defined __STRICT_ANSI__
-#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
-#define _HAVE_UINT64_T
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-
-#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
-/* note: all ELF-systems seem to have loff-support which needs 64-bit */
-#if !defined _NO_LONGLONG
-#define _HAVE_UINT64_T
-typedef long long int64_t;
-typedef unsigned long long uint64_t;
-#endif
-
-#elif defined __alpha || (defined __mips && defined _ABIN32)
-#if !defined _NO_LONGLONG
-typedef long int64_t;
-typedef unsigned long uint64_t;
-#endif
- /* compiler/cpu type to define int64_t */
-#endif
-#endif
-#endif
-
-#if defined _STDINT_HAVE_U_INT_TYPES
-/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
-typedef u_int8_t uint8_t;
-typedef u_int16_t uint16_t;
-typedef u_int32_t uint32_t;
-
-/* glibc compatibility */
-#ifndef __int8_t_defined
-#define __int8_t_defined
-#endif
-#endif
-
-#ifdef _STDINT_NEED_INT_MODEL_T
-/* we must guess all the basic types. Apart from byte-adressable system, */
-/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
-/* (btw, those nibble-addressable systems are way off, or so we assume) */
-
-
-#if defined _STDINT_BYTE_MODEL
-#if _STDINT_LONG_MODEL+0 == 242
-/* 2:4:2 = IP16 = a normal 16-bit system */
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned long uint32_t;
-#ifndef __int8_t_defined
-#define __int8_t_defined
-typedef char int8_t;
-typedef short int16_t;
-typedef long int32_t;
-#endif
-#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
-/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
-/* 4:4:4 = ILP32 = a normal 32-bit system */
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#ifndef __int8_t_defined
-#define __int8_t_defined
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-#endif
-#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
-/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
-/* 4:8:8 = LP64 = a normal 64-bit system */
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#ifndef __int8_t_defined
-#define __int8_t_defined
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-#endif
-/* this system has a "long" of 64bit */
-#ifndef _HAVE_UINT64_T
-#define _HAVE_UINT64_T
-typedef unsigned long uint64_t;
-typedef long int64_t;
-#endif
-#elif _STDINT_LONG_MODEL+0 == 448
-/* LLP64 a 64-bit system derived from a 32-bit system */
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-#ifndef __int8_t_defined
-#define __int8_t_defined
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-#endif
-/* assuming the system has a "long long" */
-#ifndef _HAVE_UINT64_T
-#define _HAVE_UINT64_T
-typedef unsigned long long uint64_t;
-typedef long long int64_t;
-#endif
-#else
-#define _STDINT_NO_INT32_T
-#endif
-#else
-#define _STDINT_NO_INT8_T
-#define _STDINT_NO_INT32_T
-#endif
-#endif
-
-/*
- * quote from SunOS-5.8 sys/inttypes.h:
- * Use at your own risk. As of February 1996, the committee is squarely
- * behind the fixed sized types; the "least" and "fast" types are still being
- * discussed. The probability that the "fast" types may be removed before
- * the standard is finalized is high enough that they are not currently
- * implemented.
- */
-
-#if defined _STDINT_NEED_INT_LEAST_T
-typedef int8_t int_least8_t;
-typedef int16_t int_least16_t;
-typedef int32_t int_least32_t;
-#ifdef _HAVE_UINT64_T
-typedef int64_t int_least64_t;
-#endif
-
-typedef uint8_t uint_least8_t;
-typedef uint16_t uint_least16_t;
-typedef uint32_t uint_least32_t;
-#ifdef _HAVE_UINT64_T
-typedef uint64_t uint_least64_t;
-#endif
- /* least types */
-#endif
-
-#if defined _STDINT_NEED_INT_FAST_T
-typedef int8_t int_fast8_t;
-typedef int int_fast16_t;
-typedef int32_t int_fast32_t;
-#ifdef _HAVE_UINT64_T
-typedef int64_t int_fast64_t;
-#endif
-
-typedef uint8_t uint_fast8_t;
-typedef unsigned uint_fast16_t;
-typedef uint32_t uint_fast32_t;
-#ifdef _HAVE_UINT64_T
-typedef uint64_t uint_fast64_t;
-#endif
- /* fast types */
-#endif
-
-#ifdef _STDINT_NEED_INTMAX_T
-#ifdef _HAVE_UINT64_T
-typedef int64_t intmax_t;
-typedef uint64_t uintmax_t;
-#else
-typedef long intmax_t;
-typedef unsigned long uintmax_t;
-#endif
-#endif
-
-#ifdef _STDINT_NEED_INTPTR_T
-#ifndef __intptr_t_defined
-#define __intptr_t_defined
-/* we encourage using "long" to store pointer values, never use "int" ! */
-#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
-typedef unsinged int uintptr_t;
-typedef int intptr_t;
-#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
-typedef unsigned long uintptr_t;
-typedef long intptr_t;
-#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
-typedef uint64_t uintptr_t;
-typedef int64_t intptr_t;
-#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
-typedef unsigned long uintptr_t;
-typedef long intptr_t;
-#endif
-#endif
-#endif
-
- /* shortcircuit*/
-#endif
- /* once */
-#endif
-#endif
+++ /dev/null
-/* nettle-types.h */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2005 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_TYPES_H
-#define NETTLE_TYPES_H
-
-/* Pretend these types always exists. Nettle doesn't use them. */
-#define _STDINT_HAVE_INT_FAST32_T 1
-
-#include "nettle-stdint.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Randomness. Used by key generation and dsa signature creation. */
- typedef void nettle_random_func(void *ctx,
- unsigned length, uint8_t * dst);
-
-/* Progress report function, mainly for key generation. */
- typedef void nettle_progress_func(void *ctx, int c);
-
-/* Realloc function, used by struct nettle_buffer. */
- typedef void *nettle_realloc_func(void *ctx, void *p,
- unsigned length);
-
-/* Ciphers */
- typedef void nettle_set_key_func(void *ctx,
- unsigned length,
- const uint8_t * key);
-
-/* Uses a void * for cipher contexts.
-
- For block ciphers it would make sense with a const void * for the
- context, but we use the same typedef for stream ciphers where the
- internal state changes during the encryption. */
-
- typedef void nettle_crypt_func(void *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-/* Hash algorithms */
- typedef void nettle_hash_init_func(void *ctx);
- typedef void nettle_hash_update_func(void *ctx,
- unsigned length,
- const uint8_t * src);
- typedef void nettle_hash_digest_func(void *ctx,
- unsigned length,
- uint8_t * dst);
-
-/* ASCII armor codecs. NOTE: Experimental and subject to change. */
-
- typedef unsigned nettle_armor_length_func(unsigned length);
- typedef void nettle_armor_init_func(void *ctx);
-
- typedef unsigned nettle_armor_encode_update_func(void *ctx,
- uint8_t * dst,
- unsigned
- src_length,
- const uint8_t *
- src);
-
- typedef unsigned nettle_armor_encode_final_func(void *ctx,
- uint8_t * dst);
-
- typedef int nettle_armor_decode_update_func(void *ctx,
- unsigned *dst_length,
- uint8_t * dst,
- unsigned src_length,
- const uint8_t * src);
-
- typedef int nettle_armor_decode_final_func(void *ctx);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_TYPES_H */
+++ /dev/null
-/* pbkdf2.h
- *
- * PKCS #5 password-based key derivation function PBKDF2, see RFC 2898.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2012 Simon Josefsson
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_PBKDF2_H_INCLUDED
-#define NETTLE_PBKDF2_H_INCLUDED
-
-#include "nettle-meta.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Namespace mangling */
-#define pbkdf2 nettle_pbkdf2
-#define pbkdf2_hmac_sha1 nettle_pbkdf2_hmac_sha1
-#define pbkdf2_hmac_sha256 nettle_pbkdf2_hmac_sha256
-
- void
- pbkdf2(void *mac_ctx,
- nettle_hash_update_func * update,
- nettle_hash_digest_func * digest,
- unsigned digest_size, unsigned iterations,
- unsigned salt_length, const uint8_t * salt,
- unsigned length, uint8_t * dst);
-
-#define PBKDF2(ctx, update, digest, digest_size, \
- iterations, salt_length, salt, length, dst) \
- (0 ? ((update)((ctx), 0, (uint8_t *) 0), \
- (digest)((ctx), 0, (uint8_t *) 0)) \
- : pbkdf2 ((ctx), \
- (nettle_hash_update_func *)(update), \
- (nettle_hash_digest_func *)(digest), \
- (digest_size), (iterations), \
- (salt_length), (salt), (length), (dst)))
-
-/* PBKDF2 with specific PRFs. */
-
- void
- pbkdf2_hmac_sha1(unsigned key_length, const uint8_t * key,
- unsigned iterations,
- unsigned salt_length, const uint8_t * salt,
- unsigned length, uint8_t * dst);
-
- void
- pbkdf2_hmac_sha256(unsigned key_length, const uint8_t * key,
- unsigned iterations,
- unsigned salt_length, const uint8_t * salt,
- unsigned length, uint8_t * dst);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_PBKDF2_H_INCLUDED */
+++ /dev/null
-/* pgp.h
- *
- * PGP related functions.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_PGP_H_INCLUDED
-#define NETTLE_PGP_H_INCLUDED
-
-#include <time.h>
-
-#include "nettle-types.h"
-#include "bignum.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define pgp_put_uint32 nettle_pgp_put_uint32
-#define pgp_put_uint16 nettle_pgp_put_uint16
-#define pgp_put_mpi nettle_pgp_put_mpi
-#define pgp_put_string nettle_pgp_put_string
-#define pgp_put_length nettle_pgp_put_length
-#define pgp_put_header nettle_pgp_put_header
-#define pgp_put_header_length nettle_pgp_put_header_length
-#define pgp_sub_packet_start nettle_pgp_sub_packet_start
-#define pgp_put_sub_packet nettle_pgp_put_sub_packet
-#define pgp_sub_packet_end nettle_pgp_sub_packet_end
-#define pgp_put_public_rsa_key nettle_pgp_put_public_rsa_key
-#define pgp_put_rsa_sha1_signature nettle_pgp_put_rsa_sha1_signature
-#define pgp_put_userid nettle_pgp_put_userid
-#define pgp_crc24 nettle_pgp_crc24
-#define pgp_armor nettle_pgp_armor
-
- struct nettle_buffer;
- struct rsa_public_key;
- struct rsa_private_key;
- struct sha1_ctx;
-
- int
- pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i);
-
- int
- pgp_put_uint16(struct nettle_buffer *buffer, unsigned i);
-
- int
- pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x);
-
- int
- pgp_put_string(struct nettle_buffer *buffer,
- unsigned length, const uint8_t * s);
-
- int
- pgp_put_length(struct nettle_buffer *buffer, unsigned length);
-
- int
- pgp_put_header(struct nettle_buffer *buffer,
- unsigned tag, unsigned length);
-
- void
- pgp_put_header_length(struct nettle_buffer *buffer,
- /* start of the header */
- unsigned start, unsigned field_size);
-
- unsigned
- pgp_sub_packet_start(struct nettle_buffer *buffer);
-
- int
- pgp_put_sub_packet(struct nettle_buffer *buffer,
- unsigned type,
- unsigned length, const uint8_t * data);
-
- void
- pgp_sub_packet_end(struct nettle_buffer *buffer, unsigned start);
-
- int
- pgp_put_public_rsa_key(struct nettle_buffer *,
- const struct rsa_public_key *key,
- time_t timestamp);
-
- int
- pgp_put_rsa_sha1_signature(struct nettle_buffer *buffer,
- const struct rsa_private_key *key,
- const uint8_t * keyid,
- unsigned type, struct sha1_ctx *hash);
-
- int
- pgp_put_userid(struct nettle_buffer *buffer,
- unsigned length, const uint8_t * name);
-
- uint32_t pgp_crc24(unsigned length, const uint8_t * data);
-
- int
- pgp_armor(struct nettle_buffer *buffer,
- const char *tag, unsigned length, const uint8_t * data);
-
-/* Values that can be passed to pgp_put_header when the size of the
- * length field, but not the length itself, is known. Also the minimum length
- * for the given field size. */
- enum pgp_lengths {
- PGP_LENGTH_ONE_OCTET = 0,
- PGP_LENGTH_TWO_OCTETS = 192,
- PGP_LENGTH_FOUR_OCTETS = 8384,
- };
-
- enum pgp_public_key_algorithm {
- PGP_RSA = 1,
- PGP_RSA_ENCRYPT = 2,
- PGP_RSA_SIGN = 3,
- PGP_EL_GAMAL_ENCRYPT = 16,
- PGP_DSA = 17,
- PGP_EL_GAMAL = 20,
- };
-
- enum pgp_symmetric_algorithm {
- PGP_PLAINTEXT = 0,
- PGP_IDEA = 1,
- PGP_3DES = 2,
- PGP_CAST5 = 3,
- PGP_BLOWFISH = 4,
- PGP_SAFER_SK = 5,
- PGP_AES128 = 7,
- PGP_AES192 = 8,
- PGP_AES256 = 9,
- };
-
- enum pgp_compression_algorithm {
- PGP_UNCOMPRESSED = 0,
- PGP_ZIP = 1,
- PGP_ZLIB = 2,
- };
-
- enum pgp_hash_algorithm {
- PGP_MD5 = 1,
- PGP_SHA1 = 2,
- PGP_RIPEMD = 3,
- PGP_MD2 = 5,
- PGP_TIGER192 = 6,
- PGP_HAVAL = 7,
- };
-
- enum pgp_tag {
- PGP_TAG_PUBLIC_SESSION_KEY = 1,
- PGP_TAG_SIGNATURE = 2,
- PGP_TAG_SYMMETRIC_SESSION_KEY = 3,
- PGP_TAG_ONE_PASS_SIGNATURE = 4,
- PGP_TAG_SECRET_KEY = 5,
- PGP_TAG_PUBLIC_KEY = 6,
- PGP_TAG_SECRET_SUBKEY = 7,
- PGP_TAG_COMPRESSED = 8,
- PGP_TAG_ENCRYPTED = 9,
- PGP_TAG_MARKER = 10,
- PGP_TAG_LITERAL = 11,
- PGP_TAG_TRUST = 12,
- PGP_TAG_USERID = 13,
- PGP_TAG_PUBLIC_SUBKEY = 14,
- };
-
- enum pgp_signature_type {
- PGP_SIGN_BINARY = 0,
- PGP_SIGN_TEXT = 1,
- PGP_SIGN_STANDALONE = 2,
- PGP_SIGN_CERTIFICATION = 0x10,
- PGP_SIGN_CERTIFICATION_PERSONA = 0x11,
- PGP_SIGN_CERTIFICATION_CASUAL = 0x12,
- PGP_SIGN_CERTIFICATION_POSITIVE = 0x13,
- PGP_SIGN_SUBKEY = 0x18,
- PGP_SIGN_KEY = 0x1f,
- PGP_SIGN_REVOCATION = 0x20,
- PGP_SIGN_REVOCATION_SUBKEY = 0x28,
- PGP_SIGN_REVOCATION_CERTIFICATE = 0x30,
- PGP_SIGN_TIMESTAMP = 0x40,
- };
-
- enum pgp_subpacket_tag {
- PGP_SUBPACKET_CREATION_TIME = 2,
- PGP_SUBPACKET_SIGNATURE_EXPIRATION_TIME = 3,
- PGP_SUBPACKET_EXPORTABLE_CERTIFICATION = 4,
- PGP_SUBPACKET_TRUST_SIGNATURE = 5,
- PGP_SUBPACKET_REGULAR_EXPRESSION = 6,
- PGP_SUBPACKET_REVOCABLE = 7,
- PGP_SUBPACKET_KEY_EXPIRATION_TIME = 9,
- PGP_SUBPACKET_PLACEHOLDER = 10,
- PGP_SUBPACKET_PREFERRED_SYMMETRIC_ALGORITHMS = 11,
- PGP_SUBPACKET_REVOCATION_KEY = 12,
- PGP_SUBPACKET_ISSUER_KEY_ID = 16,
- PGP_SUBPACKET_NOTATION_DATA = 20,
- PGP_SUBPACKET_PREFERRED_HASH_ALGORITHMS = 21,
- PGP_SUBPACKET_PREFERRED_COMPRESSION_ALGORITHMS = 22,
- PGP_SUBPACKET_KEY_SERVER_PREFERENCES = 23,
- PGP_SUBPACKET_PREFERRED_KEY_SERVER = 24,
- PGP_SUBPACKET_PRIMARY_USER_ID = 25,
- PGP_SUBPACKET_POLICY_URL = 26,
- PGP_SUBPACKET_KEY_FLAGS = 27,
- PGP_SUBPACKET_SIGNERS_USER_ID = 28,
- PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
- };
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_PGP_H_INCLUDED */
+++ /dev/null
-/* pkcs1.h
- *
- * PKCS1 embedding.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2003 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_PKCS1_H_INCLUDED
-#define NETTLE_PKCS1_H_INCLUDED
-
-#include <gmp.h>
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define _pkcs1_signature_prefix _nettle_pkcs1_signature_prefix
-#define pkcs1_rsa_digest_encode nettle_pkcs1_rsa_digest_encode
-#define pkcs1_rsa_md5_encode nettle_pkcs1_rsa_md5_encode
-#define pkcs1_rsa_md5_encode_digest nettle_pkcs1_rsa_md5_encode_digest
-#define pkcs1_rsa_sha1_encode nettle_pkcs1_rsa_sha1_encode
-#define pkcs1_rsa_sha1_encode_digest nettle_pkcs1_rsa_sha1_encode_digest
-#define pkcs1_rsa_sha256_encode nettle_pkcs1_rsa_sha256_encode
-#define pkcs1_rsa_sha256_encode_digest nettle_pkcs1_rsa_sha256_encode_digest
-#define pkcs1_rsa_sha512_encode nettle_pkcs1_rsa_sha512_encode
-#define pkcs1_rsa_sha512_encode_digest nettle_pkcs1_rsa_sha512_encode_digest
-#define pkcs1_encrypt nettle_pkcs1_encrypt
-#define pkcs1_decrypt nettle_pkcs1_decrypt
-
- struct md5_ctx;
- struct sha1_ctx;
- struct sha256_ctx;
- struct sha512_ctx;
-
- uint8_t *_pkcs1_signature_prefix(unsigned key_size,
- uint8_t * buffer,
- unsigned id_size,
- const uint8_t * id,
- unsigned digest_size);
-
- int
- pkcs1_encrypt(unsigned key_size,
- /* For padding */
- void *random_ctx, nettle_random_func * random,
- unsigned length, const uint8_t * message, mpz_t m);
-
- int
- pkcs1_decrypt(unsigned key_size,
- const mpz_t m, unsigned *length, uint8_t * message);
-
- int
- pkcs1_rsa_digest_encode(mpz_t m, unsigned key_size,
- unsigned di_length,
- const uint8_t * digest_info);
-
- int
- pkcs1_rsa_md5_encode(mpz_t m, unsigned length,
- struct md5_ctx *hash);
-
- int
- pkcs1_rsa_md5_encode_digest(mpz_t m, unsigned length,
- const uint8_t * digest);
-
- int
- pkcs1_rsa_sha1_encode(mpz_t m, unsigned length,
- struct sha1_ctx *hash);
-
- int
- pkcs1_rsa_sha1_encode_digest(mpz_t m, unsigned length,
- const uint8_t * digest);
-
- int
- pkcs1_rsa_sha256_encode(mpz_t m, unsigned length,
- struct sha256_ctx *hash);
-
- int
- pkcs1_rsa_sha256_encode_digest(mpz_t m, unsigned length,
- const uint8_t * digest);
-
- int
- pkcs1_rsa_sha512_encode(mpz_t m, unsigned length,
- struct sha512_ctx *hash);
-
- int
- pkcs1_rsa_sha512_encode_digest(mpz_t m, unsigned length,
- const uint8_t * digest);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_PKCS1_H_INCLUDED */
+++ /dev/null
-/* realloc.h
- *
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_REALLOC_H_INCLUDED
-#define NETTLE_REALLOC_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- nettle_realloc_func nettle_realloc;
- nettle_realloc_func nettle_xrealloc;
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_REALLOC_H_INCLUDED */
+++ /dev/null
-/* ripemd160.h
- *
- * RIPEMD-160 hash function.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2011 Andres Mejia
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_RIPEMD160_H_INCLUDED
-#define NETTLE_RIPEMD160_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "nettle-types.h"
-
-/* Name mangling */
-#define ripemd160_init nettle_ripemd160_init
-#define ripemd160_update nettle_ripemd160_update
-#define ripemd160_digest nettle_ripemd160_digest
-
-/* RIPEMD160 */
-
-#define RIPEMD160_DIGEST_SIZE 20
-#define RIPEMD160_DATA_SIZE 64
-
-/* Digest is kept internally as 5 32-bit words. */
-#define _RIPEMD160_DIGEST_LENGTH 5
-
- struct ripemd160_ctx {
- uint32_t state[_RIPEMD160_DIGEST_LENGTH];
- uint32_t count_low, count_high; /* 64-bit block count */
- uint8_t block[RIPEMD160_DATA_SIZE];
- unsigned int index;
- };
-
- void
- ripemd160_init(struct ripemd160_ctx *ctx);
-
- void
- ripemd160_update(struct ripemd160_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- ripemd160_digest(struct ripemd160_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* Internal compression function. STATE points to 5 uint32_t words,
- and DATA points to 64 bytes of input data, possibly unaligned. */
- void
- _nettle_ripemd160_compress(uint32_t * state,
- const uint8_t * data);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_RIPEMD160_H_INCLUDED */
+++ /dev/null
-/* rsa-compat.h
- *
- * The RSA publickey algorithm, RSAREF compatible interface.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_RSA_COMPAT_H_INCLUDED
-#define NETTLE_RSA_COMPAT_H_INCLUDED
-
-#include "rsa.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define R_SignInit nettle_R_SignInit
-#define R_SignUpdate nettle_R_SignUpdate
-#define R_SignFinal nettle_R_SignFinal
-#define R_VerifyInit nettle_R_VerifyInit
-#define R_VerifyUpdate nettle_R_VerifyUpdate
-#define R_VerifyFinal nettle_R_VerifyFinal
-
-/* 256 octets or 2048 bits */
-#define MAX_RSA_MODULUS_LEN 256
-
- typedef struct {
- unsigned bits;
- uint8_t modulus[MAX_RSA_MODULUS_LEN];
- uint8_t exponent[MAX_RSA_MODULUS_LEN];
- } R_RSA_PUBLIC_KEY;
-
- typedef struct {
- unsigned bits;
- uint8_t modulus[MAX_RSA_MODULUS_LEN];
- uint8_t publicExponent[MAX_RSA_MODULUS_LEN];
- uint8_t exponent[MAX_RSA_MODULUS_LEN];
- uint8_t prime[2][MAX_RSA_MODULUS_LEN];
- uint8_t primeExponent[2][MAX_RSA_MODULUS_LEN];
- uint8_t coefficient[MAX_RSA_MODULUS_LEN];
- } R_RSA_PRIVATE_KEY;
-
-/* Only MD5 is supported for now */
- typedef struct {
- struct md5_ctx hash;
- } R_SIGNATURE_CTX;
-
-/* Digest algorithms */
-/* DA_MD2 not implemented */
- enum { DA_MD5 = 1 };
-
-/* Return values */
- enum {
- RE_SUCCESS = 0,
- RE_CONTENT_ENCODING, /* encryptedContent has RFC 1421 encoding error */
- RE_DATA, /* other party's private value out of range */
- RE_DIGEST_ALGORITHM, /* message-digest algorithm is invalid */
- RE_ENCODING, /* encoded block has RFC 1421 encoding error */
- RE_ENCRYPTION_ALGORITHM, /* encryption algorithm is invalid */
- RE_KEY, /* recovered data encryption key cannot decrypt */
- RE_KEY_ENCODING, /* encrypted key has RFC 1421 encoding error */
- RE_LEN, /* signatureLen out of range */
- RE_MODULUS_LEN, /* modulus length invalid */
- RE_NEED_RANDOM, /* random structure is not seeded */
- RE_PRIVATE_KEY, /* private key cannot encrypt message digest, */
- RE_PUBLIC_KEY, /* publicKey cannot decrypt signature */
- RE_SIGNATURE, /* signature is incorrect */
- RE_SIGNATURE_ENCODING, /* encodedSignature has RFC 1421 encoding error */
- };
-
- int
- R_SignInit(R_SIGNATURE_CTX * ctx, int digestAlgorithm);
-
- int
- R_SignUpdate(R_SIGNATURE_CTX * ctx, const uint8_t * data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length);
-
- int
- R_SignFinal(R_SIGNATURE_CTX * ctx,
- uint8_t * signature,
- unsigned *length, R_RSA_PRIVATE_KEY * key);
-
- int
- R_VerifyInit(R_SIGNATURE_CTX * ctx, int digestAlgorithm);
-
- int
- R_VerifyUpdate(R_SIGNATURE_CTX * ctx, const uint8_t * data,
- /* Length is an unsigned char according to rsaref.txt,
- * but that must be a typo. */
- unsigned length);
-
- int
- R_VerifyFinal(R_SIGNATURE_CTX * ctx,
- uint8_t * signature,
- unsigned length, R_RSA_PUBLIC_KEY * key);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_RSA_COMPAT_H_INCLUDED */
+++ /dev/null
-/* rsa.h
- *
- * The RSA publickey algorithm.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_RSA_H_INCLUDED
-#define NETTLE_RSA_H_INCLUDED
-
-#include <gmp.h>
-#include "nettle-types.h"
-
-#include "md5.h"
-#include "sha1.h"
-#include "sha2.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define rsa_public_key_init nettle_rsa_public_key_init
-#define rsa_public_key_clear nettle_rsa_public_key_clear
-#define rsa_public_key_prepare nettle_rsa_public_key_prepare
-#define rsa_private_key_init nettle_rsa_private_key_init
-#define rsa_private_key_clear nettle_rsa_private_key_clear
-#define rsa_private_key_prepare nettle_rsa_private_key_prepare
-#define rsa_pkcs1_verify nettle_rsa_pkcs1_verify
-#define rsa_pkcs1_sign nettle_rsa_pkcs1_sign
-#define rsa_pkcs1_sign_tr nettle_rsa_pkcs1_sign_tr
-#define rsa_md5_sign nettle_rsa_md5_sign
-#define rsa_md5_verify nettle_rsa_md5_verify
-#define rsa_sha1_sign nettle_rsa_sha1_sign
-#define rsa_sha1_verify nettle_rsa_sha1_verify
-#define rsa_sha256_sign nettle_rsa_sha256_sign
-#define rsa_sha256_verify nettle_rsa_sha256_verify
-#define rsa_sha512_sign nettle_rsa_sha512_sign
-#define rsa_sha512_verify nettle_rsa_sha512_verify
-#define rsa_md5_sign_digest nettle_rsa_md5_sign_digest
-#define rsa_md5_verify_digest nettle_rsa_md5_verify_digest
-#define rsa_sha1_sign_digest nettle_rsa_sha1_sign_digest
-#define rsa_sha1_verify_digest nettle_rsa_sha1_verify_digest
-#define rsa_sha256_sign_digest nettle_rsa_sha256_sign_digest
-#define rsa_sha256_verify_digest nettle_rsa_sha256_verify_digest
-#define rsa_sha512_sign_digest nettle_rsa_sha512_sign_digest
-#define rsa_sha512_verify_digest nettle_rsa_sha512_verify_digest
-#define rsa_encrypt nettle_rsa_encrypt
-#define rsa_decrypt nettle_rsa_decrypt
-#define rsa_decrypt_tr nettle_rsa_decrypt_tr
-#define rsa_compute_root nettle_rsa_compute_root
-#define rsa_generate_keypair nettle_rsa_generate_keypair
-#define rsa_keypair_to_sexp nettle_rsa_keypair_to_sexp
-#define rsa_keypair_from_sexp_alist nettle_rsa_keypair_from_sexp_alist
-#define rsa_keypair_from_sexp nettle_rsa_keypair_from_sexp
-#define rsa_public_key_from_der_iterator nettle_rsa_public_key_from_der_iterator
-#define rsa_private_key_from_der_iterator nettle_rsa_private_key_from_der_iterator
-#define rsa_keypair_from_der nettle_rsa_keypair_from_der
-#define rsa_keypair_to_openpgp nettle_rsa_keypair_to_openpgp
-#define _rsa_verify _nettle_rsa_verify
-#define _rsa_check_size _nettle_rsa_check_size
-#define _rsa_blind _nettle_rsa_blind
-#define _rsa_unblind _nettle_rsa_unblind
-
-/* This limit is somewhat arbitrary. Technically, the smallest modulo
- which makes sense at all is 15 = 3*5, phi(15) = 8, size 4 bits. But
- for ridiculously small keys, not all odd e are possible (e.g., for
- 5 bits, the only possible modulo is 3*7 = 21, phi(21) = 12, and e =
- 3 don't work). The smallest size that makes sense with pkcs#1, and
- which allows RSA encryption of one byte messages, is 12 octets, 89
- bits. */
-
-#define RSA_MINIMUM_N_OCTETS 12
-#define RSA_MINIMUM_N_BITS (8*RSA_MINIMUM_N_OCTETS - 7)
-
- struct rsa_public_key {
- /* Size of the modulo, in octets. This is also the size of all
- * signatures that are created or verified with this key. */
- unsigned size;
-
- /* Modulo */
- mpz_t n;
-
- /* Public exponent */
- mpz_t e;
- };
-
- struct rsa_private_key {
- unsigned size;
-
- /* d is filled in by the key generation function; otherwise it's
- * completely unused. */
- mpz_t d;
-
- /* The two factors */
- mpz_t p;
- mpz_t q;
-
- /* d % (p-1), i.e. a e = 1 (mod (p-1)) */
- mpz_t a;
-
- /* d % (q-1), i.e. b e = 1 (mod (q-1)) */
- mpz_t b;
-
- /* modular inverse of q , i.e. c q = 1 (mod p) */
- mpz_t c;
- };
-
-/* Signing a message works as follows:
- *
- * Store the private key in a rsa_private_key struct.
- *
- * Call rsa_private_key_prepare. This initializes the size attribute
- * to the length of a signature.
- *
- * Initialize a hashing context, by callling
- * md5_init
- *
- * Hash the message by calling
- * md5_update
- *
- * Create the signature by calling
- * rsa_md5_sign
- *
- * The signature is represented as a mpz_t bignum. This call also
- * resets the hashing context.
- *
- * When done with the key and signature, don't forget to call
- * mpz_clear.
- */
-
-/* Calls mpz_init to initialize bignum storage. */
- void
- rsa_public_key_init(struct rsa_public_key *key);
-
-/* Calls mpz_clear to deallocate bignum storage. */
- void
- rsa_public_key_clear(struct rsa_public_key *key);
-
- int
- rsa_public_key_prepare(struct rsa_public_key *key);
-
-/* Calls mpz_init to initialize bignum storage. */
- void
- rsa_private_key_init(struct rsa_private_key *key);
-
-/* Calls mpz_clear to deallocate bignum storage. */
- void
- rsa_private_key_clear(struct rsa_private_key *key);
-
- int
- rsa_private_key_prepare(struct rsa_private_key *key);
-
-
-/* PKCS#1 style signatures */
- int
- rsa_pkcs1_sign(const struct rsa_private_key *key,
- unsigned length, const uint8_t * digest_info,
- mpz_t s);
-
- int
- rsa_pkcs1_sign_tr(const struct rsa_public_key *pub,
- const struct rsa_private_key *key,
- void *random_ctx, nettle_random_func * random,
- unsigned length, const uint8_t * digest_info,
- mpz_t s);
- int
- rsa_pkcs1_verify(const struct rsa_public_key *key,
- unsigned length, const uint8_t * digest_info,
- const mpz_t signature);
-
- int
- rsa_md5_sign(const struct rsa_private_key *key,
- struct md5_ctx *hash, mpz_t signature);
-
-
- int
- rsa_md5_verify(const struct rsa_public_key *key,
- struct md5_ctx *hash, const mpz_t signature);
-
- int
- rsa_sha1_sign(const struct rsa_private_key *key,
- struct sha1_ctx *hash, mpz_t signature);
-
- int
- rsa_sha1_verify(const struct rsa_public_key *key,
- struct sha1_ctx *hash, const mpz_t signature);
-
- int
- rsa_sha256_sign(const struct rsa_private_key *key,
- struct sha256_ctx *hash, mpz_t signature);
-
- int
- rsa_sha256_verify(const struct rsa_public_key *key,
- struct sha256_ctx *hash, const mpz_t signature);
-
- int
- rsa_sha512_sign(const struct rsa_private_key *key,
- struct sha512_ctx *hash, mpz_t signature);
-
- int
- rsa_sha512_verify(const struct rsa_public_key *key,
- struct sha512_ctx *hash, const mpz_t signature);
-
-/* Variants taking the digest as argument. */
- int
- rsa_md5_sign_digest(const struct rsa_private_key *key,
- const uint8_t * digest, mpz_t s);
-
- int
- rsa_md5_verify_digest(const struct rsa_public_key *key,
- const uint8_t * digest,
- const mpz_t signature);
-
- int
- rsa_sha1_sign_digest(const struct rsa_private_key *key,
- const uint8_t * digest, mpz_t s);
-
- int
- rsa_sha1_verify_digest(const struct rsa_public_key *key,
- const uint8_t * digest,
- const mpz_t signature);
-
- int
- rsa_sha256_sign_digest(const struct rsa_private_key *key,
- const uint8_t * digest, mpz_t s);
-
- int
- rsa_sha256_verify_digest(const struct rsa_public_key *key,
- const uint8_t * digest,
- const mpz_t signature);
-
- int
- rsa_sha512_sign_digest(const struct rsa_private_key *key,
- const uint8_t * digest, mpz_t s);
-
- int
- rsa_sha512_verify_digest(const struct rsa_public_key *key,
- const uint8_t * digest,
- const mpz_t signature);
-
-
-/* RSA encryption, using PKCS#1 */
-/* These functions uses the v1.5 padding. What should the v2 (OAEP)
- * functions be called? */
-
-/* Returns 1 on success, 0 on failure, which happens if the
- * message is too long for the key. */
- int
- rsa_encrypt(const struct rsa_public_key *key,
- /* For padding */
- void *random_ctx, nettle_random_func * random,
- unsigned length, const uint8_t * cleartext,
- mpz_t cipher);
-
-/* Message must point to a buffer of size *LENGTH. KEY->size is enough
- * for all valid messages. On success, *LENGTH is updated to reflect
- * the actual length of the message. Returns 1 on success, 0 on
- * failure, which happens if decryption failed or if the message
- * didn't fit. */
- int
- rsa_decrypt(const struct rsa_private_key *key,
- unsigned *length, uint8_t * cleartext,
- const mpz_t ciphertext);
-
-/* Timing-resistant version, using randomized RSA blinding. */
- int
- rsa_decrypt_tr(const struct rsa_public_key *pub,
- const struct rsa_private_key *key,
- void *random_ctx, nettle_random_func * random,
- unsigned *length, uint8_t * message,
- const mpz_t gibberish);
-
-/* Compute x, the e:th root of m. Calling it with x == m is allowed. */
- void
- rsa_compute_root(const struct rsa_private_key *key,
- mpz_t x, const mpz_t m);
-
-
-/* Key generation */
-
-/* Note that the key structs must be initialized first. */
- int
- rsa_generate_keypair(struct rsa_public_key *pub,
- struct rsa_private_key *key,
- void *random_ctx,
- nettle_random_func * random,
- void *progress_ctx,
- nettle_progress_func * progress,
- /* Desired size of modulo, in bits */
- unsigned n_size,
- /* Desired size of public exponent, in bits. If
- * zero, the passed in value pub->e is used. */
- unsigned e_size);
-
-
-#define RSA_SIGN(key, algorithm, ctx, length, data, signature) ( \
- algorithm##_update(ctx, length, data), \
- rsa_##algorithm##_sign(key, ctx, signature) \
-)
-
-#define RSA_VERIFY(key, algorithm, ctx, length, data, signature) ( \
- algorithm##_update(ctx, length, data), \
- rsa_##algorithm##_verify(key, ctx, signature) \
-)
-\f
-
-/* Keys in sexp form. */
-
- struct nettle_buffer;
-
-/* Generates a public-key expression if PRIV is NULL .*/
- int
- rsa_keypair_to_sexp(struct nettle_buffer *buffer, const char *algorithm_name, /* NULL means "rsa" */
- const struct rsa_public_key *pub,
- const struct rsa_private_key *priv);
-
- struct sexp_iterator;
-
- int
- rsa_keypair_from_sexp_alist(struct rsa_public_key *pub,
- struct rsa_private_key *priv,
- unsigned limit,
- struct sexp_iterator *i);
-
-/* If PRIV is NULL, expect a public-key expression. If PUB is NULL,
- * expect a private key expression and ignore the parts not needed for
- * the public key. */
-/* Keys must be initialized before calling this function, as usual. */
- int
- rsa_keypair_from_sexp(struct rsa_public_key *pub,
- struct rsa_private_key *priv,
- unsigned limit,
- unsigned length, const uint8_t * expr);
-
-
-/* Keys in PKCS#1 format. */
- struct asn1_der_iterator;
-
- int
- rsa_public_key_from_der_iterator(struct rsa_public_key *pub,
- unsigned limit,
- struct asn1_der_iterator *i);
-
- int
- rsa_private_key_from_der_iterator(struct rsa_public_key *pub,
- struct rsa_private_key *priv,
- unsigned limit,
- struct asn1_der_iterator *i);
-
-/* For public keys, use PRIV == NULL */
- int
- rsa_keypair_from_der(struct rsa_public_key *pub,
- struct rsa_private_key *priv,
- unsigned limit,
- unsigned length, const uint8_t * data);
-
-/* OpenPGP format. Experimental interface, subject to change. */
- int
- rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
- const struct rsa_public_key *pub,
- const struct rsa_private_key *priv,
- /* A single user id. NUL-terminated utf8. */
- const char *userid);
-
-/* Internal functions. */
- int
- _rsa_verify(const struct rsa_public_key *key,
- const mpz_t m, const mpz_t s);
-
- unsigned
- _rsa_check_size(mpz_t n);
-
- void
- _rsa_blind(const struct rsa_public_key *pub,
- void *random_ctx, nettle_random_func * random,
- mpz_t c, mpz_t ri);
- void
- _rsa_unblind(const struct rsa_public_key *pub, mpz_t c,
- const mpz_t ri);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_RSA_H_INCLUDED */
+++ /dev/null
-/* salsa20.h
- *
- * The Salsa20 stream cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2012 Simon Josefsson
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SALSA20_H_INCLUDED
-#define NETTLE_SALSA20_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define salsa20_set_key nettle_salsa20_set_key
-#define salsa20_set_iv nettle_salsa20_set_iv
-#define salsa20_crypt nettle_salsa20_crypt
-#define _salsa20_core _nettle_salsa20_core
-
-#define salsa20r12_crypt nettle_salsa20r12_crypt
-
-/* Minimum and maximum keysizes, and a reasonable default. In
- * octets.*/
-#define SALSA20_MIN_KEY_SIZE 16
-#define SALSA20_MAX_KEY_SIZE 32
-#define SALSA20_KEY_SIZE 32
-#define SALSA20_BLOCK_SIZE 64
-
-#define SALSA20_IV_SIZE 8
-
-#define _SALSA20_INPUT_LENGTH 16
-
- struct salsa20_ctx {
- /* Indices 1-4 and 11-14 holds the key (two identical copies for the
- shorter key size), indices 0, 5, 10, 15 are constant, indices 6, 7
- are the IV, and indices 8, 9 are the block counter:
-
- C K K K
- K C I I
- B B C K
- K K K C
- */
- uint32_t input[_SALSA20_INPUT_LENGTH];
- };
-
- void
- salsa20_set_key(struct salsa20_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- salsa20_set_iv(struct salsa20_ctx *ctx, const uint8_t * iv);
-
- void
- salsa20_crypt(struct salsa20_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
- void
- salsa20r12_crypt(struct salsa20_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
- void
- _salsa20_core(uint32_t * dst, const uint32_t * src,
- unsigned rounds);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SALSA20_H_INCLUDED */
+++ /dev/null
-/* serpent.h
- *
- * The serpent block cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/* Serpent is a 128-bit block cipher that accepts a key size of 256
- * bits, designed by Ross Anderson, Eli Biham, and Lars Knudsen. See
- * http://www.cl.cam.ac.uk/~rja14/serpent.html for details.
- */
-
-#ifndef NETTLE_SERPENT_H_INCLUDED
-#define NETTLE_SERPENT_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define serpent_set_key nettle_serpent_set_key
-#define serpent_encrypt nettle_serpent_encrypt
-#define serpent_decrypt nettle_serpent_decrypt
-
-#define SERPENT_BLOCK_SIZE 16
-
-/* Other key lengths are possible, but the design of Serpent makes
- * smaller key lengths quite pointless; they cheated with the AES
- * requirements, using a 256-bit key length exclusively and just
- * padding it out if the desired key length was less, so there really
- * is no advantage to using key lengths less than 256 bits. */
-#define SERPENT_KEY_SIZE 32
-
-/* Allow keys of size 128 <= bits <= 256 */
-
-#define SERPENT_MIN_KEY_SIZE 16
-#define SERPENT_MAX_KEY_SIZE 32
-
- struct serpent_ctx {
- uint32_t keys[33][4]; /* key schedule */
- };
-
- void
- serpent_set_key(struct serpent_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- serpent_encrypt(const struct serpent_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
- void
- serpent_decrypt(const struct serpent_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SERPENT_H_INCLUDED */
+++ /dev/null
-/* sexp.h
- *
- * Parsing s-expressions.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2002 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SEXP_H_INCLUDED
-#define NETTLE_SEXP_H_INCLUDED
-
-#include <stdarg.h>
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define sexp_iterator_first nettle_sexp_iterator_first
-#define sexp_transport_iterator_first nettle_sexp_transport_iterator_first
-#define sexp_iterator_next nettle_sexp_iterator_next
-#define sexp_iterator_enter_list nettle_sexp_iterator_enter_list
-#define sexp_iterator_exit_list nettle_sexp_iterator_exit_list
-#define sexp_iterator_subexpr nettle_sexp_iterator_subexpr
-#define sexp_iterator_get_uint32 nettle_sexp_iterator_get_uint32
-#define sexp_iterator_check_type nettle_sexp_iterator_check_type
-#define sexp_iterator_check_types nettle_sexp_iterator_check_types
-#define sexp_iterator_assoc nettle_sexp_iterator_assoc
-#define sexp_format nettle_sexp_format
-#define sexp_vformat nettle_sexp_vformat
-#define sexp_transport_format nettle_sexp_transport_format
-#define sexp_transport_vformat nettle_sexp_transport_vformat
-#define sexp_token_chars nettle_sexp_token_chars
-
- enum sexp_type { SEXP_ATOM, SEXP_LIST, SEXP_END };
-
- struct sexp_iterator {
- unsigned length;
- const uint8_t *buffer;
-
- /* Points at the start of the current sub expression. */
- unsigned start;
- /* If type is SEXP_LIST, pos points at the start of the current
- * element. Otherwise, it points at the end. */
- unsigned pos;
- unsigned level;
-
- enum sexp_type type;
-
- unsigned display_length;
- const uint8_t *display;
-
- unsigned atom_length;
- const uint8_t *atom;
- };
-
-
-/* All these functions return 1 on success, 0 on failure */
-
-/* Initializes the iterator. */
- int
- sexp_iterator_first(struct sexp_iterator *iterator,
- unsigned length, const uint8_t * input);
-
-/* NOTE: Decodes the input string in place */
- int
- sexp_transport_iterator_first(struct sexp_iterator *iterator,
- unsigned length, uint8_t * input);
-
- int
- sexp_iterator_next(struct sexp_iterator *iterator);
-
-/* Current element must be a list. */
- int
- sexp_iterator_enter_list(struct sexp_iterator *iterator);
-
-/* Skips the rest of the current list */
- int
- sexp_iterator_exit_list(struct sexp_iterator *iterator);
-
-#if 0
-/* Skips out of as many lists as necessary to get back to the given
- * level. */
- int
- sexp_iterator_exit_lists(struct sexp_iterator *iterator,
- unsigned level);
-#endif
-
-/* Gets start and length of the current subexpression. Implies
- * sexp_iterator_next. */
- const uint8_t *sexp_iterator_subexpr(struct sexp_iterator
- *iterator, unsigned *length);
-
- int
- sexp_iterator_get_uint32(struct sexp_iterator *iterator,
- uint32_t * x);
-\f
-
-/* Checks the type of the current expression, which should be a list
- *
- * (<type> ...)
- */
- int
- sexp_iterator_check_type(struct sexp_iterator *iterator,
- const uint8_t * type);
-
- const uint8_t *sexp_iterator_check_types(struct sexp_iterator
- *iterator,
- unsigned ntypes,
- const uint8_t *
- const *types);
-
-/* Current element must be a list. Looks up element of type
- *
- * (key rest...)
- *
- * For a matching key, the corresponding iterator is initialized
- * pointing at the start of REST.
- *
- * On success, exits the current list.
- */
- int
- sexp_iterator_assoc(struct sexp_iterator *iterator,
- unsigned nkeys,
- const uint8_t * const *keys,
- struct sexp_iterator *values);
-\f
-
-/* Output functions. What is a reasonable API for this? It seems
- * ugly to have to reimplement string streams. */
-
-/* Declared for real in buffer.h */
- struct nettle_buffer;
-
-/* Returns the number of output characters, or 0 on out of memory. If
- * buffer == NULL, just compute length.
- *
- * Format strings can contained matched parentheses, tokens ("foo" in
- * the format string is formatted as "3:foo"), whitespace (which
- * separates tokens but is otherwise ignored) and the following
- * formatting specifiers:
- *
- * %s String represented as unsigned length, const uint8_t *data.
- *
- * %t Optional display type, represented as
- * unsigned display_length, const uint8_t *display,
- * display == NULL means no display type.
- *
- * %i Non-negative small integer, uint32_t.
- *
- * %b Non-negative bignum, mpz_t.
- *
- * %l Literal string (no length added), typically a balanced
- * subexpression. Represented as unsigned length, const uint8_t
- * *data.
- *
- * %(, %) Allows insertion of unbalanced parenthesis.
- *
- * Modifiers:
- *
- * %0 For %s, %t and %l, says that there's no length argument,
- * instead the string is NUL-terminated, and there's only one
- * const uint8_t * argument.
- */
-
- unsigned
- sexp_format(struct nettle_buffer *buffer,
- const char *format, ...);
-
- unsigned
- sexp_vformat(struct nettle_buffer *buffer,
- const char *format, va_list args);
-
- unsigned
- sexp_transport_format(struct nettle_buffer *buffer,
- const char *format, ...);
-
- unsigned
- sexp_transport_vformat(struct nettle_buffer *buffer,
- const char *format, va_list args);
-
-/* Classification for advanced syntax. */
- extern const char
- sexp_token_chars[0x80];
-
-#define TOKEN_CHAR(c) ((c) < 0x80 && sexp_token_chars[(c)])
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SEXP_H_INCLUDED */
+++ /dev/null
-/* sha.h
- *
- * This file is deprecated, and provided only for backwards
- * compatibility with earlier versions of Nettle. Please use sha1.h
- * and/or sha2.h instead.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SHA_H_INCLUDED
-#define NETTLE_SHA_H_INCLUDED
-
-#include "sha1.h"
-#include "sha2.h"
-
-#endif /* NETTLE_SHA_H_INCLUDED */
+++ /dev/null
-/* sha1.h
- *
- * The sha1 hash function.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2012 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SHA1_H_INCLUDED
-#define NETTLE_SHA1_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define sha1_init nettle_sha1_init
-#define sha1_update nettle_sha1_update
-#define sha1_digest nettle_sha1_digest
-
-/* SHA1 */
-
-#define SHA1_DIGEST_SIZE 20
-#define SHA1_DATA_SIZE 64
-
-/* Digest is kept internally as 5 32-bit words. */
-#define _SHA1_DIGEST_LENGTH 5
-
- struct sha1_ctx {
- uint32_t state[_SHA1_DIGEST_LENGTH]; /* State variables */
- uint32_t count_low, count_high; /* 64-bit block count */
- uint8_t block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
- unsigned int index; /* index into buffer */
- };
-
- void
- sha1_init(struct sha1_ctx *ctx);
-
- void
- sha1_update(struct sha1_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha1_digest(struct sha1_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* Internal compression function. STATE points to 5 uint32_t words,
- and DATA points to 64 bytes of input data, possibly unaligned. */
- void
- _nettle_sha1_compress(uint32_t * state, const uint8_t * data);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SHA1_H_INCLUDED */
+++ /dev/null
-/* sha2.h
- *
- * The sha2 family of hash functions.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001, 2012 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SHA2_H_INCLUDED
-#define NETTLE_SHA2_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define sha224_init nettle_sha224_init
-#define sha224_digest nettle_sha224_digest
-#define sha256_init nettle_sha256_init
-#define sha256_update nettle_sha256_update
-#define sha256_digest nettle_sha256_digest
-#define sha384_init nettle_sha384_init
-#define sha384_digest nettle_sha384_digest
-#define sha512_init nettle_sha512_init
-#define sha512_update nettle_sha512_update
-#define sha512_digest nettle_sha512_digest
-
-/* SHA256 */
-
-#define SHA256_DIGEST_SIZE 32
-#define SHA256_DATA_SIZE 64
-
-/* Digest is kept internally as 8 32-bit words. */
-#define _SHA256_DIGEST_LENGTH 8
-
- struct sha256_ctx {
- uint32_t state[_SHA256_DIGEST_LENGTH]; /* State variables */
- uint32_t count_low, count_high; /* 64-bit block count */
- uint8_t block[SHA256_DATA_SIZE]; /* SHA256 data buffer */
- unsigned int index; /* index into buffer */
- };
-
- void
- sha256_init(struct sha256_ctx *ctx);
-
- void
- sha256_update(struct sha256_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha256_digest(struct sha256_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* Internal compression function. STATE points to 8 uint32_t words,
- DATA points to 64 bytes of input data, possibly unaligned, and K
- points to the table of constants. */
- void
- _nettle_sha256_compress(uint32_t * state, const uint8_t * data,
- const uint32_t * k);
-
-
-/* SHA224, a truncated SHA256 with different initial state. */
-
-#define SHA224_DIGEST_SIZE 28
-#define SHA224_DATA_SIZE SHA256_DATA_SIZE
-#define sha224_ctx sha256_ctx
-
- void
- sha224_init(struct sha256_ctx *ctx);
-
-#define sha224_update nettle_sha256_update
-
- void
- sha224_digest(struct sha256_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-/* SHA512 */
-
-#define SHA512_DIGEST_SIZE 64
-#define SHA512_DATA_SIZE 128
-
-/* Digest is kept internally as 8 64-bit words. */
-#define _SHA512_DIGEST_LENGTH 8
-
- struct sha512_ctx {
- uint64_t state[_SHA512_DIGEST_LENGTH]; /* State variables */
- uint64_t count_low, count_high; /* 128-bit block count */
- uint8_t block[SHA512_DATA_SIZE]; /* SHA512 data buffer */
- unsigned int index; /* index into buffer */
- };
-
- void
- sha512_init(struct sha512_ctx *ctx);
-
- void
- sha512_update(struct sha512_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha512_digest(struct sha512_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-/* Internal compression function. STATE points to 8 uint64_t words,
- DATA points to 128 bytes of input data, possibly unaligned, and K
- points to the table of constants. */
- void
- _nettle_sha512_compress(uint64_t * state, const uint8_t * data,
- const uint64_t * k);
-
-
-/* SHA384, a truncated SHA512 with different initial state. */
-
-#define SHA384_DIGEST_SIZE 48
-#define SHA384_DATA_SIZE SHA512_DATA_SIZE
-#define sha384_ctx sha512_ctx
-
- void
- sha384_init(struct sha512_ctx *ctx);
-
-#define sha384_update nettle_sha512_update
-
- void
- sha384_digest(struct sha512_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SHA2_H_INCLUDED */
+++ /dev/null
-/* sha3.h
- *
- * The sha3 hash function (aka Keccak).
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2012 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_SHA3_H_INCLUDED
-#define NETTLE_SHA3_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define sha3_permute nettle_sha3_permute
-#define _sha3_update _nettle_sha3_update
-#define _sha3_pad _nettle_sha3_pad
-#define sha3_224_init nettle_sha3_224_init
-#define sha3_224_update nettle_sha3_224_update
-#define sha3_224_digest nettle_sha3_224_digest
-#define sha3_256_init nettle_sha3_256_init
-#define sha3_256_update nettle_sha3_256_update
-#define sha3_256_digest nettle_sha3_256_digest
-#define sha3_384_init nettle_sha3_384_init
-#define sha3_384_update nettle_sha3_384_update
-#define sha3_384_digest nettle_sha3_384_digest
-#define sha3_512_init nettle_sha3_512_init
-#define sha3_512_update nettle_sha3_512_update
-#define sha3_512_digest nettle_sha3_512_digest
-
-/* The sha3 state is a 5x5 matrix of 64-bit words. In the notation of
- Keccak description, S[x,y] is element x + 5*y, so if x is
- interpreted as the row index and y the column index, it is stored
- in column-major order. */
-#define SHA3_STATE_LENGTH 25
-
-/* The "width" is 1600 bits or 200 octets */
- struct sha3_state {
- uint64_t a[SHA3_STATE_LENGTH];
- };
-
- void
- sha3_permute(struct sha3_state *state);
-
- unsigned
- _sha3_update(struct sha3_state *state,
- unsigned block_size, uint8_t * block,
- unsigned pos, unsigned length, const uint8_t * data);
- void
- _sha3_pad(struct sha3_state *state,
- unsigned block_size, uint8_t * block, unsigned pos);
-
-/* The "capacity" is set to 2*(digest size), 512 bits or 64 octets.
- The "rate" is the width - capacity, or width - 2 * (digest
- size). */
-
-#define SHA3_224_DIGEST_SIZE 28
-#define SHA3_224_DATA_SIZE 144
-
-#define SHA3_256_DIGEST_SIZE 32
-#define SHA3_256_DATA_SIZE 136
-
-#define SHA3_384_DIGEST_SIZE 48
-#define SHA3_384_DATA_SIZE 104
-
-#define SHA3_512_DIGEST_SIZE 64
-#define SHA3_512_DATA_SIZE 72
-
-
- struct sha3_224_ctx {
- struct sha3_state state;
- unsigned index;
- uint8_t block[SHA3_224_DATA_SIZE];
- };
-
- void
- sha3_224_init(struct sha3_224_ctx *ctx);
-
- void
- sha3_224_update(struct sha3_224_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha3_224_digest(struct sha3_224_ctx *ctx,
- unsigned length, uint8_t * digest);
-
- struct sha3_256_ctx {
- struct sha3_state state;
- unsigned index;
- uint8_t block[SHA3_256_DATA_SIZE];
- };
-
- void
- sha3_256_init(struct sha3_256_ctx *ctx);
-
- void
- sha3_256_update(struct sha3_256_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha3_256_digest(struct sha3_256_ctx *ctx,
- unsigned length, uint8_t * digest);
-
- struct sha3_384_ctx {
- struct sha3_state state;
- unsigned index;
- uint8_t block[SHA3_384_DATA_SIZE];
- };
-
- void
- sha3_384_init(struct sha3_384_ctx *ctx);
-
- void
- sha3_384_update(struct sha3_384_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha3_384_digest(struct sha3_384_ctx *ctx,
- unsigned length, uint8_t * digest);
-
- struct sha3_512_ctx {
- struct sha3_state state;
- unsigned index;
- uint8_t block[SHA3_512_DATA_SIZE];
- };
-
- void
- sha3_512_init(struct sha3_512_ctx *ctx);
-
- void
- sha3_512_update(struct sha3_512_ctx *ctx,
- unsigned length, const uint8_t * data);
-
- void
- sha3_512_digest(struct sha3_512_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_SHA3_H_INCLUDED */
+++ /dev/null
-/* twofish.h
- *
- * The twofish block cipher.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-/*
- * Twofish is a 128-bit block cipher that accepts a variable-length
- * key up to 256 bits, designed by Bruce Schneier and others. See
- * http://www.counterpane.com/twofish.html for details.
- */
-
-#ifndef NETTLE_TWOFISH_H_INCLUDED
-#define NETTLE_TWOFISH_H_INCLUDED
-
-#include "nettle-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define twofish_set_key nettle_twofish_set_key
-#define twofish_encrypt nettle_twofish_encrypt
-#define twofish_decrypt nettle_twofish_decrypt
-
-#define TWOFISH_BLOCK_SIZE 16
-
-/* Variable key size between 128 and 256 bits. But the only valid
- * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
-#define TWOFISH_MIN_KEY_SIZE 16
-#define TWOFISH_MAX_KEY_SIZE 32
-
-#define TWOFISH_KEY_SIZE 32
-
- struct twofish_ctx {
- uint32_t keys[40];
- uint32_t s_box[4][256];
- };
-
- void
- twofish_set_key(struct twofish_ctx *ctx,
- unsigned length, const uint8_t * key);
-
- void
- twofish_encrypt(const struct twofish_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
- void
- twofish_decrypt(const struct twofish_ctx *ctx,
- unsigned length, uint8_t * dst,
- const uint8_t * src);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_TWOFISH_H_INCLUDED */
+++ /dev/null
-/* umac.h
- *
- * UMAC message authentication code (RFC-4418).
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2013 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_UMAC_H_INCLUDED
-#define NETTLE_UMAC_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Namespace mangling */
-#define umac32_set_key nettle_umac32_set_key
-#define umac64_set_key nettle_umac64_set_key
-#define umac96_set_key nettle_umac96_set_key
-#define umac128_set_key nettle_umac128_set_key
-#define umac32_set_nonce nettle_umac32_set_nonce
-#define umac64_set_nonce nettle_umac64_set_nonce
-#define umac96_set_nonce nettle_umac96_set_nonce
-#define umac128_set_nonce nettle_umac128_set_nonce
-#define umac32_update nettle_umac32_update
-#define umac64_update nettle_umac64_update
-#define umac96_update nettle_umac96_update
-#define umac128_update nettle_umac128_update
-#define umac32_digest nettle_umac32_digest
-#define umac64_digest nettle_umac64_digest
-#define umac96_digest nettle_umac96_digest
-#define umac128_digest nettle_umac128_digest
-#define _umac_set_key _nettle_umac_set_key
-#define _umac_nh _nettle_umac_nh
-#define _umac_nh_n _nettle_umac_nh_n
-#define _umac_poly64 _nettle_umac_poly64
-#define _umac_poly128 _nettle_umac_poly128
-#define _umac_l2_init _nettle_umac_l2_init
-#define _umac_l2 _nettle_umac_l2
-#define _umac_l2_final _nettle_umac_l2_final
-#define _umac_l3_init _nettle_umac_l3_init
-#define _umac_l3 _nettle_umac_l3
-
-#include "nettle-types.h"
-#include "aes.h"
-
-#define UMAC_KEY_SIZE 16
-#define UMAC32_DIGEST_SIZE 4
-#define UMAC64_DIGEST_SIZE 8
-#define UMAC96_DIGEST_SIZE 12
-#define UMAC128_DIGEST_SIZE 16
-#define UMAC_DATA_SIZE 1024
-
-/* Subkeys and state for UMAC with tag size 32*n bits. */
-#define _UMAC_STATE(n) \
- uint32_t l1_key[UMAC_DATA_SIZE/4 + 4*((n)-1)]; \
- /* Keys in 32-bit pieces, high first */ \
- uint32_t l2_key[6*(n)]; \
- uint64_t l3_key1[8*(n)]; \
- uint32_t l3_key2[(n)]; \
- /* AES cipher for encrypting the nonce */ \
- struct aes_ctx pdf_key; \
- /* The l2_state consists of 2*n uint64_t, for poly64 \
- and poly128 hashing, followed by n additional \
- uint64_t used as an input buffer. */ \
- uint64_t l2_state[3*(n)]; \
- /* Input to the pdf_key, zero-padded and low bits \
- cleared if appropriate. */ \
- uint8_t nonce[AES_BLOCK_SIZE]; \
- unsigned short nonce_length /* For incrementing */
-
- /* Buffering */
-#define _UMAC_BUFFER \
- unsigned index; \
- /* Complete blocks processed */ \
- uint64_t count; \
- uint8_t block[UMAC_DATA_SIZE]
-
-#define _UMAC_NONCE_CACHED 0x80
-
- struct umac32_ctx {
- _UMAC_STATE(1);
- /* Low bits and cache flag. */
- unsigned short nonce_low;
- /* Previous padding block */
- uint32_t pad_cache[AES_BLOCK_SIZE / 4];
- _UMAC_BUFFER;
- };
-
- struct umac64_ctx {
- _UMAC_STATE(2);
- /* Low bit and cache flag. */
- unsigned short nonce_low;
- /* Previous padding block */
- uint32_t pad_cache[AES_BLOCK_SIZE / 4];
- _UMAC_BUFFER;
- };
-
- struct umac96_ctx {
- _UMAC_STATE(3);
- _UMAC_BUFFER;
- };
-
- struct umac128_ctx {
- _UMAC_STATE(4);
- _UMAC_BUFFER;
- };
-
-/* The _set_key function initialize the nonce to zero. */
- void
- umac32_set_key(struct umac32_ctx *ctx, const uint8_t * key);
- void
- umac64_set_key(struct umac64_ctx *ctx, const uint8_t * key);
- void
- umac96_set_key(struct umac96_ctx *ctx, const uint8_t * key);
- void
- umac128_set_key(struct umac128_ctx *ctx, const uint8_t * key);
-
-/* Optional, if not used, messages get incrementing nonces starting from zero. */
- void
- umac32_set_nonce(struct umac32_ctx *ctx,
- unsigned nonce_length, const uint8_t * nonce);
- void
- umac64_set_nonce(struct umac64_ctx *ctx,
- unsigned nonce_length, const uint8_t * nonce);
- void
- umac96_set_nonce(struct umac96_ctx *ctx,
- unsigned nonce_length, const uint8_t * nonce);
- void
- umac128_set_nonce(struct umac128_ctx *ctx,
- unsigned nonce_length, const uint8_t * nonce);
-
- void
- umac32_update(struct umac32_ctx *ctx,
- unsigned length, const uint8_t * data);
- void
- umac64_update(struct umac64_ctx *ctx,
- unsigned length, const uint8_t * data);
- void
- umac96_update(struct umac96_ctx *ctx,
- unsigned length, const uint8_t * data);
- void
- umac128_update(struct umac128_ctx *ctx,
- unsigned length, const uint8_t * data);
-
-/* The _digest functions increment the nonce */
- void
- umac32_digest(struct umac32_ctx *ctx,
- unsigned length, uint8_t * digest);
- void
- umac64_digest(struct umac64_ctx *ctx,
- unsigned length, uint8_t * digest);
- void
- umac96_digest(struct umac96_ctx *ctx,
- unsigned length, uint8_t * digest);
- void
- umac128_digest(struct umac128_ctx *ctx,
- unsigned length, uint8_t * digest);
-
-
-/* Internal functions */
-#define UMAC_POLY64_BLOCKS 16384
-
-#define UMAC_P64_OFFSET 59
-#define UMAC_P64 (- (uint64_t) UMAC_P64_OFFSET)
-
-#define UMAC_P128_OFFSET 159
-#define UMAC_P128_HI (~(uint64_t) 0)
-#define UMAC_P128_LO (-(uint64_t) UMAC_P128_OFFSET)
-
- void
- _umac_set_key(uint32_t * l1_key, uint32_t * l2_key,
- uint64_t * l3_key1, uint32_t * l3_key2,
- struct aes_ctx *pad, const uint8_t * key,
- unsigned n);
-
- uint64_t
- _umac_nh(const uint32_t * key, unsigned length,
- const uint8_t * msg);
-
-/* Equivalent to
-
- for (i = 0; i < n; i++)
- out[i] = _umac_nh (key + 4*i, length, msg);
-
- but processing input only once.
-*/
- void
- _umac_nh_n(uint64_t * out, unsigned n, const uint32_t * key,
- unsigned length, const uint8_t * msg);
-
-/* Returns y*k + m (mod p), including "marker" processing. Return
- value is *not* in canonical representation, and must be normalized
- before the output is used. */
- uint64_t
- _umac_poly64(uint32_t kh, uint32_t kl, uint64_t y, uint64_t m);
-
- void
- _umac_poly128(const uint32_t * k, uint64_t * y, uint64_t mh,
- uint64_t ml);
-
- void
- _umac_l2_init(unsigned size, uint32_t * k);
-
- void
- _umac_l2(const uint32_t * key, uint64_t * state, unsigned n,
- uint64_t count, const uint64_t * m);
-
- void
- _umac_l2_final(const uint32_t * key, uint64_t * state, unsigned n,
- uint64_t count);
-
- void
- _umac_l3_init(unsigned size, uint64_t * k);
-
- uint32_t _umac_l3(const uint64_t * key, const uint64_t * m);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_UMAC_H_INCLUDED */
+++ /dev/null
-/* yarrow.h
- *
- * The yarrow pseudo-randomness generator.
- */
-
-/* nettle, low-level cryptographics library
- *
- * Copyright (C) 2001 Niels Möller
- *
- * The nettle library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
- *
- * The nettle library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with the nettle library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02111-1301, USA.
- */
-
-#ifndef NETTLE_YARROW_H_INCLUDED
-#define NETTLE_YARROW_H_INCLUDED
-
-#include "aes.h"
-#include "sha2.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Name mangling */
-#define yarrow256_init nettle_yarrow256_init
-#define yarrow256_seed nettle_yarrow256_seed
-#define yarrow256_update nettle_yarrow256_update
-#define yarrow256_random nettle_yarrow256_random
-#define yarrow256_is_seeded nettle_yarrow256_is_seeded
-#define yarrow256_needed_sources nettle_yarrow256_needed_sources
-#define yarrow256_fast_reseed nettle_yarrow256_fast_reseed
-#define yarrow256_slow_reseed nettle_yarrow256_slow_reseed
-#define yarrow_key_event_init nettle_yarrow_key_event_init
-#define yarrow_key_event_estimate nettle_yarrow_key_event_estimate
-
-/* Obsolete alias for backwards compatibility. Will be deleted in some
- later version. */
-#define yarrow256_force_reseed yarrow256_slow_reseed
-
- enum yarrow_pool_id { YARROW_FAST = 0, YARROW_SLOW = 1 };
-
- struct yarrow_source {
- /* Indexed by yarrow_pool_id */
- uint32_t estimate[2];
-
- /* The pool next sample should go to. */
- enum yarrow_pool_id next;
- };
-
-
-#define YARROW256_SEED_FILE_SIZE (2 * AES_BLOCK_SIZE)
-
-/* Yarrow-256, based on SHA-256 and AES-256 */
- struct yarrow256_ctx {
- /* Indexed by yarrow_pool_id */
- struct sha256_ctx pools[2];
-
- int seeded;
-
- /* The current key and counter block */
- struct aes_ctx key;
- uint8_t counter[AES_BLOCK_SIZE];
-
- /* The entropy sources */
- unsigned nsources;
- struct yarrow_source *sources;
- };
-
- void
- yarrow256_init(struct yarrow256_ctx *ctx,
- unsigned nsources, struct yarrow_source *sources);
-
- void
- yarrow256_seed(struct yarrow256_ctx *ctx,
- unsigned length, const uint8_t * seed_file);
-
-/* Returns 1 on reseed */
- int
- yarrow256_update(struct yarrow256_ctx *ctx,
- unsigned source, unsigned entropy,
- unsigned length, const uint8_t * data);
-
- void
- yarrow256_random(struct yarrow256_ctx *ctx, unsigned length,
- uint8_t * dst);
-
- int
- yarrow256_is_seeded(struct yarrow256_ctx *ctx);
-
- unsigned
- yarrow256_needed_sources(struct yarrow256_ctx *ctx);
-
- void
- yarrow256_fast_reseed(struct yarrow256_ctx *ctx);
-
- void
- yarrow256_slow_reseed(struct yarrow256_ctx *ctx);
-
-
-/* Key event estimator */
-#define YARROW_KEY_EVENT_BUFFER 16
-
- struct yarrow_key_event_ctx {
- /* Counter for initial priming of the state */
- unsigned index;
- unsigned chars[YARROW_KEY_EVENT_BUFFER];
- unsigned previous;
- };
-
- void
- yarrow_key_event_init(struct yarrow_key_event_ctx *ctx);
-
- unsigned
- yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx,
- unsigned key, unsigned time);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* NETTLE_YARROW_H_INCLUDED */
+++ /dev/null
-/*
- * Copyright (c) 2013 Red Hat Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Author: Stef Walter <stefw@redhat.com>
- */
-
-#ifndef __P11_KIT_DEPRECATED_H__
-#define __P11_KIT_DEPRECATED_H__
-
-#ifndef __P11_KIT_H__
-#error "Please include <p11-kit/p11-kit.h> instead of this file."
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef P11_KIT_NO_DEPRECATIONS
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define P11_KIT_DEPRECATED_FOR(f) __attribute__((deprecated("Use " #f " instead")))
-#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-#define P11_KIT_DEPRECATED_FOR(f) __attribute__((__deprecated__))
-#endif
-#endif
-
-#ifndef P11_KIT_DEPRECATED_FOR
-#define P11_KIT_DEPRECATED_FOR(f)
-#endif
-
-#ifndef P11_KIT_DISABLE_DEPRECATED
-
-P11_KIT_DEPRECATED_FOR (p11_kit_modules_load)
-CK_RV p11_kit_initialize_registered (void);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_modules_release)
-CK_RV p11_kit_finalize_registered (void);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_modules_release)
-CK_FUNCTION_LIST_PTR * p11_kit_registered_modules (void);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_module_for_name)
-CK_FUNCTION_LIST_PTR p11_kit_registered_name_to_module (const char *name);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_module_get_name)
-char * p11_kit_registered_module_to_name (CK_FUNCTION_LIST_PTR module);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_config_option)
-char * p11_kit_registered_option (CK_FUNCTION_LIST_PTR module,
- const char *field);
-
-P11_KIT_DEPRECATED_FOR (module->C_Initialize)
-CK_RV p11_kit_initialize_module (CK_FUNCTION_LIST_PTR module);
-
-P11_KIT_DEPRECATED_FOR (module->C_Finalize)
-CK_RV p11_kit_finalize_module (CK_FUNCTION_LIST_PTR module);
-
-P11_KIT_DEPRECATED_FOR (p11_kit_module_load)
-CK_RV p11_kit_load_initialize_module (const char *module_path,
- CK_FUNCTION_LIST_PTR *module);
-
-#endif /* P11_KIT_DISABLE_DEPRECATED */
-
-#undef P11_KIT_DEPRECATED_FOR
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* __P11_KIT_DEPRECATED_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2013 Red Hat, Inc
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Author: Stef Walter <stefw@redhat.com>
- */
-
-#ifndef P11_KIT_ITER_H
-#define P11_KIT_ITER_H
-
-#include "p11-kit/p11-kit.h"
-#include "p11-kit/pkcs11.h"
-#include "p11-kit/uri.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef P11_KIT_FUTURE_UNSTABLE_API
-
-typedef struct p11_kit_iter P11KitIter;
-typedef P11KitIter p11_kit_iter;
-
-typedef enum {
- P11_KIT_ITER_BUSY_SESSIONS = 1 << 1,
- P11_KIT_ITER_WANT_WRITABLE = 1 << 2,
-} P11KitIterBehavior;
-
-typedef CK_RV (* p11_kit_iter_callback) (P11KitIter *iter,
- CK_BBOOL *matches,
- void *data);
-
-P11KitIter * p11_kit_iter_new (P11KitUri *uri,
- P11KitIterBehavior behavior);
-
-void p11_kit_iter_free (P11KitIter *iter);
-
-void p11_kit_iter_add_callback (P11KitIter *iter,
- p11_kit_iter_callback callback,
- void *callback_data,
- p11_kit_destroyer callback_destroy);
-
-void p11_kit_iter_add_filter (P11KitIter *iter,
- CK_ATTRIBUTE *matching,
- CK_ULONG count);
-
-void p11_kit_iter_set_uri (P11KitIter *iter,
- P11KitUri *uri);
-
-void p11_kit_iter_begin (P11KitIter *iter,
- CK_FUNCTION_LIST_PTR *modules);
-
-void p11_kit_iter_begin_with (P11KitIter *iter,
- CK_FUNCTION_LIST_PTR module,
- CK_SLOT_ID slot,
- CK_SESSION_HANDLE session);
-
-CK_RV p11_kit_iter_next (P11KitIter *iter);
-
-CK_FUNCTION_LIST_PTR p11_kit_iter_get_module (P11KitIter *iter);
-
-CK_SLOT_ID p11_kit_iter_get_slot (P11KitIter *iter);
-
-CK_TOKEN_INFO * p11_kit_iter_get_token (P11KitIter *iter);
-
-CK_SESSION_HANDLE p11_kit_iter_get_session (P11KitIter *iter);
-
-CK_OBJECT_HANDLE p11_kit_iter_get_object (P11KitIter *iter);
-
-CK_RV p11_kit_iter_get_attributes (P11KitIter *iter,
- CK_ATTRIBUTE *template,
- CK_ULONG count);
-
-CK_RV p11_kit_iter_load_attributes (P11KitIter *iter,
- CK_ATTRIBUTE *template,
- CK_ULONG count);
-
-CK_SESSION_HANDLE p11_kit_iter_keep_session (P11KitIter *iter);
-
-CK_RV p11_kit_iter_destroy_object (P11KitIter *iter);
-
-#endif /* P11_KIT_FUTURE_UNSTABLE_API */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* P11_KIT_ITER_H */
+++ /dev/null
-/*
- * Copyright (c) 2011 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Author: Stef Walter <stefw@collabora.co.uk>
- */
-
-#ifndef __P11_KIT_H__
-#define __P11_KIT_H__
-
-#include "p11-kit/pkcs11.h"
-
-/*
- * If the caller is using the PKCS#11 GNU calling convention, then we cater
- * to that here.
- */
-#ifdef CRYPTOKI_GNU
-typedef ck_rv_t CK_RV;
-typedef struct ck_function_list* CK_FUNCTION_LIST_PTR;
-typedef struct ck_function_list CK_FUNCTION_LIST;
-#endif
-
-#include "p11-kit/deprecated.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- P11_KIT_MODULE_UNMANAGED = 1 << 0,
- P11_KIT_MODULE_CRITICAL = 1 << 1,
- P11_KIT_MODULE_TRUSTED = 1 << 2,
-};
-
-typedef void (* p11_kit_destroyer) (void *data);
-
-CK_FUNCTION_LIST ** p11_kit_modules_load (const char *reserved,
- int flags);
-
-CK_RV p11_kit_modules_initialize (CK_FUNCTION_LIST **modules,
- p11_kit_destroyer failure_callback);
-
-CK_FUNCTION_LIST ** p11_kit_modules_load_and_initialize (int flags);
-
-CK_RV p11_kit_modules_finalize (CK_FUNCTION_LIST **modules);
-
-void p11_kit_modules_release (CK_FUNCTION_LIST **modules);
-
-void p11_kit_modules_finalize_and_release (CK_FUNCTION_LIST **modules);
-
-CK_FUNCTION_LIST * p11_kit_module_for_name (CK_FUNCTION_LIST **modules,
- const char *name);
-
-char * p11_kit_module_get_name (CK_FUNCTION_LIST *module);
-
-int p11_kit_module_get_flags (CK_FUNCTION_LIST *module);
-
-CK_FUNCTION_LIST * p11_kit_module_load (const char *module_path,
- int flags);
-
-CK_RV p11_kit_module_initialize (CK_FUNCTION_LIST *module);
-
-CK_RV p11_kit_module_finalize (CK_FUNCTION_LIST *module);
-
-void p11_kit_module_release (CK_FUNCTION_LIST *module);
-
-char * p11_kit_config_option (CK_FUNCTION_LIST *module,
- const char *option);
-
-const char* p11_kit_strerror (CK_RV rv);
-
-size_t p11_kit_space_strlen (const unsigned char *string,
- size_t max_length);
-
-char* p11_kit_space_strdup (const unsigned char *string,
- size_t max_length);
-
-#ifdef P11_KIT_FUTURE_UNSTABLE_API
-
-void p11_kit_set_progname (const char *progname);
-
-void p11_kit_be_quiet (void);
-
-void p11_kit_be_loud (void);
-
-#endif
-
-const char * p11_kit_message (void);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* __P11_KIT_H__ */
+++ /dev/null
-/*
- * Copyright (c) 2011 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Author: Stef Walter <stefw@collabora.co.uk>
- */
-
-#ifndef P11_KIT_PIN_H
-#define P11_KIT_PIN_H
-
-#include <p11-kit/uri.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct p11_kit_pin P11KitPin;
-
-typedef enum {
- P11_KIT_PIN_FLAGS_USER_LOGIN = 1<<0,
- P11_KIT_PIN_FLAGS_SO_LOGIN = 1<<1,
- P11_KIT_PIN_FLAGS_CONTEXT_LOGIN = 1<<2,
- P11_KIT_PIN_FLAGS_RETRY = 1<<3,
- P11_KIT_PIN_FLAGS_MANY_TRIES = 1<<4,
- P11_KIT_PIN_FLAGS_FINAL_TRY = 1<<5
-} P11KitPinFlags;
-
-#define P11_KIT_PIN_FALLBACK ""
-
-typedef void (*p11_kit_pin_destroy_func) (void *data);
-
-P11KitPin* p11_kit_pin_new (const unsigned char *value,
- size_t length);
-
-P11KitPin* p11_kit_pin_new_for_string (const char *value);
-
-P11KitPin* p11_kit_pin_new_for_buffer (unsigned char *buffer,
- size_t length,
- p11_kit_pin_destroy_func destroy);
-
-P11KitPin* p11_kit_pin_ref (P11KitPin *pin);
-
-void p11_kit_pin_unref (P11KitPin *pin);
-
-const unsigned char * p11_kit_pin_get_value (P11KitPin *pin,
- size_t *length);
-
-size_t p11_kit_pin_get_length (P11KitPin *pin);
-
-typedef P11KitPin* (*p11_kit_pin_callback) (const char *pin_source,
- P11KitUri *pin_uri,
- const char *pin_description,
- P11KitPinFlags pin_flags,
- void *callback_data);
-
-int p11_kit_pin_register_callback (const char *pin_source,
- p11_kit_pin_callback callback,
- void *callback_data,
- p11_kit_pin_destroy_func callback_destroy);
-
-void p11_kit_pin_unregister_callback (const char *pin_source,
- p11_kit_pin_callback callback,
- void *callback_data);
-
-P11KitPin* p11_kit_pin_request (const char *pin_source,
- P11KitUri *pin_uri,
- const char *pin_description,
- P11KitPinFlags pin_flags);
-
-P11KitPin* p11_kit_pin_file_callback (const char *pin_source,
- P11KitUri *pin_uri,
- const char *pin_description,
- P11KitPinFlags pin_flags,
- void *callback_data);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* P11_KIT_URI_H */
+++ /dev/null
-/* pkcs11.h
- Copyright 2006, 2007 g10 Code GmbH
- Copyright 2006 Andreas Jellinghaus
-
- This file is free software; as a special exception the author gives
- unlimited permission to copy and/or distribute it, with or without
- modifications, as long as this notice is preserved.
-
- This file is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, to the extent permitted by law; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. */
-
-/* Please submit changes back to the Scute project at
- http://www.scute.org/ (or send them to marcus@g10code.com), so that
- they can be picked up by other projects from there as well. */
-
-/* This file is a modified implementation of the PKCS #11 standard by
- RSA Security Inc. It is mostly a drop-in replacement, with the
- following change:
-
- This header file does not require any macro definitions by the user
- (like CK_DEFINE_FUNCTION etc). In fact, it defines those macros
- for you (if useful, some are missing, let me know if you need
- more).
-
- There is an additional API available that does comply better to the
- GNU coding standard. It can be switched on by defining
- CRYPTOKI_GNU before including this header file. For this, the
- following changes are made to the specification:
-
- All structure types are changed to a "struct ck_foo" where CK_FOO
- is the type name in PKCS #11.
-
- All non-structure types are changed to ck_foo_t where CK_FOO is the
- lowercase version of the type name in PKCS #11. The basic types
- (CK_ULONG et al.) are removed without substitute.
-
- All members of structures are modified in the following way: Type
- indication prefixes are removed, and underscore characters are
- inserted before words. Then the result is lowercased.
-
- Note that function names are still in the original case, as they
- need for ABI compatibility.
-
- CK_FALSE, CK_TRUE and NULL_PTR are removed without substitute. Use
- <stdbool.h>.
-
- If CRYPTOKI_COMPAT is defined before including this header file,
- then none of the API changes above take place, and the API is the
- one defined by the PKCS #11 standard. */
-
-#ifndef PKCS11_H
-#define PKCS11_H 1
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-
-/* The version of cryptoki we implement. The revision is changed with
- each modification of this file. If you do not use the "official"
- version of this file, please consider deleting the revision macro
- (you may use a macro with a different name to keep track of your
- versions). */
-#define CRYPTOKI_VERSION_MAJOR 2
-#define CRYPTOKI_VERSION_MINOR 20
-#define CRYPTOKI_VERSION_REVISION 6
-
-
-/* Compatibility interface is default, unless CRYPTOKI_GNU is
- given. */
-#ifndef CRYPTOKI_GNU
-#ifndef CRYPTOKI_COMPAT
-#define CRYPTOKI_COMPAT 1
-#endif
-#endif
-
-/* System dependencies. */
-
-#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
-
-/* There is a matching pop below. */
-#pragma pack(push, cryptoki, 1)
-
-#ifdef CRYPTOKI_EXPORTS
-#define CK_SPEC __declspec(dllexport)
-#else
-#define CK_SPEC __declspec(dllimport)
-#endif
-
-#else
-
-#define CK_SPEC
-
-#endif
-
-
-#ifdef CRYPTOKI_COMPAT
- /* If we are in compatibility mode, switch all exposed names to the
- PKCS #11 variant. There are corresponding #undefs below. */
-
-#define ck_flags_t CK_FLAGS
-#define ck_version _CK_VERSION
-
-#define ck_info _CK_INFO
-#define cryptoki_version cryptokiVersion
-#define manufacturer_id manufacturerID
-#define library_description libraryDescription
-#define library_version libraryVersion
-
-#define ck_notification_t CK_NOTIFICATION
-#define ck_slot_id_t CK_SLOT_ID
-
-#define ck_slot_info _CK_SLOT_INFO
-#define slot_description slotDescription
-#define hardware_version hardwareVersion
-#define firmware_version firmwareVersion
-
-#define ck_token_info _CK_TOKEN_INFO
-#define serial_number serialNumber
-#define max_session_count ulMaxSessionCount
-#define session_count ulSessionCount
-#define max_rw_session_count ulMaxRwSessionCount
-#define rw_session_count ulRwSessionCount
-#define max_pin_len ulMaxPinLen
-#define min_pin_len ulMinPinLen
-#define total_public_memory ulTotalPublicMemory
-#define free_public_memory ulFreePublicMemory
-#define total_private_memory ulTotalPrivateMemory
-#define free_private_memory ulFreePrivateMemory
-#define utc_time utcTime
-
-#define ck_session_handle_t CK_SESSION_HANDLE
-#define ck_user_type_t CK_USER_TYPE
-#define ck_state_t CK_STATE
-
-#define ck_session_info _CK_SESSION_INFO
-#define slot_id slotID
-#define device_error ulDeviceError
-
-#define ck_object_handle_t CK_OBJECT_HANDLE
-#define ck_object_class_t CK_OBJECT_CLASS
-#define ck_hw_feature_type_t CK_HW_FEATURE_TYPE
-#define ck_key_type_t CK_KEY_TYPE
-#define ck_certificate_type_t CK_CERTIFICATE_TYPE
-#define ck_attribute_type_t CK_ATTRIBUTE_TYPE
-
-#define ck_attribute _CK_ATTRIBUTE
-#define value pValue
-#define value_len ulValueLen
-
-#define ck_date _CK_DATE
-
-#define ck_mechanism_type_t CK_MECHANISM_TYPE
-
-#define ck_mechanism _CK_MECHANISM
-#define parameter pParameter
-#define parameter_len ulParameterLen
-
-#define ck_mechanism_info _CK_MECHANISM_INFO
-#define min_key_size ulMinKeySize
-#define max_key_size ulMaxKeySize
-
-#define ck_rv_t CK_RV
-#define ck_notify_t CK_NOTIFY
-
-#define ck_function_list _CK_FUNCTION_LIST
-
-#define ck_createmutex_t CK_CREATEMUTEX
-#define ck_destroymutex_t CK_DESTROYMUTEX
-#define ck_lockmutex_t CK_LOCKMUTEX
-#define ck_unlockmutex_t CK_UNLOCKMUTEX
-
-#define ck_c_initialize_args _CK_C_INITIALIZE_ARGS
-#define create_mutex CreateMutex
-#define destroy_mutex DestroyMutex
-#define lock_mutex LockMutex
-#define unlock_mutex UnlockMutex
-#define reserved pReserved
-
-#endif /* CRYPTOKI_COMPAT */
-
-
-
-typedef unsigned long ck_flags_t;
-
-struct ck_version
-{
- unsigned char major;
- unsigned char minor;
-};
-
-
-struct ck_info
-{
- struct ck_version cryptoki_version;
- unsigned char manufacturer_id[32];
- ck_flags_t flags;
- unsigned char library_description[32];
- struct ck_version library_version;
-};
-
-
-typedef unsigned long ck_notification_t;
-
-#define CKN_SURRENDER (0UL)
-
-
-typedef unsigned long ck_slot_id_t;
-
-
-struct ck_slot_info
-{
- unsigned char slot_description[64];
- unsigned char manufacturer_id[32];
- ck_flags_t flags;
- struct ck_version hardware_version;
- struct ck_version firmware_version;
-};
-
-
-#define CKF_TOKEN_PRESENT (1UL << 0)
-#define CKF_REMOVABLE_DEVICE (1UL << 1)
-#define CKF_HW_SLOT (1UL << 2)
-#define CKF_ARRAY_ATTRIBUTE (1UL << 30)
-
-
-struct ck_token_info
-{
- unsigned char label[32];
- unsigned char manufacturer_id[32];
- unsigned char model[16];
- unsigned char serial_number[16];
- ck_flags_t flags;
- unsigned long max_session_count;
- unsigned long session_count;
- unsigned long max_rw_session_count;
- unsigned long rw_session_count;
- unsigned long max_pin_len;
- unsigned long min_pin_len;
- unsigned long total_public_memory;
- unsigned long free_public_memory;
- unsigned long total_private_memory;
- unsigned long free_private_memory;
- struct ck_version hardware_version;
- struct ck_version firmware_version;
- unsigned char utc_time[16];
-};
-
-
-#define CKF_RNG (1UL << 0)
-#define CKF_WRITE_PROTECTED (1UL << 1)
-#define CKF_LOGIN_REQUIRED (1UL << 2)
-#define CKF_USER_PIN_INITIALIZED (1UL << 3)
-#define CKF_RESTORE_KEY_NOT_NEEDED (1UL << 5)
-#define CKF_CLOCK_ON_TOKEN (1UL << 6)
-#define CKF_PROTECTED_AUTHENTICATION_PATH (1UL << 8)
-#define CKF_DUAL_CRYPTO_OPERATIONS (1UL << 9)
-#define CKF_TOKEN_INITIALIZED (1UL << 10)
-#define CKF_SECONDARY_AUTHENTICATION (1UL << 11)
-#define CKF_USER_PIN_COUNT_LOW (1UL << 16)
-#define CKF_USER_PIN_FINAL_TRY (1UL << 17)
-#define CKF_USER_PIN_LOCKED (1UL << 18)
-#define CKF_USER_PIN_TO_BE_CHANGED (1UL << 19)
-#define CKF_SO_PIN_COUNT_LOW (1UL << 20)
-#define CKF_SO_PIN_FINAL_TRY (1UL << 21)
-#define CKF_SO_PIN_LOCKED (1UL << 22)
-#define CKF_SO_PIN_TO_BE_CHANGED (1UL << 23)
-
-#define CK_UNAVAILABLE_INFORMATION ((unsigned long)-1L)
-#define CK_EFFECTIVELY_INFINITE (0UL)
-
-
-typedef unsigned long ck_session_handle_t;
-
-#define CK_INVALID_HANDLE (0UL)
-
-
-typedef unsigned long ck_user_type_t;
-
-#define CKU_SO (0UL)
-#define CKU_USER (1UL)
-#define CKU_CONTEXT_SPECIFIC (2UL)
-
-
-typedef unsigned long ck_state_t;
-
-#define CKS_RO_PUBLIC_SESSION (0UL)
-#define CKS_RO_USER_FUNCTIONS (1UL)
-#define CKS_RW_PUBLIC_SESSION (2UL)
-#define CKS_RW_USER_FUNCTIONS (3UL)
-#define CKS_RW_SO_FUNCTIONS (4UL)
-
-
-struct ck_session_info
-{
- ck_slot_id_t slot_id;
- ck_state_t state;
- ck_flags_t flags;
- unsigned long device_error;
-};
-
-#define CKF_RW_SESSION (1UL << 1)
-#define CKF_SERIAL_SESSION (1UL << 2)
-
-
-typedef unsigned long ck_object_handle_t;
-
-
-typedef unsigned long ck_object_class_t;
-
-#define CKO_DATA (0UL)
-#define CKO_CERTIFICATE (1UL)
-#define CKO_PUBLIC_KEY (2UL)
-#define CKO_PRIVATE_KEY (3UL)
-#define CKO_SECRET_KEY (4UL)
-#define CKO_HW_FEATURE (5UL)
-#define CKO_DOMAIN_PARAMETERS (6UL)
-#define CKO_MECHANISM (7UL)
-#define CKO_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-typedef unsigned long ck_hw_feature_type_t;
-
-#define CKH_MONOTONIC_COUNTER (1UL)
-#define CKH_CLOCK (2UL)
-#define CKH_USER_INTERFACE (3UL)
-#define CKH_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-typedef unsigned long ck_key_type_t;
-
-#define CKK_RSA (0UL)
-#define CKK_DSA (1UL)
-#define CKK_DH (2UL)
-#define CKK_ECDSA (3UL)
-#define CKK_EC (3UL)
-#define CKK_X9_42_DH (4UL)
-#define CKK_KEA (5UL)
-#define CKK_GENERIC_SECRET (0x10UL)
-#define CKK_RC2 (0x11UL)
-#define CKK_RC4 (0x12UL)
-#define CKK_DES (0x13UL)
-#define CKK_DES2 (0x14UL)
-#define CKK_DES3 (0x15UL)
-#define CKK_CAST (0x16UL)
-#define CKK_CAST3 (0x17UL)
-#define CKK_CAST128 (0x18UL)
-#define CKK_RC5 (0x19UL)
-#define CKK_IDEA (0x1aUL)
-#define CKK_SKIPJACK (0x1bUL)
-#define CKK_BATON (0x1cUL)
-#define CKK_JUNIPER (0x1dUL)
-#define CKK_CDMF (0x1eUL)
-#define CKK_AES (0x1fUL)
-#define CKK_BLOWFISH (0x20UL)
-#define CKK_TWOFISH (0x21UL)
-#define CKK_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-typedef unsigned long ck_certificate_type_t;
-
-#define CKC_X_509 (0UL)
-#define CKC_X_509_ATTR_CERT (1UL)
-#define CKC_WTLS (2UL)
-#define CKC_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-typedef unsigned long ck_attribute_type_t;
-
-#define CKA_CLASS (0UL)
-#define CKA_TOKEN (1UL)
-#define CKA_PRIVATE (2UL)
-#define CKA_LABEL (3UL)
-#define CKA_APPLICATION (0x10UL)
-#define CKA_VALUE (0x11UL)
-#define CKA_OBJECT_ID (0x12UL)
-#define CKA_CERTIFICATE_TYPE (0x80UL)
-#define CKA_ISSUER (0x81UL)
-#define CKA_SERIAL_NUMBER (0x82UL)
-#define CKA_AC_ISSUER (0x83UL)
-#define CKA_OWNER (0x84UL)
-#define CKA_ATTR_TYPES (0x85UL)
-#define CKA_TRUSTED (0x86UL)
-#define CKA_CERTIFICATE_CATEGORY (0x87UL)
-#define CKA_JAVA_MIDP_SECURITY_DOMAIN (0x88UL)
-#define CKA_URL (0x89UL)
-#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY (0x8aUL)
-#define CKA_HASH_OF_ISSUER_PUBLIC_KEY (0x8bUL)
-#define CKA_CHECK_VALUE (0x90UL)
-#define CKA_KEY_TYPE (0x100UL)
-#define CKA_SUBJECT (0x101UL)
-#define CKA_ID (0x102UL)
-#define CKA_SENSITIVE (0x103UL)
-#define CKA_ENCRYPT (0x104UL)
-#define CKA_DECRYPT (0x105UL)
-#define CKA_WRAP (0x106UL)
-#define CKA_UNWRAP (0x107UL)
-#define CKA_SIGN (0x108UL)
-#define CKA_SIGN_RECOVER (0x109UL)
-#define CKA_VERIFY (0x10aUL)
-#define CKA_VERIFY_RECOVER (0x10bUL)
-#define CKA_DERIVE (0x10cUL)
-#define CKA_START_DATE (0x110UL)
-#define CKA_END_DATE (0x111UL)
-#define CKA_MODULUS (0x120UL)
-#define CKA_MODULUS_BITS (0x121UL)
-#define CKA_PUBLIC_EXPONENT (0x122UL)
-#define CKA_PRIVATE_EXPONENT (0x123UL)
-#define CKA_PRIME_1 (0x124UL)
-#define CKA_PRIME_2 (0x125UL)
-#define CKA_EXPONENT_1 (0x126UL)
-#define CKA_EXPONENT_2 (0x127UL)
-#define CKA_COEFFICIENT (0x128UL)
-#define CKA_PRIME (0x130UL)
-#define CKA_SUBPRIME (0x131UL)
-#define CKA_BASE (0x132UL)
-#define CKA_PRIME_BITS (0x133UL)
-#define CKA_SUB_PRIME_BITS (0x134UL)
-#define CKA_VALUE_BITS (0x160UL)
-#define CKA_VALUE_LEN (0x161UL)
-#define CKA_EXTRACTABLE (0x162UL)
-#define CKA_LOCAL (0x163UL)
-#define CKA_NEVER_EXTRACTABLE (0x164UL)
-#define CKA_ALWAYS_SENSITIVE (0x165UL)
-#define CKA_KEY_GEN_MECHANISM (0x166UL)
-#define CKA_MODIFIABLE (0x170UL)
-#define CKA_ECDSA_PARAMS (0x180UL)
-#define CKA_EC_PARAMS (0x180UL)
-#define CKA_EC_POINT (0x181UL)
-#define CKA_SECONDARY_AUTH (0x200UL)
-#define CKA_AUTH_PIN_FLAGS (0x201UL)
-#define CKA_ALWAYS_AUTHENTICATE (0x202UL)
-#define CKA_WRAP_WITH_TRUSTED (0x210UL)
-#define CKA_HW_FEATURE_TYPE (0x300UL)
-#define CKA_RESET_ON_INIT (0x301UL)
-#define CKA_HAS_RESET (0x302UL)
-#define CKA_PIXEL_X (0x400UL)
-#define CKA_PIXEL_Y (0x401UL)
-#define CKA_RESOLUTION (0x402UL)
-#define CKA_CHAR_ROWS (0x403UL)
-#define CKA_CHAR_COLUMNS (0x404UL)
-#define CKA_COLOR (0x405UL)
-#define CKA_BITS_PER_PIXEL (0x406UL)
-#define CKA_CHAR_SETS (0x480UL)
-#define CKA_ENCODING_METHODS (0x481UL)
-#define CKA_MIME_TYPES (0x482UL)
-#define CKA_MECHANISM_TYPE (0x500UL)
-#define CKA_REQUIRED_CMS_ATTRIBUTES (0x501UL)
-#define CKA_DEFAULT_CMS_ATTRIBUTES (0x502UL)
-#define CKA_SUPPORTED_CMS_ATTRIBUTES (0x503UL)
-#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x211UL)
-#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x212UL)
-#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE | 0x600UL)
-#define CKA_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-struct ck_attribute
-{
- ck_attribute_type_t type;
- void *value;
- unsigned long value_len;
-};
-
-
-struct ck_date
-{
- unsigned char year[4];
- unsigned char month[2];
- unsigned char day[2];
-};
-
-
-typedef unsigned long ck_mechanism_type_t;
-
-#define CKM_RSA_PKCS_KEY_PAIR_GEN (0UL)
-#define CKM_RSA_PKCS (1UL)
-#define CKM_RSA_9796 (2UL)
-#define CKM_RSA_X_509 (3UL)
-#define CKM_MD2_RSA_PKCS (4UL)
-#define CKM_MD5_RSA_PKCS (5UL)
-#define CKM_SHA1_RSA_PKCS (6UL)
-#define CKM_RIPEMD128_RSA_PKCS (7UL)
-#define CKM_RIPEMD160_RSA_PKCS (8UL)
-#define CKM_RSA_PKCS_OAEP (9UL)
-#define CKM_RSA_X9_31_KEY_PAIR_GEN (0xaUL)
-#define CKM_RSA_X9_31 (0xbUL)
-#define CKM_SHA1_RSA_X9_31 (0xcUL)
-#define CKM_RSA_PKCS_PSS (0xdUL)
-#define CKM_SHA1_RSA_PKCS_PSS (0xeUL)
-#define CKM_DSA_KEY_PAIR_GEN (0x10UL)
-#define CKM_DSA (0x11UL)
-#define CKM_DSA_SHA1 (0x12UL)
-#define CKM_DH_PKCS_KEY_PAIR_GEN (0x20UL)
-#define CKM_DH_PKCS_DERIVE (0x21UL)
-#define CKM_X9_42_DH_KEY_PAIR_GEN (0x30UL)
-#define CKM_X9_42_DH_DERIVE (0x31UL)
-#define CKM_X9_42_DH_HYBRID_DERIVE (0x32UL)
-#define CKM_X9_42_MQV_DERIVE (0x33UL)
-#define CKM_SHA256_RSA_PKCS (0x40UL)
-#define CKM_SHA384_RSA_PKCS (0x41UL)
-#define CKM_SHA512_RSA_PKCS (0x42UL)
-#define CKM_SHA256_RSA_PKCS_PSS (0x43UL)
-#define CKM_SHA384_RSA_PKCS_PSS (0x44UL)
-#define CKM_SHA512_RSA_PKCS_PSS (0x45UL)
-#define CKM_RC2_KEY_GEN (0x100UL)
-#define CKM_RC2_ECB (0x101UL)
-#define CKM_RC2_CBC (0x102UL)
-#define CKM_RC2_MAC (0x103UL)
-#define CKM_RC2_MAC_GENERAL (0x104UL)
-#define CKM_RC2_CBC_PAD (0x105UL)
-#define CKM_RC4_KEY_GEN (0x110UL)
-#define CKM_RC4 (0x111UL)
-#define CKM_DES_KEY_GEN (0x120UL)
-#define CKM_DES_ECB (0x121UL)
-#define CKM_DES_CBC (0x122UL)
-#define CKM_DES_MAC (0x123UL)
-#define CKM_DES_MAC_GENERAL (0x124UL)
-#define CKM_DES_CBC_PAD (0x125UL)
-#define CKM_DES2_KEY_GEN (0x130UL)
-#define CKM_DES3_KEY_GEN (0x131UL)
-#define CKM_DES3_ECB (0x132UL)
-#define CKM_DES3_CBC (0x133UL)
-#define CKM_DES3_MAC (0x134UL)
-#define CKM_DES3_MAC_GENERAL (0x135UL)
-#define CKM_DES3_CBC_PAD (0x136UL)
-#define CKM_CDMF_KEY_GEN (0x140UL)
-#define CKM_CDMF_ECB (0x141UL)
-#define CKM_CDMF_CBC (0x142UL)
-#define CKM_CDMF_MAC (0x143UL)
-#define CKM_CDMF_MAC_GENERAL (0x144UL)
-#define CKM_CDMF_CBC_PAD (0x145UL)
-#define CKM_DES_OFB64 (0x150UL)
-#define CKM_DES_OFB8 (0x151UL)
-#define CKM_DES_CFB64 (0x152UL)
-#define CKM_DES_CFB8 (0x153UL)
-#define CKM_MD2 (0x200UL)
-#define CKM_MD2_HMAC (0x201UL)
-#define CKM_MD2_HMAC_GENERAL (0x202UL)
-#define CKM_MD5 (0x210UL)
-#define CKM_MD5_HMAC (0x211UL)
-#define CKM_MD5_HMAC_GENERAL (0x212UL)
-#define CKM_SHA_1 (0x220UL)
-#define CKM_SHA_1_HMAC (0x221UL)
-#define CKM_SHA_1_HMAC_GENERAL (0x222UL)
-#define CKM_RIPEMD128 (0x230UL)
-#define CKM_RIPEMD128_HMAC (0x231UL)
-#define CKM_RIPEMD128_HMAC_GENERAL (0x232UL)
-#define CKM_RIPEMD160 (0x240UL)
-#define CKM_RIPEMD160_HMAC (0x241UL)
-#define CKM_RIPEMD160_HMAC_GENERAL (0x242UL)
-#define CKM_SHA256 (0x250UL)
-#define CKM_SHA256_HMAC (0x251UL)
-#define CKM_SHA256_HMAC_GENERAL (0x252UL)
-#define CKM_SHA384 (0x260UL)
-#define CKM_SHA384_HMAC (0x261UL)
-#define CKM_SHA384_HMAC_GENERAL (0x262UL)
-#define CKM_SHA512 (0x270UL)
-#define CKM_SHA512_HMAC (0x271UL)
-#define CKM_SHA512_HMAC_GENERAL (0x272UL)
-#define CKM_CAST_KEY_GEN (0x300UL)
-#define CKM_CAST_ECB (0x301UL)
-#define CKM_CAST_CBC (0x302UL)
-#define CKM_CAST_MAC (0x303UL)
-#define CKM_CAST_MAC_GENERAL (0x304UL)
-#define CKM_CAST_CBC_PAD (0x305UL)
-#define CKM_CAST3_KEY_GEN (0x310UL)
-#define CKM_CAST3_ECB (0x311UL)
-#define CKM_CAST3_CBC (0x312UL)
-#define CKM_CAST3_MAC (0x313UL)
-#define CKM_CAST3_MAC_GENERAL (0x314UL)
-#define CKM_CAST3_CBC_PAD (0x315UL)
-#define CKM_CAST5_KEY_GEN (0x320UL)
-#define CKM_CAST128_KEY_GEN (0x320UL)
-#define CKM_CAST5_ECB (0x321UL)
-#define CKM_CAST128_ECB (0x321UL)
-#define CKM_CAST5_CBC (0x322UL)
-#define CKM_CAST128_CBC (0x322UL)
-#define CKM_CAST5_MAC (0x323UL)
-#define CKM_CAST128_MAC (0x323UL)
-#define CKM_CAST5_MAC_GENERAL (0x324UL)
-#define CKM_CAST128_MAC_GENERAL (0x324UL)
-#define CKM_CAST5_CBC_PAD (0x325UL)
-#define CKM_CAST128_CBC_PAD (0x325UL)
-#define CKM_RC5_KEY_GEN (0x330UL)
-#define CKM_RC5_ECB (0x331UL)
-#define CKM_RC5_CBC (0x332UL)
-#define CKM_RC5_MAC (0x333UL)
-#define CKM_RC5_MAC_GENERAL (0x334UL)
-#define CKM_RC5_CBC_PAD (0x335UL)
-#define CKM_IDEA_KEY_GEN (0x340UL)
-#define CKM_IDEA_ECB (0x341UL)
-#define CKM_IDEA_CBC (0x342UL)
-#define CKM_IDEA_MAC (0x343UL)
-#define CKM_IDEA_MAC_GENERAL (0x344UL)
-#define CKM_IDEA_CBC_PAD (0x345UL)
-#define CKM_GENERIC_SECRET_KEY_GEN (0x350UL)
-#define CKM_CONCATENATE_BASE_AND_KEY (0x360UL)
-#define CKM_CONCATENATE_BASE_AND_DATA (0x362UL)
-#define CKM_CONCATENATE_DATA_AND_BASE (0x363UL)
-#define CKM_XOR_BASE_AND_DATA (0x364UL)
-#define CKM_EXTRACT_KEY_FROM_KEY (0x365UL)
-#define CKM_SSL3_PRE_MASTER_KEY_GEN (0x370UL)
-#define CKM_SSL3_MASTER_KEY_DERIVE (0x371UL)
-#define CKM_SSL3_KEY_AND_MAC_DERIVE (0x372UL)
-#define CKM_SSL3_MASTER_KEY_DERIVE_DH (0x373UL)
-#define CKM_TLS_PRE_MASTER_KEY_GEN (0x374UL)
-#define CKM_TLS_MASTER_KEY_DERIVE (0x375UL)
-#define CKM_TLS_KEY_AND_MAC_DERIVE (0x376UL)
-#define CKM_TLS_MASTER_KEY_DERIVE_DH (0x377UL)
-#define CKM_TLS_PRF (0x378UL)
-#define CKM_SSL3_MD5_MAC (0x380UL)
-#define CKM_SSL3_SHA1_MAC (0x381UL)
-#define CKM_MD5_KEY_DERIVATION (0x390UL)
-#define CKM_MD2_KEY_DERIVATION (0x391UL)
-#define CKM_SHA1_KEY_DERIVATION (0x392UL)
-#define CKM_SHA256_KEY_DERIVATION (0x393UL)
-#define CKM_SHA384_KEY_DERIVATION (0x394UL)
-#define CKM_SHA512_KEY_DERIVATION (0x395UL)
-#define CKM_PBE_MD2_DES_CBC (0x3a0UL)
-#define CKM_PBE_MD5_DES_CBC (0x3a1UL)
-#define CKM_PBE_MD5_CAST_CBC (0x3a2UL)
-#define CKM_PBE_MD5_CAST3_CBC (0x3a3UL)
-#define CKM_PBE_MD5_CAST5_CBC (0x3a4UL)
-#define CKM_PBE_MD5_CAST128_CBC (0x3a4UL)
-#define CKM_PBE_SHA1_CAST5_CBC (0x3a5UL)
-#define CKM_PBE_SHA1_CAST128_CBC (0x3a5UL)
-#define CKM_PBE_SHA1_RC4_128 (0x3a6UL)
-#define CKM_PBE_SHA1_RC4_40 (0x3a7UL)
-#define CKM_PBE_SHA1_DES3_EDE_CBC (0x3a8UL)
-#define CKM_PBE_SHA1_DES2_EDE_CBC (0x3a9UL)
-#define CKM_PBE_SHA1_RC2_128_CBC (0x3aaUL)
-#define CKM_PBE_SHA1_RC2_40_CBC (0x3abUL)
-#define CKM_PKCS5_PBKD2 (0x3b0UL)
-#define CKM_PBA_SHA1_WITH_SHA1_HMAC (0x3c0UL)
-#define CKM_WTLS_PRE_MASTER_KEY_GEN (0x3d0UL)
-#define CKM_WTLS_MASTER_KEY_DERIVE (0x3d1UL)
-#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC (0x3d2UL)
-#define CKM_WTLS_PRF (0x3d3UL)
-#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE (0x3d4UL)
-#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE (0x3d5UL)
-#define CKM_KEY_WRAP_LYNKS (0x400UL)
-#define CKM_KEY_WRAP_SET_OAEP (0x401UL)
-#define CKM_CMS_SIG (0x500UL)
-#define CKM_SKIPJACK_KEY_GEN (0x1000UL)
-#define CKM_SKIPJACK_ECB64 (0x1001UL)
-#define CKM_SKIPJACK_CBC64 (0x1002UL)
-#define CKM_SKIPJACK_OFB64 (0x1003UL)
-#define CKM_SKIPJACK_CFB64 (0x1004UL)
-#define CKM_SKIPJACK_CFB32 (0x1005UL)
-#define CKM_SKIPJACK_CFB16 (0x1006UL)
-#define CKM_SKIPJACK_CFB8 (0x1007UL)
-#define CKM_SKIPJACK_WRAP (0x1008UL)
-#define CKM_SKIPJACK_PRIVATE_WRAP (0x1009UL)
-#define CKM_SKIPJACK_RELAYX (0x100aUL)
-#define CKM_KEA_KEY_PAIR_GEN (0x1010UL)
-#define CKM_KEA_KEY_DERIVE (0x1011UL)
-#define CKM_FORTEZZA_TIMESTAMP (0x1020UL)
-#define CKM_BATON_KEY_GEN (0x1030UL)
-#define CKM_BATON_ECB128 (0x1031UL)
-#define CKM_BATON_ECB96 (0x1032UL)
-#define CKM_BATON_CBC128 (0x1033UL)
-#define CKM_BATON_COUNTER (0x1034UL)
-#define CKM_BATON_SHUFFLE (0x1035UL)
-#define CKM_BATON_WRAP (0x1036UL)
-#define CKM_ECDSA_KEY_PAIR_GEN (0x1040UL)
-#define CKM_EC_KEY_PAIR_GEN (0x1040UL)
-#define CKM_ECDSA (0x1041UL)
-#define CKM_ECDSA_SHA1 (0x1042UL)
-#define CKM_ECDH1_DERIVE (0x1050UL)
-#define CKM_ECDH1_COFACTOR_DERIVE (0x1051UL)
-#define CKM_ECMQV_DERIVE (0x1052UL)
-#define CKM_JUNIPER_KEY_GEN (0x1060UL)
-#define CKM_JUNIPER_ECB128 (0x1061UL)
-#define CKM_JUNIPER_CBC128 (0x1062UL)
-#define CKM_JUNIPER_COUNTER (0x1063UL)
-#define CKM_JUNIPER_SHUFFLE (0x1064UL)
-#define CKM_JUNIPER_WRAP (0x1065UL)
-#define CKM_FASTHASH (0x1070UL)
-#define CKM_AES_KEY_GEN (0x1080UL)
-#define CKM_AES_ECB (0x1081UL)
-#define CKM_AES_CBC (0x1082UL)
-#define CKM_AES_MAC (0x1083UL)
-#define CKM_AES_MAC_GENERAL (0x1084UL)
-#define CKM_AES_CBC_PAD (0x1085UL)
-#define CKM_BLOWFISH_KEY_GEN (0x1090UL)
-#define CKM_BLOWFISH_CBC (0x1091UL)
-#define CKM_TWOFISH_KEY_GEN (0x1092UL)
-#define CKM_TWOFISH_CBC (0x1093UL)
-#define CKM_DES_ECB_ENCRYPT_DATA (0x1100UL)
-#define CKM_DES_CBC_ENCRYPT_DATA (0x1101UL)
-#define CKM_DES3_ECB_ENCRYPT_DATA (0x1102UL)
-#define CKM_DES3_CBC_ENCRYPT_DATA (0x1103UL)
-#define CKM_AES_ECB_ENCRYPT_DATA (0x1104UL)
-#define CKM_AES_CBC_ENCRYPT_DATA (0x1105UL)
-#define CKM_DSA_PARAMETER_GEN (0x2000UL)
-#define CKM_DH_PKCS_PARAMETER_GEN (0x2001UL)
-#define CKM_X9_42_DH_PARAMETER_GEN (0x2002UL)
-#define CKM_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-/* Ammendments */
-#define CKM_SHA224 (0x255UL)
-#define CKM_SHA224_HMAC (0x256UL)
-#define CKM_SHA224_HMAC_GENERAL (0x257UL)
-#define CKM_SHA224_RSA_PKCS (0x46UL)
-#define CKM_SHA224_RSA_PKCS_PSS (0x47UL)
-#define CKM_SHA224_KEY_DERIVATION (0x396UL)
-
-#define CKM_CAMELLIA_KEY_GEN (0x550UL)
-#define CKM_CAMELLIA_ECB (0x551UL)
-#define CKM_CAMELLIA_CBC (0x552UL)
-#define CKM_CAMELLIA_MAC (0x553UL)
-#define CKM_CAMELLIA_MAC_GENERAL (0x554UL)
-#define CKM_CAMELLIA_CBC_PAD (0x555UL)
-#define CKM_CAMELLIA_ECB_ENCRYPT_DATA (0x556UL)
-#define CKM_CAMELLIA_CBC_ENCRYPT_DATA (0x557UL)
-
-struct ck_mechanism
-{
- ck_mechanism_type_t mechanism;
- void *parameter;
- unsigned long parameter_len;
-};
-
-
-struct ck_mechanism_info
-{
- unsigned long min_key_size;
- unsigned long max_key_size;
- ck_flags_t flags;
-};
-
-#define CKF_HW (1UL << 0)
-#define CKF_ENCRYPT (1UL << 8)
-#define CKF_DECRYPT (1UL << 9)
-#define CKF_DIGEST (1UL << 10)
-#define CKF_SIGN (1UL << 11)
-#define CKF_SIGN_RECOVER (1UL << 12)
-#define CKF_VERIFY (1UL << 13)
-#define CKF_VERIFY_RECOVER (1UL << 14)
-#define CKF_GENERATE (1UL << 15)
-#define CKF_GENERATE_KEY_PAIR (1UL << 16)
-#define CKF_WRAP (1UL << 17)
-#define CKF_UNWRAP (1UL << 18)
-#define CKF_DERIVE (1UL << 19)
-#define CKF_EXTENSION ((unsigned long) (1UL << 31))
-
-
-/* Flags for C_WaitForSlotEvent. */
-#define CKF_DONT_BLOCK (1UL)
-
-
-typedef unsigned long ck_rv_t;
-
-
-typedef ck_rv_t (*ck_notify_t) (ck_session_handle_t session,
- ck_notification_t event, void *application);
-
-/* Forward reference. */
-struct ck_function_list;
-
-#define _CK_DECLARE_FUNCTION(name, args) \
-typedef ck_rv_t (*CK_ ## name) args; \
-ck_rv_t CK_SPEC name args
-
-_CK_DECLARE_FUNCTION (C_Initialize, (void *init_args));
-_CK_DECLARE_FUNCTION (C_Finalize, (void *reserved));
-_CK_DECLARE_FUNCTION (C_GetInfo, (struct ck_info *info));
-_CK_DECLARE_FUNCTION (C_GetFunctionList,
- (struct ck_function_list **function_list));
-
-_CK_DECLARE_FUNCTION (C_GetSlotList,
- (unsigned char token_present, ck_slot_id_t *slot_list,
- unsigned long *count));
-_CK_DECLARE_FUNCTION (C_GetSlotInfo,
- (ck_slot_id_t slot_id, struct ck_slot_info *info));
-_CK_DECLARE_FUNCTION (C_GetTokenInfo,
- (ck_slot_id_t slot_id, struct ck_token_info *info));
-_CK_DECLARE_FUNCTION (C_WaitForSlotEvent,
- (ck_flags_t flags, ck_slot_id_t *slot, void *reserved));
-_CK_DECLARE_FUNCTION (C_GetMechanismList,
- (ck_slot_id_t slot_id,
- ck_mechanism_type_t *mechanism_list,
- unsigned long *count));
-_CK_DECLARE_FUNCTION (C_GetMechanismInfo,
- (ck_slot_id_t slot_id, ck_mechanism_type_t type,
- struct ck_mechanism_info *info));
-_CK_DECLARE_FUNCTION (C_InitToken,
- (ck_slot_id_t slot_id, unsigned char *pin,
- unsigned long pin_len, unsigned char *label));
-_CK_DECLARE_FUNCTION (C_InitPIN,
- (ck_session_handle_t session, unsigned char *pin,
- unsigned long pin_len));
-_CK_DECLARE_FUNCTION (C_SetPIN,
- (ck_session_handle_t session, unsigned char *old_pin,
- unsigned long old_len, unsigned char *new_pin,
- unsigned long new_len));
-
-_CK_DECLARE_FUNCTION (C_OpenSession,
- (ck_slot_id_t slot_id, ck_flags_t flags,
- void *application, ck_notify_t notify,
- ck_session_handle_t *session));
-_CK_DECLARE_FUNCTION (C_CloseSession, (ck_session_handle_t session));
-_CK_DECLARE_FUNCTION (C_CloseAllSessions, (ck_slot_id_t slot_id));
-_CK_DECLARE_FUNCTION (C_GetSessionInfo,
- (ck_session_handle_t session,
- struct ck_session_info *info));
-_CK_DECLARE_FUNCTION (C_GetOperationState,
- (ck_session_handle_t session,
- unsigned char *operation_state,
- unsigned long *operation_state_len));
-_CK_DECLARE_FUNCTION (C_SetOperationState,
- (ck_session_handle_t session,
- unsigned char *operation_state,
- unsigned long operation_state_len,
- ck_object_handle_t encryption_key,
- ck_object_handle_t authentiation_key));
-_CK_DECLARE_FUNCTION (C_Login,
- (ck_session_handle_t session, ck_user_type_t user_type,
- unsigned char *pin, unsigned long pin_len));
-_CK_DECLARE_FUNCTION (C_Logout, (ck_session_handle_t session));
-
-_CK_DECLARE_FUNCTION (C_CreateObject,
- (ck_session_handle_t session,
- struct ck_attribute *templ,
- unsigned long count, ck_object_handle_t *object));
-_CK_DECLARE_FUNCTION (C_CopyObject,
- (ck_session_handle_t session, ck_object_handle_t object,
- struct ck_attribute *templ, unsigned long count,
- ck_object_handle_t *new_object));
-_CK_DECLARE_FUNCTION (C_DestroyObject,
- (ck_session_handle_t session,
- ck_object_handle_t object));
-_CK_DECLARE_FUNCTION (C_GetObjectSize,
- (ck_session_handle_t session,
- ck_object_handle_t object,
- unsigned long *size));
-_CK_DECLARE_FUNCTION (C_GetAttributeValue,
- (ck_session_handle_t session,
- ck_object_handle_t object,
- struct ck_attribute *templ,
- unsigned long count));
-_CK_DECLARE_FUNCTION (C_SetAttributeValue,
- (ck_session_handle_t session,
- ck_object_handle_t object,
- struct ck_attribute *templ,
- unsigned long count));
-_CK_DECLARE_FUNCTION (C_FindObjectsInit,
- (ck_session_handle_t session,
- struct ck_attribute *templ,
- unsigned long count));
-_CK_DECLARE_FUNCTION (C_FindObjects,
- (ck_session_handle_t session,
- ck_object_handle_t *object,
- unsigned long max_object_count,
- unsigned long *object_count));
-_CK_DECLARE_FUNCTION (C_FindObjectsFinal,
- (ck_session_handle_t session));
-
-_CK_DECLARE_FUNCTION (C_EncryptInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_Encrypt,
- (ck_session_handle_t session,
- unsigned char *data, unsigned long data_len,
- unsigned char *encrypted_data,
- unsigned long *encrypted_data_len));
-_CK_DECLARE_FUNCTION (C_EncryptUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len,
- unsigned char *encrypted_part,
- unsigned long *encrypted_part_len));
-_CK_DECLARE_FUNCTION (C_EncryptFinal,
- (ck_session_handle_t session,
- unsigned char *last_encrypted_part,
- unsigned long *last_encrypted_part_len));
-
-_CK_DECLARE_FUNCTION (C_DecryptInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_Decrypt,
- (ck_session_handle_t session,
- unsigned char *encrypted_data,
- unsigned long encrypted_data_len,
- unsigned char *data, unsigned long *data_len));
-_CK_DECLARE_FUNCTION (C_DecryptUpdate,
- (ck_session_handle_t session,
- unsigned char *encrypted_part,
- unsigned long encrypted_part_len,
- unsigned char *part, unsigned long *part_len));
-_CK_DECLARE_FUNCTION (C_DecryptFinal,
- (ck_session_handle_t session,
- unsigned char *last_part,
- unsigned long *last_part_len));
-
-_CK_DECLARE_FUNCTION (C_DigestInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism));
-_CK_DECLARE_FUNCTION (C_Digest,
- (ck_session_handle_t session,
- unsigned char *data, unsigned long data_len,
- unsigned char *digest,
- unsigned long *digest_len));
-_CK_DECLARE_FUNCTION (C_DigestUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len));
-_CK_DECLARE_FUNCTION (C_DigestKey,
- (ck_session_handle_t session, ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_DigestFinal,
- (ck_session_handle_t session,
- unsigned char *digest,
- unsigned long *digest_len));
-
-_CK_DECLARE_FUNCTION (C_SignInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_Sign,
- (ck_session_handle_t session,
- unsigned char *data, unsigned long data_len,
- unsigned char *signature,
- unsigned long *signature_len));
-_CK_DECLARE_FUNCTION (C_SignUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len));
-_CK_DECLARE_FUNCTION (C_SignFinal,
- (ck_session_handle_t session,
- unsigned char *signature,
- unsigned long *signature_len));
-_CK_DECLARE_FUNCTION (C_SignRecoverInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_SignRecover,
- (ck_session_handle_t session,
- unsigned char *data, unsigned long data_len,
- unsigned char *signature,
- unsigned long *signature_len));
-
-_CK_DECLARE_FUNCTION (C_VerifyInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_Verify,
- (ck_session_handle_t session,
- unsigned char *data, unsigned long data_len,
- unsigned char *signature,
- unsigned long signature_len));
-_CK_DECLARE_FUNCTION (C_VerifyUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len));
-_CK_DECLARE_FUNCTION (C_VerifyFinal,
- (ck_session_handle_t session,
- unsigned char *signature,
- unsigned long signature_len));
-_CK_DECLARE_FUNCTION (C_VerifyRecoverInit,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t key));
-_CK_DECLARE_FUNCTION (C_VerifyRecover,
- (ck_session_handle_t session,
- unsigned char *signature,
- unsigned long signature_len,
- unsigned char *data,
- unsigned long *data_len));
-
-_CK_DECLARE_FUNCTION (C_DigestEncryptUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len,
- unsigned char *encrypted_part,
- unsigned long *encrypted_part_len));
-_CK_DECLARE_FUNCTION (C_DecryptDigestUpdate,
- (ck_session_handle_t session,
- unsigned char *encrypted_part,
- unsigned long encrypted_part_len,
- unsigned char *part,
- unsigned long *part_len));
-_CK_DECLARE_FUNCTION (C_SignEncryptUpdate,
- (ck_session_handle_t session,
- unsigned char *part, unsigned long part_len,
- unsigned char *encrypted_part,
- unsigned long *encrypted_part_len));
-_CK_DECLARE_FUNCTION (C_DecryptVerifyUpdate,
- (ck_session_handle_t session,
- unsigned char *encrypted_part,
- unsigned long encrypted_part_len,
- unsigned char *part,
- unsigned long *part_len));
-
-_CK_DECLARE_FUNCTION (C_GenerateKey,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- struct ck_attribute *templ,
- unsigned long count,
- ck_object_handle_t *key));
-_CK_DECLARE_FUNCTION (C_GenerateKeyPair,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- struct ck_attribute *public_key_template,
- unsigned long public_key_attribute_count,
- struct ck_attribute *private_key_template,
- unsigned long private_key_attribute_count,
- ck_object_handle_t *public_key,
- ck_object_handle_t *private_key));
-_CK_DECLARE_FUNCTION (C_WrapKey,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t wrapping_key,
- ck_object_handle_t key,
- unsigned char *wrapped_key,
- unsigned long *wrapped_key_len));
-_CK_DECLARE_FUNCTION (C_UnwrapKey,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t unwrapping_key,
- unsigned char *wrapped_key,
- unsigned long wrapped_key_len,
- struct ck_attribute *templ,
- unsigned long attribute_count,
- ck_object_handle_t *key));
-_CK_DECLARE_FUNCTION (C_DeriveKey,
- (ck_session_handle_t session,
- struct ck_mechanism *mechanism,
- ck_object_handle_t base_key,
- struct ck_attribute *templ,
- unsigned long attribute_count,
- ck_object_handle_t *key));
-
-_CK_DECLARE_FUNCTION (C_SeedRandom,
- (ck_session_handle_t session, unsigned char *seed,
- unsigned long seed_len));
-_CK_DECLARE_FUNCTION (C_GenerateRandom,
- (ck_session_handle_t session,
- unsigned char *random_data,
- unsigned long random_len));
-
-_CK_DECLARE_FUNCTION (C_GetFunctionStatus, (ck_session_handle_t session));
-_CK_DECLARE_FUNCTION (C_CancelFunction, (ck_session_handle_t session));
-
-
-struct ck_function_list
-{
- struct ck_version version;
- CK_C_Initialize C_Initialize;
- CK_C_Finalize C_Finalize;
- CK_C_GetInfo C_GetInfo;
- CK_C_GetFunctionList C_GetFunctionList;
- CK_C_GetSlotList C_GetSlotList;
- CK_C_GetSlotInfo C_GetSlotInfo;
- CK_C_GetTokenInfo C_GetTokenInfo;
- CK_C_GetMechanismList C_GetMechanismList;
- CK_C_GetMechanismInfo C_GetMechanismInfo;
- CK_C_InitToken C_InitToken;
- CK_C_InitPIN C_InitPIN;
- CK_C_SetPIN C_SetPIN;
- CK_C_OpenSession C_OpenSession;
- CK_C_CloseSession C_CloseSession;
- CK_C_CloseAllSessions C_CloseAllSessions;
- CK_C_GetSessionInfo C_GetSessionInfo;
- CK_C_GetOperationState C_GetOperationState;
- CK_C_SetOperationState C_SetOperationState;
- CK_C_Login C_Login;
- CK_C_Logout C_Logout;
- CK_C_CreateObject C_CreateObject;
- CK_C_CopyObject C_CopyObject;
- CK_C_DestroyObject C_DestroyObject;
- CK_C_GetObjectSize C_GetObjectSize;
- CK_C_GetAttributeValue C_GetAttributeValue;
- CK_C_SetAttributeValue C_SetAttributeValue;
- CK_C_FindObjectsInit C_FindObjectsInit;
- CK_C_FindObjects C_FindObjects;
- CK_C_FindObjectsFinal C_FindObjectsFinal;
- CK_C_EncryptInit C_EncryptInit;
- CK_C_Encrypt C_Encrypt;
- CK_C_EncryptUpdate C_EncryptUpdate;
- CK_C_EncryptFinal C_EncryptFinal;
- CK_C_DecryptInit C_DecryptInit;
- CK_C_Decrypt C_Decrypt;
- CK_C_DecryptUpdate C_DecryptUpdate;
- CK_C_DecryptFinal C_DecryptFinal;
- CK_C_DigestInit C_DigestInit;
- CK_C_Digest C_Digest;
- CK_C_DigestUpdate C_DigestUpdate;
- CK_C_DigestKey C_DigestKey;
- CK_C_DigestFinal C_DigestFinal;
- CK_C_SignInit C_SignInit;
- CK_C_Sign C_Sign;
- CK_C_SignUpdate C_SignUpdate;
- CK_C_SignFinal C_SignFinal;
- CK_C_SignRecoverInit C_SignRecoverInit;
- CK_C_SignRecover C_SignRecover;
- CK_C_VerifyInit C_VerifyInit;
- CK_C_Verify C_Verify;
- CK_C_VerifyUpdate C_VerifyUpdate;
- CK_C_VerifyFinal C_VerifyFinal;
- CK_C_VerifyRecoverInit C_VerifyRecoverInit;
- CK_C_VerifyRecover C_VerifyRecover;
- CK_C_DigestEncryptUpdate C_DigestEncryptUpdate;
- CK_C_DecryptDigestUpdate C_DecryptDigestUpdate;
- CK_C_SignEncryptUpdate C_SignEncryptUpdate;
- CK_C_DecryptVerifyUpdate C_DecryptVerifyUpdate;
- CK_C_GenerateKey C_GenerateKey;
- CK_C_GenerateKeyPair C_GenerateKeyPair;
- CK_C_WrapKey C_WrapKey;
- CK_C_UnwrapKey C_UnwrapKey;
- CK_C_DeriveKey C_DeriveKey;
- CK_C_SeedRandom C_SeedRandom;
- CK_C_GenerateRandom C_GenerateRandom;
- CK_C_GetFunctionStatus C_GetFunctionStatus;
- CK_C_CancelFunction C_CancelFunction;
- CK_C_WaitForSlotEvent C_WaitForSlotEvent;
-};
-
-
-typedef ck_rv_t (*ck_createmutex_t) (void **mutex);
-typedef ck_rv_t (*ck_destroymutex_t) (void *mutex);
-typedef ck_rv_t (*ck_lockmutex_t) (void *mutex);
-typedef ck_rv_t (*ck_unlockmutex_t) (void *mutex);
-
-
-struct ck_c_initialize_args
-{
- ck_createmutex_t create_mutex;
- ck_destroymutex_t destroy_mutex;
- ck_lockmutex_t lock_mutex;
- ck_unlockmutex_t unlock_mutex;
- ck_flags_t flags;
- void *reserved;
-};
-
-
-#define CKF_LIBRARY_CANT_CREATE_OS_THREADS (1UL << 0)
-#define CKF_OS_LOCKING_OK (1UL << 1)
-
-#define CKR_OK (0UL)
-#define CKR_CANCEL (1UL)
-#define CKR_HOST_MEMORY (2UL)
-#define CKR_SLOT_ID_INVALID (3UL)
-#define CKR_GENERAL_ERROR (5UL)
-#define CKR_FUNCTION_FAILED (6UL)
-#define CKR_ARGUMENTS_BAD (7UL)
-#define CKR_NO_EVENT (8UL)
-#define CKR_NEED_TO_CREATE_THREADS (9UL)
-#define CKR_CANT_LOCK (0xaUL)
-#define CKR_ATTRIBUTE_READ_ONLY (0x10UL)
-#define CKR_ATTRIBUTE_SENSITIVE (0x11UL)
-#define CKR_ATTRIBUTE_TYPE_INVALID (0x12UL)
-#define CKR_ATTRIBUTE_VALUE_INVALID (0x13UL)
-#define CKR_DATA_INVALID (0x20UL)
-#define CKR_DATA_LEN_RANGE (0x21UL)
-#define CKR_DEVICE_ERROR (0x30UL)
-#define CKR_DEVICE_MEMORY (0x31UL)
-#define CKR_DEVICE_REMOVED (0x32UL)
-#define CKR_ENCRYPTED_DATA_INVALID (0x40UL)
-#define CKR_ENCRYPTED_DATA_LEN_RANGE (0x41UL)
-#define CKR_FUNCTION_CANCELED (0x50UL)
-#define CKR_FUNCTION_NOT_PARALLEL (0x51UL)
-#define CKR_FUNCTION_NOT_SUPPORTED (0x54UL)
-#define CKR_KEY_HANDLE_INVALID (0x60UL)
-#define CKR_KEY_SIZE_RANGE (0x62UL)
-#define CKR_KEY_TYPE_INCONSISTENT (0x63UL)
-#define CKR_KEY_NOT_NEEDED (0x64UL)
-#define CKR_KEY_CHANGED (0x65UL)
-#define CKR_KEY_NEEDED (0x66UL)
-#define CKR_KEY_INDIGESTIBLE (0x67UL)
-#define CKR_KEY_FUNCTION_NOT_PERMITTED (0x68UL)
-#define CKR_KEY_NOT_WRAPPABLE (0x69UL)
-#define CKR_KEY_UNEXTRACTABLE (0x6aUL)
-#define CKR_MECHANISM_INVALID (0x70UL)
-#define CKR_MECHANISM_PARAM_INVALID (0x71UL)
-#define CKR_OBJECT_HANDLE_INVALID (0x82UL)
-#define CKR_OPERATION_ACTIVE (0x90UL)
-#define CKR_OPERATION_NOT_INITIALIZED (0x91UL)
-#define CKR_PIN_INCORRECT (0xa0UL)
-#define CKR_PIN_INVALID (0xa1UL)
-#define CKR_PIN_LEN_RANGE (0xa2UL)
-#define CKR_PIN_EXPIRED (0xa3UL)
-#define CKR_PIN_LOCKED (0xa4UL)
-#define CKR_SESSION_CLOSED (0xb0UL)
-#define CKR_SESSION_COUNT (0xb1UL)
-#define CKR_SESSION_HANDLE_INVALID (0xb3UL)
-#define CKR_SESSION_PARALLEL_NOT_SUPPORTED (0xb4UL)
-#define CKR_SESSION_READ_ONLY (0xb5UL)
-#define CKR_SESSION_EXISTS (0xb6UL)
-#define CKR_SESSION_READ_ONLY_EXISTS (0xb7UL)
-#define CKR_SESSION_READ_WRITE_SO_EXISTS (0xb8UL)
-#define CKR_SIGNATURE_INVALID (0xc0UL)
-#define CKR_SIGNATURE_LEN_RANGE (0xc1UL)
-#define CKR_TEMPLATE_INCOMPLETE (0xd0UL)
-#define CKR_TEMPLATE_INCONSISTENT (0xd1UL)
-#define CKR_TOKEN_NOT_PRESENT (0xe0UL)
-#define CKR_TOKEN_NOT_RECOGNIZED (0xe1UL)
-#define CKR_TOKEN_WRITE_PROTECTED (0xe2UL)
-#define CKR_UNWRAPPING_KEY_HANDLE_INVALID (0xf0UL)
-#define CKR_UNWRAPPING_KEY_SIZE_RANGE (0xf1UL)
-#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT (0xf2UL)
-#define CKR_USER_ALREADY_LOGGED_IN (0x100UL)
-#define CKR_USER_NOT_LOGGED_IN (0x101UL)
-#define CKR_USER_PIN_NOT_INITIALIZED (0x102UL)
-#define CKR_USER_TYPE_INVALID (0x103UL)
-#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN (0x104UL)
-#define CKR_USER_TOO_MANY_TYPES (0x105UL)
-#define CKR_WRAPPED_KEY_INVALID (0x110UL)
-#define CKR_WRAPPED_KEY_LEN_RANGE (0x112UL)
-#define CKR_WRAPPING_KEY_HANDLE_INVALID (0x113UL)
-#define CKR_WRAPPING_KEY_SIZE_RANGE (0x114UL)
-#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT (0x115UL)
-#define CKR_RANDOM_SEED_NOT_SUPPORTED (0x120UL)
-#define CKR_RANDOM_NO_RNG (0x121UL)
-#define CKR_DOMAIN_PARAMS_INVALID (0x130UL)
-#define CKR_BUFFER_TOO_SMALL (0x150UL)
-#define CKR_SAVED_STATE_INVALID (0x160UL)
-#define CKR_INFORMATION_SENSITIVE (0x170UL)
-#define CKR_STATE_UNSAVEABLE (0x180UL)
-#define CKR_CRYPTOKI_NOT_INITIALIZED (0x190UL)
-#define CKR_CRYPTOKI_ALREADY_INITIALIZED (0x191UL)
-#define CKR_MUTEX_BAD (0x1a0UL)
-#define CKR_MUTEX_NOT_LOCKED (0x1a1UL)
-#define CKR_FUNCTION_REJECTED (0x200UL)
-#define CKR_VENDOR_DEFINED ((unsigned long) (1UL << 31))
-
-
-
-/* Compatibility layer. */
-
-#ifdef CRYPTOKI_COMPAT
-
-#undef CK_DEFINE_FUNCTION
-#define CK_DEFINE_FUNCTION(retval, name) retval CK_SPEC name
-
-/* For NULL. */
-#include <stddef.h>
-
-typedef unsigned char CK_BYTE;
-typedef unsigned char CK_CHAR;
-typedef unsigned char CK_UTF8CHAR;
-typedef unsigned char CK_BBOOL;
-typedef unsigned long int CK_ULONG;
-typedef long int CK_LONG;
-typedef CK_BYTE *CK_BYTE_PTR;
-typedef CK_CHAR *CK_CHAR_PTR;
-typedef CK_UTF8CHAR *CK_UTF8CHAR_PTR;
-typedef CK_ULONG *CK_ULONG_PTR;
-typedef void *CK_VOID_PTR;
-typedef void **CK_VOID_PTR_PTR;
-#define CK_FALSE 0
-#define CK_TRUE 1
-#ifndef CK_DISABLE_TRUE_FALSE
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-#endif
-
-typedef struct ck_version CK_VERSION;
-typedef struct ck_version *CK_VERSION_PTR;
-
-typedef struct ck_info CK_INFO;
-typedef struct ck_info *CK_INFO_PTR;
-
-typedef ck_slot_id_t *CK_SLOT_ID_PTR;
-
-typedef struct ck_slot_info CK_SLOT_INFO;
-typedef struct ck_slot_info *CK_SLOT_INFO_PTR;
-
-typedef struct ck_token_info CK_TOKEN_INFO;
-typedef struct ck_token_info *CK_TOKEN_INFO_PTR;
-
-typedef ck_session_handle_t *CK_SESSION_HANDLE_PTR;
-
-typedef struct ck_session_info CK_SESSION_INFO;
-typedef struct ck_session_info *CK_SESSION_INFO_PTR;
-
-typedef ck_object_handle_t *CK_OBJECT_HANDLE_PTR;
-
-typedef ck_object_class_t *CK_OBJECT_CLASS_PTR;
-
-typedef struct ck_attribute CK_ATTRIBUTE;
-typedef struct ck_attribute *CK_ATTRIBUTE_PTR;
-
-typedef struct ck_date CK_DATE;
-typedef struct ck_date *CK_DATE_PTR;
-
-typedef ck_mechanism_type_t *CK_MECHANISM_TYPE_PTR;
-
-typedef struct ck_mechanism CK_MECHANISM;
-typedef struct ck_mechanism *CK_MECHANISM_PTR;
-
-typedef struct ck_mechanism_info CK_MECHANISM_INFO;
-typedef struct ck_mechanism_info *CK_MECHANISM_INFO_PTR;
-
-typedef struct ck_function_list CK_FUNCTION_LIST;
-typedef struct ck_function_list *CK_FUNCTION_LIST_PTR;
-typedef struct ck_function_list **CK_FUNCTION_LIST_PTR_PTR;
-
-typedef struct ck_c_initialize_args CK_C_INITIALIZE_ARGS;
-typedef struct ck_c_initialize_args *CK_C_INITIALIZE_ARGS_PTR;
-
-#define NULL_PTR NULL
-
-/* Delete the helper macros defined at the top of the file. */
-#undef ck_flags_t
-#undef ck_version
-
-#undef ck_info
-#undef cryptoki_version
-#undef manufacturer_id
-#undef library_description
-#undef library_version
-
-#undef ck_notification_t
-#undef ck_slot_id_t
-
-#undef ck_slot_info
-#undef slot_description
-#undef hardware_version
-#undef firmware_version
-
-#undef ck_token_info
-#undef serial_number
-#undef max_session_count
-#undef session_count
-#undef max_rw_session_count
-#undef rw_session_count
-#undef max_pin_len
-#undef min_pin_len
-#undef total_public_memory
-#undef free_public_memory
-#undef total_private_memory
-#undef free_private_memory
-#undef utc_time
-
-#undef ck_session_handle_t
-#undef ck_user_type_t
-#undef ck_state_t
-
-#undef ck_session_info
-#undef slot_id
-#undef device_error
-
-#undef ck_object_handle_t
-#undef ck_object_class_t
-#undef ck_hw_feature_type_t
-#undef ck_key_type_t
-#undef ck_certificate_type_t
-#undef ck_attribute_type_t
-
-#undef ck_attribute
-#undef value
-#undef value_len
-
-#undef ck_date
-
-#undef ck_mechanism_type_t
-
-#undef ck_mechanism
-#undef parameter
-#undef parameter_len
-
-#undef ck_mechanism_info
-#undef min_key_size
-#undef max_key_size
-
-#undef ck_rv_t
-#undef ck_notify_t
-
-#undef ck_function_list
-
-#undef ck_createmutex_t
-#undef ck_destroymutex_t
-#undef ck_lockmutex_t
-#undef ck_unlockmutex_t
-
-#undef ck_c_initialize_args
-#undef create_mutex
-#undef destroy_mutex
-#undef lock_mutex
-#undef unlock_mutex
-#undef reserved
-
-#endif /* CRYPTOKI_COMPAT */
-
-\f
-/* System dependencies. */
-#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
-#pragma pack(pop, cryptoki)
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* PKCS11_H */
+++ /dev/null
-/*
- * Copyright (c) 2011 Collabora Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * Author: Stef Walter <stefw@collabora.co.uk>
- */
-
-#ifndef P11_KIT_URI_H
-#define P11_KIT_URI_H
-
-#include "p11-kit/pkcs11.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define P11_KIT_URI_SCHEME "pkcs11"
-#define P11_KIT_URI_SCHEME_LEN 6
-
-typedef enum {
- P11_KIT_URI_OK = 0,
- P11_KIT_URI_UNEXPECTED = -1,
- P11_KIT_URI_BAD_SCHEME = -2,
- P11_KIT_URI_BAD_ENCODING = -3,
- P11_KIT_URI_BAD_SYNTAX = -4,
- P11_KIT_URI_BAD_VERSION = -5,
- P11_KIT_URI_NOT_FOUND = -6,
-} P11KitUriResult;
-
-#define P11_KIT_URI_NO_MEMORY P11_KIT_URI_UNEXPECTED
-
-typedef enum {
- P11_KIT_URI_FOR_OBJECT = (1 << 1),
- P11_KIT_URI_FOR_TOKEN = (1 << 2),
- P11_KIT_URI_FOR_MODULE = (1 << 3),
-
- P11_KIT_URI_FOR_MODULE_WITH_VERSION =
- (1 << 4) | P11_KIT_URI_FOR_MODULE,
-
- P11_KIT_URI_FOR_OBJECT_ON_TOKEN =
- P11_KIT_URI_FOR_OBJECT | P11_KIT_URI_FOR_TOKEN,
-
- P11_KIT_URI_FOR_OBJECT_ON_TOKEN_AND_MODULE =
- P11_KIT_URI_FOR_OBJECT_ON_TOKEN | P11_KIT_URI_FOR_MODULE,
-
- P11_KIT_URI_FOR_ANY = 0x0000FFFF,
-} P11KitUriType;
-
-/*
- * If the caller is using the PKCS#11 GNU calling convention, then we cater
- * to that here.
- */
-#ifdef CRYPTOKI_GNU
-typedef struct ck_info *CK_INFO_PTR;
-typedef struct ck_token_info *CK_TOKEN_INFO_PTR;
-typedef ck_attribute_type_t CK_ATTRIBUTE_TYPE;
-typedef struct ck_attribute *CK_ATTRIBUTE_PTR;
-typedef unsigned long int CK_ULONG;
-typedef P11KitUriType p11_kit_uri_type_t;
-typedef P11KitUriResult p11_kit_uri_result_t;
-#endif
-
-typedef struct p11_kit_uri P11KitUri;
-typedef struct p11_kit_uri p11_kit_uri;
-
-CK_INFO_PTR p11_kit_uri_get_module_info (P11KitUri *uri);
-
-int p11_kit_uri_match_module_info (P11KitUri *uri,
- CK_INFO_PTR info);
-
-CK_TOKEN_INFO_PTR p11_kit_uri_get_token_info (P11KitUri *uri);
-
-int p11_kit_uri_match_token_info (P11KitUri *uri,
- CK_TOKEN_INFO_PTR token_info);
-
-CK_ATTRIBUTE_PTR p11_kit_uri_get_attribute (P11KitUri *uri,
- CK_ATTRIBUTE_TYPE attr_type);
-
-int p11_kit_uri_set_attribute (P11KitUri *uri,
- CK_ATTRIBUTE_PTR attr);
-
-int p11_kit_uri_clear_attribute (P11KitUri *uri,
- CK_ATTRIBUTE_TYPE attr_type);
-
-CK_ATTRIBUTE_PTR p11_kit_uri_get_attributes (P11KitUri *uri,
- CK_ULONG *n_attrs);
-
-int p11_kit_uri_set_attributes (P11KitUri *uri,
- CK_ATTRIBUTE_PTR attrs,
- CK_ULONG n_attrs);
-
-void p11_kit_uri_clear_attributes (P11KitUri *uri);
-
-int p11_kit_uri_match_attributes (P11KitUri *uri,
- CK_ATTRIBUTE_PTR attrs,
- CK_ULONG n_attrs);
-
-const char* p11_kit_uri_get_pin_source (P11KitUri *uri);
-
-void p11_kit_uri_set_pin_source (P11KitUri *uri,
- const char *pin_source);
-
-#ifndef P11_KIT_DISABLE_DEPRECATED
-
-const char* p11_kit_uri_get_pinfile (P11KitUri *uri);
-
-void p11_kit_uri_set_pinfile (P11KitUri *uri,
- const char *pinfile);
-
-#endif /* P11_KIT_DISABLE_DEPRECATED */
-
-void p11_kit_uri_set_unrecognized (P11KitUri *uri,
- int unrecognized);
-
-int p11_kit_uri_any_unrecognized (P11KitUri *uri);
-
-P11KitUri* p11_kit_uri_new (void);
-
-int p11_kit_uri_format (P11KitUri *uri,
- P11KitUriType uri_type,
- char **string);
-
-int p11_kit_uri_parse (const char *string,
- P11KitUriType uri_type,
- P11KitUri *uri);
-
-void p11_kit_uri_free (P11KitUri *uri);
-
-const char* p11_kit_uri_message (int code);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* P11_KIT_URI_H */