Re: [PATCH v2] crypto: arm64/sha: fix function types

From: Sami Tolvanen
Date: Tue Nov 19 2019 - 15:02:07 EST


On Fri, Nov 15, 2019 at 3:32 AM Ard Biesheuvel
<ard.biesheuvel@xxxxxxxxxx> wrote:
>
> On Thu, 14 Nov 2019 at 22:51, Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote:
> >
> > Instead of casting pointers to callback functions, add C wrappers
> > to avoid type mismatch failures with Control-Flow Integrity (CFI)
> > checking.
> >
> > Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> > ---
> > arch/arm64/crypto/sha1-ce-glue.c | 17 +++++++++------
> > arch/arm64/crypto/sha2-ce-glue.c | 34 ++++++++++++++++++------------
> > arch/arm64/crypto/sha256-glue.c | 32 +++++++++++++++++-----------
> > arch/arm64/crypto/sha512-ce-glue.c | 26 ++++++++++++-----------
> > arch/arm64/crypto/sha512-glue.c | 15 ++++++++-----
> > 5 files changed, 76 insertions(+), 48 deletions(-)
> >
> > diff --git a/arch/arm64/crypto/sha1-ce-glue.c b/arch/arm64/crypto/sha1-ce-glue.c
> > index bdc1b6d7aff7..76a951ce2a7b 100644
> > --- a/arch/arm64/crypto/sha1-ce-glue.c
> > +++ b/arch/arm64/crypto/sha1-ce-glue.c
> > @@ -28,6 +28,13 @@ struct sha1_ce_state {
> > asmlinkage void sha1_ce_transform(struct sha1_ce_state *sst, u8 const *src,
> > int blocks);
> >
> > +static inline void __sha1_ce_transform(struct sha1_state *sst, u8 const *src,
> > + int blocks)
>
> Nit: making a function inline when all we ever do is take its address
> is rather pointless, so please drop that (below as well)

Ack, I'll send v3 that removes the extra inlines shortly.

> With that fixed (and assuming that the crypto selftests still pass -
> please confirm that you've tried that)

I don't have a test device that supports sha512-ce, but self-tests for
everything else pass with these changes.

Sami