123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef EPID_MEMBER_TINY_MATH_HASHWRAP_H_
- #define EPID_MEMBER_TINY_MATH_HASHWRAP_H_
- #include <stddef.h>
- #include "epid/common/types.h"
- #include "epid/member/tiny/math/mathtypes.h"
- #define SHA512_SUPPORT
- #define SHA256_SUPPORT
- #ifdef SHA512_SUPPORT
- #include "epid/member/tiny/math/sha512.h"
- #endif
- #ifdef SHA256_SUPPORT
- #include "epid/member/tiny/math/sha256.h"
- #endif
- typedef union sha_digest {
- #ifdef SHA512_SUPPORT
- uint8_t sha512_digest[SHA512_DIGEST_SIZE];
- #endif
- #ifdef SHA256_SUPPORT
- uint8_t sha256_digest[SHA256_DIGEST_SIZE];
- #endif
- uint8_t digest[1];
- } sha_digest;
- typedef struct tiny_sha {
- union {
- #ifdef SHA512_SUPPORT
- sha512_state sha512s;
- #endif
- #ifdef SHA256_SUPPORT
- sha256_state sha256s;
- #endif
- } sha_state_t;
- HashAlg hash_alg;
- } tiny_sha;
- void tinysha_init(HashAlg sha_type, tiny_sha* s);
- void tinysha_update(tiny_sha* s, void const* data, size_t data_length);
- void tinysha_final(unsigned char* digest, tiny_sha* s);
- size_t tinysha_digest_size(tiny_sha* s);
- #endif
|