fix(tools): update the fiptool and certtool to fix POSIX build
This patch fixes below issue raised:
https://github.com/TrustedFirmware-A/trusted-firmware-a/issues/8
https://github.com/TrustedFirmware-A/trusted-firmware-a/issues/9
https://github.com/TrustedFirmware-A/trusted-firmware-a/issues/10
Change-Id: I521bf7410535ffe49198789ba183cc401b3b88a0
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
diff --git a/tools/cert_create/src/main.c b/tools/cert_create/src/main.c
index edc2d68..aa21206 100644
--- a/tools/cert_create/src/main.c
+++ b/tools/cert_create/src/main.c
@@ -4,6 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#define _POSIX_C_SOURCE 200809L
+
#include <assert.h>
#include <ctype.h>
#include <getopt.h>
@@ -69,16 +71,6 @@
static const char build_msg[] = "Built : " __TIME__ ", " __DATE__;
static const char platform_msg[] = PLAT_MSG;
-static char *strdup(const char *str)
-{
- int n = strlen(str) + 1;
- char *dup = malloc(n);
- if (dup) {
- strcpy(dup, str);
- }
- return dup;
-}
-
static const char *key_algs_str[] = {
[KEY_ALG_RSA] = "rsa",
#ifndef OPENSSL_NO_EC
@@ -178,7 +170,7 @@
{
cert_t *cert;
ext_t *ext;
- key_t *key;
+ cert_key_t *key;
int i, j;
bool valid_size;
@@ -303,7 +295,7 @@
STACK_OF(X509_EXTENSION) * sk;
X509_EXTENSION *cert_ext = NULL;
ext_t *ext;
- key_t *key;
+ cert_key_t *key;
cert_t *cert;
FILE *file;
int i, j, ext_nid, nvctr;