forked from wolfSSL/wolfssl
Merge pull request #5419 from dgarske/aurix
Support for Infineon AURIX IDE and minor compiler warnings.
This commit is contained in:
151
IDE/AURIX/Cpu0_Main.c
Normal file
151
IDE/AURIX/Cpu0_Main.c
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/* Cpu0_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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Infineon includes */
|
||||||
|
#include "Ifx_Types.h"
|
||||||
|
#include "IfxCpu.h"
|
||||||
|
#include "IfxScuWdt.h"
|
||||||
|
#include "IfxAsclin_Asc.h"
|
||||||
|
#include "IfxCpu_Irq.h"
|
||||||
|
#include "IfxPort.h"
|
||||||
|
#include "SysSe/Bsp/Bsp.h"
|
||||||
|
|
||||||
|
/* For mapping stdio printf */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* used to wait for CPU sync event */
|
||||||
|
IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0;
|
||||||
|
|
||||||
|
#define SERIAL_BAUDRATE 115200 /* Baud rate in bit/s */
|
||||||
|
#define SERIAL_PIN_RX IfxAsclin0_RXA_P14_1_IN /* RX pin of the board */
|
||||||
|
#define SERIAL_PIN_TX IfxAsclin0_TX_P14_0_OUT /* TX pin of the board */
|
||||||
|
#define INTPRIO_ASCLIN0_TX 19 /* Priority of the ISR */
|
||||||
|
#define ASC_TX_BUFFER_SIZE 128 /* Definition of the buffer size */
|
||||||
|
|
||||||
|
/* Declaration of the ASC handle */
|
||||||
|
static IfxAsclin_Asc g_asc;
|
||||||
|
|
||||||
|
/* Declaration of the FIFOs parameters:
|
||||||
|
* The transfer buffers allocate memory for the data itself and for FIFO runtime
|
||||||
|
* variables. 8 more bytes have to be added to ensure a proper circular buffer
|
||||||
|
* handling independent from the address to which the buffers have been located.
|
||||||
|
*/
|
||||||
|
static uint8 g_ascTxBuffer[ASC_TX_BUFFER_SIZE + sizeof(Ifx_Fifo) + 8];
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/*----Function Implementations------------------------------------------------*/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Re-target the C library printf function to the asc lin. */
|
||||||
|
int fputc(int ch, FILE *f)
|
||||||
|
{
|
||||||
|
Ifx_SizeT count;
|
||||||
|
/* convert to CRLF */
|
||||||
|
if (ch == (int)'\n') {
|
||||||
|
int chcr = (int)'\r';
|
||||||
|
count = 1;
|
||||||
|
IfxAsclin_Asc_write(&g_asc, &chcr, &count, TIME_INFINITE);
|
||||||
|
}
|
||||||
|
count = 1;
|
||||||
|
IfxAsclin_Asc_write(&g_asc, &ch, &count, TIME_INFINITE);
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add the Interrupt Service Routine */
|
||||||
|
IFX_INTERRUPT(asclin0_Tx_ISR, 0, INTPRIO_ASCLIN0_TX);
|
||||||
|
void asclin0_Tx_ISR(void)
|
||||||
|
{
|
||||||
|
IfxAsclin_Asc_isrTransmit(&g_asc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init_UART(void)
|
||||||
|
{
|
||||||
|
IfxAsclin_Asc_Config ascConfig;
|
||||||
|
|
||||||
|
/* Port pins configuration */
|
||||||
|
const IfxAsclin_Asc_Pins pins = {
|
||||||
|
NULL_PTR, IfxPort_InputMode_pullUp, /* CTS pin not used */
|
||||||
|
&SERIAL_PIN_RX, IfxPort_InputMode_pullUp, /* RX pin */
|
||||||
|
NULL_PTR, IfxPort_OutputMode_pushPull, /* RTS pin not used */
|
||||||
|
&SERIAL_PIN_TX, IfxPort_OutputMode_pushPull, /* TX pin */
|
||||||
|
IfxPort_PadDriver_cmosAutomotiveSpeed1
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Initialize an instance of IfxAsclin_Asc_Config with default values */
|
||||||
|
IfxAsclin_Asc_initModuleConfig(&ascConfig, SERIAL_PIN_TX.module);
|
||||||
|
|
||||||
|
/* Set the desired baud rate */
|
||||||
|
ascConfig.baudrate.baudrate = SERIAL_BAUDRATE;
|
||||||
|
|
||||||
|
/* ISR priorities and interrupt target */
|
||||||
|
ascConfig.interrupt.txPriority = INTPRIO_ASCLIN0_TX;
|
||||||
|
ascConfig.interrupt.typeOfService = IfxCpu_Irq_getTos(IfxCpu_getCoreIndex());
|
||||||
|
|
||||||
|
/* FIFO configuration */
|
||||||
|
ascConfig.txBuffer = &g_ascTxBuffer;
|
||||||
|
ascConfig.txBufferSize = ASC_TX_BUFFER_SIZE;
|
||||||
|
|
||||||
|
ascConfig.pins = &pins;
|
||||||
|
|
||||||
|
/* Initialize module with above parameters */
|
||||||
|
IfxAsclin_Asc_initModule(&g_asc, &ascConfig);
|
||||||
|
|
||||||
|
/* Turn off buffers, so I/O occurs immediately */
|
||||||
|
setvbuf(stdin, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
setvbuf(stderr, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int send_UART(const char* str)
|
||||||
|
{
|
||||||
|
Ifx_SizeT count = (Ifx_SizeT)strlen(str);
|
||||||
|
IfxAsclin_Asc_write(&g_asc, str, &count, TIME_INFINITE);
|
||||||
|
return (int)count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void core0_main(void)
|
||||||
|
{
|
||||||
|
IfxCpu_enableInterrupts();
|
||||||
|
|
||||||
|
/* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
|
||||||
|
* Enable the watchdogs and service them periodically if it is required
|
||||||
|
*/
|
||||||
|
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
|
||||||
|
IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword());
|
||||||
|
|
||||||
|
/* Wait for CPU sync event */
|
||||||
|
IfxCpu_emitEvent(&g_cpuSyncEvent);
|
||||||
|
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
|
||||||
|
|
||||||
|
/* Initialize the UART to board VCOM */
|
||||||
|
init_UART();
|
||||||
|
|
||||||
|
/* bare metal loop */
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
extern void run_wolf_tests(void);
|
||||||
|
run_wolf_tests();
|
||||||
|
|
||||||
|
/* wait 5 seconds */
|
||||||
|
waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, 5 * 1000));
|
||||||
|
} /* while */
|
||||||
|
}
|
114
IDE/AURIX/README.md
Normal file
114
IDE/AURIX/README.md
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# Infineon AURIX Development Studio
|
||||||
|
|
||||||
|
An Eclipse based IDE for developing software for the Infineon TriCore AURIX TX3XX.
|
||||||
|
|
||||||
|
Tested Platform:
|
||||||
|
* Infineon AURIX™ Development Studio 1.7.2 (Build 20220617-0730)
|
||||||
|
* Infineon TriBoard TC399 v2.0
|
||||||
|
* wolfSSL v5.4.0 (with PR 5419)
|
||||||
|
|
||||||
|
## Running wolfCrypt on TriCore
|
||||||
|
|
||||||
|
1) Add the wolfSSL source and headers to `Libraries/wolfssl`.
|
||||||
|
- Only the following folders are required: `src`, `wolfcrypt` and `wolfssl`.
|
||||||
|
- See script to help with producing bundle here: https://github.com/wolfSSL/wolfssl/blob/master/scripts/makedistsmall.sh
|
||||||
|
2) Add `WOLFSSL_USER_SETTINGS` to the Preprocessing symbols list. C/C++ Build -> Settings -> TASKING C/C++ Compiler -> Preprocessing.
|
||||||
|
3) Add `Libraries/wolfssl` to the include path. C/C++ General -> Paths and Symbols -> Includes -> GNU C
|
||||||
|
4) Add ignores for the following warnings. Unused static function (553) and switch missing break (536). C/C++ Build -> Settings -> TASKING C/C++ Compiler -> Diagnostics
|
||||||
|
5) Copy `Cpu0_Main.c`, `user_settings.h` and `wolf_main.c` into the project folder.
|
||||||
|
6) Increase the stack by modifying `Lcf_Tasking_Tricore_Tc.lsl` to adjusting the USTACK0-4 (`LCF_USTACK#_SIZE`) from 2k to 12k.
|
||||||
|
6) Build and run/debug.
|
||||||
|
|
||||||
|
### Example output from wolfCrypt test and benchmark
|
||||||
|
|
||||||
|
Benchmark Configuration:
|
||||||
|
* TriCore (TC1.6.2P) 32-bit super-scalar running at 300MHz:
|
||||||
|
* Release build: `-O2`
|
||||||
|
* SP Math SMALL: sp_c32.c for RSA/ECC/DH
|
||||||
|
* AES GCM SMALL
|
||||||
|
|
||||||
|
```
|
||||||
|
Running wolfCrypt Tests...
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
wolfSSL version 5.4.0
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
error test passed!
|
||||||
|
MEMORY test passed!
|
||||||
|
base64 test passed!
|
||||||
|
asn test passed!
|
||||||
|
RANDOM test passed!
|
||||||
|
SHA test passed!
|
||||||
|
SHA-256 test passed!
|
||||||
|
Hash test passed!
|
||||||
|
HMAC-SHA test passed!
|
||||||
|
HMAC-SHA256 test passed!
|
||||||
|
HMAC-KDF test passed!
|
||||||
|
TLSv1.3 KDF test passed!
|
||||||
|
GMAC test passed!
|
||||||
|
Chacha test passed!
|
||||||
|
POLY1305 test passed!
|
||||||
|
ChaCha20-Poly1305 AEAD test passed!
|
||||||
|
AES test passed!
|
||||||
|
AES192 test passed!
|
||||||
|
AES256 test passed!
|
||||||
|
AES-GCM test passed!
|
||||||
|
RSA test passed!
|
||||||
|
ECC test passed!
|
||||||
|
ECC buffer test passed!
|
||||||
|
CMAC test passed!
|
||||||
|
logging test passed!
|
||||||
|
time test passed!
|
||||||
|
mutex test passed!
|
||||||
|
memcb test passed!
|
||||||
|
Test complete
|
||||||
|
Crypt Test: Return code 0
|
||||||
|
Running wolfCrypt Benchmarks...
|
||||||
|
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
|
||||||
|
RNG 725 KB took 1.023 seconds, 708.703 KB/s
|
||||||
|
AES-128-CBC-enc 2 MB took 1.002 seconds, 2.071 MB/s
|
||||||
|
AES-128-CBC-dec 2 MB took 1.005 seconds, 2.065 MB/s
|
||||||
|
AES-192-CBC-enc 2 MB took 1.002 seconds, 1.779 MB/s
|
||||||
|
AES-192-CBC-dec 2 MB took 1.013 seconds, 1.783 MB/s
|
||||||
|
AES-256-CBC-enc 2 MB took 1.003 seconds, 1.558 MB/s
|
||||||
|
AES-256-CBC-dec 2 MB took 1.009 seconds, 1.573 MB/s
|
||||||
|
AES-128-GCM-enc 225 KB took 1.013 seconds, 222.112 KB/s
|
||||||
|
AES-128-GCM-dec 225 KB took 1.014 seconds, 221.892 KB/s
|
||||||
|
AES-192-GCM-enc 225 KB took 1.046 seconds, 215.107 KB/s
|
||||||
|
AES-192-GCM-dec 225 KB took 1.046 seconds, 215.104 KB/s
|
||||||
|
AES-256-GCM-enc 225 KB took 1.070 seconds, 210.279 KB/s
|
||||||
|
AES-256-GCM-dec 225 KB took 1.069 seconds, 210.477 KB/s
|
||||||
|
GMAC Small 251 KB took 1.000 seconds, 251.000 KB/s
|
||||||
|
AES-128-ECB-enc 2 MB took 1.000 seconds, 2.000 MB/s
|
||||||
|
AES-128-ECB-dec 2 MB took 1.000 seconds, 2.049 MB/s
|
||||||
|
AES-192-ECB-enc 2 MB took 1.000 seconds, 1.727 MB/s
|
||||||
|
AES-192-ECB-dec 2 MB took 1.000 seconds, 1.772 MB/s
|
||||||
|
AES-256-ECB-enc 2 MB took 1.000 seconds, 1.518 MB/s
|
||||||
|
AES-256-ECB-dec 2 MB took 1.000 seconds, 1.563 MB/s
|
||||||
|
CHACHA 3 MB took 1.007 seconds, 3.322 MB/s
|
||||||
|
CHA-POLY 2 MB took 1.011 seconds, 2.028 MB/s
|
||||||
|
POLY1305 6 MB took 1.003 seconds, 6.012 MB/s
|
||||||
|
SHA 3 MB took 1.004 seconds, 3.380 MB/s
|
||||||
|
SHA-256 2 MB took 1.003 seconds, 1.558 MB/s
|
||||||
|
AES-128-CMAC 2 MB took 1.010 seconds, 2.055 MB/s
|
||||||
|
AES-256-CMAC 2 MB took 1.010 seconds, 1.547 MB/s
|
||||||
|
HMAC-SHA 3 MB took 1.004 seconds, 3.356 MB/s
|
||||||
|
HMAC-SHA256 2 MB took 1.010 seconds, 1.547 MB/s
|
||||||
|
RSA 2048 public 50 ops took 1.020 sec, avg 20.400 ms, 49.019 ops/sec
|
||||||
|
RSA 2048 private 2 ops took 2.377 sec, avg 1188.492 ms, 0.841 ops/sec
|
||||||
|
ECC [ SECP256R1] 256 key gen 16 ops took 1.061 sec, avg 66.313 ms, 15.080 ops/sec
|
||||||
|
ECDHE [ SECP256R1] 256 agree 16 ops took 1.059 sec, avg 66.187 ms, 15.109 ops/sec
|
||||||
|
ECDSA [ SECP256R1] 256 sign 14 ops took 1.058 sec, avg 75.570 ms, 13.233 ops/sec
|
||||||
|
ECDSA [ SECP256R1] 256 verify 8 ops took 1.080 sec, avg 135.002 ms, 7.407 ops/sec
|
||||||
|
Benchmark complete
|
||||||
|
Benchmark Test: Return code 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Running wolfCrypt on the HSM (Cortex M3)
|
||||||
|
|
||||||
|
Coming soon
|
||||||
|
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
For questions please email facts@wolfssl.com
|
8
IDE/AURIX/include.am
Normal file
8
IDE/AURIX/include.am
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# vim:ft=automake
|
||||||
|
# included from Top Level Makefile.am
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
EXTRA_DIST+= IDE/AURIX/Cpu0_Main.c
|
||||||
|
EXTRA_DIST+= IDE/AURIX/README.md
|
||||||
|
EXTRA_DIST+= IDE/AURIX/user_settings.h
|
||||||
|
EXTRA_DIST+= IDE/AURIX/wolf_main.c
|
461
IDE/AURIX/user_settings.h
Normal file
461
IDE/AURIX/user_settings.h
Normal file
@ -0,0 +1,461 @@
|
|||||||
|
/* user_settings.h
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Template for the Infineon AURIX Development Studio and TC3XX
|
||||||
|
* Example wolfSSL user settings with #if 0/1 gates to enable/disable algorithms and features.
|
||||||
|
* This file is included with wolfssl/wolfcrypt/settings.h when WOLFSSL_USER_SETTINGS is defined.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_USER_SETTINGS_H
|
||||||
|
#define WOLFSSL_USER_SETTINGS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Platform */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Alignment and sizeof 64-bit */
|
||||||
|
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||||
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
|
||||||
|
/* disable threading - mutex locking */
|
||||||
|
#define SINGLE_THREADED
|
||||||
|
|
||||||
|
/* ignore file include warnings */
|
||||||
|
#define WOLFSSL_IGNORE_FILE_WARN
|
||||||
|
|
||||||
|
/* disable the built-in socket support and use the IO callbacks.
|
||||||
|
* Set with wolfSSL_CTX_SetIORecv/wolfSSL_CTX_SetIOSend
|
||||||
|
*/
|
||||||
|
#define WOLFSSL_USER_IO
|
||||||
|
|
||||||
|
/* Disable file system */
|
||||||
|
#define NO_FILESYSTEM
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Port */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Override Current Time */
|
||||||
|
/* Allows custom "custom_time()" function to be used for benchmark */
|
||||||
|
#define WOLFSSL_USER_CURRTIME
|
||||||
|
#define WOLFSSL_GMTIME
|
||||||
|
#define USER_TICKS
|
||||||
|
extern unsigned long my_time(unsigned long* timer);
|
||||||
|
#define XTIME my_time
|
||||||
|
|
||||||
|
/* Use built-in P-RNG (SHA256 based) with HW RNG */
|
||||||
|
#undef HAVE_HASHDRBG
|
||||||
|
#define HAVE_HASHDRBG
|
||||||
|
|
||||||
|
/* Custom Seed Source */
|
||||||
|
#define CUSTOM_RAND_TYPE unsigned int
|
||||||
|
extern unsigned int my_rng_seed_gen(void);
|
||||||
|
#undef CUSTOM_RAND_GENERATE
|
||||||
|
#define CUSTOM_RAND_GENERATE my_rng_seed_gen
|
||||||
|
|
||||||
|
/* Standard Lib - C89 */
|
||||||
|
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Math Configuration */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#undef USE_FAST_MATH
|
||||||
|
#undef WOLFSSL_SP
|
||||||
|
#if 1
|
||||||
|
/* Wolf Single Precision Math */
|
||||||
|
#define WOLFSSL_HAVE_SP_RSA
|
||||||
|
//#define WOLFSSL_HAVE_SP_DH
|
||||||
|
#define WOLFSSL_HAVE_SP_ECC
|
||||||
|
#define WOLFSSL_SP_4096 /* Enable RSA/RH 4096-bit support */
|
||||||
|
#define WOLFSSL_SP_384 /* Enable ECC 384-bit SECP384R1 support */
|
||||||
|
|
||||||
|
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
|
||||||
|
//#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
|
||||||
|
|
||||||
|
#define WOLFSSL_SP_NO_MALLOC
|
||||||
|
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
|
||||||
|
//#define WOLFSSL_SP_CACHE_RESISTANT
|
||||||
|
|
||||||
|
/* use smaller version of code */
|
||||||
|
#define WOLFSSL_SP_SMALL
|
||||||
|
|
||||||
|
/* SP Assembly Speedups - specific to chip type */
|
||||||
|
//#define WOLFSSL_SP_ASM
|
||||||
|
//#define WOLFSSL_SP_ARM32_ASM
|
||||||
|
//#define WOLFSSL_SP_ARM64_ASM
|
||||||
|
//#define WOLFSSL_SP_ARM_THUMB_ASM
|
||||||
|
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WOLFSSL_SP_MATH
|
||||||
|
#if 0
|
||||||
|
/* fast math (tfmc.) (stack based and timing resistant) */
|
||||||
|
#define USE_FAST_MATH
|
||||||
|
#define TFM_TIMING_RESISTANT
|
||||||
|
#else
|
||||||
|
/* normal heap based integer.c (not timing resistant) */
|
||||||
|
#define USE_INTEGER_HEAP_MATH
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Crypto */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* RSA */
|
||||||
|
#undef NO_RSA
|
||||||
|
#if 1
|
||||||
|
#ifdef USE_FAST_MATH
|
||||||
|
/* Maximum math bits (Max RSA key bits * 2) */
|
||||||
|
#define FP_MAX_BITS 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* half as much memory but twice as slow */
|
||||||
|
//#define RSA_LOW_MEM
|
||||||
|
|
||||||
|
/* Enables blinding mode, to prevent timing attacks */
|
||||||
|
#define WC_RSA_BLINDING
|
||||||
|
|
||||||
|
/* RSA PSS Support */
|
||||||
|
#define WC_RSA_PSS
|
||||||
|
#else
|
||||||
|
#define NO_RSA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DH */
|
||||||
|
#undef NO_DH
|
||||||
|
#if 0
|
||||||
|
/* Use table for DH instead of -lm (math) lib dependency */
|
||||||
|
#if 1
|
||||||
|
#define WOLFSSL_DH_CONST
|
||||||
|
#define HAVE_FFDHE_2048
|
||||||
|
//#define HAVE_FFDHE_4096
|
||||||
|
//#define HAVE_FFDHE_6144
|
||||||
|
//#define HAVE_FFDHE_8192
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define NO_DH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ECC */
|
||||||
|
#undef HAVE_ECC
|
||||||
|
#if 1
|
||||||
|
#define HAVE_ECC
|
||||||
|
|
||||||
|
/* Manually define enabled curves */
|
||||||
|
#define ECC_USER_CURVES
|
||||||
|
|
||||||
|
#ifdef ECC_USER_CURVES
|
||||||
|
/* Manual Curve Selection */
|
||||||
|
//#define HAVE_ECC192
|
||||||
|
//#define HAVE_ECC224
|
||||||
|
#undef NO_ECC256
|
||||||
|
#define HAVE_ECC384
|
||||||
|
//#define HAVE_ECC521
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Fixed point cache (speeds repeated operations against same private key) */
|
||||||
|
//#define FP_ECC
|
||||||
|
#ifdef FP_ECC
|
||||||
|
/* Bits / Entries */
|
||||||
|
#define FP_ENTRIES 2
|
||||||
|
#define FP_LUT 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Optional ECC calculation method */
|
||||||
|
/* Note: doubles heap usage, but slightly faster */
|
||||||
|
#define ECC_SHAMIR
|
||||||
|
|
||||||
|
/* Reduces heap usage, but slower */
|
||||||
|
#define ECC_TIMING_RESISTANT
|
||||||
|
|
||||||
|
/* Compressed ECC Key Support */
|
||||||
|
//#define HAVE_COMP_KEY
|
||||||
|
|
||||||
|
/* Use alternate ECC size for ECC math */
|
||||||
|
#ifdef USE_FAST_MATH
|
||||||
|
/* MAX ECC BITS = ROUND8(MAX ECC) * 2 */
|
||||||
|
#if defined(NO_RSA) && defined(NO_DH)
|
||||||
|
/* Custom fastmath size if not using RSA/DH */
|
||||||
|
#define FP_MAX_BITS (256 * 2)
|
||||||
|
#else
|
||||||
|
/* use heap allocation for ECC points */
|
||||||
|
#define ALT_ECC_SIZE
|
||||||
|
|
||||||
|
/* wolfSSL will compute the FP_MAX_BITS_ECC, but it can be overriden */
|
||||||
|
//#define FP_MAX_BITS_ECC (256 * 2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Speedups specific to curve */
|
||||||
|
#ifndef NO_ECC256
|
||||||
|
#define TFM_ECC256
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* AES */
|
||||||
|
#undef NO_AES
|
||||||
|
#if 1
|
||||||
|
#define HAVE_AES_CBC
|
||||||
|
|
||||||
|
/* GCM Method: GCM_TABLE_4BIT, GCM_SMALL, GCM_WORD32 or GCM_TABLE */
|
||||||
|
#define HAVE_AESGCM
|
||||||
|
#define GCM_SMALL
|
||||||
|
|
||||||
|
#define WOLFSSL_AES_DIRECT
|
||||||
|
#define HAVE_AES_ECB
|
||||||
|
#else
|
||||||
|
#define NO_AES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* DES3 */
|
||||||
|
#undef NO_DES3
|
||||||
|
#if 0
|
||||||
|
#else
|
||||||
|
#define NO_DES3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ChaCha20 / Poly1305 */
|
||||||
|
#undef HAVE_CHACHA
|
||||||
|
#undef HAVE_POLY1305
|
||||||
|
#if 1
|
||||||
|
#define HAVE_CHACHA
|
||||||
|
#define HAVE_POLY1305
|
||||||
|
|
||||||
|
/* Needed for Poly1305 */
|
||||||
|
#define HAVE_ONE_TIME_AUTH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Ed25519 / Curve25519 */
|
||||||
|
#undef HAVE_CURVE25519
|
||||||
|
#undef HAVE_ED25519
|
||||||
|
#if 0
|
||||||
|
#define HAVE_CURVE25519
|
||||||
|
#define HAVE_ED25519 /* ED25519 Requires SHA512 */
|
||||||
|
|
||||||
|
/* Optionally use small math (less flash usage, but much slower) */
|
||||||
|
#if 1
|
||||||
|
#define CURVED25519_SMALL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Hashing */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Sha */
|
||||||
|
#undef NO_SHA
|
||||||
|
#if 1
|
||||||
|
/* on by default */
|
||||||
|
/* 1k smaller, but 25% slower */
|
||||||
|
//#define USE_SLOW_SHA
|
||||||
|
#else
|
||||||
|
#define NO_SHA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sha256 */
|
||||||
|
#undef NO_SHA256
|
||||||
|
#if 1
|
||||||
|
/* not unrolled - ~2k smaller and ~25% slower */
|
||||||
|
//#define USE_SLOW_SHA256
|
||||||
|
|
||||||
|
/* Sha224 */
|
||||||
|
#if 0
|
||||||
|
#define WOLFSSL_SHA224
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define NO_SHA256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sha512 */
|
||||||
|
#undef WOLFSSL_SHA512
|
||||||
|
#if 0
|
||||||
|
#define WOLFSSL_SHA512
|
||||||
|
|
||||||
|
/* Sha384 */
|
||||||
|
#undef WOLFSSL_SHA384
|
||||||
|
#if 0
|
||||||
|
#define WOLFSSL_SHA384
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* over twice as small, but 50% slower */
|
||||||
|
//#define USE_SLOW_SHA512
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sha3 */
|
||||||
|
#undef WOLFSSL_SHA3
|
||||||
|
#if 0
|
||||||
|
#define WOLFSSL_SHA3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MD5 */
|
||||||
|
#undef NO_MD5
|
||||||
|
#if 0
|
||||||
|
/* on by default */
|
||||||
|
#else
|
||||||
|
#define NO_MD5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* HKDF */
|
||||||
|
#undef HAVE_HKDF
|
||||||
|
#if 1
|
||||||
|
#define HAVE_HKDF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CMAC */
|
||||||
|
#undef WOLFSSL_CMAC
|
||||||
|
#if 1
|
||||||
|
#define WOLFSSL_CMAC
|
||||||
|
/* Note: requires WOLFSSL_AES_DIRECT */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* HMAC - on by default */
|
||||||
|
#undef NO_HMAC
|
||||||
|
#if 1
|
||||||
|
/* on by default */
|
||||||
|
#else
|
||||||
|
#define NO_HMAC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* ASN */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#if 0
|
||||||
|
/* Use the newer ASN template code */
|
||||||
|
#define WOLFSSL_ASN_TEMPLATE
|
||||||
|
//#define WOLFSSL_CUSTOM_OID
|
||||||
|
//#define HAVE_OID_ENCODING
|
||||||
|
//#define HAVE_OID_DECODING
|
||||||
|
#else
|
||||||
|
/* Use the original custom ASN code */
|
||||||
|
#endif
|
||||||
|
/* Optionally disable time checking for ASN */
|
||||||
|
//#define NO_ASN_TIME
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Benchmark / Test */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Use reduced benchmark / test sizes */
|
||||||
|
#define BENCH_EMBEDDED
|
||||||
|
|
||||||
|
/* Use test buffers from array (not filesystem) */
|
||||||
|
#ifndef NO_FILESYSTEM
|
||||||
|
#define USE_CERT_BUFFERS_256
|
||||||
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Debugging */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#undef DEBUG_WOLFSSL
|
||||||
|
#undef NO_ERROR_STRINGS
|
||||||
|
#if 0
|
||||||
|
#define DEBUG_WOLFSSL
|
||||||
|
#define WOLFSSL_LOG_PRINTF
|
||||||
|
#else
|
||||||
|
#if 0
|
||||||
|
#define NO_ERROR_STRINGS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Memory */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
#if 0
|
||||||
|
/* Static memory requires fast math or SP math with no malloc */
|
||||||
|
#define WOLFSSL_STATIC_MEMORY
|
||||||
|
|
||||||
|
/* Disable fallback malloc/free */
|
||||||
|
#define WOLFSSL_NO_MALLOC
|
||||||
|
#if 1
|
||||||
|
#define WOLFSSL_MALLOC_CHECK /* trap malloc failure */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Enable Features */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#define WOLFSSL_TLS13
|
||||||
|
#define WOLFSSL_OLD_PRIME_CHECK /* Use faster DH prime checking */
|
||||||
|
#define HAVE_TLS_EXTENSIONS
|
||||||
|
#define HAVE_SUPPORTED_CURVES
|
||||||
|
#define WOLFSSL_BASE64_ENCODE
|
||||||
|
|
||||||
|
//#define WOLFSSL_KEY_GEN /* For RSA Key gen only */
|
||||||
|
//#define KEEP_PEER_CERT
|
||||||
|
//#define HAVE_COMP_KEY
|
||||||
|
|
||||||
|
/* TLS Session Cache */
|
||||||
|
#if 0
|
||||||
|
#define SMALL_SESSION_CACHE
|
||||||
|
#else
|
||||||
|
#define NO_SESSION_CACHE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
/* Disable Features */
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
//#define NO_WOLFSSL_SERVER
|
||||||
|
//#define NO_WOLFSSL_CLIENT
|
||||||
|
//#define NO_CRYPT_TEST
|
||||||
|
//#define NO_CRYPT_BENCHMARK
|
||||||
|
//#define WOLFCRYPT_ONLY
|
||||||
|
|
||||||
|
/* In-lining of misc.c functions */
|
||||||
|
/* If defined, must include wolfcrypt/src/misc.c in build */
|
||||||
|
/* Slower, but about 1k smaller */
|
||||||
|
//#define NO_INLINE
|
||||||
|
|
||||||
|
#define NO_WRITEV
|
||||||
|
#define NO_MAIN_DRIVER
|
||||||
|
//#define NO_DEV_RANDOM
|
||||||
|
|
||||||
|
#define NO_OLD_TLS
|
||||||
|
#define NO_PSK
|
||||||
|
|
||||||
|
#define NO_DSA
|
||||||
|
#define NO_RC4
|
||||||
|
#define NO_MD4
|
||||||
|
#define NO_PWDBASED
|
||||||
|
//#define NO_CODING
|
||||||
|
//#define NO_CERTS
|
||||||
|
//#define NO_SIG_WRAPPER
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* WOLFSSL_USER_SETTINGS_H */
|
150
IDE/AURIX/wolf_main.c
Normal file
150
IDE/AURIX/wolf_main.c
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/* wolf_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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* wolfSSL includes */
|
||||||
|
#ifndef WOLFSSL_USER_SETTINGS
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
|
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||||
|
#include <wolfssl/wolfcrypt/random.h> /* for CUSTOM_RAND_TYPE */
|
||||||
|
#include <wolfcrypt/test/test.h>
|
||||||
|
#include <wolfcrypt/benchmark/benchmark.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Infineon Includes */
|
||||||
|
#include "Ifx_Types.h"
|
||||||
|
#include "IfxStm.h"
|
||||||
|
|
||||||
|
extern int send_UART(const char* str);
|
||||||
|
static void my_logging_cb(const int logLevel, const char *const logMessage)
|
||||||
|
{
|
||||||
|
send_UART(logMessage);
|
||||||
|
send_UART("\r\n");
|
||||||
|
(void)logLevel; /* not used */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TIME CODE */
|
||||||
|
/* Optionally you can define NO_ASN_TIME to disable all cert time checks */
|
||||||
|
static int hw_get_time_sec(void)
|
||||||
|
{
|
||||||
|
/* get time in seconds */
|
||||||
|
return IfxStm_get(&MODULE_STM0) / IfxStm_getFrequency(&MODULE_STM0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is used by wolfCrypt asn.c for cert time checking */
|
||||||
|
unsigned long my_time(unsigned long* timer)
|
||||||
|
{
|
||||||
|
(void)timer;
|
||||||
|
return hw_get_time_sec();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef WOLFCRYPT_ONLY
|
||||||
|
/* This is used by TLS only */
|
||||||
|
unsigned int LowResTimer(void)
|
||||||
|
{
|
||||||
|
return hw_get_time_sec();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_CRYPT_BENCHMARK
|
||||||
|
/* This is used by wolfCrypt benchmark tool only */
|
||||||
|
double current_time(int reset)
|
||||||
|
{
|
||||||
|
double timeNow;
|
||||||
|
uint64_t timeMs, ticks = IfxStm_get(&MODULE_STM0);
|
||||||
|
(void)reset;
|
||||||
|
timeMs = ticks / (IfxStm_getFrequency(&MODULE_STM0) / 1000);
|
||||||
|
timeNow = (timeMs / 1000); // sec
|
||||||
|
timeNow += (double)(timeMs % 1000) / 1000; // ms
|
||||||
|
return timeNow;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* RNG CODE */
|
||||||
|
/* TODO: Implement real RNG */
|
||||||
|
static unsigned int gCounter;
|
||||||
|
unsigned int hw_rand(void)
|
||||||
|
{
|
||||||
|
//#warning Must implement your own random source
|
||||||
|
|
||||||
|
return ++gCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int my_rng_seed_gen(void)
|
||||||
|
{
|
||||||
|
return hw_rand();
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct func_args {
|
||||||
|
int argc;
|
||||||
|
char** argv;
|
||||||
|
int return_code;
|
||||||
|
} func_args;
|
||||||
|
|
||||||
|
void run_wolf_tests(void)
|
||||||
|
{
|
||||||
|
func_args args;
|
||||||
|
|
||||||
|
#ifdef DEBUG_WOLFSSL
|
||||||
|
wolfSSL_Debugging_ON();
|
||||||
|
#endif
|
||||||
|
wolfSSL_SetLoggingCb(my_logging_cb);
|
||||||
|
|
||||||
|
/* initialize wolfSSL */
|
||||||
|
#ifdef WOLFCRYPT_ONLY
|
||||||
|
wolfCrypt_Init();
|
||||||
|
#else
|
||||||
|
wolfSSL_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memset(&args, 0, sizeof(args));
|
||||||
|
args.return_code = NOT_COMPILED_IN; /* default */
|
||||||
|
|
||||||
|
printf("Running wolfCrypt Tests...\n");
|
||||||
|
#ifndef NO_CRYPT_TEST
|
||||||
|
args.return_code = 0;
|
||||||
|
wolfcrypt_test(&args);
|
||||||
|
printf("Crypt Test: Return code %d\n", args.return_code);
|
||||||
|
#else
|
||||||
|
args.return_code = NOT_COMPILED_IN;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("Running wolfCrypt Benchmarks...\n");
|
||||||
|
#ifndef NO_CRYPT_BENCHMARK
|
||||||
|
args.return_code = 0;
|
||||||
|
benchmark_test(&args);
|
||||||
|
#else
|
||||||
|
args.return_code = NOT_COMPILED_IN;
|
||||||
|
#endif
|
||||||
|
printf("Benchmark Test: Return code %d\n", args.return_code);
|
||||||
|
|
||||||
|
#ifdef WOLFCRYPT_ONLY
|
||||||
|
wolfCrypt_Cleanup();
|
||||||
|
#else
|
||||||
|
wolfSSL_Cleanup();
|
||||||
|
#endif
|
||||||
|
}
|
@ -48,6 +48,7 @@ include IDE/Android/include.am
|
|||||||
include IDE/NETOS/include.am
|
include IDE/NETOS/include.am
|
||||||
include IDE/IAR-MSP430/include.am
|
include IDE/IAR-MSP430/include.am
|
||||||
include IDE/zephyr/include.am
|
include IDE/zephyr/include.am
|
||||||
|
include IDE/AURIX/include.am
|
||||||
|
|
||||||
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
|
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
|
||||||
EXTRA_DIST+= IDE/OPENSTM32/README.md
|
EXTRA_DIST+= IDE/OPENSTM32/README.md
|
||||||
|
@ -18041,10 +18041,9 @@ static WC_INLINE int VerifyMac(WOLFSSL* ssl, const byte* input, word32 msgSz,
|
|||||||
else { /* sslv3, some implementations have bad padding, but don't
|
else { /* sslv3, some implementations have bad padding, but don't
|
||||||
* allow bad read */
|
* allow bad read */
|
||||||
int badPadLen = 0;
|
int badPadLen = 0;
|
||||||
byte dmy[sizeof(WOLFSSL) >= MAX_PAD_SIZE ? 1 : MAX_PAD_SIZE] = {0};
|
byte dmy[sizeof(WOLFSSL) >= MAX_PAD_SIZE ? 1 : MAX_PAD_SIZE];
|
||||||
byte* dummy = sizeof(dmy) < MAX_PAD_SIZE ? (byte*) ssl : dmy;
|
byte* dummy = sizeof(dmy) < MAX_PAD_SIZE ? (byte*) ssl : dmy;
|
||||||
|
XMEMSET(dmy, 0, sizeof(dmy));
|
||||||
(void)dmy;
|
|
||||||
|
|
||||||
if (pad > (msgSz - digestSz - 1)) {
|
if (pad > (msgSz - digestSz - 1)) {
|
||||||
WOLFSSL_MSG("Plain Len not long enough for pad/mac");
|
WOLFSSL_MSG("Plain Len not long enough for pad/mac");
|
||||||
@ -19001,7 +19000,7 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr)
|
|||||||
#endif
|
#endif
|
||||||
ret = BuildFinished(ssl, &ssl->hsHashes->verifyHashes,
|
ret = BuildFinished(ssl, &ssl->hsHashes->verifyHashes,
|
||||||
ssl->options.side == WOLFSSL_CLIENT_END ?
|
ssl->options.side == WOLFSSL_CLIENT_END ?
|
||||||
server : client);
|
kTlsServerStr : kTlsClientStr);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
#endif /* !WOLFSSL_NO_TLS12 */
|
#endif /* !WOLFSSL_NO_TLS12 */
|
||||||
@ -20099,8 +20098,8 @@ int SendFinished(WOLFSSL* ssl)
|
|||||||
|
|
||||||
/* make finished hashes */
|
/* make finished hashes */
|
||||||
hashes = (Hashes*)&input[headerSz];
|
hashes = (Hashes*)&input[headerSz];
|
||||||
ret = BuildFinished(ssl, hashes,
|
ret = BuildFinished(ssl, hashes, ssl->options.side == WOLFSSL_CLIENT_END ?
|
||||||
ssl->options.side == WOLFSSL_CLIENT_END ? client : server);
|
kTlsClientStr : kTlsServerStr);
|
||||||
if (ret != 0) return ret;
|
if (ret != 0) return ret;
|
||||||
|
|
||||||
#ifdef HAVE_SECURE_RENEGOTIATION
|
#ifdef HAVE_SECURE_RENEGOTIATION
|
||||||
@ -20128,13 +20127,15 @@ int SendFinished(WOLFSSL* ssl)
|
|||||||
|
|
||||||
#ifdef WOLFSSL_DTLS
|
#ifdef WOLFSSL_DTLS
|
||||||
if (IsDtlsNotSctpMode(ssl)) {
|
if (IsDtlsNotSctpMode(ssl)) {
|
||||||
if ((ret = DtlsMsgPoolSave(ssl, input, headerSz + finishedSz, finished)) != 0)
|
if ((ret = DtlsMsgPoolSave(ssl, input, headerSz + finishedSz,
|
||||||
|
finished)) != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sendSz = BuildMessage(ssl, output, outputSz, input, headerSz + finishedSz,
|
sendSz = BuildMessage(ssl, output, outputSz, input, headerSz + finishedSz,
|
||||||
handshake, 1, 0, 0, CUR_ORDER);
|
handshake, 1, 0, 0, CUR_ORDER);
|
||||||
if (sendSz < 0)
|
if (sendSz < 0)
|
||||||
return BUILD_MSG_ERROR;
|
return BUILD_MSG_ERROR;
|
||||||
|
|
||||||
|
13
src/tls.c
13
src/tls.c
@ -187,13 +187,13 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
|
|||||||
|
|
||||||
ret = BuildTlsHandshakeHash(ssl, handshake_hash, &hashSz);
|
ret = BuildTlsHandshakeHash(ssl, handshake_hash, &hashSz);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if (XSTRNCMP((const char*)sender, (const char*)client,
|
if (XSTRNCMP((const char*)sender, (const char*)kTlsClientStr,
|
||||||
SIZEOF_SENDER) == 0) {
|
SIZEOF_SENDER) == 0) {
|
||||||
side = tls_client;
|
side = kTlsClientFinStr;
|
||||||
}
|
}
|
||||||
else if (XSTRNCMP((const char*)sender, (const char*)server,
|
else if (XSTRNCMP((const char*)sender, (const char*)kTlsServerStr,
|
||||||
SIZEOF_SENDER) == 0) {
|
SIZEOF_SENDER) == 0) {
|
||||||
side = tls_server;
|
side = kTlsServerFinStr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = BAD_FUNC_ARG;
|
ret = BAD_FUNC_ARG;
|
||||||
@ -5901,12 +5901,11 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, const byte* input,
|
|||||||
ProtocolVersion pv = ssl->ctx->method->version;
|
ProtocolVersion pv = ssl->ctx->method->version;
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
byte major, minor;
|
|
||||||
int newMinor = 0;
|
int newMinor = 0;
|
||||||
int set = 0;
|
int set = 0;
|
||||||
int ret;
|
int ret;
|
||||||
int tls13minor;
|
byte major, minor;
|
||||||
int tls12minor;
|
byte tls13minor, tls12minor;
|
||||||
byte isDtls;
|
byte isDtls;
|
||||||
|
|
||||||
tls13minor = TLSv1_3_MINOR;
|
tls13minor = TLSv1_3_MINOR;
|
||||||
|
@ -2668,7 +2668,7 @@ int BuildTls13Message(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
|
|||||||
const byte* aad = output;
|
const byte* aad = output;
|
||||||
output += args->headerSz;
|
output += args->headerSz;
|
||||||
ret = EncryptTls13(ssl, output, output, args->size, aad,
|
ret = EncryptTls13(ssl, output, output, args->size, aad,
|
||||||
args->headerSz, asyncOkay);
|
(word16)args->headerSz, asyncOkay);
|
||||||
#ifdef WOLFSSL_DTLS13
|
#ifdef WOLFSSL_DTLS13
|
||||||
if (ret == 0 && ssl->options.dtls) {
|
if (ret == 0 && ssl->options.dtls) {
|
||||||
/* AAD points to the header. Reuse the variable */
|
/* AAD points to the header. Reuse the variable */
|
||||||
|
@ -1499,7 +1499,7 @@ static WC_INLINE int bench_stats_sym_check(double start)
|
|||||||
static void bench_stats_sym_finish(const char* desc, int useDeviceID, int count,
|
static void bench_stats_sym_finish(const char* desc, int useDeviceID, int count,
|
||||||
int countSz, double start, int ret)
|
int countSz, double start, int ret)
|
||||||
{
|
{
|
||||||
double total, persec = 0, blocks = count;
|
double total, persec = 0, blocks = (double)count;
|
||||||
const char* blockType;
|
const char* blockType;
|
||||||
char msg[128] = {0};
|
char msg[128] = {0};
|
||||||
const char** word = bench_result_words1[lng_index];
|
const char** word = bench_result_words1[lng_index];
|
||||||
|
@ -1949,7 +1949,7 @@ static WC_INLINE sp_digit sp_2048_div_word_36(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -3011,7 +3011,7 @@ static WC_INLINE sp_digit sp_2048_div_word_72(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -5631,7 +5631,7 @@ static WC_INLINE sp_digit sp_3072_div_word_53(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -6470,7 +6470,7 @@ static WC_INLINE sp_digit sp_3072_div_word_106(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -9654,7 +9654,7 @@ static WC_INLINE sp_digit sp_3072_div_word_56(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 28);
|
r += (sp_digit)(m >> 28);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 56) - (sp_digit)(d >> 56);
|
r += (sp_digit)(m >> 56) - (sp_digit)(d >> 56);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -10572,7 +10572,7 @@ static WC_INLINE sp_digit sp_3072_div_word_112(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 28);
|
r += (sp_digit)(m >> 28);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 56) - (sp_digit)(d >> 56);
|
r += (sp_digit)(m >> 56) - (sp_digit)(d >> 56);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -13274,7 +13274,7 @@ static WC_INLINE sp_digit sp_4096_div_word_71(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -14114,7 +14114,7 @@ static WC_INLINE sp_digit sp_4096_div_word_142(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 29);
|
r += (sp_digit)(m >> 29);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 58) - (sp_digit)(d >> 58);
|
r += (sp_digit)(m >> 58) - (sp_digit)(d >> 58);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -17177,7 +17177,7 @@ static WC_INLINE sp_digit sp_4096_div_word_81(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 26);
|
r += (sp_digit)(m >> 26);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 52) - (sp_digit)(d >> 52);
|
r += (sp_digit)(m >> 52) - (sp_digit)(d >> 52);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -18081,7 +18081,7 @@ static WC_INLINE sp_digit sp_4096_div_word_162(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 26);
|
r += (sp_digit)(m >> 26);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 52) - (sp_digit)(d >> 52);
|
r += (sp_digit)(m >> 52) - (sp_digit)(d >> 52);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
@ -43708,7 +43708,7 @@ static WC_INLINE sp_digit sp_1024_div_word_42(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (sp_digit)(m >> 25);
|
r += (sp_digit)(m >> 25);
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
r += (m >> 50) - (sp_digit)(d >> 50);
|
r += (sp_digit)(m >> 50) - (sp_digit)(d >> 50);
|
||||||
|
|
||||||
m = d - ((sp_int64)r * div);
|
m = d - ((sp_int64)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint32)m >> 31)) * 2 + 1;
|
||||||
|
@ -869,7 +869,7 @@ static WC_INLINE sp_digit sp_2048_div_word_17(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 61);
|
r += (sp_digit)(m >> 61);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 122) - (sp_digit)(d >> 122);
|
r += (sp_digit)(m >> 122) - (sp_digit)(d >> 122);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -1694,7 +1694,7 @@ static WC_INLINE sp_digit sp_2048_div_word_34(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 61);
|
r += (sp_digit)(m >> 61);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 122) - (sp_digit)(d >> 122);
|
r += (sp_digit)(m >> 122) - (sp_digit)(d >> 122);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -4393,7 +4393,7 @@ static WC_INLINE sp_digit sp_2048_div_word_18(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 57);
|
r += (sp_digit)(m >> 57);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 114) - (sp_digit)(d >> 114);
|
r += (sp_digit)(m >> 114) - (sp_digit)(d >> 114);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -5279,7 +5279,7 @@ static WC_INLINE sp_digit sp_2048_div_word_36(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 57);
|
r += (sp_digit)(m >> 57);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 114) - (sp_digit)(d >> 114);
|
r += (sp_digit)(m >> 114) - (sp_digit)(d >> 114);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -7732,7 +7732,7 @@ static WC_INLINE sp_digit sp_3072_div_word_26(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 60);
|
r += (sp_digit)(m >> 60);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 120) - (sp_digit)(d >> 120);
|
r += (sp_digit)(m >> 120) - (sp_digit)(d >> 120);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -8563,7 +8563,7 @@ static WC_INLINE sp_digit sp_3072_div_word_52(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 60);
|
r += (sp_digit)(m >> 60);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 120) - (sp_digit)(d >> 120);
|
r += (sp_digit)(m >> 120) - (sp_digit)(d >> 120);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -11400,7 +11400,7 @@ static WC_INLINE sp_digit sp_3072_div_word_27(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 57);
|
r += (sp_digit)(m >> 57);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 114) - (sp_digit)(d >> 114);
|
r += (sp_digit)(m >> 114) - (sp_digit)(d >> 114);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -12297,7 +12297,7 @@ static WC_INLINE sp_digit sp_3072_div_word_54(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 57);
|
r += (sp_digit)(m >> 57);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 114) - (sp_digit)(d >> 114);
|
r += (sp_digit)(m >> 114) - (sp_digit)(d >> 114);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -14792,7 +14792,7 @@ static WC_INLINE sp_digit sp_4096_div_word_35(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 59);
|
r += (sp_digit)(m >> 59);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 118) - (sp_digit)(d >> 118);
|
r += (sp_digit)(m >> 118) - (sp_digit)(d >> 118);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -15618,7 +15618,7 @@ static WC_INLINE sp_digit sp_4096_div_word_70(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 59);
|
r += (sp_digit)(m >> 59);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 118) - (sp_digit)(d >> 118);
|
r += (sp_digit)(m >> 118) - (sp_digit)(d >> 118);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -18510,7 +18510,7 @@ static WC_INLINE sp_digit sp_4096_div_word_39(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 53);
|
r += (sp_digit)(m >> 53);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 106) - (sp_digit)(d >> 106);
|
r += (sp_digit)(m >> 106) - (sp_digit)(d >> 106);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -19408,7 +19408,7 @@ static WC_INLINE sp_digit sp_4096_div_word_78(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 53);
|
r += (sp_digit)(m >> 53);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 106) - (sp_digit)(d >> 106);
|
r += (sp_digit)(m >> 106) - (sp_digit)(d >> 106);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
@ -43170,7 +43170,7 @@ static WC_INLINE sp_digit sp_1024_div_word_18(sp_digit d1, sp_digit d0,
|
|||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (sp_digit)(m >> 57);
|
r += (sp_digit)(m >> 57);
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
r += (m >> 114) - (sp_digit)(d >> 114);
|
r += (sp_digit)(m >> 114) - (sp_digit)(d >> 114);
|
||||||
|
|
||||||
m = d - ((sp_int128)r * div);
|
m = d - ((sp_int128)r * div);
|
||||||
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
sign = (sp_digit)(0 - ((sp_uint64)m >> 63)) * 2 + 1;
|
||||||
|
@ -1826,7 +1826,7 @@ WOLFSSL_TEST_SUBROUTINE int base64_test(void)
|
|||||||
/* Invalid character less than 0x2b */
|
/* Invalid character less than 0x2b */
|
||||||
for (i = 1; i < 0x2b; i++) {
|
for (i = 1; i < 0x2b; i++) {
|
||||||
outLen = sizeof(out);
|
outLen = sizeof(out);
|
||||||
charTest[0] = i;
|
charTest[0] = (byte)i;
|
||||||
ret = Base64_Decode(charTest, sizeof(charTest), out, &outLen);
|
ret = Base64_Decode(charTest, sizeof(charTest), out, &outLen);
|
||||||
if (ret != ASN_INPUT_E)
|
if (ret != ASN_INPUT_E)
|
||||||
return -1240 - i;
|
return -1240 - i;
|
||||||
@ -1842,7 +1842,7 @@ WOLFSSL_TEST_SUBROUTINE int base64_test(void)
|
|||||||
/* Invalid character greater than 0x7a */
|
/* Invalid character greater than 0x7a */
|
||||||
for (i = 0x7b; i < 0x100; i++) {
|
for (i = 0x7b; i < 0x100; i++) {
|
||||||
outLen = sizeof(out);
|
outLen = sizeof(out);
|
||||||
charTest[0] = i;
|
charTest[0] = (byte)i;
|
||||||
ret = Base64_Decode(charTest, sizeof(charTest), out, &outLen);
|
ret = Base64_Decode(charTest, sizeof(charTest), out, &outLen);
|
||||||
if (ret != ASN_INPUT_E)
|
if (ret != ASN_INPUT_E)
|
||||||
return -1290 - i;
|
return -1290 - i;
|
||||||
|
@ -5057,11 +5057,11 @@ enum ProvisionSide {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const byte client[SIZEOF_SENDER+1] = { 0x43, 0x4C, 0x4E, 0x54, 0x00 }; /* CLNT */
|
static const byte kTlsClientStr[SIZEOF_SENDER+1] = { 0x43, 0x4C, 0x4E, 0x54, 0x00 }; /* CLNT */
|
||||||
static const byte server[SIZEOF_SENDER+1] = { 0x53, 0x52, 0x56, 0x52, 0x00 }; /* SRVR */
|
static const byte kTlsServerStr[SIZEOF_SENDER+1] = { 0x53, 0x52, 0x56, 0x52, 0x00 }; /* SRVR */
|
||||||
|
|
||||||
static const byte tls_client[FINISHED_LABEL_SZ + 1] = "client finished";
|
static const byte kTlsClientFinStr[FINISHED_LABEL_SZ + 1] = "client finished";
|
||||||
static const byte tls_server[FINISHED_LABEL_SZ + 1] = "server finished";
|
static const byte kTlsServerFinStr[FINISHED_LABEL_SZ + 1] = "server finished";
|
||||||
|
|
||||||
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
|
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user