intel / cryptography-primitives

Apache License 2.0
318 stars 86 forks source link

Add common hash API wrapper #44

Open mrx23dot opened 2 years ago

mrx23dot commented 2 years ago

Almost all hash libraries use the following API format. Please provide a wrapper.

void sha512_init(sha512ctx *ctx);
void sha512_update(sha512ctx *ctx, const void *data, size_t len);
void sha512_done(sha512ctx *ctx, uint8_t out[SHA512_HASH_LENGTH]);

So it would be very easy to swap out libraries, eg. one configuration doesn't need HW acceleration, just SW implementation.

ElenaTyuleneva commented 1 year ago

Hi @mrx23dot , Thanks for the proposal! We'll consider it in the future.

Could you please provide a reference to the hash libraries that you are mentioning?

mrx23dot commented 1 year ago

e.g. openssl https://github.com/openssl/openssl/blob/e4ab9d5b5cb5a6d792c313ff4d5724612351818d/include/openssl/sha.h#L124