diff options
author | Simon Josefsson <simon@josefsson.org> | 2010-10-14 22:21:22 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2010-10-14 22:21:22 +0200 |
commit | e8decd82ed4be106b5ba9ca250b8b54e1aec522b (patch) | |
tree | c0ac85ab79ecff6a837ff1fba1c38a588c5f8a36 /guile | |
parent | 608995843d8c695f2381d598950b6f1fec019ee2 (diff) | |
download | gnutls-e8decd82ed4be106b5ba9ca250b8b54e1aec522b.tar.gz |
Don't generate DH primes in Guile self checks (for speed).
Diffstat (limited to 'guile')
-rw-r--r-- | guile/tests/Makefile.am | 2 | ||||
-rw-r--r-- | guile/tests/anonymous-auth.scm | 13 | ||||
-rw-r--r-- | guile/tests/dh-parameters.pem | 5 | ||||
-rw-r--r-- | guile/tests/openpgp-auth.scm | 6 | ||||
-rw-r--r-- | guile/tests/pkcs-import-export.scm | 13 | ||||
-rw-r--r-- | guile/tests/session-record-port.scm | 13 | ||||
-rw-r--r-- | guile/tests/x509-auth.scm | 6 |
7 files changed, 52 insertions, 6 deletions
diff --git a/guile/tests/Makefile.am b/guile/tests/Makefile.am index aaa8e9a987..0832b1e806 100644 --- a/guile/tests/Makefile.am +++ b/guile/tests/Makefile.am @@ -35,5 +35,5 @@ TESTS_ENVIRONMENT = \ EXTRA_DIST = $(TESTS) openpgp-pub.asc openpgp-sec.asc \ openpgp-keyring.gpg openpgp-keyring.asc \ - rsa-parameters.pem \ + rsa-parameters.pem dh-parameters.pem \ x509-certificate.pem x509-key.pem diff --git a/guile/tests/anonymous-auth.scm b/guile/tests/anonymous-auth.scm index 7d5941e8de..17f5e8047d 100644 --- a/guile/tests/anonymous-auth.scm +++ b/guile/tests/anonymous-auth.scm @@ -38,6 +38,17 @@ ;; Message sent by the client. (define %message (apply u8vector (iota 256))) +(define (import-something import-proc file fmt) + (let* ((path (search-path %load-path file)) + (size (stat:size (stat path))) + (raw (make-u8vector size))) + (uniform-vector-read! raw (open-input-file path)) + (import-proc raw fmt))) + +(define (import-dh-params file) + (import-something pkcs3-import-dh-parameters file + x509-certificate-format/pem)) + ;; Debugging. ;; (set-log-level! 100) ;; (set-log-procedure! (lambda (level str) @@ -82,7 +93,7 @@ (set-session-transport-fd! server (fileno (cdr socket-pair))) (let ((cred (make-anonymous-server-credentials)) - (dh-params (make-dh-parameters 1024))) + (dh-params (import-dh-params "dh-parameters.pem"))) ;; Note: DH parameter generation can take some time. (set-anonymous-server-dh-parameters! cred dh-params) (set-session-credentials! server cred)) diff --git a/guile/tests/dh-parameters.pem b/guile/tests/dh-parameters.pem new file mode 100644 index 0000000000..9a824c34e2 --- /dev/null +++ b/guile/tests/dh-parameters.pem @@ -0,0 +1,5 @@ +-----BEGIN DH PARAMETERS----- +MIGGAoGAtkxw2jlsVCsrfLqxrN+IrF/3W8vVFvDzYbLmxi2GQv9s/PQGWP1d9i22 +P2DprfcJknWt7KhCI1SaYseOQIIIAYP78CfyIpGScW/vS8khrw0rlQiyeCvQgF3O +GeGOEywcw+oQT4SmFOD7H0smJe2CNyjYpexBXQ/A0mbTF9QKm1cCAQU= +-----END DH PARAMETERS----- diff --git a/guile/tests/openpgp-auth.scm b/guile/tests/openpgp-auth.scm index e02db5fed2..fe3c0cf71f 100644 --- a/guile/tests/openpgp-auth.scm +++ b/guile/tests/openpgp-auth.scm @@ -54,6 +54,10 @@ (import-something pkcs1-import-rsa-parameters file x509-certificate-format/pem)) +(define (import-dh-params file) + (import-something pkcs3-import-dh-parameters file + x509-certificate-format/pem)) + ;; Debugging. ;; (set-log-level! 3) ;; (set-log-procedure! (lambda (level str) @@ -96,7 +100,7 @@ (let ((server (make-session connection-end/server)) (rsa (import-rsa-params "rsa-parameters.pem")) - (dh (make-dh-parameters 1024))) + (dh (import-dh-params "dh-parameters.pem"))) ;; server-side (set-session-default-priority! server) (set-session-certificate-type-priority! server %certs) diff --git a/guile/tests/pkcs-import-export.scm b/guile/tests/pkcs-import-export.scm index 79f9aeebcf..8900f15992 100644 --- a/guile/tests/pkcs-import-export.scm +++ b/guile/tests/pkcs-import-export.scm @@ -25,6 +25,17 @@ (use-modules (gnutls) (srfi srfi-4)) +(define (import-something import-proc file fmt) + (let* ((path (search-path %load-path file)) + (size (stat:size (stat path))) + (raw (make-u8vector size))) + (uniform-vector-read! raw (open-input-file path)) + (import-proc raw fmt))) + +(define (import-dh-params file) + (import-something pkcs3-import-dh-parameters file + x509-certificate-format/pem)) + (dynamic-wind (lambda () @@ -32,7 +43,7 @@ (lambda () (exit - (let* ((dh-params (make-dh-parameters 1024)) + (let* ((dh-params (import-dh-params "dh-parameters.pem")) (export (pkcs3-export-dh-parameters dh-params x509-certificate-format/pem))) diff --git a/guile/tests/session-record-port.scm b/guile/tests/session-record-port.scm index 49eaa5f3e5..a41ea2cd63 100644 --- a/guile/tests/session-record-port.scm +++ b/guile/tests/session-record-port.scm @@ -38,6 +38,17 @@ ;; Message sent by the client. (define %message (apply u8vector (iota 256))) +(define (import-something import-proc file fmt) + (let* ((path (search-path %load-path file)) + (size (stat:size (stat path))) + (raw (make-u8vector size))) + (uniform-vector-read! raw (open-input-file path)) + (import-proc raw fmt))) + +(define (import-dh-params file) + (import-something pkcs3-import-dh-parameters file + x509-certificate-format/pem)) + ;; Debugging. ;; (set-log-level! 100) ;; (set-log-procedure! (lambda (level str) @@ -106,7 +117,7 @@ (set-session-transport-port! server (cdr socket-pair)) (let ((cred (make-anonymous-server-credentials)) - (dh-params (make-dh-parameters 1024))) + (dh-params (import-dh-params "dh-parameters.pem"))) ;; Note: DH parameter generation can take some time. (set-anonymous-server-dh-parameters! cred dh-params) (set-session-credentials! server cred)) diff --git a/guile/tests/x509-auth.scm b/guile/tests/x509-auth.scm index 4363e43416..83cf423808 100644 --- a/guile/tests/x509-auth.scm +++ b/guile/tests/x509-auth.scm @@ -53,6 +53,10 @@ (import-something pkcs1-import-rsa-parameters file x509-certificate-format/pem)) +(define (import-dh-params file) + (import-something pkcs3-import-dh-parameters file + x509-certificate-format/pem)) + ;; Debugging. ;; (set-log-level! 3) ;; (set-log-procedure! (lambda (level str) @@ -95,7 +99,7 @@ (let ((server (make-session connection-end/server)) (rsa (import-rsa-params "rsa-parameters.pem")) - (dh (make-dh-parameters 1024))) + (dh (import-dh-params "dh-parameters.pem"))) ;; server-side (set-session-default-priority! server) (set-session-certificate-type-priority! server %certs) |