diff options
Diffstat (limited to 'pyecsca/codegen/hash')
| -rw-r--r-- | pyecsca/codegen/hash/hash.h | 2 | ||||
| -rw-r--r-- | pyecsca/codegen/hash/none.c | 4 | ||||
| -rw-r--r-- | pyecsca/codegen/hash/sha1.c | 4 | ||||
| -rw-r--r-- | pyecsca/codegen/hash/sha2.c | 4 |
4 files changed, 14 insertions, 0 deletions
diff --git a/pyecsca/codegen/hash/hash.h b/pyecsca/codegen/hash/hash.h index 9e79b61..7121cd4 100644 --- a/pyecsca/codegen/hash/hash.h +++ b/pyecsca/codegen/hash/hash.h @@ -18,4 +18,6 @@ void hash_init(void *ctx); void hash_final(void *ctx, int size, const uint8_t *msg, uint8_t *digest); +void hash_free_ctx(void *ctx); + #endif //HASH_H_
\ No newline at end of file diff --git a/pyecsca/codegen/hash/none.c b/pyecsca/codegen/hash/none.c index 79690e8..b40adc3 100644 --- a/pyecsca/codegen/hash/none.c +++ b/pyecsca/codegen/hash/none.c @@ -17,4 +17,8 @@ void hash_init(void *ctx) { void hash_final(void *ctx, int size, const uint8_t *msg, uint8_t *digest) { memcpy(digest, msg, size); +} + +void hash_free_ctx(void *ctx) { + }
\ No newline at end of file diff --git a/pyecsca/codegen/hash/sha1.c b/pyecsca/codegen/hash/sha1.c index cf6ca3e..213ed11 100644 --- a/pyecsca/codegen/hash/sha1.c +++ b/pyecsca/codegen/hash/sha1.c @@ -187,3 +187,7 @@ void hash_final(void *ctx, int size, const uint8_t *msg, uint8_t *digest) { sha1_lastBlock(ctx, msg, length); sha1_ctx2hash(digest, ctx); } + +void hash_free_ctx(void *ctx) { + free(ctx); +} diff --git a/pyecsca/codegen/hash/sha2.c b/pyecsca/codegen/hash/sha2.c index d2ddf6f..2b7f11d 100644 --- a/pyecsca/codegen/hash/sha2.c +++ b/pyecsca/codegen/hash/sha2.c @@ -334,4 +334,8 @@ void hash_final(void* ctx, int size, const uint8_t* msg, uint8_t* digest) { } sha2_lastBlock(ctx, msg, length_b); sha2_ctx2hash(digest, ctx); +} + +void hash_free_ctx(void *ctx) { + free(ctx); }
\ No newline at end of file |
