1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
diff --git a/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.c b/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.c
index 3405781..3beeacf 100644
--- a/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.c
+++ b/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.c
@@ -28,6 +28,9 @@
#include "utils/s2n_blob.h"
#include "utils/s2n_mem.h"
+#include "smack.h"
+#include "sidetrail.h"
+
#include <stdint.h>
int s2n_hash_hmac_alg(s2n_hash_algorithm hash_alg, s2n_hmac_algorithm *out)
@@ -270,7 +273,7 @@ int s2n_hmac_update(struct s2n_hmac_state *state, const void *in, uint32_t size)
*/
const uint32_t HIGHEST_32_BIT = 4294949760;
POSIX_ENSURE(size <= (UINT32_MAX - HIGHEST_32_BIT), S2N_ERR_INTEGER_OVERFLOW);
- uint32_t value = (HIGHEST_32_BIT + size) % state->hash_block_size;
+ uint32_t value = (size) % state->hash_block_size;
POSIX_GUARD(s2n_add_overflow(state->currently_in_hash_block, value, &state->currently_in_hash_block));
state->currently_in_hash_block %= state->hash_block_size;
@@ -363,8 +366,8 @@ int s2n_hmac_copy(struct s2n_hmac_state *to, struct s2n_hmac_state *from)
POSIX_GUARD(s2n_hash_copy(&to->outer_just_key, &from->outer_just_key));
- POSIX_CHECKED_MEMCPY(to->xor_pad, from->xor_pad, sizeof(to->xor_pad));
- POSIX_CHECKED_MEMCPY(to->digest_pad, from->digest_pad, sizeof(to->digest_pad));
+ //POSIX_CHECKED_MEMCPY(to->xor_pad, from->xor_pad, sizeof(to->xor_pad));
+ //POSIX_CHECKED_MEMCPY(to->digest_pad, from->digest_pad, sizeof(to->digest_pad));
POSIX_POSTCONDITION(s2n_hmac_state_validate(to));
POSIX_POSTCONDITION(s2n_hmac_state_validate(from));
return S2N_SUCCESS;
@@ -374,28 +377,28 @@ int s2n_hmac_copy(struct s2n_hmac_state *to, struct s2n_hmac_state *from)
/* Preserve the handlers for hmac state pointers to avoid re-allocation
* Only valid if the HMAC is in EVP mode
*/
-int s2n_hmac_save_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac)
-{
- POSIX_ENSURE_REF(backup);
- POSIX_PRECONDITION(s2n_hmac_state_validate(hmac));
- backup->inner = hmac->inner.digest.high_level;
- backup->inner_just_key = hmac->inner_just_key.digest.high_level;
- backup->outer = hmac->outer.digest.high_level;
- backup->outer_just_key = hmac->outer_just_key.digest.high_level;
- return S2N_SUCCESS;
-}
-
-int s2n_hmac_restore_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac)
-{
- POSIX_ENSURE_REF(backup);
- POSIX_PRECONDITION(s2n_hmac_state_validate(hmac));
- hmac->inner.digest.high_level = backup->inner;
- hmac->inner_just_key.digest.high_level = backup->inner_just_key;
- hmac->outer.digest.high_level = backup->outer;
- hmac->outer_just_key.digest.high_level = backup->outer_just_key;
- POSIX_POSTCONDITION(s2n_hmac_state_validate(hmac));
- return S2N_SUCCESS;
-}
+// int s2n_hmac_save_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac)
+// {
+// POSIX_ENSURE_REF(backup);
+// POSIX_PRECONDITION(s2n_hmac_state_validate(hmac));
+// backup->inner = hmac->inner.digest.high_level;
+// backup->inner_just_key = hmac->inner_just_key.digest.high_level;
+// backup->outer = hmac->outer.digest.high_level;
+// backup->outer_just_key = hmac->outer_just_key.digest.high_level;
+// return S2N_SUCCESS;
+// }
+//
+// int s2n_hmac_restore_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac)
+// {
+// POSIX_ENSURE_REF(backup);
+// POSIX_PRECONDITION(s2n_hmac_state_validate(hmac));
+// hmac->inner.digest.high_level = backup->inner;
+// hmac->inner_just_key.digest.high_level = backup->inner_just_key;
+// hmac->outer.digest.high_level = backup->outer;
+// hmac->outer_just_key.digest.high_level = backup->outer_just_key;
+// POSIX_POSTCONDITION(s2n_hmac_state_validate(hmac));
+// return S2N_SUCCESS;
+// }
S2N_RESULT s2n_hmac_md_from_alg(s2n_hmac_algorithm alg, const EVP_MD **md)
{
diff --git a/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.h b/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.h
index 7af7e61..e6382ce 100644
--- a/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.h
+++ b/tests/sidetrail/working/s2n-cbc/crypto/s2n_hmac.h
@@ -53,12 +53,12 @@ struct s2n_hmac_state {
uint8_t digest_pad[SHA512_DIGEST_LENGTH];
};
-struct s2n_hmac_evp_backup {
- struct s2n_hash_evp_digest inner;
- struct s2n_hash_evp_digest inner_just_key;
- struct s2n_hash_evp_digest outer;
- struct s2n_hash_evp_digest outer_just_key;
-};
+/* struct s2n_hmac_evp_backup { */
+/* struct s2n_hash_evp_digest inner; */
+/* struct s2n_hash_evp_digest inner_just_key; */
+/* struct s2n_hash_evp_digest outer; */
+/* struct s2n_hash_evp_digest outer_just_key; */
+/* }; */
int s2n_hmac_digest_size(s2n_hmac_algorithm alg, uint8_t *out);
bool s2n_hmac_is_available(s2n_hmac_algorithm alg);
@@ -75,7 +75,7 @@ int s2n_hmac_digest_verify(const void *a, const void *b, uint32_t len);
int s2n_hmac_free(struct s2n_hmac_state *state);
int s2n_hmac_reset(struct s2n_hmac_state *state);
int s2n_hmac_copy(struct s2n_hmac_state *to, struct s2n_hmac_state *from);
-int s2n_hmac_save_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac);
-int s2n_hmac_restore_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac);
+//int s2n_hmac_save_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac);
+//int s2n_hmac_restore_evp_hash_state(struct s2n_hmac_evp_backup* backup, struct s2n_hmac_state* hmac);
S2N_RESULT s2n_hmac_md_from_alg(s2n_hmac_algorithm alg, const EVP_MD **md);
|