mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Merge pull request #4050 from julek-wolfssl/devkitpro
Add support for running `wolfcrypt/test/testwolfcrypt` on Dolphin emulator
This commit is contained in:
@ -814,7 +814,7 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
|
||||
}
|
||||
|
||||
if (ret == DRBG_SUCCESS)
|
||||
ret = Hash_DRBG_Instantiate((DRBG_internal *)rng->drbg,
|
||||
ret = Hash_DRBG_Instantiate((DRBG_internal *)rng->drbg,
|
||||
seed + SEED_BLOCK_SZ, seedSz - SEED_BLOCK_SZ,
|
||||
nonce, nonceSz, rng->heap, devId);
|
||||
|
||||
@ -2583,6 +2583,18 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(DOLPHIN_EMULATOR)
|
||||
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
{
|
||||
word32 i;
|
||||
(void)os;
|
||||
srand(time(NULL));
|
||||
for (i = 0; i < sz; i++)
|
||||
output[i] = (byte)rand();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(NO_DEV_RANDOM)
|
||||
|
||||
#error "you need to write an os specific wc_GenerateSeed() here"
|
||||
|
@ -332,6 +332,10 @@ _Pragma("GCC diagnostic ignored \"-Wunused-function\"");
|
||||
#include "libntruencrypt/ntru_crypto.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEVKITPRO
|
||||
#include <wiiuse/wpad.h>
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
static WOLFSSL_HEAP_HINT* HEAP_HINT;
|
||||
#else
|
||||
@ -1463,6 +1467,26 @@ initDefaultName();
|
||||
tz.tz_dsttime = 0;
|
||||
os_settimeofday(&utctime, &tz);
|
||||
#endif
|
||||
#ifdef DEVKITPRO
|
||||
void *framebuffer;
|
||||
GXRModeObj *rmode = NULL;
|
||||
|
||||
VIDEO_Init();
|
||||
WPAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
#pragma GCC diagnostic ignored "-Wbad-function-cast"
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
#pragma GCC diagnostic pop
|
||||
console_init(framebuffer,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WNR
|
||||
if (wc_InitNetRandom(wnrConfigFile, NULL, 5000) != 0) {
|
||||
@ -1494,7 +1518,15 @@ initDefaultName();
|
||||
if (wc_FreeNetRandom() < 0)
|
||||
err_sys("Failed to free netRandom context", -1005);
|
||||
#endif /* HAVE_WNR */
|
||||
#ifdef DOLPHIN_EMULATOR
|
||||
/* Returning from main panics the emulator. Just hang
|
||||
* and let the user force quit the emulator window. */
|
||||
printf("args.return_code: %d\n", args.return_code);
|
||||
printf("Testing complete. You may close the window now\n");
|
||||
while (1);
|
||||
#endif
|
||||
#ifndef WOLFSSL_ESPIDF
|
||||
printf("Exiting main with return code: %d\n", args.return_code);
|
||||
return args.return_code;
|
||||
#endif
|
||||
}
|
||||
|
@ -218,6 +218,11 @@
|
||||
/* Uncomment next line if building for Linux Kernel Module */
|
||||
/* #define WOLFSSL_LINUXKM */
|
||||
|
||||
/* Uncomment next line if building for devkitPro */
|
||||
/* #define DEVKITPRO */
|
||||
|
||||
/* Uncomment next line if building for Dolphin Emulator */
|
||||
/* #define DOLPHIN_EMULATOR */
|
||||
|
||||
#include <wolfssl/wolfcrypt/visibility.h>
|
||||
|
||||
|
@ -287,8 +287,7 @@
|
||||
|
||||
#ifdef DEVKITPRO
|
||||
/* from network.h */
|
||||
int net_send(int, const void*, int, unsigned int);
|
||||
int net_recv(int, void*, int, unsigned int);
|
||||
#include <network.h>
|
||||
#define SEND_FUNCTION net_send
|
||||
#define RECV_FUNCTION net_recv
|
||||
#elif defined(WOLFSSL_LWIP) && !defined(WOLFSSL_APACHE_MYNEWT)
|
||||
|
Reference in New Issue
Block a user