diff mbox series

[v2,23/28] lib/crypto: Adapt mscode_parser to MbedTLS

Message ID 20240507175132.1456512-24-raymond.mao@linaro.org
State RFC
Delegated to: Tom Rini
Headers show
Series Integrate MbedTLS v3.6 LTS with U-Boot | expand

Commit Message

Raymond Mao May 7, 2024, 5:51 p.m. UTC
Adapt mscode_parser to build with MbedTLS

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2
- Move the porting layer to MbedTLS dir.

 include/crypto/mscode.h | 4 ++++
 lib/crypto/Makefile     | 2 ++
 2 files changed, 6 insertions(+)

Comments

Ilias Apalodimas May 9, 2024, 8:25 a.m. UTC | #1
On Tue, 7 May 2024 at 21:01, Raymond Mao <raymond.mao@linaro.org> wrote:
>
> Adapt mscode_parser to build with MbedTLS

Try to be precise in the description e.g

"Previous patches enable alternative SSL libraries and use mbedTLS
directly. Adjust the header and makefiles accordingly"

Thanks
/Ilias
>
> Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> ---
> Changes in v2
> - Move the porting layer to MbedTLS dir.
>
>  include/crypto/mscode.h | 4 ++++
>  lib/crypto/Makefile     | 2 ++
>  2 files changed, 6 insertions(+)
>
> diff --git a/include/crypto/mscode.h b/include/crypto/mscode.h
> index 551058b96e6..c214fc87e40 100644
> --- a/include/crypto/mscode.h
> +++ b/include/crypto/mscode.h
> @@ -9,6 +9,10 @@
>  #ifndef __UBOOT__
>  #include <crypto/hash_info.h>
>  #endif
> +#if CONFIG_IS_ENABLED(MBEDTLS_LIB_X509)
> +#include <external/mbedtls/include/mbedtls/asn1.h>
> +#include <external/mbedtls/include/mbedtls/oid.h>
> +#endif
>
>  struct pefile_context {
>  #ifndef __UBOOT__
> diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
> index c3fe9c9d2c0..e3232019df2 100644
> --- a/lib/crypto/Makefile
> +++ b/lib/crypto/Makefile
> @@ -62,6 +62,7 @@ $(obj)/pkcs7.asn1.o: $(obj)/pkcs7.asn1.c $(obj)/pkcs7.asn1.h
>  endif
>  obj-$(CONFIG_$(SPL_)PKCS7_VERIFY) += pkcs7_verify.o
>
> +ifneq ($(CONFIG_MBEDTLS_LIB_X509), y)
>  #
>  # Signed PE binary-wrapped key handling
>  #
> @@ -73,3 +74,4 @@ mscode-y := \
>
>  $(obj)/mscode_parser.o: $(obj)/mscode.asn1.h $(obj)/mscode.asn1.h
>  $(obj)/mscode.asn1.o: $(obj)/mscode.asn1.c $(obj)/mscode.asn1.h
> +endif
> --
> 2.25.1
>

With the above fixed
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/include/crypto/mscode.h b/include/crypto/mscode.h
index 551058b96e6..c214fc87e40 100644
--- a/include/crypto/mscode.h
+++ b/include/crypto/mscode.h
@@ -9,6 +9,10 @@ 
 #ifndef __UBOOT__
 #include <crypto/hash_info.h>
 #endif
+#if CONFIG_IS_ENABLED(MBEDTLS_LIB_X509)
+#include <external/mbedtls/include/mbedtls/asn1.h>
+#include <external/mbedtls/include/mbedtls/oid.h>
+#endif
 
 struct pefile_context {
 #ifndef __UBOOT__
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
index c3fe9c9d2c0..e3232019df2 100644
--- a/lib/crypto/Makefile
+++ b/lib/crypto/Makefile
@@ -62,6 +62,7 @@  $(obj)/pkcs7.asn1.o: $(obj)/pkcs7.asn1.c $(obj)/pkcs7.asn1.h
 endif
 obj-$(CONFIG_$(SPL_)PKCS7_VERIFY) += pkcs7_verify.o
 
+ifneq ($(CONFIG_MBEDTLS_LIB_X509), y)
 #
 # Signed PE binary-wrapped key handling
 #
@@ -73,3 +74,4 @@  mscode-y := \
 
 $(obj)/mscode_parser.o: $(obj)/mscode.asn1.h $(obj)/mscode.asn1.h
 $(obj)/mscode.asn1.o: $(obj)/mscode.asn1.c $(obj)/mscode.asn1.h
+endif