From ffabb69bf87c0087afd3f9b4c992bfc0c5b9f5c1 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 7 Sep 2013 16:56:48 -0700 Subject: [PATCH] blowfish: Random cleanup. Use guarantee-substring. --- src/blowfish/Makefile.in | 2 +- src/blowfish/blowfish.cdecl | 2 +- src/blowfish/blowfish.scm | 20 ++++---------------- 3 files changed, 6 insertions(+), 18 deletions(-) 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") -- 2.25.1