[PATCH] sha2: new header <sha2.h>
Rich Felker
dalias@libc.org
Thu Apr 2 15:17:00 GMT 2015
On Thu, Apr 02, 2015 at 10:00:25AM +0200, Florian Weimer wrote:
> On 04/02/2015 02:43 AM, Rich Felker wrote:
>
> > I'm opposed to allocation/deallocation functions. They have no benefit
>
> They have the benefit that the library can ensure the required
> alignment, instead of the caller having to provide it.
Then just make the caller-provided buffer twice the size it "should"
be. Then the callee can use the actual embedded buffer it with any
alignment it wants.
> There might be hardware implementations which require additional
> alignment, to the degree that it cannot be satisfied with the current
> spare space in the buffer.
>
> The non-opaque struct also gives the impression you can copy the struct
> to implement HMACs, or that the struct contents is portable across
> process invocations, which is something we should not promise.
There's no reason to give that impression. The contents can be clearly
opaque, e.g.:
long __opaque[NNN];
> > Allocation also means you
> > can't use it in an async signal context.
>
> As far as I can tell, the functions have not been proposed as
> async-signal-safe, so this does not matter.
I agree this is a less important matter than breaking the no-fail
contract users will want/need, but I thought it was noteworthy still.
Rich
More information about the Libc-alpha
mailing list