The driver I am working with is patterned on a driver described in " How-to-develop-embedded-software-using-the-QEMU-machine-emulator-by-Apriorit". It uses SHA256 routines so I need to be able to build my driver with openssl.
My problem is that the final link of qemu-system-x86_64 fails per below LINK x86_64-softmmu/qemu-system-x86_64 /usr/bin/ld: ../hw/misc/hello_world_device.o: in function `crypto_set_aes_cbc_key_256': /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:446: undefined reference to `SHA256' /usr/bin/ld: ../hw/misc/hello_world_device.o: in function `DoSha256': /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2300: undefined reference to `SHA256_Init' /usr/bin/ld: /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2328: undefined reference to `SHA256_Update' /usr/bin/ld: /home/howard/qemu-5.1.0/hw/misc/hello_world_device.c:2346: undefined reference to `SHA256_Final' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:219: qemu-system-x86_64] Error 1 make: *** [Makefile:527: x86_64-softmmu/all] Error 2 The final link command is very long and is not work repeating in the email. Via make-n, I have determined that the statement starts and ends as follows printf " %-7s %s\n" "LINK" "x86_64-softmmu/qemu-system-x86_64" && c++ -g -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -fstack-protector-strong -o qemu-system-x86_64 exec.o exec-vary.o ........ -L/home/howard/qemu-5.1.0/capstone -lcapstone -lm -lz -lgthread-2.0 -pthread -lglib-2.0 -lrt If I manually append "-L/usr/local/src/openssl-1.1.1c -lcrypto" to the end of the command, then the link of qemu-system-x86_64 succeeds I am unable to determine how to coerce the make system to add the library reference to the link statment. If tried --extra-ldflags="-L/usr/local/src/openssl-1.1.1c -lcrypto", the text was added at the beginning of the link statement (after -Wl statements and had no effect). What config or make option must I use add the needed text at the end of the link statement Howard Weiss -----Original Message----- From: Qemu-discuss <qemu-discuss-bounces+howard.weiss2=hologic....@nongnu.org> On Behalf Of qemu-discuss-requ...@nongnu.org Sent: Saturday, November 21, 2020 12:00 PM To: qemu-discuss@nongnu.org Subject: Qemu-discuss Digest, Vol 110, Issue 22 External Mail Send Qemu-discuss mailing list submissions to qemu-discuss@nongnu.orgMy To subscribe or unsubscribe via the World Wide Web, visit https://lists.nongnu.org/mailman/listinfo/qemu-discuss or, via email, send a message with subject or body 'help' to qemu-discuss-requ...@nongnu.org You can reach the person managing the list at qemu-discuss-ow...@nongnu.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Qemu-discuss digest..." Today's Topics: 1. How to use SHA256 in a QEMU device (Weiss, Howard) 2. Re: How to use SHA256 in a QEMU device (Alberto Garcia) ---------------------------------------------------------------------- Message: 1 Date: Fri, 20 Nov 2020 21:33:18 +0000 From: "Weiss, Howard" <howard.wei...@hologic.com> To: "qemu-discuss@nongnu.org" <qemu-discuss@nongnu.org> Subject: How to use SHA256 in a QEMU device Message-ID: <mn2pr05mb704039d65c4e965d4a91b6d2bc...@mn2pr05mb7040.namprd05.prod.outlook.com> Content-Type: text/plain; charset="utf-8" I am writing a device which uses SHA256 I use the following to configure the build ./configure -target-list=x86_64-softmmu -enable-sdl -enable-debug -extra-ldflags="'pkg-config -libs openssl'" With PKG_CONFIG_PATH is defined via export PKG_CONFIG_PATH=/usr/local/openssl-1.1.1c How do I correctly incorporate the SHA256 h files in the C source for driver I have tried #include <openssl/sha.h> but this results in a build failure fatal error: openssl.sha.h: No such file or directory I even went so far as to copy the include folder for opensl-1.1.1c to qemu/include/opensll and convert all the #include <...> to #include "...". I can then change my c source to #include "openssl/sha.h" and the device builds but it then fails to link with undefined reference to the various SHA... modules I read an earlier post with suggest including -lssl and -lcrypto in the -extra-cflags and -extra-ldflags options in ./configure but this did not work because -lcrypto is not defined Please advise; PS: Is there a description of the configure process and its options? -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.nongnu.org/archive/html/qemu-discuss/attachments/20201120/504da9ae/attachment.html> ------------------------------ Message: 2 Date: Sat, 21 Nov 2020 01:42:59 +0100 From: Alberto Garcia <be...@igalia.com> To: qemu-discuss@nongnu.org Subject: Re: How to use SHA256 in a QEMU device Message-ID: <20201121004259.ga16...@igalia.com> Content-Type: text/plain; charset=us-ascii On Fri, Nov 20, 2020 at 09:33:18PM +0000, Weiss, Howard wrote: > I am writing a device which uses SHA256 [...] > I have tried > > #include <openssl/sha.h> You don't have to use openssl, QEMU already provides those algorithms, see include/crypto/hash.h Berto ------------------------------ Subject: Digest Footer _______________________________________________ Qemu-discuss mailing list Qemu-discuss@nongnu.org https://lists.nongnu.org/mailman/listinfo/qemu-discuss ------------------------------ End of Qemu-discuss Digest, Vol 110, Issue 22 *********************************************