From: Chris Hanson Date: Thu, 1 Mar 2001 04:10:42 +0000 (+0000) Subject: Don't use mcrypt for Blowfish; it provides 8-bit CFB and our original X-Git-Tag: 20090517-FFI~2946 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a30fcd148ec18ff722f1fc32595103d0409398a4;p=mit-scheme.git Don't use mcrypt for Blowfish; it provides 8-bit CFB and our original code provides 64-bit CFB. --- diff --git a/v7/src/runtime/blowfish.scm b/v7/src/runtime/blowfish.scm index e5746d315..6277f3fa5 100644 --- a/v7/src/runtime/blowfish.scm +++ b/v7/src/runtime/blowfish.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: blowfish.scm,v 1.21 2001/02/28 21:42:29 cph Exp $ +$Id: blowfish.scm,v 1.22 2001/03/01 04:10:42 cph Exp $ Copyright (c) 1997-2001 Massachusetts Institute of Technology @@ -31,32 +31,28 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (define blowfish-ofb64 (ucode-primitive blowfish-ofb64-substring 8)) (define (blowfish-available?) - (or (mcrypt-available?) - (implemented-primitive-procedure? blowfish-cfb64))) + (implemented-primitive-procedure? blowfish-cfb64)) (define (blowfish-encrypt-port input output key init-vector encrypt?) - (if (mcrypt-available?) - (mcrypt-encrypt-port "blowfish" "cfb" input output key init-vector - encrypt?) - ;; Assumes that INPUT is in blocking mode. - (let ((key (blowfish-set-key key)) - (input-buffer (make-string 4096)) - (output-buffer (make-string 4096))) - (dynamic-wind - (lambda () - unspecific) - (lambda () - (let loop ((m 0)) - (let ((n (input-port/read-string! input input-buffer))) - (if (not (fix:= 0 n)) - (let ((m - (blowfish-cfb64 input-buffer 0 n output-buffer 0 - key init-vector m encrypt?))) - (write-substring output-buffer 0 n output) - (loop m)))))) - (lambda () - (string-fill! input-buffer #\NUL) - (string-fill! output-buffer #\NUL)))))) + ;; Assumes that INPUT is in blocking mode. + (let ((key (blowfish-set-key key)) + (input-buffer (make-string 4096)) + (output-buffer (make-string 4096))) + (dynamic-wind + (lambda () + unspecific) + (lambda () + (let loop ((m 0)) + (let ((n (input-port/read-string! input input-buffer))) + (if (not (fix:= 0 n)) + (let ((m + (blowfish-cfb64 input-buffer 0 n output-buffer 0 + key init-vector m encrypt?))) + (write-substring output-buffer 0 n output) + (loop m)))))) + (lambda () + (string-fill! input-buffer #\NUL) + (string-fill! output-buffer #\NUL))))) (define (compute-blowfish-init-vector) ;; This init vector includes a timestamp with a resolution of