Skip to content

Commit

Permalink
actually just rip it out completely
Browse files Browse the repository at this point in the history
  • Loading branch information
lrstewart committed Feb 10, 2025
1 parent cd1bddb commit 1a2792a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 109 deletions.
22 changes: 0 additions & 22 deletions crypto/s2n_hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,6 @@ int s2n_hmac_digest_size(s2n_hmac_algorithm hmac_alg, uint8_t *out)
return S2N_SUCCESS;
}

/* Return 1 if hmac algorithm is available, 0 otherwise. */
bool s2n_hmac_is_available(s2n_hmac_algorithm hmac_alg)
{
switch(hmac_alg) {
case S2N_HMAC_MD5:
case S2N_HMAC_SSLv3_MD5:
case S2N_HMAC_SSLv3_SHA1:
case S2N_HMAC_NONE:
case S2N_HMAC_SHA1:
case S2N_HMAC_SHA224:
case S2N_HMAC_SHA256:
case S2N_HMAC_SHA384:
case S2N_HMAC_SHA512:
return true;
}
return false;
}

static int s2n_sslv3_mac_init(struct s2n_hmac_state *state, s2n_hmac_algorithm alg, const void *key, uint32_t klen)
{
for (int i = 0; i < state->xor_pad_size; i++) {
Expand Down Expand Up @@ -201,10 +183,6 @@ S2N_RESULT s2n_hmac_state_validate(struct s2n_hmac_state *state)
int s2n_hmac_init(struct s2n_hmac_state *state, s2n_hmac_algorithm alg, const void *key, uint32_t klen)
{
POSIX_ENSURE_REF(state);
if (!s2n_hmac_is_available(alg)) {
/* Prevent hmacs from being used if they are not available. */
POSIX_BAIL(S2N_ERR_HMAC_INVALID_ALGORITHM);
}

state->alg = alg;
POSIX_GUARD(s2n_hmac_hash_block_size(alg, &state->hash_block_size));
Expand Down
1 change: 0 additions & 1 deletion crypto/s2n_hmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ struct s2n_hmac_evp_backup {
};

int s2n_hmac_digest_size(s2n_hmac_algorithm alg, uint8_t *out);
bool s2n_hmac_is_available(s2n_hmac_algorithm alg);
int s2n_hmac_hash_alg(s2n_hmac_algorithm hmac_alg, s2n_hash_algorithm *out);
int s2n_hash_hmac_alg(s2n_hash_algorithm hash_alg, s2n_hmac_algorithm *out);

Expand Down
31 changes: 0 additions & 31 deletions tests/cbmc/proofs/s2n_hmac_is_available/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion tests/cbmc/proofs/s2n_hmac_is_available/cbmc-proof.txt

This file was deleted.

This file was deleted.

12 changes: 6 additions & 6 deletions tests/unit/s2n_hmac_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_hmac_new(&copy));
EXPECT_SUCCESS(s2n_hmac_new(&cmac));

if (s2n_hmac_is_available(S2N_HMAC_SSLv3_MD5)) {
/* Try SSLv3 MD5 */
/* Try SSLv3 MD5 */
{
uint8_t hmac_sslv3_md5_size = 0;
POSIX_GUARD(s2n_hmac_digest_size(S2N_HMAC_SSLv3_MD5, &hmac_sslv3_md5_size));
EXPECT_EQUAL(hmac_sslv3_md5_size, 16);
Expand Down Expand Up @@ -80,8 +80,8 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_hmac_reset(&hmac));
}

if (s2n_hmac_is_available(S2N_HMAC_SSLv3_SHA1)) {
/* Try SSLv3 SHA1 */
/* Try SSLv3 SHA1 */
{
uint8_t hmac_sslv3_sha1_size = 0;
POSIX_GUARD(s2n_hmac_digest_size(S2N_HMAC_SSLv3_SHA1, &hmac_sslv3_sha1_size));
EXPECT_EQUAL(hmac_sslv3_sha1_size, 20);
Expand Down Expand Up @@ -113,8 +113,8 @@ int main(int argc, char **argv)
EXPECT_SUCCESS(s2n_hmac_reset(&hmac));
}

if (s2n_hmac_is_available(S2N_HMAC_MD5)) {
/* Try MD5 */
/* Try MD5 */
{
uint8_t hmac_md5_size = 0;
POSIX_GUARD(s2n_hmac_digest_size(S2N_HMAC_MD5, &hmac_md5_size));
EXPECT_EQUAL(hmac_md5_size, 16);
Expand Down

0 comments on commit 1a2792a

Please sign in to comment.