diff options
| author | J08nY | 2019-11-27 20:34:58 +0100 |
|---|---|---|
| committer | J08nY | 2019-11-27 20:34:58 +0100 |
| commit | 32a4874abfbaff8cb4ee2d31fe71bcc3499e52dc (patch) | |
| tree | 1203a322d7488ef51b4de2d34c6e0c2871ea68a5 /pyecsca/codegen/hash | |
| parent | bb00fee9702155586e674b9d6a3b838bd54baac2 (diff) | |
| download | pyecsca-codegen-32a4874abfbaff8cb4ee2d31fe71bcc3499e52dc.tar.gz pyecsca-codegen-32a4874abfbaff8cb4ee2d31fe71bcc3499e52dc.tar.zst pyecsca-codegen-32a4874abfbaff8cb4ee2d31fe71bcc3499e52dc.zip | |
Reorganize files, implement proper main.
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 |
