Skip to content

Templatize ecdsa signature decoding

Lukas Wunner keyrings linux-crypto 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5ASN.1: Add missing include <linux/types.h>include/linux/asn1_decoder.h+1 -02 replies
2/5crypto: akcipher - Drop usage of sglists for verify opcrypto/akcipher.c crypto/ecdsa.c crypto/ecrdsa.c +4 more+76 -1067 replies
3/5crypto: ecdsa - Avoid signed integer overflow on signature decodingcrypto/ecdsa.c+4 -132 replies
4/5crypto: ecdsa - Move X9.62 signature decoding into templatecrypto/Makefile crypto/asymmetric_keys/public_key.c crypto/ecdsa-x962.c +4 more+1077 -672 replies
5/5crypto: ecdsa - Support P1363 signature decodingcrypto/Makefile crypto/asymmetric_keys/public_key.c crypto/ecdsa-p1363.c +4 more+241 -161 reply

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchStefan BergerJonathan Cameron
1/5R-b R-b
2/5
3/5R-b R-b
4/5
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] Templatize ecdsa signature decoding

Move X9.62 signature decoding out of the ecdsa driver and into a template (patch [4/5]).

This allows introduction of P1363 signature decoding as another template (patch [5/5]), which is needed by the upcoming SPDM library (Security Protocol and Data Model) for PCI device authentication.

Drop usage of sglists for signature verification and use kernel buffers instead (patch [2/5]) to avoid the overhead of extracting from sglists into kernel buffers both in the templates and in the ecdsa driver. This builds on Herbert's elimination of sglists from the akcipher API with commit 63ba4d67594a ("KEYS: asymmetric:
Use new crypto interface without scatterlists").

I realize that P1363 support (patch [5/5]) might not be acceptable standalone, but I'm hoping to get an ack for it so that I may upstream the patch as part of PCI device authentication. Patches [1/5] to [4/5] will hopefully be acceptable standalone.

Note that I've duplicated the ecdsa test vectors in their entirety in patch [4/5]. If that is considered overzealous, I can reduce them to one or a few for testing the "raw" internal encoding. In patch [5/5] I've included just a single test vector for P1363. I can add more if desired.

Link to Herbert's suggestion to use templates for X9.62 and P1363:
https://lore.kernel.org/all/[email protected]/

Link to PCI device authentication v2 patches:
https://lore.kernel.org/all/[email protected]/

Please review and test -- thank you!

Lukas Wunner (5):
ASN.1: Add missing include <linux/types.h>
crypto: akcipher - Drop usage of sglists for verify op
crypto: ecdsa - Avoid signed integer overflow on signature decoding
crypto: ecdsa - Move X9.62 signature decoding into template
crypto: ecdsa - Support P1363 signature decoding

 crypto/Makefile                     |   4 +-
 crypto/akcipher.c                   |  11 +-
 crypto/asymmetric_keys/public_key.c |  43 +-
 crypto/ecdsa-p1363.c                | 155 +++++
 crypto/ecdsa-x962.c                 | 211 +++++++
 crypto/ecdsa.c                      | 122 ++--
 crypto/ecrdsa.c                     |  28 +-
 crypto/rsa-pkcs1pad.c               |  27 +-
 crypto/sig.c                        |  24 +-
 crypto/testmgr.c                    |  57 +-
 crypto/testmgr.h                    | 847 +++++++++++++++++++++++++++-
 include/crypto/akcipher.h           |  53 +-
 include/crypto/internal/ecc.h       |   2 +
 include/linux/asn1_decoder.h        |   1 +
 14 files changed, 1391 insertions(+), 194 deletions(-)
 create mode 100644 crypto/ecdsa-p1363.c
 create mode 100644 crypto/ecdsa-x962.c
Signature · 1 line
2.43.0