Hello,I've added test cases to verify that unwrap fail if the input values are incorrect [1]. I reuse all the unwrap test cases, changed one ciphertext byte and expect the unwrap function to return 0.
Le 2021-03-29 à 13 h 32, Niels Möller a écrit :
Until we come to a solution on where to put the documentation, I've started a first draft for the documentation. Can you give me feedback on it? I'm used to write documentation but for my projects and with my style, but I don't know if the text is too much or too few.That's one possibility, but I think it would also be natural to put it somewhere under or close to "7.4. Authenticated encryption and associated data", even though there's no associated data. That section could perhaps be retitled to "Authenticated encryption" to generalize it? Or possibly under "7.3 Cipher modes", if it's too different from the AEAD constructions.
Also, I've never used LaTex. What tool do you recommend to write LaTex documentation? I've tried gummi but it says there are errors in the nettle.texinfo file...
/Nicolas[1] https://git.lysator.liu.se/nettle/nettle/-/merge_requests/19/diffs#2c39052896159220aa30be267faae43df72f2fb8_0_223
X.X.X NIST AES Keywrap
AES keywrap is a key management algorithm defined in RFC 3394. Its intention is
to provide an algorithm to wrap and unwrap cryptographic keys. It requires an
AES key (128, 192 or 256-bits), an 8-bytes IV, the data to encrypt is n blocks
of 8-bytes. The wrap output is n+1 blocks of 8-bytes.
The default IV specified by the standard is A6A6A6A6A6A6A6A6.
X.X.X.1 General NIST AES Keywrap interface
Function: void nist_keywrap16 (const void *ctx, nettle_cipher_func *encrypt,
const uint8_t *iv, size_t ciphertext_length, uint8_t *ciphertext, const uint8_t
*cleartext);
Wraps *cleartext. The AES context *ctx struct aes128_ctx, struct aes192_ctx or
struct aes256_ctx must be initialized with the cypher key. The *encrypt
function is the aes{128,192,256}_encrypt function corresponding to the AES
context size. *iv is the initialization vector, a 8-bytes value. *cleartext
length must be at least ciphertext_length+8.
Function: int nist_keyunwrap16 (const void *ctx, nettle_cipher_func *decrypt,
const uint8_t *iv, size_t cleartext_length, uint8_t *cleartext, const uint8_t
*ciphertext);
Unwraps *ciphertext. The AES context *ctx struct aes128_ctx, struct aes192_ctx
or struct aes256_ctx must be initialized with the decypher key. The *decrypt
function is the aes{128,192,256}_decrypt function corresponding to the AES
context size. *iv is the initialization vector, a 8-bytes value. *ciphertext
length must be cleartext_length-8. Returns 1 on unwrap success, 0 on unwrap
error.
X.X.X.2 Specific context NIST AES Keywrap interface
Function: void aes128_keywrap (struct aes128_ctx *ctx, const uint8_t *iv,
size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext);
Function: void aes192_keywrap (struct aes192_ctx *ctx, const uint8_t *iv,
size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext);
Function: void aes256_keywrap (struct aes256_ctx *ctx, const uint8_t *iv,
size_t ciphertext_length, uint8_t *ciphertext, const uint8_t *cleartext);
The AES context *ctx must be initialized with the cypher key. *iv is the
initialization vector, a 8-bytes value. *cleartext length must be at least
ciphertext_length+8.
Function: int aes128_keyunwrap (struct aes128_ctx *ctx, const uint8_t *iv,
size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext);
Function: int aes192_keyunwrap (struct aes192_ctx *ctx, const uint8_t *iv,
size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext);
Function: int aes256_keyunwrap (struct aes256_ctx *ctx, const uint8_t *iv,
size_t cleartext_length, uint8_t *cleartext, const uint8_t *ciphertext);
The AES context *ctx must be initialized with the decypher key. *iv is the
initialization vector, a 8-bytes value. *ciphertext length must be
cleartext_length-8. Returns 1 on unwrap success, 0 on unwrap error.
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ nettle-bugs mailing list [email protected] http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs
