diff options
author | Alexandru Gagniuc <mr.nuke.me@gmail.com> | 2021-02-19 21:45:11 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-04-14 22:06:08 +0300 |
commit | 4c17e5f69170bf033df7b4f1a2b87fa72f18aaf5 (patch) | |
tree | a9e87dde0c1072b2b4096edcbdda61fb3da3e448 /include/u-boot | |
parent | 0bcb28dfb946b32ed7550fc4c24c5dcea6718554 (diff) | |
download | u-boot-4c17e5f69170bf033df7b4f1a2b87fa72f18aaf5.tar.xz |
lib/rsa: Make fdt_add_bignum() available outside of RSA code
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/u-boot')
-rw-r--r-- | include/u-boot/fdt-libcrypto.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/u-boot/fdt-libcrypto.h b/include/u-boot/fdt-libcrypto.h new file mode 100644 index 0000000000..5142f37039 --- /dev/null +++ b/include/u-boot/fdt-libcrypto.h @@ -0,0 +1,27 @@ +/* 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> + +/** + * fdt_add_bignum() - Write a libcrypto BIGNUM as an FDT property + * + * Convert a libcrypto BIGNUM * into a big endian array of integers. + * + * @blob: FDT blob to modify + * @noffset: Offset of the FDT node + * @prop_name: What to call the property in the FDT + * @num: pointer to a libcrypto big number + * @num_bits: How big is 'num' in bits? + * @return 0 if all good all working, -ve on horror + */ +int fdt_add_bignum(void *blob, int noffset, const char *prop_name, + BIGNUM *num, int num_bits); + +#endif /* _FDT_LIBCRYPTO_H */ |