Re: How to use SHA256 in a QEMU device

2020-11-20 Thread Alberto Garcia
On Fri, Nov 20, 2020 at 09:33:18PM +, Weiss, Howard wrote:
> I am writing a device which uses SHA256
  [...]
> I have tried
> 
>   #include 

You don't have to use openssl, QEMU already provides those algorithms,
see include/crypto/hash.h

Berto



How to use SHA256 in a QEMU device

2020-11-20 Thread Weiss, Howard
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 

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?