All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files
@ 2023-07-21  3:21 Alistair Francis
  2023-07-21  3:21 ` [Buildroot] [PATCH 2/2] package/libspdm: Initial commit Alistair Francis
  2023-07-23 17:46 ` [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Yann E. MORIN
  0 siblings, 2 replies; 4+ messages in thread
From: Alistair Francis @ 2023-07-21  3:21 UTC (permalink / raw)
  To: buildroot; +Cc: alistair23, Alistair Francis, Samuel Martin

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 package/libopenssl/libopenssl.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/libopenssl/libopenssl.mk b/package/libopenssl/libopenssl.mk
index 7a4e0dfca2..9d44098063 100644
--- a/package/libopenssl/libopenssl.mk
+++ b/package/libopenssl/libopenssl.mk
@@ -127,6 +127,10 @@ endef
 
 define LIBOPENSSL_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
+	mkdir -p $(STAGING_DIR)/usr/include/crypto
+	$(INSTALL) -m 644 $(@D)/include/crypto/* $(STAGING_DIR)/usr/include/crypto/
+	mkdir -p $(STAGING_DIR)/usr/include/internal
+	$(INSTALL) -m 644 $(@D)/include/internal/* $(STAGING_DIR)/usr/include/internal/
 endef
 
 define HOST_LIBOPENSSL_INSTALL_CMDS
-- 
2.40.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] package/libspdm: Initial commit
  2023-07-21  3:21 [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Alistair Francis
@ 2023-07-21  3:21 ` Alistair Francis
  2023-07-23 18:10   ` Yann E. MORIN
  2023-07-23 17:46 ` [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Yann E. MORIN
  1 sibling, 1 reply; 4+ messages in thread
From: Alistair Francis @ 2023-07-21  3:21 UTC (permalink / raw)
  To: buildroot; +Cc: alistair23, Alistair Francis, Samuel Martin

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 package/Config.in            |  1 +
 package/libspdm/Config.in    |  8 ++++
 package/libspdm/libspdm.hash |  3 ++
 package/libspdm/libspdm.mk   | 75 ++++++++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+)
 create mode 100644 package/libspdm/Config.in
 create mode 100644 package/libspdm/libspdm.hash
 create mode 100644 package/libspdm/libspdm.mk

diff --git a/package/Config.in b/package/Config.in
index 601922aad5..8384654616 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -192,6 +192,7 @@ menu "Development tools"
 	source "package/jo/Config.in"
 	source "package/jq/Config.in"
 	source "package/libtool/Config.in"
+	source "package/libspdm/Config.in"
 	source "package/make/Config.in"
 	source "package/mawk/Config.in"
 	source "package/patch/Config.in"
diff --git a/package/libspdm/Config.in b/package/libspdm/Config.in
new file mode 100644
index 0000000000..3051fc8c59
--- /dev/null
+++ b/package/libspdm/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LIBSPDM
+	bool "libspdm"
+	depends on BR2_PACKAGE_OPENSSL
+	help
+	  libspdm is a sample implementation that follows
+	  the DMTF SPDM specifications
+
+	  https://github.com/DMTF/libspdm
diff --git a/package/libspdm/libspdm.hash b/package/libspdm/libspdm.hash
new file mode 100644
index 0000000000..d06af29397
--- /dev/null
+++ b/package/libspdm/libspdm.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  3a40daa59f32843062c3d2699acee09bd0ee217eb8ebf0378ae12b60b6db0636  libspdm-3.0.0.tar.gz
+sha256  337130631a714eeae017556cad101d5324c2961214120b6214741d3d43667086  LICENSE.md
diff --git a/package/libspdm/libspdm.mk b/package/libspdm/libspdm.mk
new file mode 100644
index 0000000000..1f8012f599
--- /dev/null
+++ b/package/libspdm/libspdm.mk
@@ -0,0 +1,75 @@
+################################################################################
+#
+# libspdm
+#
+################################################################################
+
+LIBSPDM_VERSION = 3.0.0
+LIBSPDM_SITE = $(call github,DMTF,libspdm,$(LIBSPDM_VERSION))
+LIBSPDM_LICENSE = BSD-3-Clause
+LIBSPDM_LICENSE_FILES = LICENSE.md
+
+LIBSPDM_INSTALL_STAGING = YES
+LIBSPDM_INSTALL_TARGET = YES
+
+LIBSPDM_DEPENDENCIES += openssl
+
+ifeq ($(BR2_arcle)$(BR2_arceb),y)
+LIBSPDM_TARGET_CPU_FAMILY = arc
+else ifeq ($(BR2_arm)$(BR2_armeb),y)
+LIBSPDM_TARGET_CPU_FAMILY = arm
+else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
+LIBSPDM_TARGET_CPU_FAMILY = aarch64
+else ifeq ($(BR2_i386),y)
+LIBSPDM_TARGET_CPU_FAMILY = ia32
+else ifeq ($(BR2_riscv)$(BR2_RISCV_32),yy)
+LIBSPDM_TARGET_CPU_FAMILY = riscv32
+else ifeq ($(BR2_riscv)$(BR2_RISCV_64),yy)
+LIBSPDM_TARGET_CPU_FAMILY = riscv64
+else ifeq ($(BR2_x86_64),y)
+LIBSPDM_TARGET_CPU_FAMILY = x64
+else
+LIBSPDM_TARGET_CPU_FAMILY = $(ARCH)
+endif
+
+LIBSPDM_CONF_OPTS = \
+	-DARCH=$(LIBSPDM_TARGET_CPU_FAMILY) \
+	-DTOOLCHAIN=NONE \
+	-DTARGET=Release \
+	-DCRYPTO=openssl \
+	-DENABLE_BINARY_BUILD=1 \
+	-DCOMPILED_LIBCRYPTO_PATH=/usr/lib/ \
+	-DCOMPILED_LIBSSL_PATH=/usr/lib/ \
+	-DDISABLE_TESTS=1 \
+	-DLINK_FLAGS=$(STAGING_DIR)
+
+define LIBSPDM_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/* $(STAGING_DIR)/usr/lib/
+
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/library
+	$(INSTALL) -D -m 0755 $(@D)/include/library/* $(STAGING_DIR)/usr/include/library
+
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/internal
+	$(INSTALL) -D -m 0755 $(@D)/include/internal/*.h $(STAGING_DIR)/usr/include/internal/
+
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/hal/library/cryptlib
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/hal/library/requester
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/hal/library/responder
+	$(INSTALL) -D -m 0755 $(@D)/include/hal/*.h $(STAGING_DIR)/usr/include/hal/
+	$(INSTALL) -D -m 0755 $(@D)/include/hal/library/*.h $(STAGING_DIR)/usr/include/hal/library/
+	$(INSTALL) -D -m 0755 $(@D)/include/hal/library/cryptlib/* $(STAGING_DIR)/usr/include/hal/library/cryptlib/
+	$(INSTALL) -D -m 0755 $(@D)/include/hal/library/requester/* $(STAGING_DIR)/usr/include/hal/library/requester/
+	$(INSTALL) -D -m 0755 $(@D)/include/hal/library/responder/* $(STAGING_DIR)/usr/include/hal/library/responder/
+
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/industry_standard
+	$(INSTALL) -D -m 0755 $(@D)/include/industry_standard/* $(STAGING_DIR)/usr/include/industry_standard
+
+	$(INSTALL) -d $(STAGING_DIR)/usr/include/os_stub/spdm_crypt_ext_lib
+	$(INSTALL) -D -m 0755 $(@D)/os_stub/spdm_crypt_ext_lib/*.h $(STAGING_DIR)/usr/include/os_stub/spdm_crypt_ext_lib
+endef
+
+define LIBSPDM_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/lib/* $(TARGET_DIR)/usr/lib/
+endef
+
+$(eval $(cmake-package))
-- 
2.40.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files
  2023-07-21  3:21 [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Alistair Francis
  2023-07-21  3:21 ` [Buildroot] [PATCH 2/2] package/libspdm: Initial commit Alistair Francis
@ 2023-07-23 17:46 ` Yann E. MORIN
  1 sibling, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2023-07-23 17:46 UTC (permalink / raw)
  To: Alistair Francis; +Cc: Samuel Martin, Alistair Francis, buildroot

Alistair, All,

On 2023-07-21 13:21 +1000, Alistair Francis spake thusly:
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  package/libopenssl/libopenssl.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/libopenssl/libopenssl.mk b/package/libopenssl/libopenssl.mk
> index 7a4e0dfca2..9d44098063 100644
> --- a/package/libopenssl/libopenssl.mk
> +++ b/package/libopenssl/libopenssl.mk
> @@ -127,6 +127,10 @@ endef
>  
>  define LIBOPENSSL_INSTALL_STAGING_CMDS
>  	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
> +	mkdir -p $(STAGING_DIR)/usr/include/crypto
> +	$(INSTALL) -m 644 $(@D)/include/crypto/* $(STAGING_DIR)/usr/include/crypto/
> +	mkdir -p $(STAGING_DIR)/usr/include/internal
> +	$(INSTALL) -m 644 $(@D)/include/internal/* $(STAGING_DIR)/usr/include/internal/

You will have to provide some explanations for this change.

Indeed, as far as I can see, those headers are private headers for
openssl, and are not meant to be installed.

For example, they are not available at all in my Ubuntu 20.04, and I
could not find them in an Ubuntu 23.04 either:

    $ apt-file search /usr/include/crypto/
    [nada]

So, this commit will need some more details as to why private headers
need to be installed. Or why they are not private but not installed by
default.

Yes, I see that patch 2/2 adding libspdm will probably want those
headers, but that at the very least should be mentioned.

Regards,
Yann E. MORIN.

>  endef
>  
>  define HOST_LIBOPENSSL_INSTALL_CMDS
> -- 
> 2.40.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 2/2] package/libspdm: Initial commit
  2023-07-21  3:21 ` [Buildroot] [PATCH 2/2] package/libspdm: Initial commit Alistair Francis
@ 2023-07-23 18:10   ` Yann E. MORIN
  0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2023-07-23 18:10 UTC (permalink / raw)
  To: Alistair Francis; +Cc: Samuel Martin, Alistair Francis, buildroot

Alistair, All,

On 2023-07-21 13:21 +1000, Alistair Francis spake thusly:
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
[--SNIP--]
> diff --git a/package/libspdm/Config.in b/package/libspdm/Config.in
> new file mode 100644
> index 0000000000..3051fc8c59
> --- /dev/null
> +++ b/package/libspdm/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_LIBSPDM
> +	bool "libspdm"
> +	depends on BR2_PACKAGE_OPENSSL

You can select BR2_PACKAGE_OPENSSL. That will ensure that either openssl
(libopenssl) or libressl are enabled. If your package can work with
either, then you're all set with just that:

    select BR2_PACKAGE_OPENSSL

If your package really want opensll (libopenssl), then you must state
so:

    select BR2_PACKAGE_OPENSSL
    select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL

[--SNIP--]
> diff --git a/package/libspdm/libspdm.mk b/package/libspdm/libspdm.mk
> new file mode 100644
> index 0000000000..1f8012f599
> --- /dev/null
> +++ b/package/libspdm/libspdm.mk
> @@ -0,0 +1,75 @@
> +################################################################################
> +#
> +# libspdm
> +#
> +################################################################################
> +
> +LIBSPDM_VERSION = 3.0.0
> +LIBSPDM_SITE = $(call github,DMTF,libspdm,$(LIBSPDM_VERSION))
> +LIBSPDM_LICENSE = BSD-3-Clause
> +LIBSPDM_LICENSE_FILES = LICENSE.md
> +
> +LIBSPDM_INSTALL_STAGING = YES
> +LIBSPDM_INSTALL_TARGET = YES
> +
> +LIBSPDM_DEPENDENCIES += openssl
> +
> +ifeq ($(BR2_arcle)$(BR2_arceb),y)
> +LIBSPDM_TARGET_CPU_FAMILY = arc
> +else ifeq ($(BR2_arm)$(BR2_armeb),y)
> +LIBSPDM_TARGET_CPU_FAMILY = arm
> +else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
> +LIBSPDM_TARGET_CPU_FAMILY = aarch64
> +else ifeq ($(BR2_i386),y)
> +LIBSPDM_TARGET_CPU_FAMILY = ia32
> +else ifeq ($(BR2_riscv)$(BR2_RISCV_32),yy)
> +LIBSPDM_TARGET_CPU_FAMILY = riscv32
> +else ifeq ($(BR2_riscv)$(BR2_RISCV_64),yy)
> +LIBSPDM_TARGET_CPU_FAMILY = riscv64
> +else ifeq ($(BR2_x86_64),y)
> +LIBSPDM_TARGET_CPU_FAMILY = x64
> +else
> +LIBSPDM_TARGET_CPU_FAMILY = $(ARCH)
> +endif

I like that such conditions be written in Config.in, even if this is not
a hard requirement:

    config BR2_PACKAGE_LIBSPDM_CPU_FAMILLY
        string
        default "arc" if BR2_arcle || BR2_arceb
        default "arm" if BR2_arm || BR2_armeb
        ...
        default BR2_ARCH  # Yes, this should work...

and then in the .mk:

    LIBSPDM_TARGET_CPU_FAMILY = $(call qstrip,$(BR2_PACKAGE_LIBSPDM_CPU_FAMILLY))

[--SNIP--]
> +define LIBSPDM_INSTALL_STAGING_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/lib/* $(STAGING_DIR)/usr/lib/

You need to ensure that the destination direcotry exists before you copy
multiple files in one go there; what we usually do is:

    $(INSTALL) -m 075 -t $(STAGING_DIR)/usr/lib/ $(@D)/lib/*

or the usual mkdir-then-install dance.

> +	$(INSTALL) -d $(STAGING_DIR)/usr/include/library

The set of isntall directories:
    /usr/include/library/
    /usr/include/internal/
    /usr/include/hal/
    /usr/include/industry_standard/

are very generic and confusing. Should they not be in a common
sub-directory, e.g.:
    /usr/include/spdm/library/
    /usr/include/spdm/internal/
    /usr/include/spdm/hal/
    /usr/include/spdm/industry_standard/

Because I can at least see 'hal' conflict with a lot of other HALs (and
don't wait for Dave...)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-23 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21  3:21 [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Alistair Francis
2023-07-21  3:21 ` [Buildroot] [PATCH 2/2] package/libspdm: Initial commit Alistair Francis
2023-07-23 18:10   ` Yann E. MORIN
2023-07-23 17:46 ` [Buildroot] [PATCH 1/2] package/libopenssl: Copy the crypto include files Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.