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