summaryrefslogtreecommitdiff
path: root/src/eris.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/eris.lisp')
-rw-r--r--src/eris.lisp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/eris.lisp b/src/eris.lisp
index ed4a05e..91200a1 100644
--- a/src/eris.lisp
+++ b/src/eris.lisp
@@ -70,7 +70,7 @@ object, using the bytes from the OCTETS vector from at START."
(make-instance 'reference-pair :key key :reference reference)))
(defun encrypt-internal-block (input reference nonce)
- (declare (type octet-vector input secret reference))
+ (declare (type octet-vector input reference))
(let ((key (make-array 32 :element-type 'octet)))
(ironclad:digest-sequence :blake2/256 input :digest key)
;; NOT the IETF chacha. Need to fix this by patching ironclad. Maybe.
@@ -109,10 +109,13 @@ a (simple-array (unsigned-byte 8)) object."
(setf (aref cap 1) (level read-capability))
(reference-pair-to-octets (reference-pair read-capability) cap 2)))
-(-> octets-to-read-capability ((octet-vector 66)) read-capability)
+(-> octets-to-read-capability ((octet-vector 66)) (values read-capability &optional))
(defun octets-to-read-capability (octets)
"Convert the standard binary representation for ERIS read capabilities into a
-read-capability object. Returns the read-capability."
+read-capability object. Returns the read-capability.
+
+An ERIS:VERSION-MISMATCH condition may be signaled if the corresponding
+versioning bytes are not supported by eris-cl."
(declare (type (octet-vector 66) octets))
(let ((capability (make-instance 'read-capability)))
(setf (block-size capability)
@@ -134,7 +137,7 @@ read-capability object. Returns the read-capability."
"urn:eris:"
(bytes-to-base32-unpadded (read-capability-to-octets capability))))
-(-> urn-to-read-capability (string) read-capability)
+(-> urn-to-read-capability (string) (values read-capability &optional))
(defun urn-to-read-capability (urn)
"Convert a urn:eris URN string into a read-capability object."
(declare (type string urn))
@@ -146,7 +149,7 @@ read-capability object. Returns the read-capability."
(declare (type (octet-vector 32) reference))
(concatenate 'string "urn:blake2b:" (bytes-to-base32-unpadded reference)))
-(-> block-urn-to-reference (string) (octet-vector 32))
+(-> block-urn-to-reference (string) (values (octet-vector 32) &optional))
(defun block-urn-to-reference (urn)
"Convert a urn:blake2b URN string into a 32-byte block reference vector."
(declare (type string urn))
@@ -220,6 +223,7 @@ guarantee that a reference is only output once."))
(eris-create-tree reference-vector block-size output-function :hash-output hash-output)))
(defmethod eris-encode ((input stream) block-size output-function &key (secret null-secret) hash-output)
+ "This method does not handle any IO related conditions."
(declare (type block-size block-size)
(type function output-function)
(type (octet-vector 32) secret))
@@ -236,8 +240,7 @@ guarantee that a reference is only output once."))
(defun eris-create-tree (reference-vector block-size output-function &key hash-output)
(declare (type block-size block-size)
- (type function output-function)
- (type (octet-vector 32) secret))
+ (type function output-function))
(loop with block-keys = (/ block-size 64)
with level = 0
with reference-vector-l = (make-array 16 :adjustable t :fill-pointer 0)