Skip to content

Commit

Permalink
Fix 3 tests on OpenSSL 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
WillChilds-Klein committed Oct 2, 2023
1 parent 88bc602 commit c548a0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 5 additions & 5 deletions tests/unit/s2n_security_policies_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char **argv)
break;
}
}
if (s2n_pq_is_enabled()) {
if (s2n_pq_is_enabled() && kem_group->available) {
EXPECT_TRUE(kem_group_is_supported);
} else {
EXPECT_FALSE(kem_group_is_supported);
Expand Down Expand Up @@ -353,9 +353,9 @@ int main(int argc, char **argv)
EXPECT_NOT_NULL(security_policy->kem_preferences->tls13_kem_groups);
EXPECT_EQUAL(security_policy->kem_preferences->tls13_kem_groups, pq_kem_groups_r3_2021_05);
if (s2n_is_evp_apis_supported()) {
EXPECT_EQUAL(2, security_policy->kem_preferences->tls13_kem_group_count);
EXPECT_EQUAL(2, s2n_kem_groups_available_count(security_policy->kem_preferences));
} else {
EXPECT_EQUAL(1, security_policy->kem_preferences->tls13_kem_group_count);
EXPECT_EQUAL(1, s2n_kem_groups_available_count(security_policy->kem_preferences));
}

security_policy = NULL;
Expand All @@ -368,9 +368,9 @@ int main(int argc, char **argv)
EXPECT_NOT_NULL(security_policy->kem_preferences->tls13_kem_groups);
EXPECT_EQUAL(security_policy->kem_preferences->tls13_kem_groups, pq_kem_groups_r3_2021_05);
if (s2n_is_evp_apis_supported()) {
EXPECT_EQUAL(2, security_policy->kem_preferences->tls13_kem_group_count);
EXPECT_EQUAL(2, s2n_kem_groups_available_count(security_policy->kem_preferences));
} else {
EXPECT_EQUAL(1, security_policy->kem_preferences->tls13_kem_group_count);
EXPECT_EQUAL(1, s2n_kem_groups_available_count(security_policy->kem_preferences));
}

security_policy = NULL;
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/s2n_tls13_hybrid_shared_secret_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ int main(int argc, char **argv)
for (int i = 0; i < s2n_array_len(all_test_vectors); i++) {
const struct hybrid_test_vector *test_vector = all_test_vectors[i];
const struct s2n_kem_group *kem_group = test_vector->kem_group;
if (!kem_group->available) {
continue;
}

/* Set up connections */
struct s2n_connection *client_conn = NULL;
Expand Down
3 changes: 2 additions & 1 deletion tls/extensions/s2n_server_key_share.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ static int s2n_server_key_share_recv_pq_hybrid(struct s2n_connection *conn, uint

size_t kem_group_index = 0;
for (size_t i = 0; i < kem_pref->tls13_kem_group_count; i++) {
if (named_group_iana == kem_pref->tls13_kem_groups[i]->iana_id) {
if (named_group_iana == kem_pref->tls13_kem_groups[i]->iana_id
&& kem_pref->tls13_kem_groups[i]->available) {
kem_group_index = i;
break;
}
Expand Down

0 comments on commit c548a0d

Please sign in to comment.