<div dir="ltr"><div dir="ltr">Did you try to create your own RAND_METHOD and set it as default on loading the engine?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 30, 2019 at 5:40 PM Frederick Gotham <<a href="mailto:cauldwell.thomas@gmail.com">cauldwell.thomas@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I'm working on Linux with a x86-64 CPU.<br>
<br>
I have a TPM2 chip, and so I want OpenSSL to do all of its encryption <br>
and random number generation through the TPM2 chip.<br>
<br>
In the event that the chip fails, I do NOT want there to be a backup <br>
system. I do NOT want any kind of software psuedorandom number generator <br>
nor any software encryption routines.<br>
<br>
The engine that I'm using for OpenSSL is "libtpm2tss.so". This engine <br>
library requires two more libraries, "libtss2-tcti-device.so" and <br>
"libtss2-tcti-mssim.so". (The former is for using the TPM2 chip, whereas <br>
the latter is a software simulator).<br>
<br>
As I don't want to have a simulator, I tried simply deleting the <br>
simulator library, but this caused linkage problems for the mother <br>
engine library. As an alternative, I made a new dummy library in which <br>
all of the functions return an error value, and I put this dummy library <br>
in the place of the simulator. This transplant went fine.<br>
<br>
It appears that OpenSSL will kick and scream and refuse to die not <br>
matter how hard you hit it. If I try to generate a random number like <br>
this:<br>
<br>
    openssl rand -hex 8<br>
<br>
Then it seems it will try in this order:<br>
<br>
1) The TPM2 chip<br>
2) The software simulator of the TPM2 chip<br>
3) The built-in RDRAND number<br>
4) Another one that I can't find<br>
<br>
I have recompiled OpenSSL with the flag OPENSSL_NO_RDRAND to get rid of <br>
the in-built engine. I have even done "rm /dev/random" and "rm <br>
/dev/urandom", but SOME HOW, SOME WAY, I'm still getting output when I <br>
run openssl rand -hex 8.<br>
<br>
How on earth to get OpenSSL to simply give up? I simply cannot have it <br>
use anything other than my TPM2 chip.<br>
<br>
Frederick<br>
<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">SY, Dmitry Belyavsky</div></div>