summaryrefslogtreecommitdiff
path: root/src/eris-decode.lisp
diff options
context:
space:
mode:
authorPiotr Szarmanski2022-09-23 12:53:43 +0200
committerPiotr Szarmanski2022-09-23 12:53:43 +0200
commit9ed9bd758871d2f01a3d19192e9808ce19925a16 (patch)
tree71302b122212261b8d87e139a622dd1e0d32bae8 /src/eris-decode.lisp
parent4d82ef18a8bb18317be3e089f432f95b6e5dbd4a (diff)
Simplify octets-to-reference-pair
Diffstat (limited to 'src/eris-decode.lisp')
-rw-r--r--src/eris-decode.lisp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eris-decode.lisp b/src/eris-decode.lisp
index 43f8db0..b660cae 100644
--- a/src/eris-decode.lisp
+++ b/src/eris-decode.lisp
@@ -86,7 +86,7 @@ fetched from a trusted party.")
(flet ((find-last-reference (block)
(loop for i from (1- (/ block-size 64)) downto 0
- for key-reference = (octets-to-reference-pair (subseq-shared block (* 64 i)))
+ for key-reference = (octets-to-reference-pair block (* 64 i))
unless (key-reference-null? key-reference)
return (values key-reference i))))
(loop with position = 0
@@ -116,8 +116,8 @@ fetched from a trusted party.")
(when (zerop next-pos) ;; if 1+ mod blocks results in a zero, then update the next block
(process-block (cdr blocks) mod (1+ level)))
(let ((kr (octets-to-reference-pair
- (subseq-shared (data (cadr blocks))
- (the fixnum (* next-pos 64))))))
+ (data (cadr blocks))
+ (the fixnum (* next-pos 64)))))
(setf (data current)
(funcall get-block (reference kr) (key kr) (svref nonce-array level)))))))
(process-block (reverse root) (/ block-size 64) 0) ;; process the blocks from level 0 up
@@ -175,8 +175,8 @@ fetched from a trusted party.")
until (eq nil (cdr blocks))
when (or update-tree (not (eq block-position (pos lower-block))))
do (let ((rk (octets-to-reference-pair
- (subseq-shared (data (car blocks))
- (* 64 block-position)))))
+ (data (car blocks))
+ (* 64 block-position))))
(when (key-reference-null? rk)
(error 'eof :eof new-pos :position (pos stream)))
(setf (data lower-block) (funcall get-block (reference rk) (key rk) (svref nonce-array (1- level)))
@@ -221,7 +221,7 @@ cache."
(root (funcall get-block (reference root-reference-pair) (key root-reference-pair) (make-nonce level))))
;; "Implementations MUST verify the key appearing in the read capability
;; if level of encoded content is larger than 0."
- ;;(when (> level 0) (hash-check root (key root-reference-pair)))
+ (when (> level 0) (hash-check root (key root-reference-pair)))
(case level
;; Treat level 0 blocks specially, since those are just a single buffer.
(0 (let ((stream