diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-07-11 13:20:27 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-08-19 16:29:37 +0200 |
commit | 5cb41faece5969314ed69e0292d0a51f0425c53a (patch) | |
tree | 67e85cbfea570de97d9652eb9940202216ebe0d4 /core/math/crypto_core.h | |
parent | cce148b0242836b5c32a7fa6c39013a2fc1c9eff (diff) |
Fix CryptoCore signatures, add SHA1 context.
Fix hash size in SHA256 signature
Fix source parameter in hash context update function to be const.
Add SHA1 hash context.
Diffstat (limited to 'core/math/crypto_core.h')
-rw-r--r-- | core/math/crypto_core.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/core/math/crypto_core.h b/core/math/crypto_core.h index e28cb5a792..c859d612d4 100644 --- a/core/math/crypto_core.h +++ b/core/math/crypto_core.h @@ -46,10 +46,24 @@ public: ~MD5Context(); Error start(); - Error update(uint8_t *p_src, size_t p_len); + Error update(const uint8_t *p_src, size_t p_len); Error finish(unsigned char r_hash[16]); }; + class SHA1Context { + + private: + void *ctx; // To include, or not to include... + + public: + SHA1Context(); + ~SHA1Context(); + + Error start(); + Error update(const uint8_t *p_src, size_t p_len); + Error finish(unsigned char r_hash[20]); + }; + class SHA256Context { private: @@ -60,8 +74,8 @@ public: ~SHA256Context(); Error start(); - Error update(uint8_t *p_src, size_t p_len); - Error finish(unsigned char r_hash[16]); + Error update(const uint8_t *p_src, size_t p_len); + Error finish(unsigned char r_hash[32]); }; class AESContext { |