Andrew Chow
b4794740f8
Merge bitcoin/bitcoin#27985 : Add support for RFC8439 variant of ChaCha20
...
0bf87476f5 test: add ChaCha20 test triggering 32-bit block counter overflow (Sebastian Falbesoner)
7f2a985147 tests: improve ChaCha20 unit tests (Pieter Wuille)
511a8d406e crypto: Implement RFC8439-compatible variant of ChaCha20 (Pieter Wuille)
Pull request description:
Based on and replaces part of #25361 , part of the BIP324 project (#27634 ). See also #19225 for background.
There are two variants of ChaCha20 in use. The currently implemented one uses a 64-bit nonce and a 64-bit block counter, while the one used in RFC8439 (and thus BIP324) uses a 96-bit nonce and 32-bit block counter. This PR changes the logic to use the 96-bit nonce variant, though in a way that's compatible with >256 GiB output (by automatically incrementing the first 32-bit part of the nonce when the block counter overflows).
For those who reviewed the original PR, the biggest change is here that the 96-bit nonce is passed as a Nonce96 type (pair of 32-bit + 64-bit integer) rather than a 12-byte array.
ACKs for top commit:
achow101:
ACK 0bf87476f5
theStack:
Code-review ACK 0bf87476f5
Tree-SHA512: 62e4cbd5388b8d50ef1a0dc99b6f4ad36c7b4419032035f8e622dda63a62311dd923032217e20054bcd836865d4be5c074f9e5538ca158f94f08eab75c5519c1
2023-07-12 12:58:44 -04:00
..
2023-07-07 17:16:27 -04:00
2023-06-29 14:41:33 +01:00
2023-04-03 14:44:48 +01:00
2023-06-12 19:47:19 +01:00
2022-08-13 13:55:38 +01:00
2023-07-07 17:16:27 -04:00
2023-07-10 10:50:50 -03:00
2023-06-15 10:27:56 -06:00
2023-06-12 12:54:49 -04:00
2023-05-20 12:08:13 +02:00
2023-07-11 12:00:57 +02:00
2022-09-29 16:43:30 +01:00
2023-01-31 18:48:50 +01:00
2022-10-23 15:03:04 +01:00
2023-07-11 12:00:57 +02:00
2023-06-26 09:43:38 +01:00
2022-12-24 23:49:50 +00:00
2023-07-06 17:07:27 -04:00
2023-07-10 10:47:17 -03:00
2023-06-28 09:37:16 -03:00
2023-06-21 11:04:00 -04:00
2023-06-20 10:23:08 +02:00
2023-07-12 12:58:44 -04:00
2023-06-20 10:23:08 +02:00
2023-06-28 09:49:28 +02:00
2023-07-07 13:43:28 -04:00
2023-05-26 13:41:07 -03:00
2023-06-29 11:59:31 +01:00
2023-03-26 20:18:13 +01:00
2023-06-29 16:14:07 -06:00
2023-05-29 13:26:31 +02:00
2023-05-26 15:47:55 -07:00
2023-05-26 15:47:55 -07:00
2023-05-24 12:03:18 -07:00
2022-12-24 23:49:50 +00:00
2023-02-01 11:33:35 +01:00
2023-05-04 20:57:51 +01:00
2023-05-20 12:08:13 +02:00
2023-03-23 12:55:18 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-07-07 19:31:27 -03:00
2023-05-20 12:08:13 +02:00
2023-05-20 12:08:13 +02:00
2023-05-20 12:08:13 +02:00
2023-05-20 12:08:13 +02:00
2023-06-16 10:38:19 +01:00
2023-05-20 12:08:13 +02:00
2023-02-15 14:42:28 -08:00
2023-01-31 19:34:35 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-01-05 09:05:14 +00:00
2023-05-25 19:24:05 +02:00
2023-05-25 19:24:05 +02:00
2023-05-10 10:39:58 +02:00
2023-05-10 10:39:58 +02:00
2023-04-20 06:08:22 -07:00
2023-06-16 10:38:19 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-03-23 19:38:38 +01:00
2023-03-23 19:38:38 +01:00
2023-02-03 18:15:42 +01:00
2023-01-26 10:44:05 +01:00
2023-05-20 12:08:13 +02:00
2023-01-31 11:50:10 +00:00
2023-03-23 12:55:18 +01:00
2023-03-23 12:55:18 +01:00
2023-03-15 16:42:42 +01:00
2023-03-15 16:42:42 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-04-19 10:48:30 +02:00
2023-05-09 18:48:52 +02:00
2023-05-20 12:08:13 +02:00
2023-03-23 12:52:00 +01:00
2023-04-03 14:41:22 +01:00
2022-12-24 23:49:50 +00:00
2023-01-30 15:57:12 +00:00
2022-12-12 21:06:04 +00:00
2022-12-12 21:06:04 +00:00
2023-05-09 18:47:14 +02:00
2023-06-28 12:20:25 +01:00
2022-12-24 23:49:50 +00:00
2023-05-20 12:08:13 +02:00
2023-03-23 12:55:18 +01:00
2023-07-11 12:00:57 +02:00
2023-07-10 10:47:17 -03:00
2023-05-25 06:30:10 +00:00
2023-06-23 14:22:33 -04:00
2023-06-23 14:22:33 -04:00
2023-06-15 10:27:56 -06:00
2023-06-15 10:27:56 -06:00
2023-06-28 09:52:33 +02:00
2023-06-23 14:24:32 -04:00
2022-04-26 16:25:38 -04:00
2022-06-23 15:33:01 +02:00
2022-07-21 10:42:09 +01:00
2023-02-27 13:53:29 +00:00
2023-02-03 22:33:14 +01:00
2022-09-13 17:15:17 +01:00
2022-11-17 14:52:45 +00:00
2023-06-28 12:45:36 +02:00
2023-06-17 23:55:16 +05:30
2023-06-16 10:38:19 +01:00
2023-01-28 15:24:13 +00:00
2023-03-23 19:38:38 +01:00
2023-05-30 11:39:59 -04:00
2022-12-24 23:49:50 +00:00
2023-06-26 10:39:32 +01:00
2023-05-23 13:07:49 -04:00
2022-12-24 23:49:50 +00:00
2023-06-29 19:42:47 -04:00
2023-06-23 18:03:06 -03:00
2023-02-17 13:34:40 -05:00
2023-02-17 13:34:40 -05:00
2023-06-28 16:35:45 -05:00
2023-05-26 13:41:07 -03:00
2022-12-24 23:49:50 +00:00
2022-04-20 14:35:53 +01:00
2022-12-24 23:49:50 +00:00
2023-04-16 23:48:05 +02:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-03-26 15:49:52 +02:00
2023-05-20 12:08:13 +02:00
2023-05-15 10:18:58 +02:00
2023-04-21 14:06:12 -04:00
2023-04-21 14:06:12 -04:00
2023-06-23 14:22:33 -04:00
2023-06-27 10:13:37 +02:00
2023-06-30 12:09:44 +02:00
2023-06-30 12:09:44 +02:00
2023-04-03 14:44:48 +01:00
2023-06-12 10:24:14 -03:00
2022-03-10 12:01:53 +01:00
2023-01-12 13:42:44 +00:00
2023-06-16 10:38:19 +01:00
2022-12-24 23:49:50 +00:00
2023-06-30 12:09:45 +02:00
2023-06-28 09:52:33 +02:00
2023-06-28 09:52:33 +02:00
2023-05-20 12:08:13 +02:00
2023-06-28 15:14:45 -04:00
2023-06-01 10:27:33 -04:00
2023-01-25 09:33:26 +01:00
2023-04-19 10:48:30 +02:00
2022-12-24 23:49:50 +00:00
2023-01-31 11:50:10 +00:00
2023-06-16 10:38:19 +01:00
2023-03-23 12:55:18 +01:00
2023-06-28 09:52:27 +02:00
2023-06-28 09:52:27 +02:00
2023-06-14 23:15:20 +02:00
2023-06-12 19:47:19 +01:00
2023-06-20 10:23:08 +02:00
2023-06-20 10:23:08 +02:00
2023-05-31 15:43:01 +01:00
2022-12-10 14:34:44 -06:00
2023-06-28 15:12:12 -04:00
2023-06-28 09:52:33 +02:00
2023-07-07 19:31:27 -03:00
2023-02-01 11:33:35 +01:00
2023-01-05 09:05:14 +00:00
2023-05-15 10:18:58 +02:00
2023-01-03 19:31:29 -06:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-05-20 12:08:13 +02:00