mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-21 00:45:49 +08:00
Update code to v1.0.14 (10)
This commit is contained in:
46
android/extern/wolfssl/IDE/M68K/README.md
vendored
Normal file
46
android/extern/wolfssl/IDE/M68K/README.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
This is makefile's for creating a wolfCrypt library using the m68k-elf-gcc
|
||||
toolchain and example benchmark/testwolfcrypt application linking to it. The
|
||||
examples and default builds where made to support a MCF5441X board.
|
||||
|
||||
Macros to define for use:
|
||||
WOLFSSL_MCF5441X /* arch settings i.e. sizeof long and endianness */
|
||||
WOLFSSL_NETBURNER /* for use of NetBurner headers and RNG seed */
|
||||
|
||||
|
||||
To build the wolfssl.a library (settings for wolfCrypt only by default) run
|
||||
"make" from the directory wolfssl-root/IDE/M68K/.
|
||||
By default this outputs the wolfssl.a library to be at $(NBROOT)/lib. This can
|
||||
be adjusted by adjusting the variable OUTPUT in Makefile.
|
||||
|
||||
If the macro WOLFSSL_MCF5441X is defined then
|
||||
wolfssl-root/wolfssl/wolfcrypt/settings.h sets the sizeof long and long long
|
||||
along with big endian macro.
|
||||
|
||||
The configuration for the build is located in wolfssl-root/IDE/M68K/user_settings.h
|
||||
Along with the default build there is 2 others BUILD_B (smaller resource use),
|
||||
and BUILD_C (faster runtime with more resource use).
|
||||
|
||||
RSA speeds of the builds
|
||||
|
||||
default:
|
||||
RSA 2048 public 3.333 ops/sec
|
||||
RSA 2048 private 0.190 ops/sec
|
||||
|
||||
BUILD_B
|
||||
RSA 2048 public 3.333 ops/sec
|
||||
RSA 2048 private 0.053 ops/sec
|
||||
|
||||
BUILD_C
|
||||
RSA 2048 public 7.619 ops/sec
|
||||
RSA 2048 private 0.276 ops/sec
|
||||
|
||||
###Building testwolfcryt/benchmark
|
||||
To build either testwolfcrypt or benchmark first build wolfssl.a, place it in
|
||||
$(NBROOT)/lib and then cd into the respective directory. Running "make" will
|
||||
then create a .s19 application that can be ran on the board.
|
||||
|
||||
When running either testwolfcrypt or the benchmark app the first thing they do
|
||||
is loop on calling RandomValid until getting a successful return. This is done
|
||||
in order to wait for a source of entropy. It could take several moments until
|
||||
completed.
|
||||
|
||||
79
android/extern/wolfssl/IDE/M68K/benchmark/main.cpp
vendored
Normal file
79
android/extern/wolfssl/IDE/M68K/benchmark/main.cpp
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#include <predef.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <startnet.h>
|
||||
#include <autoupdate.h>
|
||||
#include <dhcpclient.h>
|
||||
#include <random.h>
|
||||
#include <init.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfcrypt/benchmark/benchmark.h>
|
||||
|
||||
extern "C" {
|
||||
void UserMain(void * pd);
|
||||
}
|
||||
|
||||
const char * AppName="benchmark";
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
char** argv;
|
||||
int return_code;
|
||||
} func_args;
|
||||
|
||||
void UserMain(void * pd) {
|
||||
InitializeStack();
|
||||
GetDHCPAddressIfNecessary();
|
||||
OSChangePrio(MAIN_PRIO);
|
||||
EnableAutoUpdate();
|
||||
|
||||
|
||||
init();
|
||||
iprintf("wolfcrypt benchmark Application started\n");
|
||||
iprintf("waiting for sufficient entropy before starting...\n\r");
|
||||
iprintf("looks like NetBurner is using uart/tcp to seed GetRandomX so ..."
|
||||
" input enough uart characters.\n\r");
|
||||
{
|
||||
BYTE b;
|
||||
do {
|
||||
b = GetRandomByte();
|
||||
iprintf(".");
|
||||
} while (!RandomValid());
|
||||
iprintf("\n\r");
|
||||
(void)b;
|
||||
}
|
||||
|
||||
/* run wolfCrypt benchmarks */
|
||||
{
|
||||
func_args args;
|
||||
args.argc = 0;
|
||||
args.argv = NULL;
|
||||
|
||||
benchmark_test(&args);
|
||||
}
|
||||
while (1) {
|
||||
OSTimeDly(TICKS_PER_SECOND);
|
||||
}
|
||||
}
|
||||
11
android/extern/wolfssl/IDE/M68K/include.am
vendored
Normal file
11
android/extern/wolfssl/IDE/M68K/include.am
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# vim:ft=automake
|
||||
# included from Top Level Makefile.am
|
||||
# All paths should be given relative to the root
|
||||
|
||||
EXTRA_DIST+= IDE/M68K/README.md
|
||||
EXTRA_DIST+= IDE/M68K/Makefile
|
||||
EXTRA_DIST+= IDE/M68K/user_settings.h
|
||||
EXTRA_DIST+= IDE/M68K/testwolfcrypt/main.cpp
|
||||
EXTRA_DIST+= IDE/M68K/testwolfcrypt/Makefile
|
||||
EXTRA_DIST+= IDE/M68K/benchmark/main.cpp
|
||||
EXTRA_DIST+= IDE/M68K/benchmark/Makefile
|
||||
82
android/extern/wolfssl/IDE/M68K/testwolfcrypt/main.cpp
vendored
Normal file
82
android/extern/wolfssl/IDE/M68K/testwolfcrypt/main.cpp
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/* main.c
|
||||
*
|
||||
* Copyright (C) 2006-2022 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#include <predef.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <startnet.h>
|
||||
#include <autoupdate.h>
|
||||
#include <dhcpclient.h>
|
||||
#include <random.h>
|
||||
#include <init.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#include <wolfcrypt/test/test.h>
|
||||
|
||||
extern "C" {
|
||||
void UserMain(void * pd);
|
||||
}
|
||||
|
||||
const char * AppName="testwolfcrypt";
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
char** argv;
|
||||
int return_code;
|
||||
} func_args;
|
||||
|
||||
|
||||
void UserMain(void * pd) {
|
||||
InitializeStack();
|
||||
GetDHCPAddressIfNecessary();
|
||||
OSChangePrio(MAIN_PRIO);
|
||||
EnableAutoUpdate();
|
||||
|
||||
|
||||
init();
|
||||
iprintf("wolfcrypt test Application started\n\r");
|
||||
|
||||
iprintf("waiting for sufficient entropy before starting...\n\r");
|
||||
iprintf("looks like NetBurner is using uart/tcp to seed GetRandomX so ..."
|
||||
" input enough uart characters.\n\r");
|
||||
{
|
||||
BYTE b;
|
||||
do {
|
||||
b = GetRandomByte();
|
||||
iprintf(".");
|
||||
} while (!RandomValid());
|
||||
iprintf("\n\r");
|
||||
(void)b;
|
||||
}
|
||||
|
||||
/* run wolfCrypt tests */
|
||||
{
|
||||
func_args args;
|
||||
args.argc = 0;
|
||||
args.argv = NULL;
|
||||
|
||||
wolfcrypt_test(&args);
|
||||
}
|
||||
while (1) {
|
||||
OSTimeDly(TICKS_PER_SECOND);
|
||||
}
|
||||
}
|
||||
85
android/extern/wolfssl/IDE/M68K/user_settings.h
vendored
Normal file
85
android/extern/wolfssl/IDE/M68K/user_settings.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
#ifndef USER_SETTINGS_H
|
||||
#define USER_SETTINGS_H
|
||||
|
||||
|
||||
/* Default build with fast math */
|
||||
|
||||
|
||||
/* Slower build but uses less memory */
|
||||
//#define BUILD_B
|
||||
|
||||
/* Performant build but uses more memory */
|
||||
//#define BUILD_C
|
||||
|
||||
|
||||
|
||||
/* Used for getting random value for seeding RNG */
|
||||
#define WOLFSSL_NETBURNER
|
||||
#define WOLFSSL_MCF5441X
|
||||
|
||||
/* environment settings */
|
||||
#define NO_WRITEV
|
||||
#define WOLFSSL_NO_SOCK
|
||||
#define NO_WOLFSSL_DIR
|
||||
|
||||
/* with USE_FAST_MATH smallstack is used to fit in the default stack size */
|
||||
#define WOLFSSL_SMALL_STACK
|
||||
|
||||
|
||||
/* enable features off by default */
|
||||
#define WOLFSSL_SHA512
|
||||
// OPENSSL_EXTRA uses a lot more memory but is needed in order to enable
|
||||
// compatibility layer API
|
||||
#define OPENSSL_EXTRA
|
||||
|
||||
// additional RSA padding schemes
|
||||
#define WC_RSA_NO_PADDING
|
||||
#define WC_RSA_PSS
|
||||
|
||||
// uncomment and add wolfSSL_Debugging_ON() to app for debug messages
|
||||
//#define DEBUG_WOLFSSL
|
||||
|
||||
|
||||
/* disable features that are on by default */
|
||||
#define WOLFCRYPT_ONLY
|
||||
#define NO_FILESYSTEM
|
||||
#define SINGLE_THREADED
|
||||
|
||||
#define NO_ASN_TIME
|
||||
#define NO_PWDBASED
|
||||
#define NO_RC4
|
||||
#define NO_DSA
|
||||
#define NO_DES3
|
||||
#define NO_DH
|
||||
#define NO_MD4
|
||||
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#ifdef BUILD_B
|
||||
#define RSA_LOW_MEM
|
||||
#define USE_SLOW_SHA
|
||||
#define USE_SLOW_SHA256
|
||||
#define NO_ERROR_STRINGS
|
||||
#define USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_C
|
||||
#define WOLFSSL_HAVE_SP_RSA
|
||||
#define SP_WORD_SIZE 32
|
||||
#endif
|
||||
|
||||
/* hardening against side channel attacks */
|
||||
#if defined(USE_FAST_MATH)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#ifdef HAVE_ECC
|
||||
#define ECC_TIMING_RESISTANT
|
||||
#endif
|
||||
#endif /* USE_FAST_MATH */
|
||||
#ifndef NO_RSA
|
||||
/* this slows down RSA operations but increases side channel resistance */
|
||||
#define WC_RSA_BLINDING
|
||||
#endif
|
||||
|
||||
#endif /* USER_SETTINGS_H */
|
||||
|
||||
Reference in New Issue
Block a user