Closed keepkeyjon closed 5 years ago
mnemonic_from_data()s interface prevents cleaning up secrets in RAM after it has done the conversion, since it returns a const char * into a static buffer.
mnemonic_from_data()
const char *
https://github.com/trezor/trezor-crypto/blob/c34e8ab3bd50243b78331e2aecf1aa169003ca28/bip39.c#L73
https://github.com/trezor/trezor-crypto/blob/c34e8ab3bd50243b78331e2aecf1aa169003ca28/bip39.c#L88
While it does mark the memory CONFIDENTIAL, it would be better if the caller could zero it at its earliest convenience. A couple of options I see:
CONFIDENTIAL
char *
memzero(foo, strlen(foo))
data
memzero
Which is preferable to you? I'm happy to submit PR(s).
Addressed in https://github.com/trezor/trezor-crypto/commit/d1c52401e4c76c74a10455682ace0655b7aa644c
Thanks
mnemonic_from_data()
s interface prevents cleaning up secrets in RAM after it has done the conversion, since it returns aconst char *
into a static buffer.https://github.com/trezor/trezor-crypto/blob/c34e8ab3bd50243b78331e2aecf1aa169003ca28/bip39.c#L73
https://github.com/trezor/trezor-crypto/blob/c34e8ab3bd50243b78331e2aecf1aa169003ca28/bip39.c#L88
While it does mark the memory
CONFIDENTIAL
, it would be better if the caller could zero it at its earliest convenience. A couple of options I see:char *
so the contents can getmemzero(foo, strlen(foo))
-ed as necessary.data
argument is null,memzero
the buffer.Which is preferable to you? I'm happy to submit PR(s).