Skip to contentSkip to conversation

includes: move openssl headers to include/u-boot

PATCH In review Jeroen Hofstee 3 participants 5 messages Jun 12, 2014 – Jun 19, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 includes: move openssl headers to include/u-boot

commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason.

---
build tested for ARM/powerpc/mips/sandbox

---
 board/gdsys/p1022/controlcenterd-id.c | 2 +-
 board/pcs440ep/pcs440ep.c             | 2 +-
 common/cmd_sha1sum.c                  | 2 +-
 common/hash.c                         | 4 ++--
 common/image-fit.c                    | 4 ++--
 common/image-sig.c                    | 4 ++--
 common/image.c                        | 2 +-
 drivers/crypto/ace_sha.c              | 4 ++--
 drivers/misc/cros_ec_sandbox.c        | 2 +-
 drivers/mmc/rpmb.c                    | 2 +-
 include/image.h                       | 2 +-
 include/{ => u-boot}/rsa-checksum.h   | 4 ++--
 include/{ => u-boot}/rsa.h            | 0
 include/{ => u-boot}/sha1.h           | 0
 include/{ => u-boot}/sha256.h         | 0
 lib/rsa/rsa-checksum.c                | 6 +++---
 lib/rsa/rsa-verify.c                  | 6 +++---
 lib/sha1.c                            | 2 +-
 lib/sha256.c                          | 2 +-
 lib/tpm.c                             | 2 +-
 tools/Makefile                        | 1 -
 tools/dumpimage.h                     | 2 +-
 tools/imagetool.h                     | 2 +-
 tools/mkimage.h                       | 2 +-
 tools/ubsha1.c                        | 2 +-
 25 files changed, 30 insertions(+), 31 deletions(-)
 rename include/{ => u-boot}/rsa-checksum.h (91%)
 rename include/{ => u-boot}/rsa.h (100%)
 rename include/{ => u-boot}/sha1.h (100%)
 rename include/{ => u-boot}/sha256.h (100%)
board/gdsys/p1022/controlcenterd-id.c +1 -1
index 3fca3c5..7e13c90 100644
@@ -30,7 +30,7 @@
 #include <i2c.h>
 #include <mmc.h>
 #include <tpm.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 #include <pca9698.h>
board/pcs440ep/pcs440ep.c +1 -1
index f90e809..267c001 100644
@@ -13,7 +13,7 @@
 #include <asm/processor.h>
 #include <spd_sdram.h>
 #include <status_led.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include <asm/io.h>
 #include <net.h>
 #include <ata.h>
common/cmd_sha1sum.c +1 -1
index 644b9a0..783ea2e 100644
@@ -11,7 +11,7 @@
 #include <common.h>
 #include <command.h>
 #include <hash.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 
 int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
common/hash.c +2 -2
index 237bd04..4417f36 100644
@@ -15,8 +15,8 @@
 #include <malloc.h>
 #include <hw_sha.h>
 #include <hash.h>
-#include <sha1.h>
-#include <sha256.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 #include <asm/io.h>
 #include <asm/errno.h>
 
common/image-fit.c +2 -2
index 732505a..75208c7 100644
@@ -21,10 +21,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
 
 #include <bootstage.h>
-#include <sha1.h>
-#include <sha256.h>
 #include <u-boot/crc.h>
 #include <u-boot/md5.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 
 /*****************************************************************************/
 /* New uImage format routines */
common/image-sig.c +2 -2
index 72284eb..21d5e51 100644
@@ -13,8 +13,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
 #include <image.h>
-#include <rsa.h>
-#include <rsa-checksum.h>
+#include <u-boot/rsa.h>
+#include <u-boot/rsa-checksum.h>
 
 #define IMAGE_MAX_HASHED_NODES		100
 
common/image.c +1 -1
index f33b175..e723944 100644
@@ -34,7 +34,7 @@
 #endif
 
 #include <u-boot/md5.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include <asm/errno.h>
 #include <asm/io.h>
 
drivers/crypto/ace_sha.c +2 -2
index ed4f541..efef491 100644
@@ -8,8 +8,8 @@
 #include "ace_sha.h"
 
 #ifdef CONFIG_SHA_HW_ACCEL
-#include <sha256.h>
-#include <sha1.h>
+#include <u-boot/sha256.h>
+#include <u-boot/sha1.h>
 #include <asm/errno.h>
 
 /* SHA1 value for the message of zero length */
