static Lisp_Object Qgnutls_bootprop_loglevel;
static Lisp_Object Qgnutls_bootprop_hostname;
static Lisp_Object Qgnutls_bootprop_verify_flags;
-static Lisp_Object Qgnutls_bootprop_verify_error;
static Lisp_Object Qgnutls_bootprop_verify_hostname_error;
/* Callback keys for `gnutls-boot'. Unused currently. */
#ifdef WINDOWSNT
/* Macro for defining functions that will be loaded from the GnuTLS DLL. */
-#define DEF_GNUTLS_FN(rettype,func,args) rettype (FAR CDECL *fn_##func)args
+#define DEF_GNUTLS_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
/* Macro for loading GnuTLS functions from the library. */
#define LOAD_GNUTLS_FN(lib,func) { \
DEF_GNUTLS_FN (int, gnutls_global_init, (void));
DEF_GNUTLS_FN (void, gnutls_global_set_log_function, (gnutls_log_func));
DEF_GNUTLS_FN (void, gnutls_global_set_log_level, (int));
+DEF_GNUTLS_FN (void, gnutls_global_set_mem_functions,
+ (gnutls_alloc_function, gnutls_alloc_function,
+ gnutls_is_secure_function, gnutls_realloc_function,
+ gnutls_free_function));
DEF_GNUTLS_FN (int, gnutls_handshake, (gnutls_session_t));
DEF_GNUTLS_FN (int, gnutls_init, (gnutls_session_t *, gnutls_connection_end_t));
DEF_GNUTLS_FN (int, gnutls_priority_set_direct,
LOAD_GNUTLS_FN (library, gnutls_global_init);
LOAD_GNUTLS_FN (library, gnutls_global_set_log_function);
LOAD_GNUTLS_FN (library, gnutls_global_set_log_level);
+ LOAD_GNUTLS_FN (library, gnutls_global_set_mem_functions);
LOAD_GNUTLS_FN (library, gnutls_handshake);
LOAD_GNUTLS_FN (library, gnutls_init);
LOAD_GNUTLS_FN (library, gnutls_priority_set_direct);
#define fn_gnutls_certificate_get_peers gnutls_certificate_get_peers
#define fn_gnutls_certificate_set_verify_flags gnutls_certificate_set_verify_flags
#define fn_gnutls_certificate_set_x509_crl_file gnutls_certificate_set_x509_crl_file
+#define fn_gnutls_certificate_set_x509_key_file gnutls_certificate_set_x509_key_file
#define fn_gnutls_certificate_set_x509_trust_file gnutls_certificate_set_x509_trust_file
#define fn_gnutls_certificate_type_get gnutls_certificate_type_get
#define fn_gnutls_certificate_verify_peers2 gnutls_certificate_verify_peers2
#define fn_gnutls_global_init gnutls_global_init
#define fn_gnutls_global_set_log_function gnutls_global_set_log_function
#define fn_gnutls_global_set_log_level gnutls_global_set_log_level
+#define fn_gnutls_global_set_mem_functions gnutls_global_set_mem_functions
#define fn_gnutls_handshake gnutls_handshake
#define fn_gnutls_init gnutls_init
#define fn_gnutls_priority_set_direct gnutls_priority_set_direct
#define fn_gnutls_record_send gnutls_record_send
#define fn_gnutls_strerror gnutls_strerror
#define fn_gnutls_transport_set_errno gnutls_transport_set_errno
-#define fn_gnutls_transport_set_lowat gnutls_transport_set_lowat
#define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2
-#define fn_gnutls_transport_set_pull_function gnutls_transport_set_pull_function
-#define fn_gnutls_transport_set_push_function gnutls_transport_set_push_function
#define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname
#define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit
#define fn_gnutls_x509_crt_import gnutls_x509_crt_import
/* non-fatal error */
return -1;
else {
- /* a fatal error occured */
+ /* a fatal error occurred */
return 0;
}
}
int ret = GNUTLS_E_SUCCESS;
if (!gnutls_global_initialized)
- ret = fn_gnutls_global_init ();
+ {
+ fn_gnutls_global_set_mem_functions (xmalloc, xmalloc, NULL,
+ xrealloc, xfree);
+ ret = fn_gnutls_global_init ();
+ }
gnutls_global_initialized = 1;
return gnutls_make_error (ret);
:verify-flags is a bitset as per GnuTLS'
gnutls_certificate_set_verify_flags.
-:verify-error, if non-nil, makes failure of the certificate validation
-an error. Otherwise it will be just a series of warnings.
-
:verify-hostname-error, if non-nil, makes a hostname mismatch an
error. Otherwise it will be just a warning.
{
GNUTLS_LOG (2, max_log_level, "allocating x509 credentials");
x509_cred = XPROCESS (proc)->gnutls_x509_cred;
- if (fn_gnutls_certificate_allocate_credentials (&x509_cred) < 0)
- memory_full ();
+ fn_gnutls_certificate_allocate_credentials (&x509_cred);
if (NUMBERP (verify_flags))
{
{
GNUTLS_LOG (2, max_log_level, "allocating anon credentials");
anon_cred = XPROCESS (proc)->gnutls_anon_cred;
- if (fn_gnutls_anon_allocate_client_credentials (&anon_cred) < 0)
- memory_full ();
+ fn_gnutls_anon_allocate_client_credentials (&anon_cred);
}
else
{
{
gnutls_global_initialized = 0;
- Qgnutls_dll = intern_c_string ("gnutls");
- staticpro (&Qgnutls_dll);
-
- Qgnutls_log_level = intern_c_string ("gnutls-log-level");
- staticpro (&Qgnutls_log_level);
-
- Qgnutls_code = intern_c_string ("gnutls-code");
- staticpro (&Qgnutls_code);
-
- Qgnutls_anon = intern_c_string ("gnutls-anon");
- staticpro (&Qgnutls_anon);
-
- Qgnutls_x509pki = intern_c_string ("gnutls-x509pki");
- staticpro (&Qgnutls_x509pki);
-
- Qgnutls_bootprop_hostname = intern_c_string (":hostname");
- staticpro (&Qgnutls_bootprop_hostname);
-
- Qgnutls_bootprop_priority = intern_c_string (":priority");
- staticpro (&Qgnutls_bootprop_priority);
-
- Qgnutls_bootprop_trustfiles = intern_c_string (":trustfiles");
- staticpro (&Qgnutls_bootprop_trustfiles);
-
- Qgnutls_bootprop_keylist = intern_c_string (":keylist");
- staticpro (&Qgnutls_bootprop_keylist);
-
- Qgnutls_bootprop_crlfiles = intern_c_string (":crlfiles");
- staticpro (&Qgnutls_bootprop_crlfiles);
-
- Qgnutls_bootprop_callbacks = intern_c_string (":callbacks");
- staticpro (&Qgnutls_bootprop_callbacks);
-
- Qgnutls_bootprop_callbacks_verify = intern_c_string ("verify");
- staticpro (&Qgnutls_bootprop_callbacks_verify);
-
- Qgnutls_bootprop_loglevel = intern_c_string (":loglevel");
- staticpro (&Qgnutls_bootprop_loglevel);
-
- Qgnutls_bootprop_verify_flags = intern_c_string (":verify-flags");
- staticpro (&Qgnutls_bootprop_verify_flags);
-
- Qgnutls_bootprop_verify_hostname_error = intern_c_string (":verify-error");
- staticpro (&Qgnutls_bootprop_verify_error);
-
- Qgnutls_bootprop_verify_hostname_error = intern_c_string (":verify-hostname-error");
- staticpro (&Qgnutls_bootprop_verify_hostname_error);
-
- Qgnutls_e_interrupted = intern_c_string ("gnutls-e-interrupted");
- staticpro (&Qgnutls_e_interrupted);
+ DEFSYM (Qgnutls_dll, "gnutls");
+ DEFSYM (Qgnutls_log_level, "gnutls-log-level");
+ DEFSYM (Qgnutls_code, "gnutls-code");
+ DEFSYM (Qgnutls_anon, "gnutls-anon");
+ DEFSYM (Qgnutls_x509pki, "gnutls-x509pki");
+ DEFSYM (Qgnutls_bootprop_hostname, ":hostname");
+ DEFSYM (Qgnutls_bootprop_priority, ":priority");
+ DEFSYM (Qgnutls_bootprop_trustfiles, ":trustfiles");
+ DEFSYM (Qgnutls_bootprop_keylist, ":keylist");
+ DEFSYM (Qgnutls_bootprop_crlfiles, ":crlfiles");
+ DEFSYM (Qgnutls_bootprop_callbacks, ":callbacks");
+ DEFSYM (Qgnutls_bootprop_callbacks_verify, "verify");
+ DEFSYM (Qgnutls_bootprop_loglevel, ":loglevel");
+ DEFSYM (Qgnutls_bootprop_verify_flags, ":verify-flags");
+ DEFSYM (Qgnutls_bootprop_verify_hostname_error, ":verify-hostname-error");
+
+ DEFSYM (Qgnutls_e_interrupted, "gnutls-e-interrupted");
Fput (Qgnutls_e_interrupted, Qgnutls_code,
make_number (GNUTLS_E_INTERRUPTED));
- Qgnutls_e_again = intern_c_string ("gnutls-e-again");
- staticpro (&Qgnutls_e_again);
+ DEFSYM (Qgnutls_e_again, "gnutls-e-again");
Fput (Qgnutls_e_again, Qgnutls_code,
make_number (GNUTLS_E_AGAIN));
- Qgnutls_e_invalid_session = intern_c_string ("gnutls-e-invalid-session");
- staticpro (&Qgnutls_e_invalid_session);
+ DEFSYM (Qgnutls_e_invalid_session, "gnutls-e-invalid-session");
Fput (Qgnutls_e_invalid_session, Qgnutls_code,
make_number (GNUTLS_E_INVALID_SESSION));
- Qgnutls_e_not_ready_for_handshake =
- intern_c_string ("gnutls-e-not-ready-for-handshake");
- staticpro (&Qgnutls_e_not_ready_for_handshake);
+ DEFSYM (Qgnutls_e_not_ready_for_handshake, "gnutls-e-not-ready-for-handshake");
Fput (Qgnutls_e_not_ready_for_handshake, Qgnutls_code,
make_number (GNUTLS_E_APPLICATION_ERROR_MIN));