Skip to content
Draft

Test #2753

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f5b1d82
xaes-256-gcm with evp_cipher
ttungle96 Oct 14, 2025
3b7d63a
xaes-256-gcm with evp_cipher
ttungle96 Oct 15, 2025
7b2af15
xaes-256-gcm with evp_cipher
ttungle96 Oct 15, 2025
debc4f8
xaes-256-gcm with evp_cipher
ttungle96 Oct 15, 2025
3d22930
xaes-256-gcm with evp_cipher
ttungle96 Oct 15, 2025
f5e7eae
full test coverage
ttungle96 Oct 15, 2025
66a9190
full test coverage
ttungle96 Oct 15, 2025
aa801fe
increase test coverage
ttungle96 Oct 15, 2025
7c58649
Merge branch 'xaes-256-gcm' into xaes-256-gcm
ttungle96 Oct 15, 2025
c33f280
improve test coverage
ttungle96 Oct 15, 2025
4610415
Merge branch 'xaes-256-gcm' of https://github.com/ttungle96/aws-lc in…
ttungle96 Oct 15, 2025
f0c9e37
increase test coverage
ttungle96 Oct 15, 2025
39e6b19
improve test coverage
ttungle96 Oct 15, 2025
20feacc
Final
ttungle96 Oct 15, 2025
88051b8
Final
ttungle96 Oct 15, 2025
fc0ac84
Final
ttungle96 Oct 15, 2025
98e525b
Final
ttungle96 Oct 16, 2025
1d4b4da
Final
ttungle96 Oct 16, 2025
feac2d1
Check test coveraga
ttungle96 Oct 16, 2025
2b909d6
Check test coverage
ttungle96 Oct 16, 2025
171cbc4
Check test coverage
ttungle96 Oct 16, 2025
0e1d143
test
ttungle96 Oct 16, 2025
74e4871
test
ttungle96 Oct 16, 2025
7b2c444
test
ttungle96 Oct 16, 2025
d0a323a
test
ttungle96 Oct 16, 2025
f101ae0
test
ttungle96 Oct 17, 2025
ff4a4c9
test
ttungle96 Oct 17, 2025
62f17a3
test
ttungle96 Oct 17, 2025
e1a4e08
test
ttungle96 Oct 17, 2025
96b5a7f
test
ttungle96 Oct 17, 2025
706b78d
test
ttungle96 Oct 17, 2025
9af4212
test
ttungle96 Oct 17, 2025
40f57e0
test
ttungle96 Oct 17, 2025
bf1c841
test
ttungle96 Oct 17, 2025
e0144fb
test
ttungle96 Oct 17, 2025
16b73fd
test
ttungle96 Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
298 changes: 298 additions & 0 deletions crypto/cipher_extra/aead_test.cc

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions crypto/cipher_extra/cipher_test.cc

Large diffs are not rendered by default.

