Re: [PATCH ima-evm-utils v4] evmctl: Use secure heap for private keys and passwords

From
Vitaly Chikunov <hidden>
Date
2021-09-13 18:07:28
Reply to
Mimi Zohar, 2021-09-13
Mimi,

On Mon, Sep 13, 2021 at 01:51:58PM -0400, Mimi Zohar wrote:
quoted
quoted
Assuming we aren't guaranteed that the heap size is allocated, should
we check (e.g. OPENSSL_secure_actual_size())?
We guaranteed that secure heap is allocated by return value of
CRYPTO_secure_malloc_init.

OPENSSL_secure_actual_size tell if OPENSSL_secure_malloc is actually
provided bigger memory fragment than we requested (to reduce
fragmentation). Why care about it?
We wouldn't care, assuming we're guaranteed the heap size requested was
allocated and not the minimum heap size.  Hm, wondering what would be
the purpose of the minimum heap size ...
Perhaps, just to control heap fragmentation.
quoted
quoted
quoted
+	if (!CRYPTO_secure_malloc_init(8192, 64))
+		log_err("CRYPTO_secure_malloc_init() failed\n");
Either change the test to "!= 1" or also log "and 2 if successful but
the heap could not be protected by memory mapping."
Why should we care about implementation details of successful
allocation? If they don't think it's secure heap they should not return
success. And they say about its return value "and 2 if successful but",
so it's successful.
If you're correct, then there is no reason ever for returning 2. 
Without documentation or digging into OpenSSL, this makes no sense to
me.  Perhaps "secure heap" has some kernel dependency, requires HW, or
something else entirely.  Not that there is much we could or would do,
but simply ignoring it just seems wrong.
I looked at CRYPTO_secure_malloc_init and it seems they return 2 if
mlock/madvise is failed. I think it's major enough to report it, so I
will add it.

Thanks,
Thread (9 messages) 9 messages, 3 authors, last reply 2021-09-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help