On 2026-09-29 10:36, Michael Tretter wrote: > On Tue, 29 Sep 2026 07:08:56 +0000, Sascha Hauer wrote: > > On 2026-09-28 14:25, Michael Tretter wrote: > > > Similar to the oneshot helper for sha256, add helpers for sha384 and > > > sha512. > > > > > > The helper functions don't use the ARMv8 Crypto Extensions, yet. > > > > > > Signed-off-by: Michael Tretter <[email protected]> > > > --- > > > include/crypto/pbl-sha.h | 22 ++++++++++++++++++++++ > > > 1 file changed, 22 insertions(+) > > > > > > diff --git a/include/crypto/pbl-sha.h b/include/crypto/pbl-sha.h > > > index dbfb79647462..8a20e0a2b84b 100644 > > > --- a/include/crypto/pbl-sha.h > > > +++ b/include/crypto/pbl-sha.h > > > @@ -28,7 +28,29 @@ int sha512_init(struct digest *desc); > > > int sha512_update(struct digest *desc, const void *data, unsigned long > > > len); > > > int sha512_final(struct digest *desc, u8 *out); > > > > > > +static inline void pbl_sha512(const void *buf, size_t len, > > > + u8 out[SHA512_DIGEST_SIZE]) > > > +{ > > > + struct sha512_state state = { }; > > > + struct digest d = { .ctx = &state, .length = SHA512_DIGEST_SIZE }; > > > + > > > + sha512_init(&d); > > > + sha512_update(&d, buf, len); > > > + sha512_final(&d, out); > > > +} > > > > Instead of making these static inline functions, could you follow the > > template in pbl/sha256.c to give future developers an idea how for > > example the crypto extensions should be implemented? > > I implemented this as static inline to avoid the decision, if I should > add pbl/sha384.c and pbl/sha512.c modules, or if I should change > pbl/sha256.c to a more generic pbl/sha.c. I tend to the second option. > Do you have any preference?
Damn, that's the decision I thought I had pushed to you with my last mail ;) As I do not anticipate that file becoming too big, so I tend to the second option as well. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
