mirror of
https://github.com/pmai/md5.git
synced 2025-12-21 14:34:29 +01:00
Incorporate fix for partial updates ending on rest boundaries from sbcl.
In all previous versions, if an update-md5-state call received a sequence which exactly filled a partially filled buffer, then that buffer block was ignored and the agregate data not updated.
This commit is contained in:
12
md5.lisp
12
md5.lisp
@ -404,11 +404,15 @@ bounded by start and end, which must be numeric bounding-indices."
|
||||
(declare (type (integer 0 63) amount))
|
||||
(copy-to-buffer sequence start amount buffer buffer-index)
|
||||
(setq start (the fixnum (+ start amount)))
|
||||
(when (>= start end)
|
||||
(setf (md5-state-buffer-index state) (+ buffer-index amount))
|
||||
(return-from update-md5-state state)))
|
||||
(let ((new-index (+ buffer-index amount)))
|
||||
(when (= new-index 64)
|
||||
(fill-block-ub8 block buffer 0)
|
||||
(update-md5-block regs block))
|
||||
(update-md5-block regs block)
|
||||
(setq new-index 0))
|
||||
(when (>= start end)
|
||||
(setf (md5-state-buffer-index state) new-index)
|
||||
(incf (md5-state-amount state) length)
|
||||
(return-from update-md5-state state)))))
|
||||
;; Handle main-part and new-rest
|
||||
(etypecase sequence
|
||||
((simple-array (unsigned-byte 8) (*))
|
||||
|
||||
Reference in New Issue
Block a user