mirror of https://github.com/wolfSSL/wolfssl
fixes for MQX classic with Codewarrior
This commit is contained in:
parent
a89e50b7b7
commit
15a1c9d48e
|
@ -32,7 +32,8 @@
|
|||
/* Macro to disable benchmark */
|
||||
#ifndef NO_CRYPT_BENCHMARK
|
||||
|
||||
#ifdef XMALLOC_USER
|
||||
#if defined(XMALLOC_USER) || defined(FREESCALE_MQX)
|
||||
/* MQX classic needs for EXIT_FAILURE */
|
||||
#include <stdlib.h> /* we're using malloc / free direct here */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -149,6 +149,8 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
|
|||
#elif defined(WOLFSSL_UTASKER)
|
||||
fnDebugMsg((char*)logMessage);
|
||||
fnDebugMsg("\r\n");
|
||||
#elif defined(MQX_USE_IO_OLD)
|
||||
fprintf(_mqxio_stderr, "%s\n", logMessage);
|
||||
#else
|
||||
fprintf(stderr, "%s\n", logMessage);
|
||||
#endif
|
||||
|
|
|
@ -886,6 +886,9 @@ int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw,
|
|||
case WC_PKCS12_ShroudedKeyBag: /* 668 */
|
||||
{
|
||||
byte* k;
|
||||
#ifdef FREESCALE_MQX
|
||||
byte* tmp;
|
||||
#endif
|
||||
WOLFSSL_MSG("PKCS12 Shrouded Key Bag found");
|
||||
if (data[idx++] !=
|
||||
(ASN_CONSTRUCTED | ASN_CONTEXT_SPECIFIC)) {
|
||||
|
@ -911,11 +914,24 @@ int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw,
|
|||
|
||||
if (ret < size) {
|
||||
/* shrink key buffer */
|
||||
#ifdef FREESCALE_MQX
|
||||
/* MQX classic has no realloc */
|
||||
tmp = (byte*)XMALLOC(ret, pkcs12->heap,
|
||||
DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
if (tmp == NULL) {
|
||||
XFREE(k, pkcs12->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
ERROR_OUT(MEMORY_E, exit_pk12par);
|
||||
}
|
||||
XMEMCPY(tmp, k, ret);
|
||||
XFREE(k, pkcs12->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
k = tmp;
|
||||
#else
|
||||
k = (byte*)XREALLOC(k, ret, pkcs12->heap,
|
||||
DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
if (k == NULL) {
|
||||
ERROR_OUT(MEMORY_E, exit_pk12par);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
size = ret;
|
||||
|
||||
|
|
|
@ -686,6 +686,7 @@ extern void uITRON4_free(void *p) ;
|
|||
#include "mfs.h"
|
||||
#if MQX_USE_IO_OLD
|
||||
#include "fio.h"
|
||||
#define NO_STDIO_FILESYSTEM
|
||||
#else
|
||||
#include "nio.h"
|
||||
#endif
|
||||
|
@ -694,6 +695,7 @@ extern void uITRON4_free(void *p) ;
|
|||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC_OVERRIDE
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
|
@ -804,7 +806,8 @@ extern void uITRON4_free(void *p) ;
|
|||
|
||||
#ifdef FREESCALE_KSDK_1_3
|
||||
#include "fsl_device_registers.h"
|
||||
#else
|
||||
#elif !defined(FREESCALE_MQX)
|
||||
/* Classic MQX does not have fsl_common.h */
|
||||
#include "fsl_common.h"
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue