[PATCH 1/3] crypto: add enum
Sam Ravnborg
sam at ravnborg.org
Wed Jan 6 08:55:50 PST 2016
> >>
> >> +struct digest *digest_alloc_by_algo(enum hash_algo hash_algo)
> >> +{
> >> + struct digest *d;
> >> + struct digest_algo *algo;
> >> +
> >> + algo = digest_algo_get_by_algo(hash_algo);
> >> + if (!algo)
> >> + return NULL;
> >> +
> >> + d = xzalloc(sizeof(*d));
> >> + d->algo = algo;
> >> + d->ctx = xzalloc(algo->ctx_length);
> >
> > Neither allocations are checked for failure.
>
> If xzalloc fails barebox will go into OOM and throw a backtrace.
Makes sense. I thought about this, but failed to go back
and check this myself.
Sam
More information about the barebox
mailing list