diff options
-rw-r--r-- | guile/modules/Makefile.am | 4 | ||||
-rw-r--r-- | guile/modules/gnutls.in | 8 | ||||
-rw-r--r-- | guile/modules/gnutls/build/priorities.scm | 104 | ||||
-rw-r--r-- | guile/src/Makefile.am | 12 | ||||
-rw-r--r-- | guile/src/core.c | 17 | ||||
-rw-r--r-- | guile/src/make-session-priorities.scm | 43 | ||||
-rw-r--r-- | guile/tests/session-record-port.scm | 25 | ||||
-rw-r--r-- | guile/tests/x509-auth.scm | 26 |
8 files changed, 16 insertions, 223 deletions
diff --git a/guile/modules/Makefile.am b/guile/modules/Makefile.am index 1ce64089c2..71e3d6878b 100644 --- a/guile/modules/Makefile.am +++ b/guile/modules/Makefile.am @@ -1,5 +1,5 @@ # GnuTLS --- Guile bindings for GnuTLS. -# Copyright (C) 2007-2012 Free Software Foundation, Inc. +# Copyright (C) 2007-2012, 2014 Free Software Foundation, Inc. # # GnuTLS is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ documentation_modules = system/documentation/README \ system/documentation/output.scm EXTRA_DIST = gnutls/build/enums.scm gnutls/build/smobs.scm \ - gnutls/build/utils.scm gnutls/build/priorities.scm \ + gnutls/build/utils.scm \ gnutls/build/tests.scm \ gnutls.in \ $(documentation_modules) diff --git a/guile/modules/gnutls.in b/guile/modules/gnutls.in index fe10f9effc..b4825226fd 100644 --- a/guile/modules/gnutls.in +++ b/guile/modules/gnutls.in @@ -72,13 +72,7 @@ ;; priorities set-session-priorities! - - ;; priority functions (deprecated) - set-session-cipher-priority! set-session-mac-priority! - set-session-compression-method-priority! - set-session-kx-priority! set-session-protocol-priority! - set-session-certificate-type-priority! - set-session-default-priority! set-session-default-export-priority! + set-session-default-priority! ;; DH set-session-dh-prime-bits! diff --git a/guile/modules/gnutls/build/priorities.scm b/guile/modules/gnutls/build/priorities.scm deleted file mode 100644 index 4d14009308..0000000000 --- a/guile/modules/gnutls/build/priorities.scm +++ /dev/null @@ -1,104 +0,0 @@ -;;; GnuTLS --- Guile bindings for GnuTLS. -;;; Copyright (C) 2007-2013 Free Software Foundation, Inc. -;;; -;;; 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. -;;; -;;; GnuTLS 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 GnuTLS; if not, write to the Free Software -;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -;;; Written by Ludovic Courtès <ludo@chbouib.org> - -(define-module (gnutls build priorities) - :use-module (srfi srfi-9) - :use-module (gnutls build utils) - :use-module (gnutls build enums) - :export (output-session-set-priority-function %gnutls-priorities)) - -;;; -;;; Helpers to generate the `gnutls_XXX_set_priority ()' wrappers. -;;; - - - -;;; -;;; Priority functions. -;;; - -(define-record-type <session-priority> - (make-session-priority enum-type c-setter) - session-priority? - (enum-type session-priority-enum-type) - (c-setter session-priority-c-setter) - (c-getter session-priority-c-getter)) - - -;;; -;;; C code generation. -;;; - -(define (output-session-set-priority-function priority port) - (let* ((enum (session-priority-enum-type priority)) - (setter (session-priority-c-setter priority)) - (c-name (scheme-symbol->c-name (enum-type-subsystem enum)))) - (format port "SCM_DEFINE (scm_gnutls_set_session_~a_priority_x,~%" - c-name) - (format port " \"set-session-~a-priority!\", 2, 0, 0,~%" - (enum-type-subsystem enum)) - (format port " (SCM session, SCM items),~%") - (format port " \"Use @var{items} (a list) as the list of \"~%") - (format port " \"preferred ~a for @var{session}.\")~%" - (enum-type-subsystem enum)) - (format port "#define FUNC_NAME s_scm_gnutls_set_session_~a_priority_x~%" - c-name) - (format port "{~%") - (format port " gnutls_session_t c_session;~%") - (format port " ~a *c_items;~%" - (enum-type-c-type enum)) - (format port " long int c_len, i;~%") - (format port " scm_c_issue_deprecation_warning \ -(\"`set-session-~a-priority!' is deprecated, \ -use `set-session-priorities!' instead\");~%" (enum-type-subsystem enum)) - (format port " c_session = scm_to_gnutls_session (session, 1, FUNC_NAME);~%") - (format port " SCM_VALIDATE_LIST_COPYLEN (2, items, c_len);~%") - (format port " c_items = alloca (sizeof (* c_items) * (c_len + 1));~%") - (format port " for (i = 0; i < c_len; i++, items = SCM_CDR (items))~%") - (format port " c_items[i] = ~a (SCM_CAR (items), 2, FUNC_NAME);~%" - (enum-type-to-c-function enum)) - (format port " c_items[c_len] = (~a) 0;~%" - (enum-type-c-type enum)) - (format port " ~a (c_session, (int *) c_items);~%" - setter) - (format port " return SCM_UNSPECIFIED;~%") - (format port "}~%") - (format port "#undef FUNC_NAME~%"))) - - -;;; -;;; Actual priority functions. -;;; - -(define %gnutls-priorities - (map make-session-priority - (list %cipher-enum %mac-enum %compression-method-enum %kx-enum - %protocol-enum %certificate-type-enum) - (list "gnutls_cipher_set_priority" "gnutls_mac_set_priority" - "gnutls_compression_set_priority" "gnutls_kx_set_priority" - "gnutls_protocol_set_priority" - "gnutls_certificate_type_set_priority"))) - - -;;; Local Variables: -;;; mode: scheme -;;; coding: latin-1 -;;; End: - -;;; arch-tag: a9cdcc92-6dcf-4d63-afec-6dc16334e379 diff --git a/guile/src/Makefile.am b/guile/src/Makefile.am index 40ff26559e..21efaa4e53 100644 --- a/guile/src/Makefile.am +++ b/guile/src/Makefile.am @@ -1,5 +1,5 @@ # GnuTLS --- Guile bindings for GnuTLS. -# Copyright (C) 2007-2013 Free Software Foundation, Inc. +# Copyright (C) 2007-2014 Free Software Foundation, Inc. # # GnuTLS is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,13 +22,11 @@ noinst_HEADERS = errors.h utils.h EXTRA_DIST = \ make-enum-map.scm make-smob-types.scm \ - make-enum-header.scm make-smob-header.scm \ - make-session-priorities.scm + make-enum-header.scm make-smob-header.scm # Files generated by the (gnutls build ...) modules. GENERATED_BINDINGS = \ - enum-map.i.c smob-types.i.c enums.h smobs.h \ - priorities.i.c + enum-map.i.c smob-types.i.c enums.h smobs.h BUILT_SOURCES = \ $(GENERATED_BINDINGS) \ @@ -95,10 +93,6 @@ smob-types.i.c: $(srcdir)/make-smob-types.scm $(GUILE_FOR_BUILD) "$^" > "$@.tmp" mv "$@.tmp" "$@" -priorities.i.c: $(srcdir)/make-session-priorities.scm - $(GUILE_FOR_BUILD) "$^" > "$@.tmp" - mv "$@.tmp" "$@" - # C file snarfing. diff --git a/guile/src/core.c b/guile/src/core.c index 9668b22312..dc1ae862ac 100644 --- a/guile/src/core.c +++ b/guile/src/core.c @@ -516,8 +516,6 @@ SCM_DEFINE (scm_gnutls_set_server_session_certificate_request_x, /* Choice of a protocol and cipher suite. */ -#include "priorities.i.c" - SCM_DEFINE (scm_gnutls_set_default_priority_x, "set-session-default-priority!", 1, 0, 0, (SCM session), "Have @var{session} use the default priorities.") @@ -533,21 +531,6 @@ SCM_DEFINE (scm_gnutls_set_default_priority_x, #undef FUNC_NAME -SCM_DEFINE (scm_gnutls_set_default_export_priority_x, - "set-session-default-export-priority!", 1, 0, 0, - (SCM session), - "Have @var{session} use the default export priorities.") -#define FUNC_NAME s_scm_gnutls_set_default_export_priority_x -{ - gnutls_session_t c_session; - - c_session = scm_to_gnutls_session (session, 1, FUNC_NAME); - gnutls_set_default_export_priority (c_session); - - return SCM_UNSPECIFIED; -} -#undef FUNC_NAME - SCM_DEFINE (scm_gnutls_set_session_priorities_x, "set-session-priorities!", 2, 0, 0, (SCM session, SCM priorities), diff --git a/guile/src/make-session-priorities.scm b/guile/src/make-session-priorities.scm deleted file mode 100644 index 1bc5edcdad..0000000000 --- a/guile/src/make-session-priorities.scm +++ /dev/null @@ -1,43 +0,0 @@ -;;; Help produce Guile wrappers for GnuTLS types. -;;; -;;; GnuTLS --- Guile bindings for GnuTLS. -;;; Copyright (C) 2007, 2010, 2012 Free Software Foundation, Inc. -;;; -;;; 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. -;;; -;;; GnuTLS 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 GnuTLS; if not, write to the Free Software -;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -;;; Written by Ludovic Courtès <ludo@chbouib.org>. - - -(use-modules (gnutls build priorities)) - - -;;; -;;; The program. -;;; - -(define (main . args) - (let ((port (current-output-port))) - (for-each (lambda (priority) - (output-session-set-priority-function priority port)) - %gnutls-priorities))) - -(main) - -;;; Local Variables: -;;; mode: scheme -;;; coding: latin-1 -;;; End: - -;;; arch-tag: 026228de-e6d6-421b-bf2f-aaf9630d6b73 diff --git a/guile/tests/session-record-port.scm b/guile/tests/session-record-port.scm index 93b637c145..bb3f25f844 100644 --- a/guile/tests/session-record-port.scm +++ b/guile/tests/session-record-port.scm @@ -1,5 +1,5 @@ ;;; GnuTLS --- Guile bindings for GnuTLS. -;;; Copyright (C) 2007-2012 Free Software Foundation, Inc. +;;; Copyright (C) 2007-2012, 2014 Free Software Foundation, Inc. ;;; ;;; GnuTLS is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -27,14 +27,9 @@ (gnutls build tests) (srfi srfi-4)) - ;; TLS session settings. -(define %protos (list protocol/tls-1.0)) -(define %certs '()) -(define %ciphers (list cipher/null cipher/arcfour cipher/aes-128-cbc - cipher/aes-256-cbc)) -(define %kx (list kx/anon-dh)) -(define %macs (list mac/sha1 mac/rmd160 mac/md5)) +(define priorities + "NONE:+VERS-TLS-ALL:+CIPHER-ALL:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-DH") ;; Message sent by the client. (define %message (apply u8vector (iota 256))) @@ -87,12 +82,7 @@ (let ((client (make-session connection-end/client))) ;; client-side (child process) - (set-session-default-priority! client) - (set-session-certificate-type-priority! client %certs) - (set-session-kx-priority! client %kx) - (set-session-protocol-priority! client %protos) - (set-session-cipher-priority! client %ciphers) - (set-session-mac-priority! client %macs) + (set-session-priorities! client priorities) (set-session-transport-port! client (car socket-pair)) (set-session-credentials! client (make-anonymous-client-credentials)) @@ -106,12 +96,7 @@ (let ((server (make-session connection-end/server))) ;; server-side - (set-session-default-priority! server) - (set-session-certificate-type-priority! server %certs) - (set-session-kx-priority! server %kx) - (set-session-protocol-priority! server %protos) - (set-session-cipher-priority! server %ciphers) - (set-session-mac-priority! server %macs) + (set-session-priorities! server priorities) (set-session-transport-port! server (cdr socket-pair)) (let ((cred (make-anonymous-server-credentials)) diff --git a/guile/tests/x509-auth.scm b/guile/tests/x509-auth.scm index cc83ed95a4..71c8d1500a 100644 --- a/guile/tests/x509-auth.scm +++ b/guile/tests/x509-auth.scm @@ -27,14 +27,9 @@ (gnutls build tests) (srfi srfi-4)) - -;; TLS session settings (using the deprecated method). -(define %protos (list protocol/tls-1.0)) -(define %certs (list certificate-type/x509)) -(define %ciphers (list cipher/null cipher/arcfour cipher/aes-128-cbc - cipher/aes-256-cbc)) -(define %kx (list kx/rsa kx/rsa-export kx/dhe-dss kx/dhe-dss)) -(define %macs (list mac/sha1 mac/rmd160 mac/md5)) +;; TLS session settings. +(define priorities + "NORMAL") ;; Message sent by the client. (define %message @@ -72,13 +67,7 @@ (let ((client (make-session connection-end/client)) (cred (make-certificate-credentials))) ;; client-side (child process) - (set-session-default-priority! client) - (set-session-certificate-type-priority! client %certs) - (set-session-kx-priority! client %kx) - (set-session-protocol-priority! client %protos) - (set-session-cipher-priority! client %ciphers) - (set-session-mac-priority! client %macs) - + (set-session-priorities! client priorities) (set-certificate-credentials-x509-keys! cred (list pub) sec) (set-session-credentials! client cred) (set-session-dh-prime-bits! client 1024) @@ -94,12 +83,7 @@ (let ((server (make-session connection-end/server)) (dh (import-dh-params "dh-parameters.pem"))) ;; server-side - (set-session-default-priority! server) - (set-session-certificate-type-priority! server %certs) - (set-session-kx-priority! server %kx) - (set-session-protocol-priority! server %protos) - (set-session-cipher-priority! server %ciphers) - (set-session-mac-priority! server %macs) + (set-session-priorities! server priorities) (set-server-session-certificate-request! server certificate-request/require) |