security: Generate random block in Tpm.

Change-Id: Ia65d32802ed0ebc76605ae7975ea02f4c2db737d
diff --git a/src/security/sec-tpm-memory.cpp b/src/security/sec-tpm-memory.cpp
index a72e385..a115d48 100644
--- a/src/security/sec-tpm-memory.cpp
+++ b/src/security/sec-tpm-memory.cpp
@@ -13,6 +13,7 @@
 #include <openssl/ssl.h>
 #include <openssl/sha.h>
 #include <openssl/rsa.h>
+#include <cryptopp/osrng.h>
 
 using namespace std;
 
@@ -154,4 +155,16 @@
     return false;
 }
 
+bool
+SecTpmMemory::generateRandomBlock(uint8_t* res, size_t size)
+{
+  try{
+    CryptoPP::AutoSeededRandomPool rng;
+    rng.GenerateBlock(res, size);
+    return true;
+  }catch(const CryptoPP::Exception& e){
+    return false;
+  }
+}
+
 }