From 78b1e7ab219c93b8e6f9a275332cf6e92cbd8d08 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 13 Apr 2000 02:59:12 +0000 Subject: [PATCH] Don't do mhash initialization if the primitives are unimplemented. --- v7/src/runtime/crypto.scm | 47 +++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/v7/src/runtime/crypto.scm b/v7/src/runtime/crypto.scm index 3b37a9dc4..c501b3bd2 100644 --- a/v7/src/runtime/crypto.scm +++ b/v7/src/runtime/crypto.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: crypto.scm,v 14.9 2000/04/11 16:01:42 cph Exp $ +$Id: crypto.scm,v 14.10 2000/04/13 02:59:12 cph Exp $ Copyright (c) 2000 Massachusetts Institute of Technology @@ -295,24 +295,27 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;;; Package initialization (define (initialize-package!) - (set! mhash-algorithm-names - (let ((n ((ucode-primitive mhash_count 0)))) - (let ((v (make-vector n))) - (do ((i 0 (fix:+ i 1))) - ((fix:= i n)) - (vector-set! - v i (intern ((ucode-primitive mhash_get_hash_name 1) i)))) - v))) - (set! mhash-contexts - (make-gc-finalizer (ucode-primitive mhash_end 1))) - (set! mhash-hmac-contexts - (make-gc-finalizer (ucode-primitive mhash_hmac_end 1))) - (set! mhash-keygen-names - (let ((n ((ucode-primitive mhash_keygen_count 0)))) - (let ((v (make-vector n))) - (do ((i 0 (fix:+ i 1))) - ((fix:= i n)) - (vector-set! - v i (intern ((ucode-primitive mhash_get_keygen_name 1) i)))) - v))) - unspecific) \ No newline at end of file + (if (mhash-available?) + (begin + (set! mhash-algorithm-names + (let ((n ((ucode-primitive mhash_count 0)))) + (let ((v (make-vector n))) + (do ((i 0 (fix:+ i 1))) + ((fix:= i n)) + (vector-set! + v i (intern ((ucode-primitive mhash_get_hash_name 1) i)))) + v))) + (set! mhash-contexts + (make-gc-finalizer (ucode-primitive mhash_end 1))) + (set! mhash-hmac-contexts + (make-gc-finalizer (ucode-primitive mhash_hmac_end 1))) + (set! mhash-keygen-names + (let ((n ((ucode-primitive mhash_keygen_count 0)))) + (let ((v (make-vector n))) + (do ((i 0 (fix:+ i 1))) + ((fix:= i n)) + (vector-set! + v i + (intern ((ucode-primitive mhash_get_keygen_name 1) i)))) + v))) + unspecific))) \ No newline at end of file -- 2.25.1