-/* $OpenBSD: e_chacha.c,v 1.12 2023/07/07 19:37:53 beck Exp $ */
+/* $OpenBSD: e_chacha.c,v 1.13 2023/08/24 04:20:57 tb Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
.nid = NID_chacha20,
.block_size = 1,
.key_len = 32,
- /*
- * The 128 bit EVP IV is split for ChaCha into four 32 bit pieces:
- * counter[0] counter[1] iv[0] iv[1]
- * OpenSSL exposes these as:
- * openssl_iv = counter[0] iv[0] iv[1] iv[2]
- * Due to the cipher internal state's symmetry, these are functionally
- * equivalent.
+ /*
+ * The 16-byte EVP IV is split into 4 little-endian 4-byte words
+ * evpiv[15:12] evpiv[11:8] evpiv[7:4] evpiv[3:0]
+ * iv[1] iv[0] counter[1] counter[0]
+ * and passed as iv[] and counter[] to ChaCha_set_iv().
*/
.iv_len = 16,
.flags = EVP_CIPH_STREAM_CIPHER | EVP_CIPH_ALWAYS_CALL_INIT |