[PATCH v4 04/14] drivers: crypto: add software ecdsa support
Raymond Mao
raymondmaoca at gmail.com
Mon Apr 20 18:52:20 CEST 2026
Hi Philippe,
On Fri, Apr 17, 2026 at 9:02 AM Philippe Reynes
<philippe.reynes at softathome.com> wrote:
>
> Add a software ecdsa driver so it is
> now possible to use ecdsa signature on
> board without ecdsa hardware support.
>
> Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>
> ---
> v2:
> - no change
> v3:
> - add depends on ECDSA_VERIFY to ECDSA_SW
> - change sw_ecdsa_verify to ecdsa_hash_verify
> - v4
> - use ECDSA_MBEDTLS to build the driver
> - clean include (change order)
>
> drivers/crypto/Makefile | 1 +
> drivers/crypto/ecdsa/Makefile | 6 ++++++
> drivers/crypto/ecdsa/ecdsa-sw.c | 33 +++++++++++++++++++++++++++++++++
> 3 files changed, 40 insertions(+)
> create mode 100644 drivers/crypto/ecdsa/Makefile
> create mode 100644 drivers/crypto/ecdsa/ecdsa-sw.c
>
> diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
> index e4a4482b7f3..8170e4cae9c 100644
> --- a/drivers/crypto/Makefile
> +++ b/drivers/crypto/Makefile
> @@ -4,6 +4,7 @@
> # http://www.samsung.com
>
> obj-$(CONFIG_EXYNOS_ACE_SHA) += ace_sha.o
> +obj-$(CONFIG_ECDSA) += ecdsa/
> obj-y += aes/
> obj-y += rsa_mod_exp/
> obj-y += fsl/
> diff --git a/drivers/crypto/ecdsa/Makefile b/drivers/crypto/ecdsa/Makefile
> new file mode 100644
> index 00000000000..53456d9cb4c
> --- /dev/null
> +++ b/drivers/crypto/ecdsa/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2026 Philippe Reynes <philippe.reynes at softathome.com>
> +#
> +
> +obj-$(CONFIG_ECDSA_MBEDTLS) += ecdsa-sw.o
As Simon already pointed out, please use 'CONFIG_$(PHASE_)ECDSA_MBEDTLS'.
With this change applied,
Reviewed-by: Raymond Mao <raymondmaoca at gmail.com>
Thanks and regards,
Raymond
> diff --git a/drivers/crypto/ecdsa/ecdsa-sw.c b/drivers/crypto/ecdsa/ecdsa-sw.c
> new file mode 100644
> index 00000000000..21dffeddf59
> --- /dev/null
> +++ b/drivers/crypto/ecdsa/ecdsa-sw.c
> @@ -0,0 +1,33 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2026 Philippe Reynes <philippe.reynes at softathome.com>
> + */
> +#include <crypto/ecdsa-uclass.h>
> +#include <crypto/internal/ecdsa.h>
> +#include <dm.h>
> +#include <linux/types.h>
> +#include <u-boot/ecdsa.h>
> +
> +static int ops_sw_ecdsa_verify(__always_unused struct udevice *dev,
> + const struct ecdsa_public_key *pubkey,
> + const void *hash, size_t hash_len,
> + const void *signature, size_t sig_len)
> +{
> + return ecdsa_hash_verify(pubkey, hash, hash_len, signature, sig_len);
> +}
> +
> +static const struct ecdsa_ops sw_ecdsa_ops = {
> + .verify = ops_sw_ecdsa_verify,
> +};
> +
> +U_BOOT_DRIVER(sw_ecdsa) = {
> + .name = "sw_ecdsa",
> + .id = UCLASS_ECDSA,
> + .ops = &sw_ecdsa_ops,
> + .flags = DM_FLAG_PRE_RELOC,
> +};
> +
> +U_BOOT_DRVINFO(sw_ecdsa) = {
> + .name = "sw_ecdsa",
> +};
> +
> --
> 2.43.0
>
More information about the U-Boot
mailing list