Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ran reformat #426

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 26 additions & 12 deletions tests/unit/t_header.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,26 @@ void set_aad_tbl(struct aws_cryptosdk_hdr *hdr, struct aws_cryptosdk_hdr_aad *aa

static struct aws_cryptosdk_hdr test_header_1_hdr() {
struct aws_cryptosdk_hdr test_header_1_hdr = {
.alg_id = ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256_ECDSA_P256,
.frame_len = 0x1000,
.iv = { .buffer = test_header_1_iv_arr, .len = sizeof(test_header_1_iv_arr) },
.auth_tag = { .buffer = test_header_1_auth_tag_arr, .len = sizeof(test_header_1_auth_tag_arr) },
.message_id =
{ 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 },
.alg_id = ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256_ECDSA_P256,
.frame_len = 0x1000,
.iv = { .buffer = test_header_1_iv_arr, .len = sizeof(test_header_1_iv_arr) },
.auth_tag = { .buffer = test_header_1_auth_tag_arr, .len = sizeof(test_header_1_auth_tag_arr) },
.message_id = { 0x11,
0x22,
0x33,
0x44,
0x55,
0x66,
0x77,
0x88,
0x11,
0x22,
0x33,
0x44,
0x55,
0x66,
0x77,
0x88 },
// .aad_tbl = test_header_1_aad_tbl,
// .edk_tbl = test_header_1_edk_tbl,
.auth_len = sizeof(test_header_1) - 29 // not used by aws_cryptosdk_hdr_size/write
Expand Down Expand Up @@ -287,12 +301,12 @@ static const uint8_t hdr_with_zero_edk_count[] = {
};
// clang-format on

static const uint8_t *bad_headers[] = {
hdr_with_nonzero_reserve_bytes, hdr_with_zero_aad_count, hdr_with_zero_edk_count
};
static const size_t bad_headers_sz[] = {
sizeof(hdr_with_nonzero_reserve_bytes), sizeof(hdr_with_zero_aad_count), sizeof(hdr_with_zero_edk_count)
};
static const uint8_t *bad_headers[] = { hdr_with_nonzero_reserve_bytes,
hdr_with_zero_aad_count,
hdr_with_zero_edk_count };
static const size_t bad_headers_sz[] = { sizeof(hdr_with_nonzero_reserve_bytes),
sizeof(hdr_with_zero_aad_count),
sizeof(hdr_with_zero_edk_count) };

struct aws_cryptosdk_hdr test_header_2_hdr() {
// clang-format off
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/t_materials.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ static void track_destroy_keyring(struct aws_cryptosdk_keyring *keyring) {
destroy_called = true;
}

static const struct aws_cryptosdk_cmm_vt track_destroy_cmm_vt = {
.vt_size = sizeof(track_destroy_cmm_vt), .name = "track_destroy_cmm_vt", .destroy = track_destroy_cmm
};
static const struct aws_cryptosdk_cmm_vt track_destroy_cmm_vt = { .vt_size = sizeof(track_destroy_cmm_vt),
.name = "track_destroy_cmm_vt",
.destroy = track_destroy_cmm };

static const struct aws_cryptosdk_keyring_vt track_destroy_keyring_vt = {
.vt_size = sizeof(track_destroy_keyring_vt), .name = "track_destroy_keyring_vt", .destroy = track_destroy_keyring
};
static const struct aws_cryptosdk_keyring_vt track_destroy_keyring_vt = { .vt_size = sizeof(track_destroy_keyring_vt),
.name = "track_destroy_keyring_vt",
.destroy = track_destroy_keyring };

static int refcount_keyring() {
struct aws_cryptosdk_keyring keyring;
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/t_raw_aes_keyring_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ static void tear_down_all_the_things() {
aws_byte_buf_clean_up(&decrypted_data_key);
}

static enum aws_cryptosdk_aes_key_len raw_key_lens[] = {
AWS_CRYPTOSDK_AES128, AWS_CRYPTOSDK_AES192, AWS_CRYPTOSDK_AES256
};
static enum aws_cryptosdk_alg_id algs[] = {
ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256, ALG_AES192_GCM_IV12_TAG16_HKDF_SHA256, ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256
};
static enum aws_cryptosdk_aes_key_len raw_key_lens[] = { AWS_CRYPTOSDK_AES128,
AWS_CRYPTOSDK_AES192,
AWS_CRYPTOSDK_AES256 };
static enum aws_cryptosdk_alg_id algs[] = { ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256,
ALG_AES192_GCM_IV12_TAG16_HKDF_SHA256,
ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256 };

static int encrypt_decrypt_data_key() {
for (int fill_enc_ctx = 0; fill_enc_ctx < 2; ++fill_enc_ctx) {
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/t_raw_rsa_keyring_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ static struct aws_byte_buf unencrypted_data_key = { 0 };
// same key, after it has been encrypted and then decrypted
static struct aws_byte_buf decrypted_data_key = { 0 };

static enum aws_cryptosdk_alg_id alg_ids[] = {
ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256, ALG_AES192_GCM_IV12_TAG16_HKDF_SHA256, ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256
};
static enum aws_cryptosdk_alg_id alg_ids[] = { ALG_AES128_GCM_IV12_TAG16_HKDF_SHA256,
ALG_AES192_GCM_IV12_TAG16_HKDF_SHA256,
ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256 };

static enum aws_cryptosdk_rsa_padding_mode rsa_padding_mode[] = {
AWS_CRYPTOSDK_RSA_PKCS1, AWS_CRYPTOSDK_RSA_OAEP_SHA1_MGF1, AWS_CRYPTOSDK_RSA_OAEP_SHA256_MGF1
};
static enum aws_cryptosdk_rsa_padding_mode rsa_padding_mode[] = { AWS_CRYPTOSDK_RSA_PKCS1,
AWS_CRYPTOSDK_RSA_OAEP_SHA1_MGF1,
AWS_CRYPTOSDK_RSA_OAEP_SHA256_MGF1 };

static int set_up_encrypt_with_wrong_key(enum aws_cryptosdk_rsa_padding_mode rsa_padding_mode) {
alloc = aws_default_allocator();
Expand Down