Get all of the files
diff --git a/src/Encrypt.c b/src/Encrypt.c
index 408bdcc..089377a 100644
--- a/src/Encrypt.c
+++ b/src/Encrypt.c
@@ -14,8 +14,6 @@
void _COSE_Enveloped_Release(COSE_Enveloped * p);
-byte RgbDontUse[8 * 1024]; // Remove this array when we can compute the size of a cbor serialization without this hack.
-
COSE * EnvelopedRoot = NULL;
/*! \private
@@ -824,7 +822,7 @@
CHECK_CONDITION_CBOR(cn_cbor_array_append(pAuthData, ptmp, &cbor_error), cbor_error);
ptmp = NULL;
- cbAuthData = cn_cbor_encoder_write(RgbDontUse, 0, sizeof(RgbDontUse), pAuthData);
+ cbAuthData = cn_cbor_encode_size(pAuthData);
pbAuthData = (byte *)COSE_CALLOC(cbAuthData, 1, context);
CHECK_CONDITION(pbAuthData != NULL, COSE_ERR_OUT_OF_MEMORY);
CHECK_CONDITION((size_t)cn_cbor_encoder_write(pbAuthData, 0, cbAuthData, pAuthData) == cbAuthData, COSE_ERR_CBOR);
diff --git a/src/MacMessage.c b/src/MacMessage.c
index 0c085c7..6fe434b 100644
--- a/src/MacMessage.c
+++ b/src/MacMessage.c
@@ -13,8 +13,6 @@
#include "configure.h"
#include "crypto.h"
-byte RgbDontUse2[8 * 1024]; // Remove this array when we can compute the size of a cbor serialization without this hack.
-
COSE * MacRoot = NULL;
/*! \private
@@ -279,7 +277,7 @@
ptmp = NULL;
// Turn it into bytes
- cbAuthData = cn_cbor_encoder_write(RgbDontUse2, 0, sizeof(RgbDontUse2), pAuthData);
+ cbAuthData = cn_cbor_encode_size(pAuthData);
CHECK_CONDITION(cbAuthData > 0, COSE_ERR_CBOR);
pbAuthData = (byte *)COSE_CALLOC(cbAuthData, 1, context);
CHECK_CONDITION(pbAuthData != NULL, COSE_ERR_OUT_OF_MEMORY);
diff --git a/src/Sign0.c b/src/Sign0.c
index b08ce5e..be725d5 100644
--- a/src/Sign0.c
+++ b/src/Sign0.c
@@ -246,9 +246,6 @@
}
-byte RgbDontUse4[8 * 1024];
-byte RgbDontUseSign[8 * 1024];
-
static bool CreateSign0AAD(COSE_Sign0Message * pMessage, byte ** ppbToSign, size_t * pcbToSign, char * szContext, cose_errback * perr)
{
cn_cbor * pArray = NULL;
@@ -290,7 +287,7 @@
cn = NULL;
- cbToSign = cn_cbor_encoder_write(RgbDontUse4, 0, sizeof(RgbDontUse4), pArray);
+ cbToSign = cn_cbor_encode_size(pArray);
CHECK_CONDITION(cbToSign > 0, COSE_ERR_CBOR);
pbToSign = (byte *)COSE_CALLOC(cbToSign, 1, context);
CHECK_CONDITION(pbToSign != NULL, COSE_ERR_OUT_OF_MEMORY);