summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/tpm_test/Makefile3
-rw-r--r--test/tpm_test/bn_test.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/test/tpm_test/Makefile b/test/tpm_test/Makefile
index 985e0fffcb..95c407c03f 100644
--- a/test/tpm_test/Makefile
+++ b/test/tpm_test/Makefile
@@ -30,9 +30,10 @@ else
# Use BOARD=cr50 specific implementation
vpath %c $(src) ../../board/cr50/dcrypto $(src)/testlib
CFLAGS += -I../../board/cr50/dcrypto
+CFLAGS += -DCR50_DCRYPTO
endif
-CFLAGS += -fPIC
+CFLAGS += -O2 -fPIC
CFLAGS += -I ${PYTHON_INCLUDE}
CFLAGS += -I../../../../third_party/cryptoc/include
CFLAGS += -I../../board/cr50
diff --git a/test/tpm_test/bn_test.c b/test/tpm_test/bn_test.c
index 78268d9ba7..01a2119daa 100644
--- a/test/tpm_test/bn_test.c
+++ b/test/tpm_test/bn_test.c
@@ -2,7 +2,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#ifdef CR50_DCRYPTO
+/* some of the functions became internal in CR50 */
#include "internal.h"
+#else
+#include "dcrypto.h"
+#endif
#include <assert.h>
#include <stdio.h>
@@ -403,6 +408,8 @@ void watchdog_reload(void)
{
}
+#ifdef CR50_DCRYPTO
+/* For CR50 we need to mock additional functions. */
bool fips_rand_bytes(void *buffer, size_t len)
{
uint8_t *b, *end;
@@ -425,6 +432,7 @@ uint64_t fips_trng_rand32(void)
return (uint64_t)(rand_r(&seed) & 0xffffffff) | (1ULL << 32);
}
+#endif
int main(void)
{