From f0f45836bfa3b2ef7ca0677433a03d81c550432e Mon Sep 17 00:00:00 2001 From: Guillaume LE VAILLANT Date: Thu, 9 Aug 2018 11:05:55 +0200 Subject: Release version 0.42 --- NEWS | 2 +- README.org | 4 +- doc/ironclad.html | 607 ++++++++++++++++++++++++++++-------------------------- ironclad.asd | 4 +- 4 files changed, 320 insertions(+), 297 deletions(-) diff --git a/NEWS b/NEWS index d38f3ba..144f3b2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ -*- mode: outline -*- -* Changes since version 0.41 +* Version 0.42, released 2018-08-09 ** bug fixes diff --git a/README.org b/README.org index 86f16b4..36ce1fd 100644 --- a/README.org +++ b/README.org @@ -57,8 +57,8 @@ usually not safe against side channel attacks. :CUSTOM_ID: installation :END: -The current version of Ironclad is 0.41. It can be downloaded -at [[https://github.com/sharplispers/ironclad/archive/v0.41.tar.gz]]. +The current version of Ironclad is 0.42. It can be downloaded +at [[https://github.com/sharplispers/ironclad/archive/v0.42.tar.gz]]. If you are feeling adventurous, you can download a bleeding-edge version at [[https://github.com/sharplispers/ironclad]]. diff --git a/doc/ironclad.html b/doc/ironclad.html index e3fef0f..6621e12 100644 --- a/doc/ironclad.html +++ b/doc/ironclad.html @@ -1,7 +1,7 @@ - + Ironclad @@ -72,8 +72,8 @@ a level of confidence in the correctness of the implementations. -
-

Warning

+
+

Warning

Ironclad should not be considered safe against side channel attacks. @@ -89,12 +89,12 @@ usually not safe against side channel attacks.

-
-

Installation

+
+

Installation

-The current version of Ironclad is 0.41. It can be downloaded -at https://github.com/sharplispers/ironclad/archive/v0.41.tar.gz. +The current version of Ironclad is 0.42. It can be downloaded +at https://github.com/sharplispers/ironclad/archive/v0.42.tar.gz. If you are feeling adventurous, you can download a bleeding-edge version at https://github.com/sharplispers/ironclad.

@@ -143,8 +143,8 @@ a bug; please report it.
-
-

License

+
+

License

Ironclad is released under a MIT-like license; you can do pretty much @@ -153,11 +153,11 @@ anything you want to with the code except claim that you wrote it.

-
-

Ciphers

+
+

Ciphers

-
(make-cipher name &key key mode initialization-vector padding tweak) => cipher
+
(make-cipher name &key key mode initialization-vector padding tweak) => cipher
 
@@ -166,7 +166,7 @@ Return a cipher object suitable for use for both encryption and decryption.

-name denotes the encryption algorithm to use. list-all-ciphers will tell you +name denotes the encryption algorithm to use. list-all-ciphers will tell you the names of all supported ciphers. They are:

    @@ -223,7 +223,7 @@ such as AES and DES can operate in several different modes:
  • ecb
  • cbc
  • ofb
  • -
  • cfb (note that Ironclad's CFB mode is n-bit CFB, where n is the block-length of the cipher)
  • +
  • cfb (note that Ironclad's CFB mode is n-bit CFB, where n is the block-length of the cipher)
  • cfb8 (this seems to be the mode other crypto packages call CFB)
  • ctr
@@ -237,7 +237,7 @@ such as AES and DES can operate in several different modes:

initialization-vector (IV) should be supplied only if mode requires one. initialization-vector should be a (simple-array (unsigned-byte 8) (*)). -The supplied IV should be the same length as the block-length of name. +The supplied IV should be the same length as the block-length of name. The Chacha and Salsa20 stream ciphers also use an initialization vector (nonce). It should be 8 bytes long for Chacha and Salsa20, and 24 bytes long for XChacha and XSalsa20. @@ -250,7 +250,7 @@ vector (nonce). It should be 8 bytes long for Chacha and Salsa20, and

If padding is supplied, the specified padding method will be used by -encrypt and decrypt to handle short blocks when the +encrypt and decrypt to handle short blocks when the :handle-final-block argument is supplied. Depending on the mode specified, padding may be ignored (e.g. OFB and CFB modes do not care about short blocks; neither do stream ciphers). @@ -269,7 +269,7 @@ with the tweak key parameter.

-
(encrypt cipher plaintext ciphertext &key plaintext-start plaintext-end ciphertext-start handle-final-block) => n-bytes-consumed, n-bytes-produced
+
(encrypt cipher plaintext ciphertext &key plaintext-start plaintext-end ciphertext-start handle-final-block) => n-bytes-consumed, n-bytes-produced
 
@@ -281,7 +281,7 @@ data is placed in ciphertext starting at ciphertext-start.
-
(decrypt cipher ciphertext plaintext &key ciphertext-start ciphertext-end plaintext-start handle-final-block) => n-bytes-consumed, n-bytes-produced
+
(decrypt cipher ciphertext plaintext &key ciphertext-start ciphertext-end plaintext-start handle-final-block) => n-bytes-consumed, n-bytes-produced
 
@@ -293,11 +293,11 @@ data is placed in plaintext starting at plaintext-start.
-
(encrypt-in-place cipher text &key start end) => n-bytes-consumed, n-bytes-produced
+
(encrypt-in-place cipher text &key start end) => n-bytes-consumed, n-bytes-produced
 
-
(decrypt-in-place cipher text &key start end) => n-bytes-consumed, n-bytes-produced
+
(decrypt-in-place cipher text &key start end) => n-bytes-consumed, n-bytes-produced
 
@@ -311,46 +311,69 @@ according to cipher. These functions are shorthand for:

-Note: encrypt-in-place and decrypt-in-place do not support -a handle-final-block parameter as encrypt and decrypt do. If you +Note: encrypt-in-place and decrypt-in-place do not support +a handle-final-block parameter as encrypt and decrypt do. If you need the functionality that handle-final-block provides, then you -need to use encrypt and decrypt. +need to use encrypt and decrypt.

Note: n-bytes-consumed and n-bytes-produced may not always be equal to the length of the data specified in the call to -encrypt-in-place or decrypt-in-place. This subtlely is also present in -encrypt or decrypt. +encrypt-in-place or decrypt-in-place. This subtlely is also present in +encrypt or decrypt. +

+ + +
+
(encrypt-message cipher message &key start end &allow-other-keys) => encrypted-message
+
+
+ +

+Return the message between start and end encrypted with the cipher; the +class of cipher determines the algorithm used to encrypt the message. +

+ + +
+
(decrypt-message cipher message &key start end n-bits &allow-other-keys) => decrypted-message
+
+
+ +

+Return the message between start and end decrypted by the cipher; the +class of cipher determines the algorithm used to decrypt the message. n-bits +can be used to indicate the expected size of the decrypted message.

-
-

Inquiry functions

-
+
+

Inquiry functions

+
-
(list-all-ciphers) => list
+
(list-all-ciphers) => list
 

-Returns a list of cipher-names that may be validly passed to make-cipher. +Returns a list of cipher-names that may be validly passed to make-cipher.

-
(cipher-supported-p name) => boolean
+
(cipher-supported-p name) => boolean
 

-Returns t if name would be in the list returned by list-all-ciphers, +Returns t if name would be in the list returned by list-all-ciphers, nil otherwise.

-
(key-lengths cipher) => list
+
(key-lengths cipher) => list
 
@@ -360,7 +383,7 @@ Return a list of valid key lengths for cipher.
-
(block-length cipher) => number
+
(block-length cipher) => number
 
@@ -371,9 +394,9 @@ function always returns 1 for stream ciphers.
-
-

Key stream position

-
+
+

Key stream position

+

Block ciphers in CTR mode and some stream ciphers have the ability to change the current position within the key stream in constant time instead of having to @@ -381,21 +404,21 @@ consume all the bytes until the desired position is reached.

-
(keystream-position cipher &optional position) => number or boolean
+
(keystream-position cipher &optional position) => number or boolean
 

Return or change the current position within the key stream of a cipher. -When position is not supplied, keystream-position returns the current position +When position is not supplied, keystream-position returns the current position in the key stream, or nil if it can't be determined. When position is supplied, the key stream position of the cipher is set to that position if -possible. keystream-position returns t if the repositioning is performed +possible. keystream-position returns t if the repositioning is performed successfully, or nil otherwise.

-keystream-position can be used with the following ciphers: +keystream-position can be used with the following ciphers:

  • all the block ciphers (aes, twofish, etc.) in CTR mode
  • @@ -416,8 +439,8 @@ successfully, or nil otherwise.
-
-

Digests

+
+

Digests

Digest functions, also known as hash functions, produce fixed-length @@ -445,14 +468,14 @@ See your local Unicode guru for more details.

-
(make-digest digest-name &rest keys &key &allow-other-keys) => digester
+
(make-digest digest-name &rest keys &key &allow-other-keys) => digester
 

Returns a digest object. digest-name is a keyword naming the algorithm you wish digester to use. The supported digest names can be found -by calling list-all-digests. They are: +by calling list-all-digests. They are:

-Like for make-cipher, digest-name should be a symbol in the +Like for make-cipher, digest-name should be a symbol in the keyword or ironclad packages.

@@ -531,7 +554,7 @@ any size. The size of the digest in bytes can be specified with the
-
(update-digest digester thing &key &allow-other-keys) => (values)
+
(update-digest digester thing &key &allow-other-keys) => (values)
 
@@ -571,14 +594,14 @@ suffice. Update the internal state of digester with the contents of stream, which must respond to read-byte or read-sequence with a (simple-array (unsigned-byte 8) (*)) and return digester. It -differs from digest-stream, below, in that you may need to digest data +differs from digest-stream, below, in that you may need to digest data before or after the contents of stream (this happens, for instance, when signing the contents of some file).

-
(produce-digest digester &key digest digest-start) => digest
+
(produce-digest digester &key digest digest-start) => digest
 
@@ -589,19 +612,19 @@ Return the digest of the data processed by digester so far.

If digest is provided, the computed digest will be placed into digest starting at digest-start. digest must be a -(simple-array (unsigned-byte 8) (*)). An insufficient-buffer-space +(simple-array (unsigned-byte 8) (*)). An insufficient-buffer-space error will be signaled if there is insufficient space in digest.

-
-

High-level convenience functions

-
+
+

High-level convenience functions

+

Several high-level convenience functions that encapsulate common -sequences of make-digest, update-digest and produce-digest are +sequences of make-digest, update-digest and produce-digest are provided by Ironclad as well. They come in two flavors: the first -takes a digest name as would be provided to make-digest. The second +takes a digest name as would be provided to make-digest. The second way to call these functions is to provide an actual digest object as the first argument. So one can say:

@@ -620,12 +643,12 @@ or, equivalently:

-The second form comes in handy if you plan on reusing the digest object. +The second form comes in handy if you plan on reusing the digest object.

-
(digest-sequence digest-spec sequence &rest args &key start end digest digest-start) => digest
+
(digest-sequence digest-spec sequence &rest args &key start end digest digest-start) => digest
 
@@ -633,12 +656,12 @@ The second form comes in handy if you plan on reusing the Returns the digest of the subsequence of sequence bounded by start and end, according to digest-name. sequence must be a (simple-array (unsigned-byte 8) (*)). digest and digest-start -are as in produce-digest. +are as in produce-digest.

-
(digest-stream digest-spec stream &rest args &key buffer start end digest digest-start) => digest
+
(digest-stream digest-spec stream &rest args &key buffer start end digest digest-start) => digest
 
@@ -647,7 +670,7 @@ Returns the digest of the contents of the stream specified by stream. read-byte must be a legal operation on stream and return an (unsigned-byte 8). In a similar fashion, read-sequence on stream must support reading into a (simple-array (unsigned-byte 8) (*)). -digest and digest-start are as in produce-digest. +digest and digest-start are as in produce-digest.

@@ -658,13 +681,13 @@ the data from the stream.

-
(digest-file digest-spec pathname &rest args &key buffer start end digest digest-start) => digest
+
(digest-file digest-spec pathname &rest args &key buffer start end digest digest-start) => digest
 

Returns the digest of the contents of the file named by pathname. -digest and digest-start are as in produce-digest. +digest and digest-start are as in produce-digest.

@@ -675,32 +698,32 @@ the data from the stream.

-
-

Inquiry functions

-
+
+

Inquiry functions

+
-
(list-all-digests) => list
+
(list-all-digests) => list
 

-Returns a list whose elements may be validly passed to make-digest. +Returns a list whose elements may be validly passed to make-digest.

-
(digest-supported-p name) => boolean
+
(digest-supported-p name) => boolean
 

-Returns t if name would be in the list returned by list-all-digests, +Returns t if name would be in the list returned by list-all-digests, nil otherwise.

-
(digest-length digest) => number
+
(digest-length digest) => number
 
@@ -711,9 +734,9 @@ a digest-name or a digest instance.
-
-

Miscellaneous

-
+
+

Miscellaneous

+

Ironclad digests are CLOS objects; the interesting thing about this for most purposes is that functions like reinitialize-instance are @@ -738,9 +761,9 @@ supported. This means one can write a fairly efficient clone of the

-
-

Tree hashes

-
+
+

Tree hashes

+

Ironclad supports tree hashes, as described in Tree Hash EXchange format. You create tree hashes as if you were creating a digest: @@ -786,8 +809,8 @@ computed while computing the final tree hash.

-
-

Message authentication codes

+
+

Message authentication codes

A message authentication code is a cryptographic function of some data @@ -809,14 +832,14 @@ Ironclad provides different kinds of MACs:

-
(make-mac mac-name key &rest args) => mac
+
(make-mac mac-name key &rest args) => mac
 

Return a MAC object initialized with a secret key. mac-name is a keyword naming the algorithm you wish mac to use. The supported -MACs can be found by calling list-all-macs. They are: +MACs can be found by calling list-all-macs. They are:

  • blake2-mac
  • @@ -828,7 +851,7 @@ MACs can be found by calling list-all-macs. They are:

-Like for make-digest, mac-name should be a symbol in the keyword +Like for make-digest, mac-name should be a symbol in the keyword or ironclad packages.

@@ -846,24 +869,24 @@ Some MACs take extra arguments that can be specified in args.

-When making a Blake2 MAC, the length of the key passed to make-mac +When making a Blake2 MAC, the length of the key passed to make-mac must be 64 bytes.

-When making a Blake2s MAC, the length of the key passed to make-mac +When making a Blake2s MAC, the length of the key passed to make-mac must be 32 bytes.

-When making a CMAC, cipher-name must have a block-length of either +When making a CMAC, cipher-name must have a block-length of either 8 or 16; this restriction is satisfied by many ciphers in Ironclad with the notable exception of stream ciphers. key must be an acceptable key for cipher-name.

-When making a Poly1305, the length of the key passed to make-mac +When making a Poly1305, the length of the key passed to make-mac must be 32 bytes.

@@ -886,12 +909,12 @@ MAC objects support reinitialize-instance:

-The :key argument is the secret key, as provided to make-mac. +The :key argument is the secret key, as provided to make-mac.

-
(update-mac mac thing &key &allow-other-keys) => (values)
+
(update-mac mac thing &key &allow-other-keys) => (values)
 
@@ -924,7 +947,7 @@ suffice.
-
(produce-mac mac &key digest digest-start) => digest
+
(produce-mac mac &key digest digest-start) => digest
 
@@ -937,52 +960,52 @@ compute a "rolling MAC" of a document.

If digest is provided, the computed digest will be placed into digest starting at digest-start. digest must be a -(simple-array (unsigned-byte 8) (*)). An insufficient-buffer-space +(simple-array (unsigned-byte 8) (*)). An insufficient-buffer-space error will be signaled if there is insufficient space in digest.

-The length of the digest returned by produce-mac is determined by the -kind of MAC and the extra arguments passed to make-mac: +The length of the digest returned by produce-mac is determined by the +kind of MAC and the extra arguments passed to make-mac:

-
-

Inquiry functions

-
+
+

Inquiry functions

+
-
(list-all-macs) => list
+
(list-all-macs) => list
 

-Returns a list whose elements may be validly passed to make-mac. +Returns a list whose elements may be validly passed to make-mac.

-
(mac-supported-p name) => boolean
+
(mac-supported-p name) => boolean
 

-Returns t if name would be in the list returned by list-all-macs, +Returns t if name would be in the list returned by list-all-macs, nil otherwise.

-
-

Key derivation functions

+
+

Key derivation functions

Ironclad comes with a few key derivation functions: @@ -996,12 +1019,12 @@ Ironclad comes with a few key derivation functions:

-
(derive-key kdf passphrase salt iteration-count key-length) => digest
+
(derive-key kdf passphrase salt iteration-count key-length) => digest
 

-Given a key derivation function object (produced by make-kdf), +Given a key derivation function object (produced by make-kdf), a password and salt (both must be of type (simple-array (unsigned-byte 8) (*))), and number of iterations, returns the password digest as a byte array of length key-length. @@ -1013,7 +1036,7 @@ Scrypt ignores the iteration-count parameter.

-
(make-kdf kind &key digest n r p block-count additional-key additional-data) => kdf
+
(make-kdf kind &key digest n r p block-count additional-key additional-data) => kdf
 
@@ -1034,14 +1057,14 @@ memory cost parameters that must be defined such that

The default Scrypt parameters are N = 4096, r = 8, and p = 2. Please note that depending on the values of N and r, -derive-key may not be able to allocate sufficient space for its +derive-key may not be able to allocate sufficient space for its temporary arrays.

-
-

PBKDF convenience functions

-
+
+

PBKDF convenience functions

+

Ironclad comes with convenience functions for using PBKDF1 and PBKDF2 to store passwords. @@ -1049,7 +1072,7 @@ to store passwords.

-
(pbkdf2-hash-password password &key salt digest iterations) => password
+
(pbkdf2-hash-password password &key salt digest iterations) => password
 
@@ -1061,7 +1084,7 @@ byte vectors.
-
(pbkdf2-hash-password-to-combined-string password &key salt digest iterations) => password
+
(pbkdf2-hash-password-to-combined-string password &key salt digest iterations) => password
 
@@ -1073,21 +1096,21 @@ encodes the given salt and PBKDF2 algorithm parameters.
-
(pbkdf2-check-password password combined-salt-and-digest) => boolean
+
(pbkdf2-check-password password combined-salt-and-digest) => boolean
 

Given a password byte vector and a combined salt and digest string -produced by pbkdf2-hash-password-to-combined-string, checks whether +produced by pbkdf2-hash-password-to-combined-string, checks whether the password is valid.

-
-

Public key cryptography

+
+

Public key cryptography

Ironclad includes support for a few public key cryptography algorithms. @@ -1122,11 +1145,11 @@ Diffie-Hellman key exchange:

-
-

Key pair generation

-
+
+

Key pair generation

+
-
(generate-key-pair kind &key num-bits &allow-other-keys) => private-key, public-key
+
(generate-key-pair kind &key num-bits &allow-other-keys) => private-key, public-key
 
@@ -1149,11 +1172,11 @@ a Diffie-Hellman exchange with Bob's Elgamal key pair:
-
-

Key construction

-
+
+

Key construction

+
-
(make-public-key kind &key &allow-other-keys) => public-key
+
(make-public-key kind &key &allow-other-keys) => public-key
 
@@ -1175,7 +1198,7 @@ methods that specialize on kind, below.
-
(make-private-key kind &key &allow-other-keys) => private-key
+
(make-private-key kind &key &allow-other-keys) => private-key
 
@@ -1227,43 +1250,43 @@ For RSA keys, the type of the parameters is integer:
-
-

Key destructuring

-
+
+

Key destructuring

+

-The destructure-public-key and destructure-private-key functions can +The destructure-public-key and destructure-private-key functions can be useful if you need to store keys somewhere for future use.

-
(destructure-public-key public-key) => plist
+
(destructure-public-key public-key) => plist
 

Return the elements of a public key in a plist. The indicators of the -plist match the &key arguments of the make-public-key method. +plist match the &key arguments of the make-public-key method.

-
(destructure-private-key private-key) => plist
+
(destructure-private-key private-key) => plist
 

Return the elements of a private key in a plist. The indicators of the -plist match the &key arguments of the make-private-key method. +plist match the &key arguments of the make-private-key method.

-
-

Digital signatures

-
+
+

Digital signatures

+
-
(sign-message key message &key start end &allow-other-keys) => signature
+
(sign-message key message &key start end &allow-other-keys) => signature
 
@@ -1274,14 +1297,14 @@ Return a signature of message between start and end signed

-Note: The sign-message does not perform the hashing of the data. You +Note: The sign-message does not perform the hashing of the data. You should hash your data using your favorite hash function, and then use -this hash as the message passed to sign-message. +this hash as the message passed to sign-message.

-
(verify-signature key message signature &key start end &allow-other-keys) => boolean
+
(verify-signature key message signature &key start end &allow-other-keys) => boolean
 
@@ -1292,9 +1315,9 @@ and nil otherwise.

-
-

Padding

-
+
+

Padding

+

To be secure, RSA signature requires the message to be padded. The pss key parameter is provided to pad (or unpad) the message @@ -1315,22 +1338,22 @@ necessary.

-
-

Format of signatures

-
+
+

Format of signatures

+

-sign-message returns signatures as octet vectors. When the signature +sign-message returns signatures as octet vectors. When the signature contains several values (e.g. the R and S values of DSA signatures), the octet vector is the concatenation of these values (e.g. the first half of the vector is the R value, the second half is the S value). -You can use the make-signature and destructure-signature functions if +You can use the make-signature and destructure-signature functions if you need access to the elements of a signature (e.g. to use a different kind of serialization).

-
(make-signature kind &key &allow-other-keys) => signature
+
(make-signature kind &key &allow-other-keys) => signature
 
@@ -1365,23 +1388,23 @@ For RSA signatures, the type of the parameters s and n-bits is
-
(destructure-signature kind signature) => plist
+
(destructure-signature kind signature) => plist
 

Return the elements of a signature in a plist. The indicators of the -plist match the &key arguments of the make-signature method. +plist match the &key arguments of the make-signature method.

-
-

Encryption and decryption

-
+
+

Encryption and decryption

+
-
(encrypt-message key message &key start end &allow-other-keys) => encrypted-message
+
(encrypt-message key message &key start end &allow-other-keys) => encrypted-message
 
@@ -1392,7 +1415,7 @@ the class of key determines the algorithm used to encrypt the message.
-
(decrypt-message key message &key start end n-bits &allow-other-keys) => decrypted-message
+
(decrypt-message key message &key start end n-bits &allow-other-keys) => decrypted-message
 
@@ -1405,9 +1428,9 @@ without padding, which is probably a bad idea, c.f. Padding section).

-
-

Padding

-
+
+

Padding

+

To be secure, RSA encryption requires the message to be padded. The oaep key parameter is provided to pad (or unpad) the message during @@ -1428,23 +1451,23 @@ necessary.

-
-

Format of messages

-
+
+

Format of messages

+

-encrypt-message returns encrypted messages as octet vectors. When the +encrypt-message returns encrypted messages as octet vectors. When the message contains several values (e.g. the C1 and C2 values of Elgamal messages), the octet vector is the concatenation of these values (e.g. the first half of the vector is the big-endian representation of the C1 value, the second half is the C2 value). You can use the -make-message and destructure-message functions if you need access to +make-message and destructure-message functions if you need access to the elements of a message (e.g. to use a different kind of serialization).

-
(make-message kind &key &allow-other-keys) => message
+
(make-message kind &key &allow-other-keys) => message
 
@@ -1471,23 +1494,23 @@ For RSA signatures, the type of the parameters m and n-bits is
-
(destructure-message kind message) => plist
+
(destructure-message kind message) => plist
 

Return the elements of a message in a plist. The indicators of the -plist match the &key arguments of the make-message method. +plist match the &key arguments of the make-message method.

-
-

Diffie-Hellman key exchange

-
+
+

Diffie-Hellman key exchange

+
-
(diffie-hellman private-key public-key) => bytes
+
(diffie-hellman private-key public-key) => bytes
 
@@ -1500,8 +1523,8 @@ compatible, i.e. have the same group parameters).
-
-

Pseudo-random number generation

+
+

Pseudo-random number generation

The *prng* special variable indicates which pseudo-random number @@ -1522,7 +1545,7 @@ use os-prng, which is the default.

-
(make-prng name &key seed) => prng
+
(make-prng name &key seed) => prng
 
@@ -1531,7 +1554,7 @@ Create a pseudo-random number generator.

-name denotes the style of PRNG to use. list-all-prngs will tell you +name denotes the style of PRNG to use. list-all-prngs will tell you the names of all supported PRNGs. Currently supported PRNGs are:

    @@ -1559,13 +1582,13 @@ be used to seed the PRNG.

    -You should very rarely need to call make-prng; the default OS-provided +You should very rarely need to call make-prng; the default OS-provided PRNG should be appropriate in nearly all cases.

    -
    (list-all-prngs) => list
    +
    (list-all-prngs) => list
     
    @@ -1575,7 +1598,7 @@ List all known PRNG types.
    -
    (random-data num-bytes &optional prng) => bytes
    +
    (random-data num-bytes &optional prng) => bytes
     
    @@ -1586,7 +1609,7 @@ state of the generator.
    -
    (random-bits num-bits &optional prng) => integer
    +
    (random-bits num-bits &optional prng) => integer
     
    @@ -1596,19 +1619,19 @@ Generate an integer with num-bits bits.
    -
    (strong-random limit &optional prng) => number
    +
    (strong-random limit &optional prng) => number
     

    -A drop-in replacement for common-lisp:random, strong-random +A drop-in replacement for common-lisp:random, strong-random generates a number (an integer if limit is an integer and a float if it is a float) between 0 and limit - 1 in an unbiased fashion.

    -
    (read-os-random-seed source &optional prng) => reseed-count
    +
    (read-os-random-seed source &optional prng) => reseed-count
     
    @@ -1625,14 +1648,14 @@ on Unix; CryptGenRandom on Windows) and reseed prng.
    -
    (read-seed path &optional prng) => t
    +
    (read-seed path &optional prng) => t
     

    Read enough bytes from path to reseed prng, then generate a pseudo-random seed and write it back to path. If path doesn't -exist, calls read-os-random-seed to get a truly random seed from the +exist, calls read-os-random-seed to get a truly random seed from the OS. Note that reseeding does not reset the generator's state to the seed value; rather, it combines the generator's state with the seed to form a new state. @@ -1640,7 +1663,7 @@ to form a new state.

    -
    (write-seed path &optional prng) => t
    +
    (write-seed path &optional prng) => t
     
    @@ -1649,9 +1672,9 @@ Generate enough random data to reseed prng, then write it to path.

-
-

Example

-
+
+

Example

+
 (random-data 16)
 => #(61 145 133 130 220 200 90 86 0 101 62 169 0 40 101 78)
@@ -1665,9 +1688,9 @@ Generate enough random data to reseed prng, then write it to path.
 
-
-

Fortuna

-
+
+

Fortuna

+

You should only use the Fortuna PRNG if your OS does not provided a sufficiently-good PRNG. If you use a Unix or Unix-like OS (e.g. @@ -1696,7 +1719,7 @@ spread entropy across all 32 pools.

Fortuna automatically feeds entropy from the pools back into its -random state when random-data is called, using a method designed to +random state when random-data is called, using a method designed to make it resistant to various avenues of attack; even in case of generator compromise it will return to a safe state within a bounded time. @@ -1716,7 +1739,7 @@ It also will not reseed more than ten times per second.

-
(add-random-event source pool-id event &optional prng) => pool-length
+
(add-random-event source pool-id event &optional prng) => pool-length
 
@@ -1742,8 +1765,8 @@ or break them up into chunks).
-
-

Gray streams

+
+

Gray streams

Ironclad includes support for several convenient stream abstractions @@ -1752,9 +1775,9 @@ for SBCL, CMUCL, OpenMCL/CCL, Lispworks, ABCL, ECL, Clisp and Allegro.

-
-

Octet streams

-
+
+

Octet streams

+

Octet streams are very similar to Common Lisp's string-stream except they deal in octets instead of characters. @@ -1762,7 +1785,7 @@ they deal in octets instead of characters.

-
(make-octet-input-stream buffer &optional start end) => octet-input-stream
+
(make-octet-input-stream buffer &optional start end) => octet-input-stream
 
@@ -1772,7 +1795,7 @@ As make-string-input-stream, only with octets instead of characters
-
(make-octet-output-stream) => octet-output-stream
+
(make-octet-output-stream) => octet-output-stream
 
@@ -1782,7 +1805,7 @@ As make-string-output-stream, only with octets instead of character
-
(get-output-stream-octets stream) => octet-vector
+
(get-output-stream-octets stream) => octet-vector
 
@@ -1793,7 +1816,7 @@ of a string output-stream.
-
(with-octet-input-stream ((var buffer &optional (start 0) end) &body body))
+
(with-octet-input-stream ((var buffer &optional (start 0) end) &body body))
 
@@ -1805,7 +1828,7 @@ Within body, var is bound to an octet input stream. Reading from
-
(with-octet-output-stream ((var) &body body)) => bytes
+
(with-octet-output-stream ((var) &body body)) => bytes
 
@@ -1813,14 +1836,14 @@ Within body, var is bound to an octet input stream. Reading from Within body, var is bound to an octet output stream. After all the forms in body have been executed, the data that has been written to var (and that hasn't been consumed by a call to -get-output-stream-octets within body) is returned. +get-output-stream-octets within body) is returned.

-
-

Digest streams

-
+
+

Digest streams

+

Digest streams compute a digest of the data written to them according to a specific digest algorithm. @@ -1844,7 +1867,7 @@ Example:

-
(make-digesting-stream digest &rest args) => stream
+
(make-digesting-stream digest &rest args) => stream
 
@@ -1852,18 +1875,18 @@ Example: Make a stream that computes a digest of the data written to it according to the algorithm digest. The parameters that can be used by some algorithms can be specified as args. -produce-digest may be used to obtain a digest of all the data written +produce-digest may be used to obtain a digest of all the data written to the stream.

-Note: Calling produce-digest on a digest stream does not alter +Note: Calling produce-digest on a digest stream does not alter the internal state of the digest.

-
(with-digesting-stream (var digest-name &rest args) &body body) => digest
+
(with-digesting-stream (var digest-name &rest args) &body body) => digest
 
@@ -1876,9 +1899,9 @@ returned.
-
-

Cipher streams

-
+
+

Cipher streams

+

Cipher streams encrypt or decrypt the data written to or read from them according to a specific cipher algorithm. @@ -1886,7 +1909,7 @@ them according to a specific cipher algorithm.

-
(make-encrypting-stream stream cipher mode key &key initialization-vector direction padding) => stream
+
(make-encrypting-stream stream cipher mode key &key initialization-vector direction padding) => stream
 
@@ -1902,7 +1925,7 @@ stream is encrypted before being sent to stream.
-
(make-decrypting-stream stream cipher mode key &key initialization-vector direction padding) => stream
+
(make-decrypting-stream stream cipher mode key &key initialization-vector direction padding) => stream
 
@@ -1919,14 +1942,14 @@ stream is decrypted before being sent to stream.

Note: For the moment, only stream ciphers and block ciphers in CTR -mode are supported by make-encrypting-stream and -make-decrypting-stream. Therefore the padding parameter is always +mode are supported by make-encrypting-stream and +make-decrypting-stream. Therefore the padding parameter is always ignored.

-
(with-encrypting-stream ((var stream cipher mode key &key initialization-vector direction padding) &body body))
+
(with-encrypting-stream ((var stream cipher mode key &key initialization-vector direction padding) &body body))
 
@@ -1937,7 +1960,7 @@ the last form of body is returned.
-
(with-decrypting-stream ((var stream cipher mode key &key initialization-vector direction padding) &body body))
+
(with-decrypting-stream ((var stream cipher mode key &key initialization-vector direction padding) &body body))
 
@@ -1948,16 +1971,16 @@ the last form of body is returned.
-
-

MAC streams

-
+
+

MAC streams

+

MAC streams compute a message authentication code of the data written to them according to a specific MAC algorithm.

-
(make-authenticating-stream mac key &rest args) => stream
+
(make-authenticating-stream mac key &rest args) => stream
 
@@ -1965,12 +1988,12 @@ to them according to a specific MAC algorithm. Make a stream that computes a MAC of the data written to it according to the algorithm mac initialized with a key. The parameters used to create the MAC can be specified as args. -produce-mac may be used to obtain a MAC of all the data written to the +produce-mac may be used to obtain a MAC of all the data written to the stream.

-Note: Calling produce-mac on a MAC stream does not alter the +Note: Calling produce-mac on a MAC stream does not alter the internal state of the MAC.

@@ -2001,7 +2024,7 @@ Example: encrypt some data and compute a MAC of the ciphertext
-
(with-authenticating-stream (var mac-name key &rest args) &body body) => mac
+
(with-authenticating-stream (var mac-name key &rest args) &body body) => mac
 
@@ -2015,11 +2038,11 @@ written to var is returned.
-
-

Utility functions

+
+

Utility functions

-
(ub16ref/le vector index) => value
+
(ub16ref/le vector index) => value
 (ub32ref/le vector index) => value
 (ub64ref/le vector index) => value
 
@@ -2034,7 +2057,7 @@ functions are SETFable.
-
(ub16ref/be vector index) => value
+
(ub16ref/be vector index) => value
 (ub32ref/be vector index) => value
 (ub64ref/be vector index) => value
 
@@ -2046,41 +2069,41 @@ As the above, only the value is stored in big-endian order.
-
(byte-array-to-hex-string vector &key start end element-type) => string
+
(byte-array-to-hex-string vector &key start end element-type) => string
 (hex-string-to-byte-array string &key start end) => string
 (ascii-string-to-byte-array string &key start end) => vector
 

-byte-array-to-hex-string converts the bytes of vector between +byte-array-to-hex-string converts the bytes of vector between start and end into a hexadecimal string. It is useful for converting digests to a more readable form. element-type indicates the element-type of the returned string.

-hex-string-to-byte-array parses a substring of string delimited +hex-string-to-byte-array parses a substring of string delimited start and end of hexadecimal digits into a byte array.

-ascii-string-to-byte-array is provided as a quick and dirty way to -convert a string to a byte array suitable for feeding to update-digest -or encrypt. Care should be taken to ensure that the provided string is +ascii-string-to-byte-array is provided as a quick and dirty way to +convert a string to a byte array suitable for feeding to update-digest +or encrypt. Care should be taken to ensure that the provided string is actually an ASCII string. start and end have their usual interpretations.

-
(octets-to-integer octet-vec &key start end big-endian n-bits) => number
+
(octets-to-integer octet-vec &key start end big-endian n-bits) => number
 (integer-to-octets bignum &key n-bits big-endian) => vector
 

-octets-to-integer converts the bytes of octet-vec between start +octets-to-integer converts the bytes of octet-vec between start and end to an integer as though the bytes denoted a number in base 256. big-endian is a boolean indicating whether the bytes are to be read in big-endian or little-endian order. n-bits specifies @@ -2089,12 +2112,12 @@ number.

-integer-to-octets is the reverse operation. +integer-to-octets is the reverse operation.

-
(expt-mod n exponent modulus) => number
+
(expt-mod n exponent modulus) => number
 (expt-mod/unsafe n exponent modulus) => number
 
@@ -2102,15 +2125,15 @@ number.

Raises n to the exponent power modulo modulus in a more efficient fashion than (mod (expt n exponent) modulus). -expt-mod is using the Montgomery ladder algorithm to be more robust +expt-mod is using the Montgomery ladder algorithm to be more robust against timing attacks. -expt-mod/unsafe runs faster than expt-mod but is not safe against +expt-mod/unsafe runs faster than expt-mod but is not safe against timing attacks; don't use it on secret data.

-
make-random-salt &optional size => bytes
+
make-random-salt &optional size => bytes
 
@@ -2121,7 +2144,7 @@ for use as a password salt.
-
constant-time-equal data1 data2 => boolean
+
constant-time-equal data1 data2 => boolean
 
@@ -2134,11 +2157,11 @@ or MACs.
-
-

Conditions

+
+

Conditions

-
ironclad-error
+
ironclad-error
 
@@ -2149,141 +2172,141 @@ a direct subtype of simple-error without any extra slots or options
-
initialization-vector-not-supplied
+
initialization-vector-not-supplied
 

-This error is signaled by make-cipher when an initialization vector is +This error is signaled by make-cipher when an initialization vector is not provided and the requested mode requires an initialization vector.

-
invalid-initialization-vector
+
invalid-initialization-vector
 

This error is signaled when an invalid initialization vector is -supplied to make-cipher (e.g. when the length of the initialization +supplied to make-cipher (e.g. when the length of the initialization vector does not match the block length of the cipher).

-
invalid-key-length
+
invalid-key-length
 

-This error is signaled when the key provided to make-cipher is not of +This error is signaled when the key provided to make-cipher is not of an acceptable length for the requested cipher.

-
unsupported-cipher
+
unsupported-cipher
 

-This error is signaled when the cipher-name provided to make-cipher -is not cipher-supported-p. +This error is signaled when the cipher-name provided to make-cipher +is not cipher-supported-p.

-
unsupported-mode
+
unsupported-mode
 

This error is signaled when the mode provided to -make-cipher is not mode-supported-p. +make-cipher is not mode-supported-p.

-
unsupported-digest
+
unsupported-digest
 

This error is signaled when the digest-name provided to -make-digest is not digest-supported-p. +make-digest is not digest-supported-p.

-
unsupported-mac
+
unsupported-mac
 

This error is signaled when the mac-name provided to -make-mac is not mac-supported-p. +make-mac is not mac-supported-p.

-
insufficient-buffer-space
+
insufficient-buffer-space
 

This error is signaled when Ironclad needs to stuff some data into -a buffer (e.g. when the user provides digest to produce-digest and +a buffer (e.g. when the user provides digest to produce-digest and there is insufficient space).

-
key-not-supplied
+
key-not-supplied
 

This error is signaled when a :key argument is not provided -to make-cipher. +to make-cipher.

-
unsupported-kdf
+
unsupported-kdf
 

This error is signaled when an invalid KDF name is provided -to make-kdf. +to make-kdf.

-
unsupported-scrypt-cost-factors
+
unsupported-scrypt-cost-factors
 

This error is signaled when invalid Scrypt cost factors are provided -to make-kdf. +to make-kdf.

-
unsupported-argon2i-cost-factors
+
unsupported-argon2i-cost-factors
 

This error is signaled when invalid Argon2i parameters are provided -to make-kdf. +to make-kdf.

-
invalid-padding
+
invalid-padding
 
@@ -2294,84 +2317,84 @@ invalid.
-
invalid-mac-parameter
+
invalid-mac-parameter
 

This error is signaled when an invalid parameter is provided -to make-mac. +to make-mac.

-
invalid-signature-length
+
invalid-signature-length
 

This error is signaled when a signature with an invalid length is provided -to verify-signature or destructure-signature. +to verify-signature or destructure-signature.

-
invalid-message-length
+
invalid-message-length
 

This error is signaled when a message with an invalid length is provided -to encrypt-message, decrypt-message or destructure-message. +to encrypt-message, decrypt-message or destructure-message.

-
missing-key-parameter
+
missing-key-parameter
 

This error is signaled when it is determined that a parameter is -missing in a call to make-public-key or make-private-key. +missing in a call to make-public-key or make-private-key.

-
missing-message-parameter
+
missing-message-parameter
 

This error is signaled when it is determined that a parameter is -missing in a call to make-message. +missing in a call to make-message.

-
missing-signature-parameter
+
missing-signature-parameter
 

This error is signaled when it is determined that a parameter is -missing in a call to make-signature. +missing in a call to make-signature.

-
incompatible-keys
+
incompatible-keys
 

This error is signaled when incompatible keys are provided to -diffie-hellman. +diffie-hellman.

-
invalid-curve-point
+
invalid-curve-point
 
@@ -2381,18 +2404,18 @@ This error is signaled when trying to use an invalid curve point.
-
invalid-public-key-length
+
invalid-public-key-length
 

This error is signaled when a public key with an invalid length is -provided to verify-signature. +provided to verify-signature.

-
oaep-decoding-error
+
oaep-decoding-error
 
diff --git a/ironclad.asd b/ironclad.asd index cc45375..91738b8 100644 --- a/ironclad.asd +++ b/ironclad.asd @@ -8,7 +8,7 @@ (defclass ironclad-source-file (cl-source-file) ()) (defsystem "ironclad" - :version "0.41" + :version "0.42" :author "Nathan Froyd " :maintainer "Guillaume LE VAILLANT " :description "A cryptographic toolkit written in pure Common Lisp" @@ -165,7 +165,7 @@ (defsystem "ironclad/tests" :depends-on ("ironclad" "rt") - :version "0.41" + :version "0.42" :in-order-to ((test-op (load-op "ironclad/tests"))) :perform (test-op (o s) (or (funcall (intern "DO-TESTS" (find-package "RTEST"))) -- cgit v1.2.3-70-g09d2