Skip to content

Commit

Permalink
Start adding stream cipher documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ktakashi committed Jul 27, 2023
1 parent 85374f1 commit 715aaac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
32 changes: 28 additions & 4 deletions doc/sagittarius/crypto/ciphers.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ must be either `encrypt` or `decrypt`.

### [§4] Symmetric ciphers

Symmetric cipher can be either block cipher or stream cipher. At this
moment, the library only supports block cipher. Stream ciphers may
come in the future.
Symmetric cipher can be either block cipher or stream cipher.

###### [!Function] `symmetric-cipher-descriptor?` _obj_

Expand All @@ -222,6 +220,8 @@ Returns maximum key length of the given _descriptor_'s algorithm.
Returns `#t` if the given _obj_ is a symmetric cipher object, otherwise `#f`.


#### [§5] Block ciphers

###### [!Function] `block-cipher-descriptor?` _obj_

Returns `#t` if the given _obj_ is a block cipher descriptor,
Expand Down Expand Up @@ -297,7 +297,7 @@ Mode descriptors for ECB, CBC, CFB, OFB, CTR, LRW and F8 respectively.
###### [!Mode descriptor] `*mode:gcm*`

Mode descriptor for EAX, OCB, OCB3 and GCM respectively. These are
authenticated encryption modes.
authenticated encryption with assiciated data (AEAD) modes.

###### [!Function] `mode-descriptor-name` (_descriptor_ `mode-descriptor?`)

Expand Down Expand Up @@ -435,6 +435,30 @@ This procedure is only for encryption mode.
Stores the *cipher*'s authentication tag into the given _tag_,
starting position of _start_.

#### [§5] Stream ciphers

###### [!Function] `stream-cipher-descriptor?` _obj_

Returns `#t` if the given _obj_ is a stream cipher descriptor, otherwise `#f`.

Currently, below encryption algorithms are supported:

###### [!Stream cipher descriptor] `*scheme:chacha20*`
###### [!Stream cipher descriptor] `*scheme:chacha20-poly1305*`

###### [!Function] `stream-cipher-descriptor-aead?` (_descriptor_ `stream-cipher-descriptor?`)

Returns `#t` if given the _descriptor_ is a AEAD stream cipher, otherwise `#f`.

###### [!Function] `stream-cipher?` _obj_

Returns `#t` if the given _obj_ is a stream cipher object, otherwise `#f`.

###### [!Function] `make-stream-cipher` (_scheme_ `stream-cipher-descriptor?`)

Creates a stream cipher object of _scheme_ encryption scheme.


### [§4] Asymmetric ciphers

###### [!Function] `asymmetric-cipher-descriptor?` _obj_
Expand Down
1 change: 1 addition & 0 deletions tools/scripts/make-test-vectors.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
;; Making test vectors from wycheproof
(import (rnrs)
(text json)
(text json pointer)
Expand Down

0 comments on commit 715aaac

Please sign in to comment.