Hi Simo,
On Mon, 02 Nov 2020 14:31:34 +0100, Simo Sorce wrote:
On Mon, 2020-11-02 at 12:53 +0100, Neal H. Walfield wrote: This change would have to be conditional as it will break compatibility for the very use case you mention, data at rest saved moons ago.
I see two ways forward.
If I recall the C calling conventions correctly, it should be possible to change sha1_digest from returning void to returning an int in a backwards compatible way. Then, a user of the return code would check some function at run time to see whether the function really returns an int.
That's ugly. For us (Sequoia [1]), we'd be happy to have a parallel API.
For SHA1, Nettle has the following functions [2]:
void sha1_init (struct sha1_ctx *ctx) void sha1_update (struct sha1_ctx *ctx, size_t length, const uint8_t *data) void sha1_digest (struct sha1_ctx *ctx, size_t length, uint8_t *digest)
[2] http://www.lysator.liu.se/~nisse/nettle/nettle.html#Legacy-hash-functions
So we could add:
void sha1_collision_detection_init(...); void sha1_collision_detection_update (struct sha1_ctx *ctx, size_t length, const uint8_t *data) error_code_t sha1_collision_detection_digest (struct sha1_ctx *ctx, size_t length, uint8_t *digest)
What do you think? Or, am I misunderstanding what you mean by breaking compatibility?
Thanks!
:) Neal