From: Matt Birkholz Date: Sat, 7 Sep 2013 23:56:48 +0000 (-0700) Subject: blowfish: Random cleanup. Use guarantee-substring. X-Git-Tag: release-9.2.0~122 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ffabb69bf87c0087afd3f9b4c992bfc0c5b9f5c1;p=mit-scheme.git blowfish: Random cleanup. Use guarantee-substring. --- diff --git a/src/blowfish/Makefile.in b/src/blowfish/Makefile.in index b618b7325..5e98b8cbc 100644 --- a/src/blowfish/Makefile.in +++ b/src/blowfish/Makefile.in @@ -49,7 +49,7 @@ distclean: clean rm -f Makefile config.h config.log config.status maintainer-clean: distclean - rm -f configure + rm -f configure config.h.in rm -rf autom4te.cache blowfish-shim.so: blowfish-shim.o blowfish-adapter.o diff --git a/src/blowfish/blowfish.cdecl b/src/blowfish/blowfish.cdecl index 179a83aba..0d8c2659a 100644 --- a/src/blowfish/blowfish.cdecl +++ b/src/blowfish/blowfish.cdecl @@ -72,7 +72,7 @@ USA. (length long) (schedule (* BF_KEY)) (ivec (* uchar)) - (num int))) + (num int)) (extern (* (const char)) BF_options) diff --git a/src/blowfish/blowfish.scm b/src/blowfish/blowfish.scm index 64e6fa437..4f5b40e0b 100644 --- a/src/blowfish/blowfish.scm +++ b/src/blowfish/blowfish.scm @@ -91,9 +91,8 @@ USA. ;; Returned value is the new value of NUM. (guarantee-bfkey key 'BLOWFISH-CFB64) (guarantee-init-vector init-vector 'BLOWFISH-CFB64) - (guarantee-substring-indices input istart iend 'BLOWFISH-CFB64) - (guarantee-substring-indices output ostart (+ ostart (- iend istart)) - 'BLOWFISH-CFB64) + (guarantee-substring input istart iend 'BLOWFISH-CFB64) + (guarantee-substring output ostart (+ ostart (- iend istart)) 'BLOWFISH-CFB64) (guarantee-init-index num 'BLOWFISH-CFB64) (let ((ilen (- iend istart))) (if (and (eq? input output) @@ -121,9 +120,8 @@ USA. ;; Returned value is the new value of NUM. (guarantee-bfkey key 'BLOWFISH-OFB64) (guarantee-init-vector init-vector 'BLOWFISH-OFB64) - (guarantee-substring-indices input istart iend 'BLOWFISH-OFB64) - (guarantee-substring-indices output ostart (+ ostart (- iend istart)) - 'BLOWFISH-OFB64) + (guarantee-substring input istart iend 'BLOWFISH-OFB64) + (guarantee-substring output ostart (+ ostart (- iend istart)) 'BLOWFISH-OFB64) (guarantee-init-index num 'BLOWFISH-OFB64) (let ((ilen (- iend istart))) (if (and (eq? input output) @@ -153,16 +151,6 @@ USA. "a multiple of 8 characters string" operator))) -(define (guarantee-substring-indices string start end operator) - (guarantee-string string operator) - (guarantee-fixnum start operator) - (guarantee-fixnum end operator) - (if (not (fix:<= 0 start)) - (error:bad-range-argument start "a string index" operator)) - (if (not (and (fix:<= start end) - (fix:<= end (string-length string)))) - (error:bad-range-argument end "a string index" operator))) - (define (guarantee-bfkey object operator) (if (not (and (string? object) (fix:= (C-sizeof "BF_KEY")