refactor: remove more extern
diff --git a/src/Encrypt.c b/src/Encrypt.c
index 806a0dd..9ba37f1 100644
--- a/src/Encrypt.c
+++ b/src/Encrypt.c
@@ -19,7 +19,7 @@
#if INCLUDE_ENCRYPT || INCLUDE_MAC
void _COSE_Enveloped_Release(COSE_Enveloped * p);
-COSE * EnvelopedRoot = NULL;
+static COSE * EnvelopedRoot = NULL;
#endif
#if INCLUDE_ENCRYPT
diff --git a/src/Encrypt0.c b/src/Encrypt0.c
index 9012fe2..ad6b84c 100644
--- a/src/Encrypt0.c
+++ b/src/Encrypt0.c
@@ -17,7 +17,7 @@
#if INCLUDE_ENCRYPT0 || INCLUDE_MAC0
void _COSE_Encrypt_Release(COSE_Encrypt * p);
-COSE * EncryptRoot = NULL;
+static COSE * EncryptRoot = NULL;
#endif
#if INCLUDE_ENCRYPT0
diff --git a/src/MacMessage.c b/src/MacMessage.c
index b09870a..0ee00a3 100644
--- a/src/MacMessage.c
+++ b/src/MacMessage.c
@@ -17,7 +17,7 @@
#if INCLUDE_MAC
-COSE * MacRoot = NULL;
+static COSE * MacRoot = NULL;
/*! \private
* @brief Test if a HCOSE_MAC handle is valid
diff --git a/src/MacMessage0.c b/src/MacMessage0.c
index e9368d0..0f06095 100644
--- a/src/MacMessage0.c
+++ b/src/MacMessage0.c
@@ -17,7 +17,7 @@
#if INCLUDE_MAC0
-COSE * Mac0Root = NULL;
+static COSE * Mac0Root = NULL;
/*! \private
* @brief Test if a HCOSE_MAC0 handle is valid
diff --git a/src/Recipient.c b/src/Recipient.c
index 761f52b..8f103cb 100644
--- a/src/Recipient.c
+++ b/src/Recipient.c
@@ -9,11 +9,11 @@
#include "crypto.h"
#if INCLUDE_ENCRYPT || INCLUDE_ENCRYPT0 || INCLUDE_MAC || INCLUDE_MAC0
-extern bool BuildContextBytes(COSE * pcose, int algID, size_t cbitKey, byte ** ppbContext, size_t * pcbContext, CBOR_CONTEXT_COMMA cose_errback * perr);
+static bool BuildContextBytes(COSE * pcose, int algID, size_t cbitKey, byte ** ppbContext, size_t * pcbContext, CBOR_CONTEXT_COMMA cose_errback * perr);
#endif
#if INCLUDE_ENCRYPT || INCLUDE_MAC
-COSE* RecipientRoot = NULL;
+static COSE* RecipientRoot = NULL;
/*! \private
* @brief Test if a HCOSE_RECIPIENT handle is valid
@@ -1215,7 +1215,7 @@
#endif
#if INCLUDE_ENCRYPT || INCLUDE_ENCRYPT0 || INCLUDE_MAC || INCLUDE_MAC0
-bool BuildContextBytes(COSE * pcose, int algID, size_t cbitKey, byte ** ppbContext, size_t * pcbContext, CBOR_CONTEXT_COMMA cose_errback * perr)
+static bool BuildContextBytes(COSE * pcose, int algID, size_t cbitKey, byte ** ppbContext, size_t * pcbContext, CBOR_CONTEXT_COMMA cose_errback * perr)
{
cn_cbor * pArray;
cn_cbor_errback cbor_error;
diff --git a/src/Sign.c b/src/Sign.c
index c9c04fd..d0190aa 100644
--- a/src/Sign.c
+++ b/src/Sign.c
@@ -10,7 +10,7 @@
#if INCLUDE_SIGN
-COSE * SignRoot = NULL;
+static COSE * SignRoot = NULL;
/*! \private
* @brief Test if a HCOSE_SIGN handle is valid
@@ -26,7 +26,7 @@
* @returns result of check
*/
-bool IsValidSignHandle(HCOSE_SIGN h)
+static bool IsValidSignHandle(HCOSE_SIGN h)
{
COSE_SignMessage * p = (COSE_SignMessage *)h;
diff --git a/src/Sign1.c b/src/Sign1.c
index f71c8ce..60f89f1 100644
--- a/src/Sign1.c
+++ b/src/Sign1.c
@@ -15,7 +15,7 @@
bool _COSE_Signer0_validate(COSE_Sign1Message * pSign, const cn_cbor * pKey, cose_errback * perr);
void _COSE_Sign1_Release(COSE_Sign1Message * p);
-COSE * Sign1Root = NULL;
+static COSE * Sign1Root = NULL;
/*! \private
* @brief Test if a HCOSE_SIGN1 handle is valid
diff --git a/src/SignerInfo.c b/src/SignerInfo.c
index 8898916..8410802 100644
--- a/src/SignerInfo.c
+++ b/src/SignerInfo.c
@@ -14,9 +14,7 @@
#if INCLUDE_SIGN
-extern bool IsValidSignHandle(HCOSE_SIGN h);
-
-COSE * SignerRoot = NULL;
+static COSE * SignerRoot = NULL;
bool IsValidSignerHandle(HCOSE_SIGNER h)
{
@@ -110,7 +108,7 @@
return NULL;
}
-bool BuildToBeSigned(byte ** ppbToSign, size_t * pcbToSign, const cn_cbor * pcborBody, const cn_cbor * pcborProtected, const cn_cbor * pcborProtectedSign, const byte * pbExternal, size_t cbExternal, CBOR_CONTEXT_COMMA cose_errback * perr)
+static bool BuildToBeSigned(byte ** ppbToSign, size_t * pcbToSign, const cn_cbor * pcborBody, const cn_cbor * pcborProtected, const cn_cbor * pcborProtectedSign, const byte * pbExternal, size_t cbExternal, CBOR_CONTEXT_COMMA cose_errback * perr)
{
cn_cbor * pArray = NULL;
cn_cbor_errback cbor_error;
diff --git a/src/crypto.h b/src/crypto.h
index 5a069d2..2585bc9 100644
--- a/src/crypto.h
+++ b/src/crypto.h
@@ -33,10 +33,9 @@
bool AES_KW_Encrypt(COSE_RecipientInfo * pcose, const byte * pbKeyIn, int cbitKey, const byte * pbContent, int cbContent, cose_errback * perr);
-extern bool AES_CMAC_Validate(COSE_MacMessage * pcose, int KeySize, int TagSize, const byte * pbKey, int cbitKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
-
-extern bool AES_CBC_MAC_Create(COSE_MacMessage * pcose, int TagSize, const byte * pbKey, size_t cbKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
-extern bool AES_CBC_MAC_Validate(COSE_MacMessage * pcose, int TagSize, const byte * pbKey, size_t cbitKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
+bool AES_CMAC_Validate(COSE_MacMessage * pcose, int KeySize, int TagSize, const byte * pbKey, int cbitKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
+bool AES_CBC_MAC_Create(COSE_MacMessage * pcose, int TagSize, const byte * pbKey, size_t cbKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
+bool AES_CBC_MAC_Validate(COSE_MacMessage * pcose, int TagSize, const byte * pbKey, size_t cbitKey, const byte * pbAuthData, size_t cbAuthData, cose_errback * perr);
/**
* Perform an HMAC Creation operation
diff --git a/src/mbedtls.c b/src/mbedtls.c
index 4cf3e9f..462120e 100644
--- a/src/mbedtls.c
+++ b/src/mbedtls.c
@@ -21,7 +21,7 @@
#include "mbedtls/ecdh.h"
#include "mbedtls/nist_kw.h"
-bool FUseCompressed = true;
+static bool FUseCompressed = true;
#define MIN(A, B) ((A) < (B) ? (A) : (B))
diff --git a/src/openssl.c b/src/openssl.c
index 297fa33..c1f1e3f 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -17,7 +17,7 @@
#include <openssl/ecdh.h>
#include <openssl/rand.h>
-bool FUseCompressed = true;
+static bool FUseCompressed = true;
#define MIN(A, B) ((A) < (B) ? (A) : (B))
diff --git a/test/json.c b/test/json.c
index d3bd7bc..a786744 100644
--- a/test/json.c
+++ b/test/json.c
@@ -144,7 +144,7 @@
}
-extern void build_decoding_table();
+static void build_decoding_table();
static char encoding_table[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
@@ -237,7 +237,7 @@
}
-void build_decoding_table() {
+static void build_decoding_table() {
decoding_table = malloc(256);
diff --git a/test/json.h b/test/json.h
index 4e2d60f..6dbef75 100644
--- a/test/json.h
+++ b/test/json.h
@@ -1,6 +1,5 @@
#pragma once
-extern const cn_cbor * ParseJson(const char * fileName);
-
-extern unsigned char *base64_decode(const char *data, size_t input_length, size_t *output_length);
-extern unsigned char* hex_decode(const char* data, size_t input_length, size_t* output_length);
+const cn_cbor * ParseJson(const char * fileName);
+unsigned char *base64_decode(const char *data, size_t input_length, size_t *output_length);
+unsigned char* hex_decode(const char* data, size_t input_length, size_t* output_length);