aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/tpm/tpm.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-11-17 14:54:21 -0500
committerJack Lloyd <[email protected]>2018-11-17 22:50:26 -0500
commit432d31546eb335bb96c6b2a8c58f0168266387ec (patch)
tree2397468c243906a08eea08b9376a9922346e6856 /src/lib/prov/tpm/tpm.cpp
parent6b3a827fb493ad884c7443092ba8f9967636b3c8 (diff)
Avoid calling memset, memcpy within library code
Prefer using wrappers in mem_utils for this. Current exception is where memcpy is being used to convert between two different types, since copy_mem requires input and output pointers have the same type. There should be a new function to handle conversion-via-memcpy operation.
Diffstat (limited to 'src/lib/prov/tpm/tpm.cpp')
-rw-r--r--src/lib/prov/tpm/tpm.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/prov/tpm/tpm.cpp b/src/lib/prov/tpm/tpm.cpp
index 4847b0df6..ffbc220d6 100644
--- a/src/lib/prov/tpm/tpm.cpp
+++ b/src/lib/prov/tpm/tpm.cpp
@@ -191,7 +191,7 @@ void TPM_Context::gen_random(uint8_t out[], size_t out_len)
{
BYTE* mem;
TSPI_CHECK_SUCCESS(::Tspi_TPM_GetRandom(m_tpm, out_len, &mem));
- std::memcpy(out, mem, out_len);
+ copy_mem(out, reinterpret_cast<const uint8_t*>(mem), out_len);
TSPI_CHECK_SUCCESS(::Tspi_Context_FreeMemory(m_ctx, mem));
}