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