diff options
Diffstat (limited to 'test/tpm_test/testlib')
-rw-r--r-- | test/tpm_test/testlib/common.c | 17 | ||||
-rw-r--r-- | test/tpm_test/testlib/common.h | 18 | ||||
-rw-r--r-- | test/tpm_test/testlib/trng.h | 6 | ||||
-rw-r--r-- | test/tpm_test/testlib/util.h | 6 |
4 files changed, 47 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); +} diff --git a/test/tpm_test/testlib/common.h b/test/tpm_test/testlib/common.h new file mode 100644 index 0000000000..9fdd7ebcae --- /dev/null +++ b/test/tpm_test/testlib/common.h @@ -0,0 +1,18 @@ +/* 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. + */ + +#ifndef __EC_TEST_TPM_TEST_TESTLIB_COMMON_H +#define __EC_TEST_TPM_TEST_TESTLIB_COMMON_H + +#include "dcrypto.h" + +#include <inttypes.h> +#include <stdlib.h> +#include <sys/param.h> + +void rand_bytes(void *buf, size_t num); + +#endif /* ! __EC_TEST_TPM_TEST_TESTLIB_COMMON_H */ + diff --git a/test/tpm_test/testlib/trng.h b/test/tpm_test/testlib/trng.h new file mode 100644 index 0000000000..07c82f3333 --- /dev/null +++ b/test/tpm_test/testlib/trng.h @@ -0,0 +1,6 @@ +/* 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. + */ + +/* Dummy empty file, just to make test compilation work. */ diff --git a/test/tpm_test/testlib/util.h b/test/tpm_test/testlib/util.h new file mode 100644 index 0000000000..07c82f3333 --- /dev/null +++ b/test/tpm_test/testlib/util.h @@ -0,0 +1,6 @@ +/* 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. + */ + +/* Dummy empty file, just to make test compilation work. */ |