Browse Source

build: Link user-only with crypto random number objects

For user-only, we require only the random number bits of the
crypto subsystem.  Rename crypto-aes-obj-y to crypto-user-obj-y,
and add the random number objects, plus init.o to handle any
extra stuff the crypto library requires.

Move the crypto libraries from libs_softmmu and libs_tools to
LIBS, so that they are universally used.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
master
Richard Henderson 4 weeks ago
parent
commit
243dc2cf95
5 changed files with 14 additions and 16 deletions
  1. 2
    2
      Makefile
  2. 1
    1
      Makefile.objs
  3. 2
    2
      Makefile.target
  4. 3
    6
      configure
  5. 6
    5
      crypto/Makefile.objs

+ 2
- 2
Makefile View File

@@ -412,7 +412,7 @@ dummy := $(call unnest-vars,, \
412 412
                 block-obj-y \
413 413
                 block-obj-m \
414 414
                 crypto-obj-y \
415
-                crypto-aes-obj-y \
415
+                crypto-user-obj-y \
416 416
                 qom-obj-y \
417 417
                 io-obj-y \
418 418
                 common-obj-y \
@@ -486,7 +486,7 @@ subdir-slirp: .git-submodule-status
486 486
 	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)")
487 487
 
488 488
 $(SUBDIR_RULES): libqemuutil.a $(common-obj-y) \
489
-	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
489
+	$(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY))
490 490
 
491 491
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
492 492
 # Only keep -O and -g cflags

+ 1
- 1
Makefile.objs View File

@@ -25,7 +25,7 @@ block-obj-m = block/
25 25
 # crypto-obj-y is code used by both qemu system emulation and qemu-img
26 26
 
27 27
 crypto-obj-y = crypto/
28
-crypto-aes-obj-y = crypto/
28
+crypto-user-obj-y = crypto/
29 29
 
30 30
 #######################################################################
31 31
 # qom-obj-y is code used by both qemu system emulation and qemu-img

+ 2
- 2
Makefile.target View File

@@ -180,7 +180,7 @@ dummy := $(call unnest-vars,.., \
180 180
                block-obj-m \
181 181
                chardev-obj-y \
182 182
                crypto-obj-y \
183
-               crypto-aes-obj-y \
183
+               crypto-user-obj-y \
184 184
                qom-obj-y \
185 185
                io-obj-y \
186 186
                common-obj-y \
@@ -189,7 +189,7 @@ all-obj-y += $(common-obj-y)
189 189
 all-obj-y += $(qom-obj-y)
190 190
 all-obj-$(CONFIG_SOFTMMU) += $(authz-obj-y)
191 191
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
192
-all-obj-$(CONFIG_USER_ONLY) += $(crypto-aes-obj-y)
192
+all-obj-$(CONFIG_USER_ONLY) += $(crypto-user-obj-y)
193 193
 all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
194 194
 all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
195 195
 

+ 3
- 6
configure View File

@@ -2792,8 +2792,7 @@ if test "$gnutls" != "no"; then
2792 2792
         # At least ubuntu 18.04 ships only shared libraries.
2793 2793
         write_c_skeleton
2794 2794
         if compile_prog "" "$gnutls_libs" ; then
2795
-            libs_softmmu="$gnutls_libs $libs_softmmu"
2796
-            libs_tools="$gnutls_libs $libs_tools"
2795
+            LIBS="$gnutls_libs $LIBS"
2797 2796
             QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags"
2798 2797
             pass="yes"
2799 2798
         fi
@@ -2864,8 +2863,7 @@ if test "$nettle" != "no"; then
2864 2863
         # Link test to make sure the given libraries work (e.g for static).
2865 2864
         write_c_skeleton
2866 2865
         if compile_prog "" "$nettle_libs" ; then
2867
-            libs_softmmu="$nettle_libs $libs_softmmu"
2868
-            libs_tools="$nettle_libs $libs_tools"
2866
+            LIBS="$nettle_libs $LIBS"
2869 2867
             QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
2870 2868
             if test -z "$gcrypt"; then
2871 2869
                gcrypt="no"
@@ -2896,8 +2894,7 @@ if test "$gcrypt" != "no"; then
2896 2894
         # Link test to make sure the given libraries work (e.g for static).
2897 2895
         write_c_skeleton
2898 2896
         if compile_prog "" "$gcrypt_libs" ; then
2899
-            libs_softmmu="$gcrypt_libs $libs_softmmu"
2900
-            libs_tools="$gcrypt_libs $libs_tools"
2897
+            LIBS="$gcrypt_libs $LIBS"
2901 2898
             QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags"
2902 2899
             pass="yes"
2903 2900
         fi

+ 6
- 5
crypto/Makefile.objs View File

@@ -19,9 +19,10 @@ crypto-obj-y += tlscredspsk.o
19 19
 crypto-obj-y += tlscredsx509.o
20 20
 crypto-obj-y += tlssession.o
21 21
 crypto-obj-y += secret.o
22
-crypto-obj-$(CONFIG_GCRYPT) += random-gcrypt.o
23
-crypto-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o
24
-crypto-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) += random-platform.o
22
+crypto-rng-obj-$(CONFIG_GCRYPT) += random-gcrypt.o
23
+crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) += random-gnutls.o
24
+crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) += random-platform.o
25
+crypto-obj-y += $(crypto-rng-obj-y)
25 26
 crypto-obj-y += pbkdf.o
26 27
 crypto-obj-$(CONFIG_NETTLE) += pbkdf-nettle.o
27 28
 crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) += pbkdf-gcrypt.o
@@ -35,7 +36,7 @@ crypto-obj-y += block.o
35 36
 crypto-obj-y += block-qcow.o
36 37
 crypto-obj-y += block-luks.o
37 38
 
38
-# Let the userspace emulators avoid linking gnutls/etc
39
-crypto-aes-obj-y = aes.o
39
+# Let the userspace emulators avoid linking stuff they won't use.
40
+crypto-user-obj-y = aes.o $(crypto-rng-obj-y) init.o
40 41
 
41 42
 stub-obj-y += pbkdf-stub.o

Loading…
Cancel
Save