484 changes: 484 additions & 0 deletions crypto/fipsmodule/cipher/e_aes.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions crypto/fipsmodule/cipher/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ extern "C" {
#define AEAD_AES_128_CCM_MATTER_ID 27
#define AEAD_AES_256_CBC_SHA384_TLS_ID 28
#define AEAD_MAX_ID 28
#define AEAD_XAES_256_GCM_ID 29
#define AEAD_XAES_256_GCM_KEY_COMMIT_ID 30

// EVP_AEAD represents a specific AEAD algorithm.
struct evp_aead_st {
Expand Down
34 changes: 32 additions & 2 deletions crypto/obj/obj_dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

/* This file is generated by crypto/obj/objects.go. */

#define NUM_NID 999
#define NUM_NID 1001

static const uint8_t kObjectData[] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unknown type name 'uint8_t' [clang-diagnostic-error]

static const uint8_t kObjectData[] = {
             ^

/* NID_rsadsi */
Expand Down Expand Up @@ -7330,6 +7330,26 @@ static const uint8_t kObjectData[] = {
0xc9,
0x7b,
0x06,
/* NID_xaes_256_gcm */
0x60,
0x86,
0x48,
0x01,
0x65,
0x03,
0x04,
0x01,
0x31,
/* NID_xaes_256_gcm_kc */
0x60,
0x86,
0x48,
0x01,
0x65,
0x03,
0x04,
0x01,
0x32,
};

static const ASN1_OBJECT kObjects[NUM_NID] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: unknown type name 'ASN1_OBJECT' [clang-diagnostic-error]

static const ASN1_OBJECT kObjects[NUM_NID] = {
             ^

Expand Down Expand Up @@ -9017,6 +9037,10 @@ static const ASN1_OBJECT kObjects[NUM_NID] = {
{"ED25519ph", "ED25519ph", NID_ED25519ph, 0, NULL, 0},
{"SecP384r1MLKEM1024", "SecP384r1MLKEM1024", NID_SecP384r1MLKEM1024, 9,
&kObjectData[6360], 0},
{"id-xaes256-GCM", "xaes-256-gcm", NID_xaes_256_gcm, 9, &kObjectData[6369],
0},
{"id-xaes256-GCM-KC", "xaes-256-gcm-kc", NID_xaes_256_gcm_kc, 9,
&kObjectData[6378], 0},
};

static const uint16_t kNIDsInShortNameOrder[] = {
Expand Down Expand Up @@ -9657,6 +9681,8 @@ static const uint16_t kNIDsInShortNameOrder[] = {
194 /* id-smime-spq */,
250 /* id-smime-spq-ets-sqt-unotice */,
249 /* id-smime-spq-ets-sqt-uri */,
999 /* id-xaes256-GCM */,
1000 /* id-xaes256-GCM-KC */,
676 /* identified-organization */,
461 /* info */,
748 /* inhibitAnyPolicy */,
Expand Down Expand Up @@ -10996,14 +11022,16 @@ static const uint16_t kNIDsInLongNameOrder[] = {
503 /* x500UniqueIdentifier */,
158 /* x509Certificate */,
160 /* x509Crl */,
999 /* xaes-256-gcm */,
1000 /* xaes-256-gcm-kc */,
125 /* zlib compression */,
};

static const uint16_t kNIDsInOIDOrder[] = {
434 /* 0.9 (OBJ_data) */,
182 /* 1.2 (OBJ_member_body) */,
379 /* 1.3 (OBJ_org) */,
676 /* 1.3 (OBJ_identified_organization) */,
379 /* 1.3 (OBJ_org) */,
11 /* 2.5 (OBJ_X500) */,
647 /* 2.23 (OBJ_international_organizations) */,
380 /* 1.3.6 (OBJ_dod) */,
Expand Down Expand Up @@ -11711,6 +11739,8 @@ static const uint16_t kNIDsInOIDOrder[] = {
901 /* 2.16.840.1.101.3.4.1.46 (OBJ_aes_256_gcm) */,
902 /* 2.16.840.1.101.3.4.1.47 (OBJ_aes_256_ccm) */,
903 /* 2.16.840.1.101.3.4.1.48 (OBJ_id_aes256_wrap_pad) */,
999 /* 2.16.840.1.101.3.4.1.49 (OBJ_xaes_256_gcm) */,
1000 /* 2.16.840.1.101.3.4.1.50 (OBJ_xaes_256_gcm_kc) */,
672 /* 2.16.840.1.101.3.4.2.1 (OBJ_sha256) */,
673 /* 2.16.840.1.101.3.4.2.2 (OBJ_sha384) */,
674 /* 2.16.840.1.101.3.4.2.3 (OBJ_sha512) */,
Expand Down
2 changes: 2 additions & 0 deletions crypto/obj/obj_mac.num
Original file line number Diff line number Diff line change
Expand Up @@ -986,3 +986,5 @@ MLDSA65 995
MLDSA87 996
ED25519ph 997
SecP384r1MLKEM1024 998
xaes_256_gcm 999
xaes_256_gcm_kc 1000
4 changes: 3 additions & 1 deletion crypto/obj/objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,9 @@ aes 44 : AES-256-CFB : aes-256-cfb
aes 45 : id-aes256-wrap
aes 46 : id-aes256-GCM : aes-256-gcm
aes 47 : id-aes256-CCM : aes-256-ccm
aes 48 : id-aes256-wrap-pad
aes 48 : id-aes256-wrap-pad
aes 49 : id-xaes256-GCM : xaes-256-gcm
aes 50 : id-xaes256-GCM-KC : xaes-256-gcm-kc

# There are no OIDs for these modes...

Expand Down
11 changes: 11 additions & 0 deletions crypto/test/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@
#include "openssl/pem.h"
#include "openssl/rand.h"

bool ConvertToBytes(std::vector<uint8_t> *out, const std::string &value) {
if (value.size() >= 2 && value[0] == '"' && value[value.size() - 1] == '"') {
out->assign(value.begin() + 1, value.end() - 1);
return true;
}

if (!DecodeHex(out, value)) {
return false;
}
return true;
}

void hexdump(FILE *fp, const char *msg, const void *in, size_t len) {
const uint8_t *data = reinterpret_cast<const uint8_t *>(in);
Expand Down
1 change: 1 addition & 0 deletions crypto/test/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
// hexdump writes |msg| to |fp| followed by the hex encoding of |len| bytes
// from |in|.
void hexdump(FILE *fp, const char *msg, const void *in, size_t len);
bool ConvertToBytes(std::vector<uint8_t> *out, const std::string &value);

// Bytes is a wrapper over a byte slice which may be compared for equality. This
// allows it to be used in EXPECT_EQ macros.
Expand Down
3 changes: 3 additions & 0 deletions include/openssl/aead.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_128_gcm_tls13(void);
// 1.3 nonce construction.
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_aes_256_gcm_tls13(void);

// EVP_aead_xaes_256_gcm is AES-256 in Galois Counter Mode with CMAC-based KDF
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_xaes_256_gcm(void);
OPENSSL_EXPORT const EVP_AEAD *EVP_aead_xaes_256_gcm_key_commit(void);

// Obscure functions.

Expand Down
6 changes: 6 additions & 0 deletions include/openssl/cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
// not act on it until the entire operation is complete.
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_gcm(void);
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_gcm(void);
OPENSSL_EXPORT const EVP_CIPHER *EVP_xaes_256_gcm(void);
OPENSSL_EXPORT const EVP_CIPHER *EVP_xaes_256_gcm_key_commit(void);

OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_ccm(void);
OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_192_ccm(void);
Expand Down Expand Up @@ -601,6 +603,9 @@ OPENSSL_EXPORT OPENSSL_DEPRECATED int EVP_add_cipher_alias(const char *a,
// EVP_CTRL_GCM_SET_IV_INV sets the GCM invocation field, decrypt only
#define EVP_CTRL_GCM_SET_IV_INV 0x18
#define EVP_CTRL_GET_IVLEN 0x19
// The following are for getting/verifying key commitment
#define EVP_CTRL_AEAD_GET_KEY_COMMITMENT 0x20
#define EVP_CTRL_AEAD_VERIFY_KEY_COMMITMENT 0x21

// The following constants are unused.
#define EVP_GCM_TLS_FIXED_IV_LEN 4
Expand Down Expand Up @@ -735,5 +740,6 @@ BSSL_NAMESPACE_END
#define CIPHER_R_ALIGNMENT_CHANGED 142
#define CIPHER_R_SERIALIZATION_INVALID_SERDE_VERSION 143
#define CIPHER_R_SERIALIZATION_INVALID_CIPHER_ID 144
#define CIPHER_R_KEY_COMMITMENT_INVALID 145

#endif // OPENSSL_HEADER_CIPHER_H
10 changes: 10 additions & 0 deletions include/openssl/nid.h
Original file line number Diff line number Diff line change
Expand Up @@ -4386,6 +4386,16 @@ extern "C" {
#define NID_SecP384r1MLKEM1024 998
#define OBJ_SecP384r1MLKEM1024 1L, 3L, 6L, 1L, 4L, 1L, 42235L, 6L

#define SN_xaes_256_gcm "id-xaes256-GCM"
#define LN_xaes_256_gcm "xaes-256-gcm"
#define NID_xaes_256_gcm 999
#define OBJ_xaes_256_gcm 2L, 16L, 840L, 1L, 101L, 3L, 4L, 1L, 49L

#define SN_xaes_256_gcm_kc "id-xaes256-GCM-KC"
#define LN_xaes_256_gcm_kc "xaes-256-gcm-kc"
#define NID_xaes_256_gcm_kc 1000
#define OBJ_xaes_256_gcm_kc 2L, 16L, 840L, 1L, 101L, 3L, 4L, 1L, 50L

#if defined(__cplusplus)
} /* extern C */
#endif
Expand Down
Loading