[PATCH RFC v2 2/5] lib/rsa: Make fdt_add_bignum() available outside of RSA code

Simon Glass
2021-01-07T12:35:35Z

Hi Alexandru,

On Wed, 30 Dec 2020 at 14:00, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
>
> fdt_add_bignum() is useful for algorithms other than just RSA. To
> allow its use for ECDSA, move it to a common file under lib/.
>
> The new file is suffixed with '-libcrypto' because it has a direct
> dependency on openssl. This is due to the use of the "BIGNUM *" type.
>
> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> ---
> include/u-boot/fdt-libcrypto.h | 15 +++++++
> lib/fdt-libcrypto.c | 72 ++++++++++++++++++++++++++++++++++
> lib/rsa/rsa-sign.c | 65 +-----------------------------
> tools/Makefile | 1 +
> 4 files changed, 89 insertions(+), 64 deletions(-)
> create mode 100644 include/u-boot/fdt-libcrypto.h
> create mode 100644 lib/fdt-libcrypto.c

Reviewed-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/include/u-boot/fdt-libcrypto.h b/include/u-boot/fdt-libcrypto.h
> new file mode 100644
> index 0000000000..a6873487ed
> --- /dev/null
> +++ b/include/u-boot/fdt-libcrypto.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2020, Alexandru Gagniuc <mr.nuke.me@gmail.com>
> + * Copyright (c) 2013, Google Inc.
> + */
> +
> +#ifndef _FDT_LIBCRYPTO_H
> +#define _FDT_LIBCRYPTO_H
> +
> +#include <openssl/bn.h>
> +
> +int fdt_add_bignum(void *blob, int noffset, const char *prop_name,
> + BIGNUM *num, int num_bits);

Please add a full function comment.

Regards,
Simon