summaryrefslogtreecommitdiff
path: root/test/tpm_test/testlib/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tpm_test/testlib/common.c')
-rw-r--r--test/tpm_test/testlib/common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/tpm_test/testlib/common.c b/test/tpm_test/testlib/common.c
new file mode 100644
index 0000000000..35b07196aa
--- /dev/null
+++ b/test/tpm_test/testlib/common.c
@@ -0,0 +1,17 @@
+/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <openssl/rand.h>
+
+void rand_bytes(void *buf, size_t num)
+{
+ assert(RAND_bytes(buf, num) == 1);
+}