drivers/misc/cros_ec_sandbox.c +1 -1
index 4bb1d60..8a04af5 100644
@@ -13,7 +13,7 @@
 #include <hash.h>
 #include <malloc.h>
 #include <os.h>
-#include <sha256.h>
+#include <u-boot/sha256.h>
 #include <spi.h>
 #include <asm/state.h>
 #include <asm/sdl.h>
drivers/mmc/rpmb.c +1 -1
index 05936f5..9d0b8bc 100644
@@ -11,7 +11,7 @@
 #include <config.h>
 #include <common.h>
 #include <mmc.h>
-#include <sha256.h>
+#include <u-boot/sha256.h>
 #include "mmc_private.h"
 
 /* Request codes */
include/image.h +1 -1
index b71e4ba..8e8c72b 100644
@@ -882,7 +882,7 @@ struct image_region {
 };
 
 #if IMAGE_ENABLE_VERIFY
-# include <rsa-checksum.h>
+# include <u-boot/rsa-checksum.h>
 #endif
 struct checksum_algo {
 	const char *name;
include/u-boot/rsa-checksum.h renamed from include/rsa-checksum.h +2 -2
similarity index 91%
rename from include/rsa-checksum.h
rename to include/u-boot/rsa-checksum.h
index 612db85..c996fb3 100644
@@ -9,8 +9,8 @@
 
 #include <errno.h>
 #include <image.h>
-#include <sha1.h>
-#include <sha256.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 
 extern const uint8_t padding_sha256_rsa4096[];
 extern const uint8_t padding_sha256_rsa2048[];
include/u-boot/rsa.h renamed from include/rsa.h +0 -0
similarity index 100%
rename from include/rsa.h
rename to include/u-boot/rsa.h
include/u-boot/sha1.h renamed from include/sha1.h +0 -0
similarity index 100%
rename from include/sha1.h
rename to include/u-boot/sha1.h
include/u-boot/sha256.h renamed from include/sha256.h +0 -0
similarity index 100%
rename from include/sha256.h
rename to include/u-boot/sha256.h
lib/rsa/rsa-checksum.c +3 -3
index 32d6602..8d8b59f 100644
@@ -13,9 +13,9 @@
 #else
 #include "fdt_host.h"
 #endif
-#include <rsa.h>
-#include <sha1.h>
-#include <sha256.h>
+#include <u-boot/rsa.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 
 /* PKCS 1.5 paddings as described in the RSA PKCS#1 v2.1 standard. */
 
lib/rsa/rsa-verify.c +3 -3
index 587da5b..bcb9063 100644
@@ -17,9 +17,9 @@
 #include "mkimage.h"
 #include <fdt_support.h>
 #endif
-#include <rsa.h>
-#include <sha1.h>
-#include <sha256.h>
+#include <u-boot/rsa.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 
 #define UINT64_MULT32(v, multby)  (((uint64_t)(v)) * ((uint32_t)(multby)))
 
lib/sha1.c +1 -1
index a121224..0a5f688 100644
@@ -36,7 +36,7 @@
 #include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
-#include "sha1.h"
+#include <u-boot/sha1.h>
 
 /*
  * 32-bit integer manipulation macros (big endian)
lib/sha256.c +1 -1
index b1085ea..bb338ba 100644
@@ -13,7 +13,7 @@
 #include <string.h>
 #endif /* USE_HOSTCC */
 #include <watchdog.h>
-#include <sha256.h>
+#include <u-boot/sha256.h>
 
 /*
  * 32-bit integer manipulation macros (big endian)
lib/tpm.c +1 -1
index 967c8e6..d9789b0 100644
@@ -7,7 +7,7 @@
 
 #include <common.h>
 #include <stdarg.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include <tpm.h>
 #include <asm/unaligned.h>
 
tools/Makefile +0 -1
index 0088c1a..5235539 100644
@@ -191,7 +191,6 @@ endif # !LOGO_BMP
 # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
 #
 HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
-		-include $(srctree)/include/sha256.h \
 		$(patsubst -I%,-idirafter%, $(UBOOTINCLUDE)) \
 		-I$(srctree)/lib/libfdt \
 		-I$(srctree)/tools \
tools/dumpimage.h +1 -1
index d78523d..e415f14 100644
@@ -18,7 +18,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include "fdt_host.h"
 #include "imagetool.h"
 
tools/imagetool.h +1 -1
index c480687..c8af0e8 100644
@@ -18,7 +18,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include "fdt_host.h"
 
 #define ARRAY_SIZE(x)		(sizeof(x) / sizeof((x)[0]))
tools/mkimage.h +1 -1
index d5491b6..3f369b7 100644
@@ -18,7 +18,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
-#include <sha1.h>
+#include <u-boot/sha1.h>
 #include "fdt_host.h"
 #include "imagetool.h"
 
tools/ubsha1.c +1 -1
index 1041588..4a17246 100644
@@ -13,7 +13,7 @@
 #include <errno.h>
 #include <string.h>
 #include <sys/stat.h>
-#include "sha1.h"
+#include <u-boot/sha1.h>
 
 int main (int argc, char **argv)
 {
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 includes: move openssl headers to include/u-boot

Hi Jeroen,

Quoted 9 lines · Jeroen Hofstee

commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason.

This seems like a much better solution. But I think you should keep the sort order - so u-boot/xxx should go after asm/xxx in the #includes I think.

Regards,
Simon

#2 lore raw

PATCH 1/1 includes: move openssl headers to include/u-boot

Quoted 10 lines · Simon Glass

Hi Jeroen,

Quoted 7 lines · Jeroen Hofstee

commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason.

Quoted 6 lines
Quoted 2 lines

This seems like a much better solution. But I think you should keep the sort order - so u-boot/xxx should go after asm/xxx in the #includes I think.

I considered it, but e.g. common/image.c contains this before this patch:

#include <u-boot/md5.h>
#include <sha1.h>
#include <asm/errno.h>
#include <asm/io.h>

While I can rearrange them, I think it should be a separate patch, since it is not sorted in the first place. Furthermore if possible I would prefer this commit to go into the current release and hence want to keep it as short as possible. What I hadn't realized with the original patch is that we don't replace the header but include them all.

On FreeBSD u-boot/sha256.h is included because the makefile said so, but the host version of sha256.h is included as well by the source code and the openssl/* will include similar headers again. And hence fails to compile in the end.

Likely the same holds for libfdt_env.h, but this likely works for the time being, since they have the same include guard.

Regards,
Jeroen

#3 lore raw

PATCH 1/1 includes: move openssl headers to include/u-boot

Hi,

Quoted 26 lines · Jeroen Hofstee
Quoted 10 lines · Simon Glass

Hi Jeroen,

Quoted 7 lines · Jeroen Hofstee

commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason.

Quoted 6 lines
Quoted 2 lines

This seems like a much better solution. But I think you should keep the sort order - so u-boot/xxx should go after asm/xxx in the #includes I think.

I considered it, but e.g. common/image.c contains this before this patch:

#include <u-boot/md5.h>
#include <sha1.h>
#include <asm/errno.h>
#include <asm/io.h>

Quoted 5 lines

While I can rearrange them, I think it should be a separate patch, since it is not sorted in the first place. Furthermore if possible I would prefer this commit to go into the current release and hence want to keep it as short as possible. What I hadn't realized with the original patch is that we don't replace the header but include them all.

OK with me, will await the follow-up patch.

Also I built it for everything and saw no regressions.

./tools/buildman/buildman -b try-jer -s
Summary of 2 commits for 1198 boards (32 threads, 1 job per thread) 01: Merge branch 'master' of git://git.denx.de/u-boot-mmc
blackfin: + bf609-ezkit

      m68k: +   M5249EVB M54418TWR_serial_rmii M5253DEMO TASREG

M5235EVB M54418TWR_nand_mii M54418TWR_nand_rmii_lowfreq M54418TWR_nand_rmii M54418TWR M5253EVBE M5235EVB_Flash32 M54418TWR_serial_mii M5272C3
powerpc: + neo io dlvision-10g P1022DS_36BIT iocon kilauea
socrates O2DNT2_RAMBOOT rainier NSCU MPC832XEMDS_HOST_33 mcc200_highboot_SDRAM quantum

        sh: +   rsk7269 rsk7264 rsk7203
     nios2: +   nios2-generic PCI5441 PK1C20
microblaze: +   microblaze-generic
  openrisc: +   openrisc-generic
       arm: +   highbank lager_nor integratorcp_cm920t omap4_sdp4430

sama5d3_xplained_mmc mx53loco omap4_panda duovero Cubietruck lager k2hk_evm koelsch_nor koelsch trats2
02: includes: move openssl headers to include/u-boot

Regards,
Simon

#4 lore raw
In reply to Jeroen Hofstee
Quoted 9 lines · Jeroen Hofstee

commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140619/94c53377/attachment.pgp>