From: Chris Hanson Date: Tue, 11 Apr 2000 04:17:37 +0000 (+0000) Subject: Improve error message for incorrect salt size. X-Git-Tag: 20090517-FFI~4056 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2eed1a9a56840289e9fb53289a70cb27788899f8;p=mit-scheme.git Improve error message for incorrect salt size. --- diff --git a/v7/src/runtime/crypto.scm b/v7/src/runtime/crypto.scm index 0e0623afe..2a9a42523 100644 --- a/v7/src/runtime/crypto.scm +++ b/v7/src/runtime/crypto.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: crypto.scm,v 14.4 2000/04/11 04:00:28 cph Exp $ +$Id: crypto.scm,v 14.5 2000/04/11 04:17:37 cph Exp $ Copyright (c) 2000 Massachusetts Institute of Technology @@ -140,7 +140,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. passphrase)) (error "Error signalled by mhash_keygen().")) keyword)) - + (define (convert-keygen-parameters name parameters) (let ((n-algorithms (mhash-keygen-uses-hash-algorithm name)) (uses-salt? (mhash-keygen-uses-salt? name)) @@ -158,7 +158,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (let ((n (fix:+ 2 n-algorithms))) (let ((v (make-vector n))) (vector-set! v 0 - (and uses-salt? (list-ref parameters n-algorithms))) + (and uses-salt? + (let ((salt (list-ref parameters n-algorithms)) + (n (mhash-keygen-salt-size name))) + (if (not (fix:= n (string-length salt))) + (error "Salt size incorrect:" + (string-length salt) + (error-irritant/noise "; should be:") + n)) + salt))) (vector-set! v 1 (and uses-count? (list-ref parameters