Better zeroizing in CryptoKey.
This commit is contained in:
parent
8e68f2e5f4
commit
a486783d3d
1 changed files with 2 additions and 2 deletions
|
@ -84,14 +84,14 @@ Error CryptoKeyMbedTLS::save(String p_path) {
|
|||
int ret = mbedtls_pk_write_key_pem(&pkey, w, sizeof(w));
|
||||
if (ret != 0) {
|
||||
memdelete(f);
|
||||
memset(w, 0, sizeof(w)); // Zeroize anything we might have written.
|
||||
mbedtls_platform_zeroize(w, sizeof(w)); // Zeroize anything we might have written.
|
||||
ERR_FAIL_V_MSG(FAILED, "Error writing key '" + itos(ret) + "'.");
|
||||
}
|
||||
|
||||
size_t len = strlen((char *)w);
|
||||
f->store_buffer(w, len);
|
||||
memdelete(f);
|
||||
memset(w, 0, sizeof(w)); // Zeroize temporary buffer.
|
||||
mbedtls_platform_zeroize(w, sizeof(w)); // Zeroize temporary buffer.
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue