Update AES-GCM-SIV to match revision four of the draft.
This change updates AES-GCM-SIV to match revision four of the draft[1].
See [2] for the reasons behind the changes.
[1] https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-04
[2] https://www.ietf.org/mail-archive/web/cfrg/current/msg08895.html
Change-Id: Icacfefbd2f470186051551ea227c9d6c6dd6e786
Reviewed-on: https://boringssl-review.googlesource.com/13973
Reviewed-by: Adam Langley <alangley@gmail.com>
Commit-Queue: Adam Langley <alangley@gmail.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/cipher/e_aes.c b/crypto/cipher/e_aes.c
index 0e9a7cd..f67cdad 100644
--- a/crypto/cipher/e_aes.c
+++ b/crypto/cipher/e_aes.c
@@ -1448,6 +1448,7 @@
#if !defined(OPENSSL_SMALL)
+#define EVP_AEAD_AES_GCM_SIV_NONCE_LEN 12
#define EVP_AEAD_AES_GCM_SIV_TAG_LEN 16
struct aead_aes_gcm_siv_ctx {
@@ -1548,9 +1549,10 @@
/* gcm_siv_polyval evaluates POLYVAL at |auth_key| on the given plaintext and
* AD. The result is written to |out_tag|. */
-static void gcm_siv_polyval(uint8_t out_tag[16], const uint8_t *in,
- size_t in_len, const uint8_t *ad, size_t ad_len,
- const uint8_t auth_key[16]) {
+static void gcm_siv_polyval(
+ uint8_t out_tag[16], const uint8_t *in, size_t in_len, const uint8_t *ad,
+ size_t ad_len, const uint8_t auth_key[16],
+ const uint8_t nonce[EVP_AEAD_AES_GCM_SIV_NONCE_LEN]) {
struct polyval_ctx polyval_ctx;
CRYPTO_POLYVAL_init(&polyval_ctx, auth_key);
@@ -1584,6 +1586,9 @@
sizeof(length_block));
CRYPTO_POLYVAL_finish(&polyval_ctx, out_tag);
+ for (size_t i = 0; i < EVP_AEAD_AES_GCM_SIV_NONCE_LEN; i++) {
+ out_tag[i] ^= nonce[i];
+ }
out_tag[15] &= 0x7f;
}
@@ -1602,22 +1607,26 @@
static void gcm_siv_keys(
const struct aead_aes_gcm_siv_ctx *gcm_siv_ctx,
struct gcm_siv_record_keys *out_keys,
- const uint8_t nonce[EVP_AEAD_AES_GCM_SIV_TAG_LEN]) {
+ const uint8_t nonce[EVP_AEAD_AES_GCM_SIV_NONCE_LEN]) {
const AES_KEY *const key = &gcm_siv_ctx->ks.ks;
- gcm_siv_ctx->kgk_block(nonce, out_keys->auth_key, key);
+ uint8_t key_material[(128 /* POLYVAL key */ + 256 /* max AES key */) / 8];
+ const size_t blocks_needed = gcm_siv_ctx->is_256 ? 6 : 4;
- if (gcm_siv_ctx->is_256) {
- uint8_t record_enc_key[32];
- gcm_siv_ctx->kgk_block(out_keys->auth_key, record_enc_key + 16, key);
- gcm_siv_ctx->kgk_block(record_enc_key + 16, record_enc_key, key);
- aes_ctr_set_key(&out_keys->enc_key.ks, NULL, &out_keys->enc_block,
- record_enc_key, sizeof(record_enc_key));
- } else {
- uint8_t record_enc_key[16];
- gcm_siv_ctx->kgk_block(out_keys->auth_key, record_enc_key, key);
- aes_ctr_set_key(&out_keys->enc_key.ks, NULL, &out_keys->enc_block,
- record_enc_key, sizeof(record_enc_key));
+ uint8_t counter[AES_BLOCK_SIZE];
+ OPENSSL_memset(counter, 0, AES_BLOCK_SIZE - EVP_AEAD_AES_GCM_SIV_NONCE_LEN);
+ OPENSSL_memcpy(counter + AES_BLOCK_SIZE - EVP_AEAD_AES_GCM_SIV_NONCE_LEN,
+ nonce, EVP_AEAD_AES_GCM_SIV_NONCE_LEN);
+ for (size_t i = 0; i < blocks_needed; i++) {
+ counter[0] = i;
+
+ uint8_t ciphertext[AES_BLOCK_SIZE];
+ gcm_siv_ctx->kgk_block(counter, ciphertext, key);
+ OPENSSL_memcpy(&key_material[i * 8], ciphertext, 8);
}
+
+ OPENSSL_memcpy(out_keys->auth_key, key_material, 16);
+ aes_ctr_set_key(&out_keys->enc_key.ks, NULL, &out_keys->enc_block,
+ key_material + 16, gcm_siv_ctx->is_256 ? 32 : 16);
}
static int aead_aes_gcm_siv_seal(const EVP_AEAD_CTX *ctx, uint8_t *out,
@@ -1641,7 +1650,7 @@
return 0;
}
- if (nonce_len != AES_BLOCK_SIZE) {
+ if (nonce_len != EVP_AEAD_AES_GCM_SIV_NONCE_LEN) {
OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_UNSUPPORTED_NONCE_SIZE);
return 0;
}
@@ -1650,7 +1659,7 @@
gcm_siv_keys(gcm_siv_ctx, &keys, nonce);
uint8_t tag[16];
- gcm_siv_polyval(tag, in, in_len, ad, ad_len, keys.auth_key);
+ gcm_siv_polyval(tag, in, in_len, ad, ad_len, keys.auth_key, nonce);
keys.enc_block(tag, tag, &keys.enc_key.ks);
gcm_siv_crypt(out, in, in_len, tag, keys.enc_block, &keys.enc_key.ks);
@@ -1679,6 +1688,11 @@
return 0;
}
+ if (nonce_len != EVP_AEAD_AES_GCM_SIV_NONCE_LEN) {
+ OPENSSL_PUT_ERROR(CIPHER, CIPHER_R_UNSUPPORTED_NONCE_SIZE);
+ return 0;
+ }
+
const struct aead_aes_gcm_siv_ctx *gcm_siv_ctx = ctx->aead_state;
const size_t plaintext_len = in_len - EVP_AEAD_AES_GCM_SIV_TAG_LEN;
@@ -1694,7 +1708,8 @@
&keys.enc_key.ks);
uint8_t expected_tag[EVP_AEAD_AES_GCM_SIV_TAG_LEN];
- gcm_siv_polyval(expected_tag, out, plaintext_len, ad, ad_len, keys.auth_key);
+ gcm_siv_polyval(expected_tag, out, plaintext_len, ad, ad_len, keys.auth_key,
+ nonce);
keys.enc_block(expected_tag, expected_tag, &keys.enc_key.ks);
if (CRYPTO_memcmp(expected_tag, &in[plaintext_len], sizeof(expected_tag)) !=
@@ -1708,10 +1723,10 @@
}
static const EVP_AEAD aead_aes_128_gcm_siv = {
- 16, /* key length */
- AES_BLOCK_SIZE, /* nonce length */
- EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* overhead */
- EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* max tag length */
+ 16, /* key length */
+ EVP_AEAD_AES_GCM_SIV_NONCE_LEN, /* nonce length */
+ EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* overhead */
+ EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* max tag length */
aead_aes_gcm_siv_init,
NULL /* init_with_direction */,
@@ -1722,10 +1737,10 @@
};
static const EVP_AEAD aead_aes_256_gcm_siv = {
- 32, /* key length */
- AES_BLOCK_SIZE, /* nonce length */
- EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* overhead */
- EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* max tag length */
+ 32, /* key length */
+ EVP_AEAD_AES_GCM_SIV_NONCE_LEN, /* nonce length */
+ EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* overhead */
+ EVP_AEAD_AES_GCM_SIV_TAG_LEN, /* max tag length */
aead_aes_gcm_siv_init,
NULL /* init_with_direction */,
diff --git a/crypto/cipher/test/aes_128_gcm_siv_tests.txt b/crypto/cipher/test/aes_128_gcm_siv_tests.txt
index faf97c1..b9e728a 100644
--- a/crypto/cipher/test/aes_128_gcm_siv_tests.txt
+++ b/crypto/cipher/test/aes_128_gcm_siv_tests.txt
@@ -1,245 +1,133 @@
# This is the example from
-# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02#section-8
+# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-04#section-8
KEY: ee8e1ed9ff2540ae8f2ba9f50bc2f27c
-NONCE: 752abad3e0afb5f434dc4310f71f3d21
+NONCE: 752abad3e0afb5f434dc4310
IN: "Hello world"
AD: "example"
-CT: 810649724764545b3625ff
-TAG: 010a10f4942710781d2948ac0192572f
+CT: 5d349ead175ef6b1def6fd
+TAG: 4fbcdeb7e4793f4a1d7e4faa70100af1
# Test vectors from
-# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02#appendix-B
+# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-04#appendix-C
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN:
AD:
CT:
-TAG: cb52de357fad226ae428d0ed5a575496
+TAG: dc20e2d83f25705bb49e439eca56de25
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0100000000000000
AD:
-CT: 7e139f58002d68ee
-TAG: 715835541f2136f03b6dc80ae0a8ac46
+CT: b5d839330ac7b786
+TAG: 578782fff6013b815b287c22493a364c
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 010000000000000000000000
AD:
-CT: 4a87f0cd26e5d5086e90da02
-TAG: 4dff905e48d512e9c34ae8f3be66ec43
+CT: 7323ea61d05932260047d942
+TAG: a4978db357391a0bc4fdec8b0d106639
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 01000000000000000000000000000000
AD:
-CT: 048ca58c46d2368ce00132389f40b511
-TAG: 971da9aa385283522c4f67a9aedb37e5
+CT: 743f7c8077ab25f8624e2e948579cf77
+TAG: 303aaf90f6fe21199c6068577437a0c4
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0100000000000000000000000000000002000000000000000000000000000000
AD:
-CT: e1cf1cf545d2743ec005b26bd2c836ac1a4233d646c195ffa401f28063127baa
-TAG: 1071338b8c2930d3ec4c17cecbefa4b4
+CT: 84e07e62ba83a6585417245d7ec413a9fe427d6315c09b57ce45f2e3936a9445
+TAG: 1a8e45dcd4578c667cd86847bf6155ff
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 010000000000000000000000000000000200000000000000000000000000000003000000000000000000000000000000
AD:
-CT: 2e7e6881a02d57b877794b2fbfbfef5484f1cf74f4ad53a751b2582c0e698466bd9a49dcab53806d8e31d864c4632d00
-TAG: 04b1b8a9c1630ff028b14d2e57bca429
+CT: 3fd24ce1f5a67b75bf2351f181a475c7b800a5b4d3dcf70106b1eea82fa1d64df42bf7226122fa92e17a40eeaac1201b
+TAG: 5e6e311dbf395d35b0fe39c2714388f8
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 01000000000000000000000000000000020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
AD:
-CT: 0ac5be860726209d9218de3e9d533743e1efe1595bc58f93f00e9bb9a7558dc1e1b14a9c0d49eb5064c7efa79842f9c7cfdd77614709f0b545d3227498e774d5
-TAG: 860b73a1ed8a5b9acd925c3f3f49c5c5
+CT: 2433668f1058190f6d43e360f4f35cd8e475127cfca7028ea8ab5c20f7ab2af02516a2bdcbc08d521be37ff28c152bba36697f25b4cd169c6590d1dd39566d3f
+TAG: 8a263dd317aa88d56bdf3936dba75bb8
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0200000000000000
AD: 01
-CT: 4919e29e9890e452
-TAG: 1433a5c0284c911163888dbd128e6874
+CT: 1e6daba35669f427
+TAG: 3b0a1a2560969cdf790d99759abd1508
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 020000000000000000000000
AD: 01
-CT: db55d6da719fe0473538294e
-TAG: 5a8ab948ccd205a70c78e8fdf954693b
+CT: 296c7889fd99f41917f44620
+TAG: 08299c5102745aaa3a0c469fad9e075a
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000000000000000000000000000
AD: 01
-CT: aea3c54272abc1b58ed34a536743f4da
-TAG: da10d98bfe23784cfdfd0af97b6d5b78
+CT: e2b0c5da79a901c1745f700525cb335b
+TAG: 8f8936ec039e4e4bb97ebd8c4457441f
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0200000000000000000000000000000003000000000000000000000000000000
AD: 01
-CT: aa694c0cfe148100cb5c6e27a77a7ff7b4233d6af251d9faa3d84f7c0d1113f1
-TAG: 778c5b68356a1a6a6f3c14a8f96c35ca
+CT: 620048ef3c1e73e57e02bb8562c416a319e73e4caac8e96a1ecb2933145a1d71
+TAG: e6af6a7f87287da059a71684ed3498e1
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
AD: 01
-CT: 9ac909928bcde79c2afa885df9c035c85a9eab136f6f6ea11034456bd306ea3c5dd542f706fffe538b5f139fa9dc622e
-TAG: 26c0c0d146d38787ca0fcbc3f911577a
+CT: 50c8303ea93925d64090d07bd109dfd9515a5a33431019c17d93465999a8b0053201d723120a8562b838cdff25bf9d1e
+TAG: 6a8cc3865f76897c2e4b245cf31c51f2
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000000000000000000000000000030000000000000000000000000000000400000000000000000000000000000005000000000000000000000000000000
AD: 01
-CT: c56be9d61ecf6a31a6289cddc9b91aaf84cdb53a3913b825d6eb5e157906dfb0a308c6b0b095d6fd1a5b761ca7fa0e39ca92f38ae206eec844c0c4ab0c1c165e
-TAG: a60986309b99431a35dd8c5ebeef8375
+CT: 2f5c64059db55ee0fb847ed513003746aca4e61c711b5de2e7a77ffd02da42feec601910d3467bb8b36ebbaebce5fba30d36c95f48a3e7980f0e7ac299332a80
+TAG: cdc46ae475563de037001ef84ae21744
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000
AD: 010000000000000000000000
-CT: 47995b96
-TAG: 16b668094202cadde992e0c16205793c
+CT: a8fe3e87
+TAG: 07eb1f84fb28f8cb73de8e99e2f48a14
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0300000000000000000000000000000004000000
AD: 010000000000000000000000000000000200
-CT: 8fe25de75089e9f849150e57ab7f7810981cd319
-TAG: 89ca91ebc560709432fe9496746404cc
+CT: 6bb0fecf5ded9b77f902c7d5da236a4391dd0297
+TAG: 24afc9805e976f451e6d87f6fe106514
KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 030000000000000000000000000000000400
AD: 0100000000000000000000000000000002000000
-CT: b26d43ae158316ac37f41579ccf1d461274e
-TAG: 13b7c01d08dd6969d51d1bf0fbbdc4d2
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN:
-AD:
-CT:
-TAG: cb52de357fad226ae428d0ed5a575496
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0100000000000000
-AD:
-CT: 7e139f58002d68ee
-TAG: 715835541f2136f03b6dc80ae0a8ac46
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 010000000000000000000000
-AD:
-CT: 4a87f0cd26e5d5086e90da02
-TAG: 4dff905e48d512e9c34ae8f3be66ec43
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 01000000000000000000000000000000
-AD:
-CT: 048ca58c46d2368ce00132389f40b511
-TAG: 971da9aa385283522c4f67a9aedb37e5
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0100000000000000000000000000000002000000000000000000000000000000
-AD:
-CT: e1cf1cf545d2743ec005b26bd2c836ac1a4233d646c195ffa401f28063127baa
-TAG: 1071338b8c2930d3ec4c17cecbefa4b4
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 010000000000000000000000000000000200000000000000000000000000000003000000000000000000000000000000
-AD:
-CT: 2e7e6881a02d57b877794b2fbfbfef5484f1cf74f4ad53a751b2582c0e698466bd9a49dcab53806d8e31d864c4632d00
-TAG: 04b1b8a9c1630ff028b14d2e57bca429
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 01000000000000000000000000000000020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
-AD:
-CT: 0ac5be860726209d9218de3e9d533743e1efe1595bc58f93f00e9bb9a7558dc1e1b14a9c0d49eb5064c7efa79842f9c7cfdd77614709f0b545d3227498e774d5
-TAG: 860b73a1ed8a5b9acd925c3f3f49c5c5
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0200000000000000
-AD: 01
-CT: 4919e29e9890e452
-TAG: 1433a5c0284c911163888dbd128e6874
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 020000000000000000000000
-AD: 01
-CT: db55d6da719fe0473538294e
-TAG: 5a8ab948ccd205a70c78e8fdf954693b
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000000000000000000000000000
-AD: 01
-CT: aea3c54272abc1b58ed34a536743f4da
-TAG: da10d98bfe23784cfdfd0af97b6d5b78
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0200000000000000000000000000000003000000000000000000000000000000
-AD: 01
-CT: aa694c0cfe148100cb5c6e27a77a7ff7b4233d6af251d9faa3d84f7c0d1113f1
-TAG: 778c5b68356a1a6a6f3c14a8f96c35ca
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
-AD: 01
-CT: 9ac909928bcde79c2afa885df9c035c85a9eab136f6f6ea11034456bd306ea3c5dd542f706fffe538b5f139fa9dc622e
-TAG: 26c0c0d146d38787ca0fcbc3f911577a
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000000000000000000000000000030000000000000000000000000000000400000000000000000000000000000005000000000000000000000000000000
-AD: 01
-CT: c56be9d61ecf6a31a6289cddc9b91aaf84cdb53a3913b825d6eb5e157906dfb0a308c6b0b095d6fd1a5b761ca7fa0e39ca92f38ae206eec844c0c4ab0c1c165e
-TAG: a60986309b99431a35dd8c5ebeef8375
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000
-AD: 010000000000000000000000
-CT: 47995b96
-TAG: 16b668094202cadde992e0c16205793c
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0300000000000000000000000000000004000000
-AD: 010000000000000000000000000000000200
-CT: 8fe25de75089e9f849150e57ab7f7810981cd319
-TAG: 89ca91ebc560709432fe9496746404cc
-
-KEY: 01000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 030000000000000000000000000000000400
-AD: 0100000000000000000000000000000002000000
-CT: b26d43ae158316ac37f41579ccf1d461274e
-TAG: 13b7c01d08dd6969d51d1bf0fbbdc4d2
+CT: 44d0aaf6fb2f1f34add5e8064e83e12a2ada
+TAG: bff9b2ef00fb47920cc72a0c0f13b9fd
# Sample large random test vector.
-KEY: ee0f62a965fa640d1c95d79b215dca71
-NONCE: 7df5a22c91e6b6f37594dfef54847bd9
-IN: 5d90037e677666fbc0215305096301d852609e1380992d8c2e3594344a7f9a0521fdeda53de07d3184d590667fc7151a93ba097f20c67da0b1da8c23bd05887a4b66ab50333874819035eafd775fcfa86b380968f15d8cd46483d418b2c074f0dc18407108f63abe89c5448e83d064b6544a275dd75a21dd0241dafa086beb8446f398f6c1b2b117ad6f2cdb04031640852b5e15560d39b8d9088824f728ae66b2214e4cd70f60174313a5f0286741caeb4b66d0513b63c4a1325306f79f1f79bb28ccf6448fa3160876eefd85ca03c196a3e5568b0f3c818e7cf9d661423ed6a50a6911d52217a1b81e94ba040f336e74ac71b33964c3a7d960a32c255e22fcb7dcc41b9b136815b784ce4015b61b55e305e2ab1f96d17b561eb0281476cbaec54e942a186fbf3df92358960182c3c034066364e80fa492b36d36ee68f2738220f249a69f24405fe9995dab0b0b338ee68d85f0e59870903ca9d02f32ee6a24efc85434610586470b938daa9d14206c360339f7ec50857f4e5075a29bb51720d9a6f399f7b8bd45b402b0eed8f6e427d5dd358a0c3f10a58582be8934ebd7903497cc6622a977d6045f97a58f5ed7a3470583ebf88f71150499047e4b624f8018cffaca0d5a9db7f73da2db6770c98cd628d2d6682a4c41d584f37ea0ff7e8763616a548027e29cb3ec3e02a82eab205f7af46b6c9b02a15de54fc301a9845d50396cf3826b23296c360fafbaf65e5f48c4998085d7dac07736b106a8bb1e8e69dca15464d1bf156a5f84b62170f680826dcca7bf1c126cdb70dc872a005806d423cee46ab0d84d2d8d490c8eaec8b17b12913d4856c59f5348c6956c96a32595eef8c89ee5ae99706c92e748714dae4ae45685710261cd66d3ef93ed01bb862bfeb3b4fb5074ffec5517c8845173fde2774cd3b5a25cc1dc11d833c29614b7272bf213aeb19f83603aee97a9bc43e8b88c8789c520f634028cce2b0be343e74c8c341a153a36f797f38a4ebb53589e45f1e64299fedd2e9bbdeb9ad9ab4e2eccb4bd2b57000a5d7b064e6b6fb5cb9c743d6afe697bac549ade238c7a3a094e799e9c7e6cef6e6d4b8c8f1d862bc8ab9b96238c7d5393b2f684c5b4826df6c5f48cadb43fd6d6cb189ca56125bfee9dd44d22a2e28d7a9e63565321c9ecad96b3ae7376c984c44cab978002ff78d947230fe15918b3a73232ff5c05586c4b0e2e0d737be6abef80414b008ad2deea1944a4248f02063500a9276217ceabeca39ec4d6af647395a9c91401dcbe8f9645ef97eca5624029f942cc9979fd31636d65ed181a65763c5c16e65f8673a3cc6143ede8144d894559dedfac3000e8d86590b0ced25dd8666d71f237fd3511d7f8a20dbb4e95e3aca9807a2351bf705a7eec5a80f2b390ef9df496c5cd7ca9f5d8846df291025beb9781c793613efe7798
-AD: 4b7531e0a946b20c80f70dea4d437833f3dd26ae6f6dc37b7b99e82122acf2b7975f6d8efcb7ec4c6ff3c0ce4a5864adba0e658aeb8d9b839f3509f033827bc69a1ab080a0a1cc63559b00a3a259c53c145b0282f5e56930fc35b11c83b6564f2e80f186c2ef2e8886641fe6c4966dc9f86c567e73902d1a8fc33be1551e8359aa585bd2b8da83c0cd78a086cdebf8904d1b66a2fee176fa19714f062b752653d75a0e441ff7fba0c5a0cb6ded48f68b38af82faa985f9d97ba3c0978e1d23d8eb8899072fbec9379ca5f2b91293cb57eac81a6d711f9cccb36ff16b0de86d27d62e136ddbc1a2be38d5a1284e4620f4f9ab1f16729630e16dd2901f24f5ad6e
-CT: 1b5a273ee4e1f87516bb711bd97c559fd5139286d90d3f64813f88c697ff448c7ce57ff3a2b70479c0f904f0c6de92234ef72b4ad62038a32108804042e07ad94e49a327bd28f1c49786c2b1537392c582031f52e3bd27336dab9d237ce47ffd0c8002b60b1055226cf28c6d99be0e4f75afb72c6953ffa0b033f74304efe19601d34dfda29874efdc9ebfa74c9d55c7273561c46b7cd4d631ab05ca7172111c13f0703ff9cec063988b7bf1bd9557b8d8a914162d2f31113f1682e951acaba4a314aabf901bdc5117184109fca1cecfe552f2e7d003eab51ceb992c2bb11245e1cd7e230398a3d18bab59c9acf033bde779166bfd3f98792902f84e4ef32cf5f410af2cec9cbe67ebb28f3fceb497abf4b1c240cab4852d840de9dec20f0e21853be6227784beee276ea3a4c6092654f7d62af614e5ea976791195415befa1f4a9d77c35a84b0d54b5eb1e00f55bbafac209468532b18d020e16798256aab9ea3989d876822cc68135ee103169962965a9383b2cff70213f9c52bcf2441e7b8ec07bee0c225be5353bcfe6d9ff546d30889813a13e1e966028dd80ec096202a26e478278af8b15bcf29137d536658d51293c6cfecde110e5b17ec39ce5317db5a03a1919f52f89ceeec0b5f48875e9692501b34303110e52ef4ea96d98cc28ab6e9ca24a8bb124629ac480b06fa8321b5712f2ae22e750848404ac20232716e195b343adebb52234cbc002c602574a7fbad638c1a7201eb38d4404b3d672119617e1190402b57568ee1e776ba18087164ddfbbf77f26ae5ee229ef101f10306f6449920b08d4e46bb2039d4777319547d7b4ef32e61c3cc897bc36cc2d5983c63e38814276a28125468112b646b877bbe2d206e578a8fd402be6d963b1d79c8b14dbca801bb92d7217cb7375d5e126702270158c89db653f1ee34e1c1ca066fe854532a36b74d36d9bc077506349a4cb8143dca1be3241f64cdc410c4d362982500aeea2a12172ccac996a333a2bff5393e0be9bcb93ca0fd62a22f0f72618325e233b42214ce8683c57dcf3113edbc5102e84b265aa031e26ec5fa18b1a7fa72358072d47b85e045cd52541e49b94d74fb21bb19725675c0d014ca8f8219c26cb8158f5d84b2cafb0474b2b39cb7f21c3320b5cbd57cff7133243a462e492de6340ee7d60ef888d639ca50380529f09b9eb279c49ad04662b7ec4f579fcec011790f18b2c0ad081eaf2be13d6f6a5969db46d56df9daea2cb332e719135109fd1d7caa84af315c0054f37177312c01a9f3f05a6e9bca719f906d1e8af7fdc24a3677c922f435e6e4c069073ea779c2b74c98f9374f5a38961a4354e74803f0f4042b91fb82a0c593c13f9ff720a70136d0b108acdb762a08f98a222f48c2858c0cc9a27edc9e79fe0f71ebe2940c60a279476975926eab478685ebf8a74705
-TAG: 6f5223329c07cbf6b038d307cbb8a719
+KEY: d301238025c7ef4fe32fd20cc3ddb1dc
+NONCE: cab44881cefbcae419a122d6
+IN: 71356c78191cf4181cee0532d45d2d4fbbf62b9adf86b0643dd3735191283b1f9fd6a890029a4640294d0ffa9e18bf9da18cea164f87a01a376ec43163c5a612b125ca261e1eaedc03e3105b59e11bbbb8cc6c8247b3e5a0e55ad690c2a77b9f30e3b5202a187a6027097efa66ab0ba824dfc167ae51a581ca5e6c78d10a2e485c61404f0cf4bbb535e0b781ec1cf558e385d3f2d31334852015c402f77e7a4f69e45c88ca3b2950a0232971d80aec4b47c22d70ec2dfd058d5dad5ec4843df0173094053ccf265de85465d32dd36309798d88f7552e2b8a962d42e3744544e753516647fd0686860cdfa52c9a674a461df0a772f05cd814dcd80e8ebc871fa6994e045112178f98dea9f1fbcc3931bd5c3a6ba834ed083bdaad943e896c86c710ce59d49b36b882a24236e792e91351fc2b7a4385ed8d304b0c89e4785660822daecdf938fa237a97a95dec37d89cfc44c5964e31f4a257f996b628e8b0fded09d06e73b864200c7a8973dcc0e84f172940fa443c05dbe3a18e49b05c362adb57c7dcad2c31d3b2588e5931922c02f0eac0c3c7780213a978cd5a0ebcbaa4bdfb6873812e61c36b93d8f5d3b81db3f97f5a5207f274e4b1174f919defc2c63fe5cee5e9e2f3d91d7e726dfadb35bbb28ef01a625a97b502fe8a5ee56a5140668ca3429395440dc75dfb8212827ef9e5b7562f3f57dbf1a9d0e0fcbb2ceaddcbeea4cb2a8ef419cc12b767ed56712d19e431da3c6e48a21c3a5dba1b83f60e7a546000543946b24a8670684283736c230253873c39ed8d884967c2dacb365e55dc40c7f77787c1f050f16376c8220611ecec2887382b8fefa4b8627b0640038732f7ef0aad2877376b5256dd6f770a426749dd2f22f69684340e32548972be0feaab5dbbb0ae0b41460f6b483086b2d3d108e7f80a7cfa559dea483ea3c567cea8b16bb2f3eb29e9917be929e32571c7253b07d967a2c05d7f5b05c56f0dda6936a4d7d7b2e0ab877c99a9fedec49bc5058ffbaea034f7a5d493bf99cf3dea26d39076246e2a0f10d62b29799c04759b534a03b82e6cfff39872b07997a8de7d71ed87f0518581d15d34ccdbf66e6bbace42c56d7e4a7ef5e7e1462bd102fe104488bb4555676f04b4974ec436e6b05f7ea043641934bf02117079eb0323e213217662331d5dd310550a5db9a3a198770238e74da7d6667959956d736cd607c6c5c05eb279f077858101767a613024dfd31f50081ec482a2532276b2ccb272c1a5f00fc041dea0220ce8d51e5c73a7be649dfbaf1c4e75ab2e30cbfc61f3a83d866cc7e9318a4eca8ab9da2f4aea2c8a7e8b2f867adb134c3433f72edf471388fcd804ba316af409474197ade5a1f39d58a7378cd8bfca5a81588f43a05c09e4249a242cfb54a1c5ec70972dfabcbdccc61f305835dfa92a37d59148ad0b74d7
+AD: d1bbfb956faacbfd116bc473b3e0ae09feb224ec760f65b941d99a09eef82dcdd4f8111cfecf1ad4f02e0bdc3a137b9095f922dc3a80d98282827066c201779af4f4267364dcb3eee26a8c9e885b835e7836666dedce8dc912aa328c56bafa3f5746a5c7304cb6805e895885dc520edcea76739db2b426e93ef404b406ede2d57f0131ad6cb1049b18e0bff1bea181b57a3b942b55348a7d2afb056e90f421f5e281c9c3ada60c5891a2e518981704d92c5712991b31a620a3d53811b971469d4fa86e32de261a4679671cfd983c56fe037e9232f06a53aa1eeb2f61caa4f8c1079679ee9fa581ee5eb49842290152655c15bad483b96340a5f1fd67368fda29
+CT: 8dd19cbf232354e78032baaafd52903569381a29110fe1a6bdeeb539149d69e35f1d8efa09c029c21514ce1a040371714b317921228d8718bb979378cfbb53e60b16ba6ffbdedfa0283d9c48fdef183aa6000d05aa1bcf76f478a6de9356726f1645a681ec9cd84716403e354f38b5364f5ca290291c965b82fe4c0d3085d853ccb0588e4c815214e895b46fc2758747559920e0d137d105419e2856d0e0e5bcbb6f7d3d6055bbbcdd29c7a70fc80a00392bd27174c0bc806adfae08e32b308ce8128e4bbae574e96daea0d3676c7ee259bf2a1ee0af0f474401795794cb51d508db5ee02d346a5019a5dcda7532317a41a7147af946d56cb1dcbd53e28feadbd9af9cd3eb96c7bff0611c2f387d95f8caf8b3ca59d02020340630406e597d665b2d2193635f157c51f1b19a1cf4349d1ef227f62812d6cdb0c7dae87647f1ac28c79d643ac0d06781ccc24d626c44e0a3b7a55e3a81f30118703d489b93dd01f94ecae0ac42e1eb7e937f67a38dafe9ec0c5d2bf846acd1536011c02a63153c9e4c0bd4e467e5671e52507a34e3a8dc6de18eb967a54cf63bc049e0c7fe89988c394959ef80f8c23bd93aef9a150ae33a245fe8b6db955193632118e1adfea566620b6dd8ac46a16f86651a8d34719128a07c63123eda805602ce923eb0b945886bd73adfe08beb77b50cbc6fb023f41355d5f1e16f289b9ad86ae89e35c978dfe8b8356f80bb809fe9274553dc094e96d865ee1cad1de31e4c838e5b5564b581369e8ff719e1dd84c3465bff3981bbafc874bb206b5e9f58d175c292613ac4005bdfafd411acda8c94d64b58462d2612b2877c9284b1a88fd55631abe6fa17a7fecf3635256c3e09fe3b7aaf032a411e8b9645def45219de48d58aeec6e239ee211de18051a2a5175a265ce1bab462c7a35c46590f6e1fa543f0ffd3777c564dba9a1bd1124b96fc2d1e7e81e51ecc83f7c6f2ee02b09962bd5f2744e54d58592336515f39a4ccccbfaa8d829259abd0030da76648dab078574638c730bd9c32f8179592029faa9f19adde63fd7e2d671d1c22cbadd8d28d4dbe8d098fa5fbb593884830fe6bb4afd89bd1143f77d194938c71f01fa3323cc23f18bdd486bc7a468bfa6fc0e9bd198ac4fb572f1d94fc3ff7e4860621929d39967e1baf493132188d6978bba043b2264ded093709a224af7358d5aae09667a1b6533e714fd9ab5157e201d7d14e7f559c1e0709faadad5c18ec7144faea92b134f9ac48a97a13d98e4fe0b4c4a66daa0b6adb23d2d17be82da4f590caf6034b2f0c3a846a2740339ec24223e1c024a3955f54b87358b62247afeca011d4830b0e23174965aac60b7f5517f11b23dadc06e4e72e4d89d0f5764e804e840a495d8352dc0bf22ff454a118db981224b73632eeebe5496a2c5a43cf69af0a79e84e1d12398c8024
+TAG: ae3f5d2b7ff538343964febbcd9e919b
diff --git a/crypto/cipher/test/aes_256_gcm_siv_tests.txt b/crypto/cipher/test/aes_256_gcm_siv_tests.txt
index b7a9efe..b7cbdad 100644
--- a/crypto/cipher/test/aes_256_gcm_siv_tests.txt
+++ b/crypto/cipher/test/aes_256_gcm_siv_tests.txt
@@ -1,235 +1,123 @@
# Test vectors from
-# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-02#appendix-B
+# https://tools.ietf.org/html/draft-irtf-cfrg-gcmsiv-04#appendix-C
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN:
AD:
CT:
-TAG: eb7ccf36eeff369241379c87cc08e4f0
+TAG: 07f5f4169bbf55a8400cd47ea6fd400f
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0100000000000000
AD:
-CT: ab3f382a6f0fb4c3
-TAG: a0a69e07b73281f5cdfd034f646cfa08
+CT: c2ef328e5c71c83b
+TAG: 843122130f7364b761e0b97427e3df28
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 010000000000000000000000
AD:
-CT: be8d81f033ca23b953da2197
-TAG: cdf3ba70da9c7cbd45f5140ba0cca9f1
+CT: 9aab2aeb3faa0a34aea8e2b1
+TAG: 8ca50da9ae6559e48fd10f6e5c9ca17e
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 01000000000000000000000000000000
AD:
-CT: 46e05b7116dbe27aaeffe99892194072
-TAG: be19d78991c62130cf97f628c37c3eaa
+CT: 85a01b63025ba19b7fd3ddfc033b3e76
+TAG: c9eac6fa700942702e90862383c6c366
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0100000000000000000000000000000002000000000000000000000000000000
AD:
-CT: 23ddbe9ef342b03003f56d6b4a2e8aff035c7d7cfd705e1ab4502904254bb67a
-TAG: 16c5944034050657af7c0fec7efbc40f
+CT: 4a6a9db4c8c6549201b9edb53006cba821ec9cf850948a7c86c68ac7539d027f
+TAG: e819e63abcd020b006a976397632eb5d
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 010000000000000000000000000000000200000000000000000000000000000003000000000000000000000000000000
AD:
-CT: b104c8945f280e75b52c05c45a63d1872c7f0552b1501968d9913d71207d0433f978f1a3eecdf782016b77e8c9d3ff53
-TAG: abedb4841c20f3b05e61e0fd1fcaf3d0
+CT: c00d121893a9fa603f48ccc1ca3c57ce7499245ea0046db16c53c7c66fe717e39cf6c748837b61f6ee3adcee17534ed5
+TAG: 790bc96880a99ba804bd12c0e6a22cc4
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 01000000000000000000000000000000020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
AD:
-CT: e3f2bd14f4c80c9cea4c90c81f0e4d7eedb87eb19a7c0cf5a5a95cd3e441a71083b1191d115e9a9ff008b93feeb5a86d012a3e0adb89de2d1e3225479022292f
-TAG: 3ced67f5e03bb476a738c1343926dc19
+CT: c2d5160a1f8683834910acdafc41fbb1632d4a353e8b905ec9a5499ac34f96c7e1049eb080883891a4db8caaa1f99dd004d80487540735234e3744512c6f90ce
+TAG: 112864c269fc0d9d88c61fa47e39aa08
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0200000000000000
AD: 01
-CT: 4dca2c16c3b0413c
-TAG: ac9b952c76a6f8b5df315f88126daa1c
+CT: 1de22967237a8132
+TAG: 91213f267e3b452f02d01ae33e4ec854
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 020000000000000000000000
AD: 01
-CT: ee0ca9068b5b85dfe115a660
-TAG: 756d6155927271077d790a05390ecb71
+CT: 163d6f9cc1b346cd453a2e4c
+TAG: c1a4a19ae800941ccdc57cc8413c277f
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000000000000000000000000000
AD: 01
-CT: 590edb785c0cb89d19f031fa7e7d4f91
-TAG: ac2c8f711c86dbecc8c7b663c5fbc1ea
+CT: c91545823cc24f17dbb0e9e807d5ec17
+TAG: b292d28ff61189e8e49f3875ef91aff7
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0200000000000000000000000000000003000000000000000000000000000000
AD: 01
-CT: dcf2024f5f98d463b82a8673c47dd82159748cac8bcc7c76b8cfa26029cb333c
-TAG: a9b406643e190e602fb104fbb842a1ac
+CT: 07dad364bfc2b9da89116d7bef6daaaf6f255510aa654f920ac81b94e8bad365
+TAG: aea1bad12702e1965604374aab96dbbc
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
AD: 01
-CT: 79216506b1ddadfe16366e4ec886d10dc9400b995259f74c0091f9b5a6add5680a612130f6c31ab833aa76d9b2be86de
-TAG: 3ddfe9ad2c350980942638d3f954ac6d
+CT: c67a1f0f567a5198aa1fcc8e3f21314336f7f51ca8b1af61feac35a86416fa47fbca3b5f749cdf564527f2314f42fe25
+TAG: 03332742b228c647173616cfd44c54eb
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000000000000000000000000000030000000000000000000000000000000400000000000000000000000000000005000000000000000000000000000000
AD: 01
-CT: 9535eb67240c49f30a0de5a90670813fa615e71fcb4c522ca79d9a33459a22f8c6a56d650bf0b15eecdd706e7689cf6510a281724613fea76b5366b40574b1b9
-TAG: abcb59ee31d25ee8889b70d7c36f9a41
+CT: 67fd45e126bfb9a79930c43aad2d36967d3f0e4d217c1e551f59727870beefc98cb933a8fce9de887b1e40799988db1fc3f91880ed405b2dd298318858467c89
+TAG: 5bde0285037c5de81e5b570a049b62a0
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 02000000
AD: 010000000000000000000000
-CT: 9611baa0
-TAG: 53daf2bc5916f7a6750f2432068dabee
+CT: 22b3f4cd
+TAG: 1835e517741dfddccfa07fa4661b74cf
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 0300000000000000000000000000000004000000
AD: 010000000000000000000000000000000200
-CT: 78e3a1b54daa6547f775f30c38a45e887aea5c87
-TAG: f65187d8c28adba364d659b627b16431
+CT: 43dd0163cdb48f9fe3212bf61b201976067f342b
+TAG: b879ad976d8242acc188ab59cabfe307
KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
+NONCE: 030000000000000000000000
IN: 030000000000000000000000000000000400
AD: 0100000000000000000000000000000002000000
-CT: c6d3d28704bf20067d62e1a3872d40dda44b
-TAG: 6ac0135a4379dbc67967ff55fd4d1f2f
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN:
-AD:
-CT:
-TAG: eb7ccf36eeff369241379c87cc08e4f0
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0100000000000000
-AD:
-CT: ab3f382a6f0fb4c3
-TAG: a0a69e07b73281f5cdfd034f646cfa08
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 010000000000000000000000
-AD:
-CT: be8d81f033ca23b953da2197
-TAG: cdf3ba70da9c7cbd45f5140ba0cca9f1
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 01000000000000000000000000000000
-AD:
-CT: 46e05b7116dbe27aaeffe99892194072
-TAG: be19d78991c62130cf97f628c37c3eaa
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0100000000000000000000000000000002000000000000000000000000000000
-AD:
-CT: 23ddbe9ef342b03003f56d6b4a2e8aff035c7d7cfd705e1ab4502904254bb67a
-TAG: 16c5944034050657af7c0fec7efbc40f
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 010000000000000000000000000000000200000000000000000000000000000003000000000000000000000000000000
-AD:
-CT: b104c8945f280e75b52c05c45a63d1872c7f0552b1501968d9913d71207d0433f978f1a3eecdf782016b77e8c9d3ff53
-TAG: abedb4841c20f3b05e61e0fd1fcaf3d0
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 01000000000000000000000000000000020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
-AD:
-CT: e3f2bd14f4c80c9cea4c90c81f0e4d7eedb87eb19a7c0cf5a5a95cd3e441a71083b1191d115e9a9ff008b93feeb5a86d012a3e0adb89de2d1e3225479022292f
-TAG: 3ced67f5e03bb476a738c1343926dc19
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0200000000000000
-AD: 01
-CT: 4dca2c16c3b0413c
-TAG: ac9b952c76a6f8b5df315f88126daa1c
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 020000000000000000000000
-AD: 01
-CT: ee0ca9068b5b85dfe115a660
-TAG: 756d6155927271077d790a05390ecb71
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000000000000000000000000000
-AD: 01
-CT: 590edb785c0cb89d19f031fa7e7d4f91
-TAG: ac2c8f711c86dbecc8c7b663c5fbc1ea
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0200000000000000000000000000000003000000000000000000000000000000
-AD: 01
-CT: dcf2024f5f98d463b82a8673c47dd82159748cac8bcc7c76b8cfa26029cb333c
-TAG: a9b406643e190e602fb104fbb842a1ac
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 020000000000000000000000000000000300000000000000000000000000000004000000000000000000000000000000
-AD: 01
-CT: 79216506b1ddadfe16366e4ec886d10dc9400b995259f74c0091f9b5a6add5680a612130f6c31ab833aa76d9b2be86de
-TAG: 3ddfe9ad2c350980942638d3f954ac6d
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000000000000000000000000000030000000000000000000000000000000400000000000000000000000000000005000000000000000000000000000000
-AD: 01
-CT: 9535eb67240c49f30a0de5a90670813fa615e71fcb4c522ca79d9a33459a22f8c6a56d650bf0b15eecdd706e7689cf6510a281724613fea76b5366b40574b1b9
-TAG: abcb59ee31d25ee8889b70d7c36f9a41
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 02000000
-AD: 010000000000000000000000
-CT: 9611baa0
-TAG: 53daf2bc5916f7a6750f2432068dabee
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 0300000000000000000000000000000004000000
-AD: 010000000000000000000000000000000200
-CT: 78e3a1b54daa6547f775f30c38a45e887aea5c87
-TAG: f65187d8c28adba364d659b627b16431
-
-KEY: 0100000000000000000000000000000000000000000000000000000000000000
-NONCE: 03000000000000000000000000000000
-IN: 030000000000000000000000000000000400
-AD: 0100000000000000000000000000000002000000
-CT: c6d3d28704bf20067d62e1a3872d40dda44b
-TAG: 6ac0135a4379dbc67967ff55fd4d1f2f
+CT: 462401724b5ce6588d5a54aae5375513a075
+TAG: cfcdf5042112aa29685c912fc2056543
# Sample large random test vector.
-KEY: 83475d5042f8baedf4ca779088abfab17d35416a767d8c42c2a650cc597e5004
-NONCE: 7df5a22c91e6b6f37594dfef54847bd9
-IN: 5d90037e677666fbc0215305096301d852609e1380992d8c2e3594344a7f9a0521fdeda53de07d3184d590667fc7151a93ba097f20c67da0b1da8c23bd05887a4b66ab50333874819035eafd775fcfa86b380968f15d8cd46483d418b2c074f0dc18407108f63abe89c5448e83d064b6544a275dd75a21dd0241dafa086beb8446f398f6c1b2b117ad6f2cdb04031640852b5e15560d39b8d9088824f728ae66b2214e4cd70f60174313a5f0286741caeb4b66d0513b63c4a1325306f79f1f79bb28ccf6448fa3160876eefd85ca03c196a3e5568b0f3c818e7cf9d661423ed6a50a6911d52217a1b81e94ba040f336e74ac71b33964c3a7d960a32c255e22fcb7dcc41b9b136815b784ce4015b61b55e305e2ab1f96d17b561eb0281476cbaec54e942a186fbf3df92358960182c3c034066364e80fa492b36d36ee68f2738220f249a69f24405fe9995dab0b0b338ee68d85f0e59870903ca9d02f32ee6a24efc85434610586470b938daa9d14206c360339f7ec50857f4e5075a29bb51720d9a6f399f7b8bd45b402b0eed8f6e427d5dd358a0c3f10a58582be8934ebd7903497cc6622a977d6045f97a58f5ed7a3470583ebf88f71150499047e4b624f8018cffaca0d5a9db7f73da2db6770c98cd628d2d6682a4c41d584f37ea0ff7e8763616a548027e29cb3ec3e02a82eab205f7af46b6c9b02a15de54fc301a9845d50396cf3826b23296c360fafbaf65e5f48c4998085d7dac07736b106a8bb1e8e69dca15464d1bf156a5f84b62170f680826dcca7bf1c126cdb70dc872a005806d423cee46ab0d84d2d8d490c8eaec8b17b12913d4856c59f5348c6956c96a32595eef8c89ee5ae99706c92e748714dae4ae45685710261cd66d3ef93ed01bb862bfeb3b4fb5074ffec5517c8845173fde2774cd3b5a25cc1dc11d833c29614b7272bf213aeb19f83603aee97a9bc43e8b88c8789c520f634028cce2b0be343e74c8c341a153a36f797f38a4ebb53589e45f1e64299fedd2e9bbdeb9ad9ab4e2eccb4bd2b57000a5d7b064e6b6fb5cb9c743d6afe697bac549ade238c7a3a094e799e9c7e6cef6e6d4b8c8f1d862bc8ab9b96238c7d5393b2f684c5b4826df6c5f48cadb43fd6d6cb189ca56125bfee9dd44d22a2e28d7a9e63565321c9ecad96b3ae7376c984c44cab978002ff78d947230fe15918b3a73232ff5c05586c4b0e2e0d737be6abef80414b008ad2deea1944a4248f02063500a9276217ceabeca39ec4d6af647395a9c91401dcbe8f9645ef97eca5624029f942cc9979fd31636d65ed181a65763c5c16e65f8673a3cc6143ede8144d894559dedfac3000e8d86590b0ced25dd8666d71f237fd3511d7f8a20dbb4e95e3aca9807a2351bf705a7eec5a80f2b390ef9df496c5cd7ca9f5d8846df291025beb9781c793613efe7798
-AD: 4b7531e0a946b20c80f70dea4d437833f3dd26ae6f6dc37b7b99e82122acf2b7975f6d8efcb7ec4c6ff3c0ce4a5864adba0e658aeb8d9b839f3509f033827bc69a1ab080a0a1cc63559b00a3a259c53c145b0282f5e56930fc35b11c83b6564f2e80f186c2ef2e8886641fe6c4966dc9f86c567e73902d1a8fc33be1551e8359aa585bd2b8da83c0cd78a086cdebf8904d1b66a2fee176fa19714f062b752653d75a0e441ff7fba0c5a0cb6ded48f68b38af82faa985f9d97ba3c0978e1d23d8eb8899072fbec9379ca5f2b91293cb57eac81a6d711f9cccb36ff16b0de86d27d62e136ddbc1a2be38d5a1284e4620f4f9ab1f16729630e16dd2901f24f5ad6e
-CT: 30b73374cc093ffaad4be2088142b08ed1b0d2914f96d90e0279aeb3a6547807b9b3bbfe2cd880e8f3a9f3b6e42da1ef53d78a6c63da686498b61523ac4c82caa01d31afe1ec00e80349df969684b060299aa86e4b7a38c643987889eab5a0a0996d18b2350439c7162d566dbb0d55f0f50a81d982df5e2047a23800a418b5adf42d8ff26cfd961527347439e76fbb2c2da08c1dd1a5fddf149d47eaf571498e23c3104c6b2dffb8e5d5e5f90e50eae9146f48b19a6e2d49cd170654a0041096f4f57aff5054dbf784e7748b3ddfdb9c447ed86681bcfb8055407fcec320990609089c3b51845f8e9bcb21382421a2f8634e1ad8739795202ade68aa47ab10026031cb3bfd94adc70702c31760753af4a2bb852581519e91cce5b1e0e49d028a1a03b915917d1011a4a7c04b46e1d8434663aa9473d1ad135966ab18145caf825f4a04d47b953989e188d21ec9f3858623fe16c413d2caa73761ec9dab8bf4e6dcdb997a503168487b67d1b3a9768a1887c292b9f39d40a404b8ffd011150490ed2e751ccbe4f7661785d8c5b778a21aa7e6efc132afe81765cc4ef32b5959e19ca97a4c37601257b8484fab234760242db6fd140ed1cfaff1d11cfad836171b42a164671c178164bbdb14815376f4eed1fbbb95f8e4614ff23de5cc9a0642a228d6bce19fbeea0e661b14696c6eb4aca97ac2cbe838578e7033703e2b551f7ef5dae4a68cdc58daac41eddc07b38ea7c4de1262ce04fb16f75870bbf41c95acbce6eb86dc3452a0d177aef3bc1e39878788d4a2680feb5d888debe62ec64fd72290c0cf8b9105c365c7305d994b28a2b32b88fdd11c3879dc1e005d6a2aa99daa926b18338f0980cdf0d8275e190bb9b8da9a63ff332bb5f5b654414a110b9d6128d0984d015c2a0a100985733fd400be0829f57e72655bfcd10c20341cd24cad0705647363ec0a3d678f30f7a1e85bc1a2dd133fcef5f25852eb6d81d7b4b531aff4e655285375f1b1ceee0d58a63f85f21f6525e3ad43f76a8fef16c785047778e1eccfe8e3c7cb34f2e037a61e3f01af88874b30911df60664e5ca65d6836166ff796e6b710af474add57957c2139b24257bcee287090f1ca1f91c95cc2c9348689aa7b95dfcedb02e68e38c1cd75ef966f0d33c4e09c40e2e58d30f6d0771d11debf01e57f342f3fffa34a1ed2bf10035c1607f3fd79423c0164dd6c171d8046edaed9b7b2a75bc11e1e8417c4550795aab6f106a95b5dda022e512269e8b2937b1d5601cfec1dba8b763707b97bc786ac94e38cd368cadeb1b48a3e068b614fc7b06430db80d46889027ca3d228d87c6eb00531e8d913734e3af987b104d052bbd63564184cd9dc803e6948d70575c9606a704245ef6136f707ddba8a00f288199867774c6e7487311c29aada3f607fc904f88be90cae49789a5163a4c
-TAG: 37db916a9c13afd36e39ce5d01665067
+KEY: 9f646d6337565c689c9ec7627ad95c26a2df7d3a36fba9f1265c607458bbb1b6
+NONCE: 336bb4bb0c03e8c87efe3b5b
+IN: ec257ff779f7cb246a38462562e508b14adbd3ff33041b94aab6f10a3e8b7fe16738f12afa470c9100924b211a728f90ba6d2260b4d451d3f4701d72b8a8cd53921f65e8aa7b6bd3995fef3cf6db60d1e2927c9012ea2a62af3a50fdada2262f8f02d9651d542e3856210af36def3c6d1b712de4dd34c63a09a6d2928019c62a7253cb47a9ed056d7435d723809768192c7df2768aa4b9ab247e1a522fa58532c7d785d2236f92fc1f4ab621023f5e5af084fe41584d136cec5ce33472f85c4dc045e70bbd5b6781c394b4b2872b3734879de37454a5351d272a84301ef5df121c0ac70de6f375b7bb185730baaa7f9b4ab093d66e34e799e3abd94d03b6c344a82968a07ed8b6fea37e5c2275b8ad40faa040558ea8636af91f42be30af2c61c34c50459e04ed93998da10c2d7cb75f4b18fa027fbd7d5f0e0b830784fc530b0df84b253690649dba92671373e43773a324b81624298a5006c9083adf09ff35ab7b098b67e40c65888f6027eb741637afc646b6769c70b594c771fb94049d4f4e74e0c9967689716d8d37405687a7dea0527500df90dee256e496f251892023dc729d42cbfb4f2514cdc177cb427d6d46493770f91744b9c173ddae6b6baf7e2e95dc6dd268e2b89510deeb2fa5aaa108cf4b7da8a2af7a6cb18c32ceec6be8d2ec734bfeffe25464aa0cbcaaea9508c92ffbb1973d7cdc6118845df7d9386da2fac4e36bddb37d01bbd47d0bcb793850865a4ee08836a72281ff1bda146017145962bbbdd486e6e3a457d3f3c0e05a7cd3514e4aaec85730a39fc8ffe8904e1009d565d919b64e388988db05f90599649699a33f7620df75be25c0c45e1f3829ca38df1343f93dd1fe5b8f05584828f9bcc61c474737ddef2ad0b0436cf303ad2f404785a6db7314e9af2e0eaa68fffcd9dac3a905709d31a259c1e5b808c2fe036ffacb4ce0ca072835815e9f232e29c193e8519d0cb4cf4e8b1f9145c13211232d082229bd80efadd0e215e30873233f60a45441295396c03916d2c44cdc30e8c3650b4045b656d530372414723d1739fe353f4124b80d78d0a170925044b225139e75b4a774262656c72ad4cce99725d505871e3c7e01fb45e5f9f36b68f6ed7974f698967fbabe57b3143ed43d7e6c9cf253b16e8758267598f687e69c217194c5ea1bbbae73757d28d109582129dfc4777a27fafb3a8c3f64c5db209e4ce06099dd0ef3ab5c123a6435d2b0603b102e9b88398413373c53d2252620b8bd7293abe35e46be0b2f828ecfe573312dd85444d32fd5d18a39295865d367aec0d51193cfe8284670f3f1febdf64e34bb6f3ecb2efd0c43f66234ff01dee3465d2fb1d9ce87f3ef7f8f57674fb269bbe8f3e2001ef6b610eed4a2d0d2e2c1b696e4e32084fe4c340612aa13636e223dd758cd765e7864b96ba787d16432bd3c
+AD: 3d186bc3d38b19b41e8c039f5417be09358ad8743cb26b6fefe19a9752901a9bc18a6ed325ec307861bd0fa333a9b0d156dbf30a84f11b72d9b74000d1690f317c04598b1930ef6df873fd9c098abdb7e92eb82d9e5675518365af68a990477f2b70fa5514ec5f5010b5ac0d00fa6d848c40c49aed54b526cd8586bb783bcac299b8c0e96853c242d7c34479bca18aff6d55fbef52c735c41a363d68452304125bea529d235e09cc861198bd292ee63ea1387f859eda363f664c3952aa4fae135cbc0d37ae89f2f34cf1a5b6a685ebbfbac18209e0ea38aadd71a6c16163b5676e84b4bc539c4b1079553a6765726cc8064489c8cbfd3c0999021d70b4c0aea0
+CT: 17bb864ba0458a63fa51ec47259f0e22a9aa387bff7774f3badc55e13748c96f4d0463d73a29d70140f384aba50f9efcd5d0fcbfd1b0b4b16226993aa00260fc1f0a0a28b4a9a19acd9d966920a56a95cacee547a0b3b1d6a752e575a10101d3ba91d59a10ac9eac7367caa1e3a5ad7173d149bd69f97ee1e6782e05f14d9434716bd103ca2e48337bb1cc68d54f31d75244a53cf1d2e47f55da7fc2b80b8eea4110c1887b157530cafa2519bef54f7f4641a8bb5bf2a7f3ea50be71aa8def7d6244c49d2d11de0e08058d08e8619aa3cedcfed1850651585e38489b9b1c7a8aad5ccb3fd380ca2745c5b8b530e6c6ce4fdb7acc8de1543d0364a96d6dac08ffe4474a4f34a96a47c4a7d5db27997963546350e28150e34f81dc6d1d354e867d5e3850f285da5890906f76471f8133da4899ee9b6774da38860e7d8de09edb782eefbbcbebfc2b61aaaae92e0f576a789b8ae4c40359e2dc69e352dc1631a7b791b41788b13b228585301e035c134f3e3a51a7622aead20191445437a9283cd03c6fd9cf128006f96eaaebfa4d71476efafef719189aefdee20d14fb5fb2d0a783ec9894edf3e937b405b7eec3c51649bba3c73a2d94e1b3cb059b6d587d9ee2714c813345f5b29852bec2422490edaf8a7423f2481c8c65497db9711143cff07c0a9889b786ac3e4def8065c8417fd56a91b20a27fb6e5bf8a188039fd51ccfb8be365b1a9f4abbf05135c66928a449aeb6110a70894edbe7e00c2111ff7bf718781965f6e49b758397036b9df6ef77f5aa005d98ff9d61612dc70fe0794e6aa9d3e78a86a3d42f5048a0f6ece5d1264eeb88c94ae529c53933b977dceb41da1b0299fd89ef4b94f66cafb67d0165a9e4210b6958f1ee66d30f7be6643970ccd9df3b11ed29580c5352cbfa3bc8cdd11454282de0b43ad748366948871d4862167fa42d6ed8de023009c9944149227f88e135c53bd50f6ea0727e7cf30ec5bf68ec951d5713fa79175e6aa5ccfe634594497e82b57f7efac8e7293d40ca2af0b63be2aa09d8b97edb7002152220ff96c620f2ab9463f1a1f0517a5df03a47842480f06835377506dd50595946a1bbccb0ef299335fe8b442aca0f900f7068d3f4c06b1c7da8c59c22ab6d1489b474c3e346f67d4a4f0b895b6c45a432bca80f95d34fb2c12dd60c4fe0cc1ac1f4e826f353ddc1ec9072554ac2259c572072d309135d3fbf879288c4cebe756663ebab72fe2078c661f3feb5ed7ef398c2f9d69dd289a835e5251d916e733b3f981714dc3e28ef8fc17b230f7aaa8ed11a99d81a7238f9041704c66b1ae02ef7d4a14bf94b5713e6a5f16718e2b2152e4e8a5f9d673dbfb14ce0b032aa7fc9e264f9002a7f955f7644cf16deede930ec209171472f2cdbabc65632220928a64eb29bfaf411b63b58a30a98b1a47a54c007bbd6
+TAG: f2d188b9ec069b81793a841cfdcd1f88