update common. to fuzz_common.h

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
diff --git a/programs/fuzz/CMakeLists.txt b/programs/fuzz/CMakeLists.txt
index 61c5b63..bd9bf91 100644
--- a/programs/fuzz/CMakeLists.txt
+++ b/programs/fuzz/CMakeLists.txt
@@ -31,7 +31,7 @@
         $<TARGET_OBJECTS:mbedtls_test_helpers>
         $<TARGET_OBJECTS:mbedtls_test>)
     if(NOT FUZZINGENGINE_LIB)
-        list(APPEND exe_sources onefile.c)
+        list(APPEND exe_sources ${MBEDTLS_DIR}/tf-psa-crypto/programs/fuzz/onefile.c)
     endif()
 
     # This emulates "if ( ... IN_LIST ... )" which becomes available in CMake 3.3
diff --git a/programs/fuzz/fuzz_client.c b/programs/fuzz/fuzz_client.c
index 6d3b73f..440c024 100644
--- a/programs/fuzz/fuzz_client.c
+++ b/programs/fuzz/fuzz_client.c
@@ -4,7 +4,7 @@
 #include "mbedtls/entropy.h"
 #include "mbedtls/ctr_drbg.h"
 #include "test/certs.h"
-#include "common.h"
+#include "fuzz_common.h"
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/programs/fuzz/fuzz_dtlsclient.c b/programs/fuzz/fuzz_dtlsclient.c
index efe1362..7a1da13 100644
--- a/programs/fuzz/fuzz_dtlsclient.c
+++ b/programs/fuzz/fuzz_dtlsclient.c
@@ -3,7 +3,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include "common.h"
+#include "fuzz_common.h"
 #include "mbedtls/ssl.h"
 #if defined(MBEDTLS_SSL_PROTO_DTLS)
 #include "mbedtls/entropy.h"
diff --git a/programs/fuzz/fuzz_dtlsserver.c b/programs/fuzz/fuzz_dtlsserver.c
index 31eb514..98a7021 100644
--- a/programs/fuzz/fuzz_dtlsserver.c
+++ b/programs/fuzz/fuzz_dtlsserver.c
@@ -3,7 +3,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include "common.h"
+#include "fuzz_common.h"
 #include "mbedtls/ssl.h"
 #include "test/certs.h"
 #if defined(MBEDTLS_SSL_PROTO_DTLS)
diff --git a/programs/fuzz/fuzz_pkcs7.c b/programs/fuzz/fuzz_pkcs7.c
index 9ec9351..f236190 100644
--- a/programs/fuzz/fuzz_pkcs7.c
+++ b/programs/fuzz/fuzz_pkcs7.c
@@ -2,7 +2,7 @@
 
 #include <stdint.h>
 #include "mbedtls/pkcs7.h"
-#include "common.h"
+#include "fuzz_common.h"
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
diff --git a/programs/fuzz/fuzz_server.c b/programs/fuzz/fuzz_server.c
index bb9dd0a..05b7480 100644
--- a/programs/fuzz/fuzz_server.c
+++ b/programs/fuzz/fuzz_server.c
@@ -5,7 +5,7 @@
 #include "mbedtls/ctr_drbg.h"
 #include "mbedtls/ssl_ticket.h"
 #include "test/certs.h"
-#include "common.h"
+#include "fuzz_common.h"
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/programs/fuzz/fuzz_x509crl.c b/programs/fuzz/fuzz_x509crl.c
index 2840fbb..92e0f5d 100644
--- a/programs/fuzz/fuzz_x509crl.c
+++ b/programs/fuzz/fuzz_x509crl.c
@@ -2,7 +2,7 @@
 
 #include <stdint.h>
 #include "mbedtls/x509_crl.h"
-#include "common.h"
+#include "fuzz_common.h"
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
diff --git a/programs/fuzz/fuzz_x509crt.c b/programs/fuzz/fuzz_x509crt.c
index 29331b9..c99ae2e 100644
--- a/programs/fuzz/fuzz_x509crt.c
+++ b/programs/fuzz/fuzz_x509crt.c
@@ -2,7 +2,7 @@
 
 #include <stdint.h>
 #include "mbedtls/x509_crt.h"
-#include "common.h"
+#include "fuzz_common.h"
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
diff --git a/programs/fuzz/fuzz_x509csr.c b/programs/fuzz/fuzz_x509csr.c
index e0aaabc..4ab071f 100644
--- a/programs/fuzz/fuzz_x509csr.c
+++ b/programs/fuzz/fuzz_x509csr.c
@@ -2,7 +2,7 @@
 
 #include <stdint.h>
 #include "mbedtls/x509_csr.h"
-#include "common.h"
+#include "fuzz_common.h"
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
diff --git a/programs/fuzz/onefile.c b/programs/fuzz/onefile.c
deleted file mode 100644
index 6c02a64..0000000
--- a/programs/fuzz/onefile.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#define MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "common.h"
-
-/* This file doesn't use any Mbed TLS function, but grab mbedtls_config.h anyway
- * in case it contains platform-specific #defines related to malloc or
- * stdio functions. */
-#include "mbedtls/build_info.h"
-
-int main(int argc, char **argv)
-{
-    FILE *fp;
-    uint8_t *Data;
-    size_t Size;
-    const char *argv0 = argv[0] == NULL ? "PROGRAM_NAME" : argv[0];
-
-    if (argc != 2) {
-        fprintf(stderr, "Usage: %s REPRODUCER_FILE\n", argv0);
-        return 1;
-    }
-    //opens the file, get its size, and reads it into a buffer
-    fp = fopen(argv[1], "rb");
-    if (fp == NULL) {
-        fprintf(stderr, "%s: Error in fopen\n", argv0);
-        perror(argv[1]);
-        return 2;
-    }
-    if (fseek(fp, 0L, SEEK_END) != 0) {
-        fprintf(stderr, "%s: Error in fseek(SEEK_END)\n", argv0);
-        perror(argv[1]);
-        fclose(fp);
-        return 2;
-    }
-    Size = ftell(fp);
-    if (Size == (size_t) -1) {
-        fprintf(stderr, "%s: Error in ftell\n", argv0);
-        perror(argv[1]);
-        fclose(fp);
-        return 2;
-    }
-    if (fseek(fp, 0L, SEEK_SET) != 0) {
-        fprintf(stderr, "%s: Error in fseek(0)\n", argv0);
-        perror(argv[1]);
-        fclose(fp);
-        return 2;
-    }
-    Data = malloc(Size);
-    if (Data == NULL) {
-        fprintf(stderr, "%s: Could not allocate memory\n", argv0);
-        perror(argv[1]);
-        fclose(fp);
-        return 2;
-    }
-    if (fread(Data, Size, 1, fp) != 1) {
-        fprintf(stderr, "%s: Error in fread\n", argv0);
-        perror(argv[1]);
-        free(Data);
-        fclose(fp);
-        return 2;
-    }
-
-    //launch fuzzer
-    LLVMFuzzerTestOneInput(Data, Size);
-    free(Data);
-    fclose(fp);
-    return 0;
-}