mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-10-02 16:24:45 +08:00
Move WolfSSL to ThirdParty and Submodule code (#433)
* Submodule wolfSSL and move wolfSSL and WolfSSL-FIPS-Ready to ThirdParty folder. * Update VS studio project. * Update FIPS project settings. * Update FIPS demo readme. * Add md to ignored file extensions.
This commit is contained in:
@@ -247,6 +247,7 @@ FREERTOS_IGNORED_EXTENSIONS = [
|
||||
'.mcpar',
|
||||
'.mcs',
|
||||
'.mcw',
|
||||
'.md',
|
||||
'.mdm',
|
||||
'.mem',
|
||||
'.mhs',
|
||||
|
||||
@@ -37,3 +37,6 @@
|
||||
[submodule "FreeRTOS-Plus/Source/Utilities/backoff_algorithm"]
|
||||
path = FreeRTOS-Plus/Source/Utilities/backoff_algorithm
|
||||
url = https://github.com/FreeRTOS/backoffAlgorithm.git
|
||||
[submodule "FreeRTOS-Plus/ThirdParty/wolfSSL"]
|
||||
path = FreeRTOS-Plus/ThirdParty/wolfSSL
|
||||
url = https://github.com/wolfSSL/wolfssl.git
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ The in-core integrity check requires a pre-calculated hash value to be stored in
|
||||
|
||||
1. Let us go back to the messages in the console shown in the previous section. You may see "hash = C66491A040..." in the message. **The charactor sequence is the value for the pre-calculated hash value.** Please copy this charactor sequece and store it in a temporary location for reference in the next step.
|
||||
|
||||
2. Find and open the file named "**fips_test.c**" under the RTOSDemo/FreeRTOS+/wolfSSL/wolfcrypt folder in the Visual Studio solution explorer pane. Or you can reach the file by traversing "../../Source/WolfSSL-FIPS-Ready/wolfcrypt/src/fips_test.c" starting from the folder where this README is included.
|
||||
2. Find and open the file named "**fips_test.c**" under the RTOSDemo/FreeRTOS+/wolfSSL/wolfcrypt folder in the Visual Studio solution explorer pane. Or you can reach the file by traversing "../../ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/fips_test.c" starting from the folder where this README is included.
|
||||
|
||||
3. In the fips_test.c, find the following statement:
|
||||
|
||||
|
||||
+132
-132
File diff suppressed because it is too large
Load Diff
+128
-128
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+110
-164
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,102 +0,0 @@
|
||||
0. Building on *nix from git repository
|
||||
|
||||
Run the autogen script to generate configure, then proceed to step 1.
|
||||
Prerequisites: You'll need autoconf, automake and libtool installed.
|
||||
|
||||
$ ./autogen.sh
|
||||
|
||||
1. Building on *nix from a release
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check # (optional, but highly recommended)
|
||||
$ sudo make install
|
||||
|
||||
2. Building on iOS
|
||||
|
||||
Use on the xcode project in IDE/iOS/wolfssl.xcodeproj
|
||||
There is a README in IDE/iOS with more information
|
||||
|
||||
3. Building on Windows
|
||||
|
||||
Use the 32bit Visual Studio Solution wolfssl.sln
|
||||
For a 64bit solution please use wolfssl64.sln
|
||||
|
||||
4. Building with IAR
|
||||
|
||||
Please see the README in IDE/IAR-EWARM for detailed instructions
|
||||
|
||||
5. Building with Keil
|
||||
|
||||
Please see the Keil Projects in IDE/MDK5-ARM/Projects
|
||||
|
||||
6. Building with Microchip tools
|
||||
|
||||
Please see the README in mplabx
|
||||
|
||||
7. Building with Freescale MQX
|
||||
|
||||
Please see the README in mqx
|
||||
|
||||
8. Building with Rowley CrossWorks for ARM
|
||||
|
||||
Use the CrossWorks project in IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp
|
||||
There is a README.md in IDE/ROWLEY-CROSSWORKS-ARM with more information
|
||||
|
||||
9. Building with Arduino
|
||||
|
||||
Use the script IDE/ARDUINO/wolfssl-arduino.sh to reformat the wolfSSL
|
||||
library for compatibility with the Arduino IDE. There is a README.md in
|
||||
IDE/ARDUINO for detailed instructions.
|
||||
|
||||
10. Building for Android with Visual Studio 2017
|
||||
|
||||
Please see the README in IDE/VS-ARM.
|
||||
Use the Visual Studio solution IDE/VS-ARM/wolfssl.sln.
|
||||
|
||||
11. Building for Yocto Project or OpenEmbedded
|
||||
|
||||
Please see the README in the "meta-wolfssl" repository. This repository
|
||||
holds wolfSSL's Yocto and OpenEmbedded layer, which contains recipes
|
||||
for wolfSSL, wolfSSH, wolfMQTT, wolfTPM, wolfCrypt examples, and OSS
|
||||
project bbappend files.
|
||||
|
||||
https://github.com/wolfssl/meta-wolfssl
|
||||
|
||||
The wolfSSL recipe can also be found in the OpenEmbedded
|
||||
"meta-openembedded/meta-networking/recipes-connectivity" layer:
|
||||
|
||||
https://github.com/openembedded/meta-openembedded
|
||||
|
||||
12. Porting to a new platform
|
||||
|
||||
Please see section 2.4 in the manual:
|
||||
http://www.wolfssl.com/yaSSL/Docs-cyassl-manual-2-building-cyassl.html
|
||||
|
||||
13. Building with CMake
|
||||
Note: Primary development uses automake (./configure). The support for CMake is minimal.
|
||||
|
||||
Internally cmake is setup to do the following:
|
||||
1. Uses the ./configure generated wolfssl/options.h as the build options by coping it to the build directory as user_settings.h.
|
||||
2. Builds wolfSSL as library.
|
||||
3. Builds the examples.
|
||||
|
||||
Build Steps:
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ cmake --build .
|
||||
$ cmake --install .
|
||||
|
||||
To build library only and not build examples and test apps use:
|
||||
$ cmake .. -DBUILD_TESTS=NO
|
||||
|
||||
To build with debugging use:
|
||||
$ cmake .. -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
Make sure and run the built examples and test from the wolfssl-root to properly find the ./certs directory.
|
||||
|
||||
CMake on Windows with Visual Studio
|
||||
1. Open Command Prompt
|
||||
2. Run the Visual Studio batch to setup command line variables: Example: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||
3. Then use steps above
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
wolfSSL (formerly known as CyaSSL) and wolfCrypt are either licensed for use
|
||||
under the GPLv2 (or at your option any later version) or a standard commercial
|
||||
license. For our users who cannot use wolfSSL under GPLv2
|
||||
(or any later version), a commercial license to wolfSSL and wolfCrypt is
|
||||
available.
|
||||
|
||||
Please contact wolfSSL Inc. directly at:
|
||||
|
||||
Email: licensing@wolfssl.com
|
||||
Phone: +1 425 245-8247
|
||||
|
||||
More information can be found on the wolfSSL website at www.wolfssl.com.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
-1183
File diff suppressed because it is too large
Load Diff
@@ -1,189 +0,0 @@
|
||||
/* config.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* User RSA is being defined */
|
||||
#undef BUILD_USER_RSA
|
||||
|
||||
/* Define to 1 to enable debugging code. */
|
||||
#undef DEBUG
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* Define to 1 if you have the `inet_ntoa' function. */
|
||||
#undef HAVE_INET_NTOA
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <ippcp.h> header file. */
|
||||
#undef HAVE_IPPCP_H
|
||||
|
||||
/* Define to 1 if you have the `network' library (-lnetwork). */
|
||||
#undef HAVE_LIBNETWORK
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#undef HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if you have the <pcap/pcap.h> header file. */
|
||||
#undef HAVE_PCAP_PCAP_H
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#undef HAVE_PTHREAD_PRIO_INHERIT
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 or 0, depending whether the compiler supports simple visibility
|
||||
declarations. */
|
||||
#undef HAVE_VISIBILITY
|
||||
|
||||
/* Define to 1 if the system has the type `__uint128_t'. */
|
||||
#undef HAVE___UINT128_T
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* The size of `time_t', as computed by sizeof. */
|
||||
#undef SIZEOF_TIME_T
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* If the compiler supports a TLS storage class define it to that here */
|
||||
#undef TLS
|
||||
|
||||
/* Define if the code was built from VCS. */
|
||||
#undef VCS_CHECKOUT
|
||||
|
||||
/* VCS system */
|
||||
#undef VCS_SYSTEM
|
||||
|
||||
/* Use __declspec(dllexport) when building library */
|
||||
#undef WOLFSSL_DLL
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
#undef _UINT8_T
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 8 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
#undef uint8_t
|
||||
-30151
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if test ! -x ./wolfcrypt/test/testwolfcrypt
|
||||
then
|
||||
echo "fips-hash: wolfCrypt test missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -s ./wolfcrypt/src/fips_test.c
|
||||
then
|
||||
echo "fips-hash: fips_test.c missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NEWHASH=$(./wolfcrypt/test/testwolfcrypt | sed -n 's/hash = \(.*\)/\1/p')
|
||||
if test -n "$NEWHASH"
|
||||
then
|
||||
sed -i.bak "s/^\".*\";/\"${NEWHASH}\";/" wolfcrypt/src/fips_test.c
|
||||
fi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,89 +0,0 @@
|
||||
/* echoclient.c */
|
||||
|
||||
#include "openssl/ssl.h"
|
||||
#include "../test.h"
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
SOCKET_T sockfd = 0;
|
||||
|
||||
FILE* fin = stdin;
|
||||
FILE* fout = stdout;
|
||||
|
||||
int inCreated = 0;
|
||||
int outCreated = 0;
|
||||
|
||||
char send[1024];
|
||||
char reply[1024];
|
||||
|
||||
SSL_METHOD* method = 0;
|
||||
SSL_CTX* ctx = 0;
|
||||
SSL* ssl = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
WSADATA wsd;
|
||||
WSAStartup(0x0002, &wsd);
|
||||
#endif
|
||||
|
||||
if (argc >= 2) {
|
||||
fin = fopen(argv[1], "r");
|
||||
inCreated = 1;
|
||||
}
|
||||
if (argc >= 3) {
|
||||
fout = fopen(argv[2], "w");
|
||||
outCreated = 1;
|
||||
}
|
||||
|
||||
if (!fin) err_sys("can't open input file");
|
||||
if (!fout) err_sys("can't open output file");
|
||||
|
||||
tcp_connect(&sockfd);
|
||||
|
||||
method = SSLv3_client_method();
|
||||
ctx = SSL_CTX_new(method);
|
||||
|
||||
if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS)
|
||||
err_sys("can't load ca file");
|
||||
|
||||
ssl = SSL_new(ctx);
|
||||
|
||||
if (SSL_set_fd(ssl, sockfd) != SSL_SUCCESS)
|
||||
err_sys("can't set ssl fd");
|
||||
|
||||
if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed");
|
||||
|
||||
while (fgets(send, sizeof(send), fin)) {
|
||||
|
||||
int sendSz = strlen(send) + 1;
|
||||
|
||||
if (SSL_write(ssl, send, sendSz) != sendSz)
|
||||
err_sys("SSL_write failed");
|
||||
|
||||
if (strncmp(send, "quit", 4) == 0) {
|
||||
fputs("sending server shutdown command: quit!\n", fout);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SSL_read(ssl, reply, sizeof(reply)) > 0)
|
||||
fputs(reply, fout);
|
||||
}
|
||||
|
||||
SSL_shutdown(ssl);
|
||||
SSL_free(ssl);
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
fflush(fout);
|
||||
if (inCreated) fclose(fin);
|
||||
if (outCreated) fclose(fout);
|
||||
|
||||
#ifdef _WIN32
|
||||
closesocket(sockfd);
|
||||
#else
|
||||
close(sockfd);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
quit
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# Our valgrind "error" wrapper.
|
||||
|
||||
TMP="valgrind.tmp.$$"
|
||||
|
||||
valgrind --suppressions=valgrind-bash.supp --leak-check=full -q "$@" 2> $TMP
|
||||
|
||||
result="$?"
|
||||
|
||||
# verify no errors
|
||||
|
||||
output="`cat $TMP`"
|
||||
|
||||
if [ "$output" != "" ]; then
|
||||
cat $TMP >&2
|
||||
result=1
|
||||
fi
|
||||
|
||||
rm $TMP
|
||||
|
||||
exit $result
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,111 +0,0 @@
|
||||
/* wolfcrypt/benchmark/benchmark.h
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WOLFCRYPT_BENCHMARK_H
|
||||
#define WOLFCRYPT_BENCHMARK_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* run all benchmark entry */
|
||||
#ifdef HAVE_STACK_SIZE
|
||||
THREAD_RETURN WOLFSSL_THREAD benchmark_test(void* args);
|
||||
#else
|
||||
int benchmark_test(void *args);
|
||||
#endif
|
||||
|
||||
/* individual benchmarks */
|
||||
int benchmark_init(void);
|
||||
int benchmark_free(void);
|
||||
void benchmark_configure(int block_size);
|
||||
|
||||
void bench_des(int);
|
||||
void bench_idea(void);
|
||||
void bench_arc4(int);
|
||||
void bench_hc128(void);
|
||||
void bench_rabbit(void);
|
||||
void bench_chacha(void);
|
||||
void bench_chacha20_poly1305_aead(void);
|
||||
void bench_aescbc(int);
|
||||
void bench_aesgcm(int);
|
||||
void bench_aesccm(void);
|
||||
void bench_aesecb(int);
|
||||
void bench_aesxts(void);
|
||||
void bench_aesctr(void);
|
||||
void bench_aescfb(void);
|
||||
void bench_aesofb(void);
|
||||
void bench_poly1305(void);
|
||||
void bench_camellia(void);
|
||||
void bench_md5(int);
|
||||
void bench_sha(int);
|
||||
void bench_sha224(int);
|
||||
void bench_sha256(int);
|
||||
void bench_sha384(int);
|
||||
void bench_sha512(int);
|
||||
void bench_sha3_224(int);
|
||||
void bench_sha3_256(int);
|
||||
void bench_sha3_384(int);
|
||||
void bench_sha3_512(int);
|
||||
int bench_ripemd(void);
|
||||
void bench_cmac(void);
|
||||
void bench_scrypt(void);
|
||||
void bench_hmac_md5(int);
|
||||
void bench_hmac_sha(int);
|
||||
void bench_hmac_sha224(int);
|
||||
void bench_hmac_sha256(int);
|
||||
void bench_hmac_sha384(int);
|
||||
void bench_hmac_sha512(int);
|
||||
void bench_rsaKeyGen(int);
|
||||
void bench_rsaKeyGen_size(int, int);
|
||||
void bench_rsa(int);
|
||||
void bench_rsa_key(int, int);
|
||||
void bench_dh(int);
|
||||
void bench_eccMakeKey(int);
|
||||
void bench_ecc(int);
|
||||
void bench_eccEncrypt(void);
|
||||
void bench_curve25519KeyGen(void);
|
||||
void bench_curve25519KeyAgree(void);
|
||||
void bench_ed25519KeyGen(void);
|
||||
void bench_ed25519KeySign(void);
|
||||
void bench_curve448KeyGen(void);
|
||||
void bench_curve448KeyAgree(void);
|
||||
void bench_ed448KeyGen(void);
|
||||
void bench_ed448KeySign(void);
|
||||
void bench_ntru(void);
|
||||
void bench_ntruKeyGen(void);
|
||||
void bench_rng(void);
|
||||
void bench_blake2b(void);
|
||||
void bench_blake2s(void);
|
||||
void bench_pbkdf2(void);
|
||||
|
||||
void bench_stats_print(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* WOLFCRYPT_BENCHMARK_H */
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "benchmark", "benchmark.vcproj", "{615AEC46-5595-4DEA-9490-DBD5DE0F8772}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B} = {73973223-5EE8-41CA-8E88-1D60E89A237B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssl", "..\..\wolfssl.vcxproj", "{73973223-5EE8-41CA-8E88-1D60E89A237B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
DLL Debug|Win32 = DLL Debug|Win32
|
||||
DLL Debug|x64 = DLL Debug|x64
|
||||
DLL Release|Win32 = DLL Release|Win32
|
||||
DLL Release|x64 = DLL Release|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Debug|x64.Build.0 = Debug|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Debug|Win32.Build.0 = Debug|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Debug|x64.ActiveCfg = Debug|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Debug|x64.Build.0 = Debug|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Release|Win32.ActiveCfg = Release|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Release|Win32.Build.0 = Release|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Release|x64.ActiveCfg = Release|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.DLL Release|x64.Build.0 = Release|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|Win32.Build.0 = Release|Win32
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|x64.ActiveCfg = Release|x64
|
||||
{615AEC46-5595-4DEA-9490-DBD5DE0F8772}.Release|x64.Build.0 = Release|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Debug|x64.Build.0 = Debug|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|Win32.Build.0 = DLL Debug|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.ActiveCfg = DLL Debug|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Debug|x64.Build.0 = DLL Debug|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.ActiveCfg = DLL Release|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|Win32.Build.0 = DLL Release|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.ActiveCfg = DLL Release|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.DLL Release|x64.Build.0 = DLL Release|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|Win32.Build.0 = Release|Win32
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|x64.ActiveCfg = Release|x64
|
||||
{73973223-5EE8-41CA-8E88-1D60E89A237B}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,197 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="benchmark"
|
||||
ProjectGUID="{615AEC46-5595-4DEA-9490-DBD5DE0F8772}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../..;../../IDE/WIN;"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Ws2_32.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../..;../../IDE/WIN;"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Ws2_32.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\benchmark.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,14 +0,0 @@
|
||||
# vim:ft=automake
|
||||
# All paths should be given relative to the root
|
||||
|
||||
if BUILD_WOLFCRYPT_TESTS
|
||||
noinst_PROGRAMS += wolfcrypt/benchmark/benchmark
|
||||
wolfcrypt_benchmark_benchmark_SOURCES = wolfcrypt/benchmark/benchmark.c
|
||||
wolfcrypt_benchmark_benchmark_LDADD = src/libwolfssl.la $(LIB_STATIC_ADD)
|
||||
wolfcrypt_benchmark_benchmark_DEPENDENCIES = src/libwolfssl.la
|
||||
noinst_HEADERS += wolfcrypt/benchmark/benchmark.h
|
||||
endif
|
||||
EXTRA_DIST += wolfcrypt/benchmark/benchmark.sln
|
||||
EXTRA_DIST += wolfcrypt/benchmark/benchmark.vcproj
|
||||
EXTRA_DIST += wolfcrypt/benchmark/README.md
|
||||
DISTCLEANFILES+= wolfcrypt/benchmark/.libs/benchmark
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,149 +0,0 @@
|
||||
/* arc4.c
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#ifndef NO_RC4
|
||||
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/arc4.h>
|
||||
|
||||
|
||||
int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
{
|
||||
int ret = 0;
|
||||
word32 i;
|
||||
word32 keyIndex = 0, stateIndex = 0;
|
||||
|
||||
if (arc4 == NULL || key == NULL || length == 0) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4) && \
|
||||
defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
if (arc4->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ARC4) {
|
||||
return NitroxArc4SetKey(arc4, key, length);
|
||||
}
|
||||
#endif
|
||||
|
||||
arc4->x = 1;
|
||||
arc4->y = 0;
|
||||
|
||||
for (i = 0; i < ARC4_STATE_SIZE; i++)
|
||||
arc4->state[i] = (byte)i;
|
||||
|
||||
for (i = 0; i < ARC4_STATE_SIZE; i++) {
|
||||
word32 a = arc4->state[i];
|
||||
stateIndex += key[keyIndex] + a;
|
||||
stateIndex &= 0xFF;
|
||||
arc4->state[i] = arc4->state[stateIndex];
|
||||
arc4->state[stateIndex] = (byte)a;
|
||||
|
||||
if (++keyIndex >= length)
|
||||
keyIndex = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static WC_INLINE byte MakeByte(word32* x, word32* y, byte* s)
|
||||
{
|
||||
word32 a = s[*x], b;
|
||||
*y = (*y+a) & 0xff;
|
||||
|
||||
b = s[*y];
|
||||
s[*x] = (byte)b;
|
||||
s[*y] = (byte)a;
|
||||
*x = (*x+1) & 0xff;
|
||||
|
||||
return s[(a+b) & 0xff];
|
||||
}
|
||||
|
||||
|
||||
int wc_Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
{
|
||||
int ret = 0;
|
||||
word32 x;
|
||||
word32 y;
|
||||
|
||||
if (arc4 == NULL || out == NULL || in == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4) && \
|
||||
defined(HAVE_CAVIUM) && !defined(HAVE_CAVIUM_V)
|
||||
if (arc4->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ARC4) {
|
||||
return NitroxArc4Process(arc4, out, in, length);
|
||||
}
|
||||
#endif
|
||||
|
||||
x = arc4->x;
|
||||
y = arc4->y;
|
||||
|
||||
while(length--)
|
||||
*out++ = *in++ ^ MakeByte(&x, &y, arc4->state);
|
||||
|
||||
arc4->x = (byte)x;
|
||||
arc4->y = (byte)y;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Initialize Arc4 for use with async device */
|
||||
int wc_Arc4Init(Arc4* arc4, void* heap, int devId)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (arc4 == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
arc4->heap = heap;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4)
|
||||
ret = wolfAsync_DevCtxInit(&arc4->asyncDev, WOLFSSL_ASYNC_MARKER_ARC4,
|
||||
arc4->heap, devId);
|
||||
#else
|
||||
(void)devId;
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Free Arc4 from use with async device */
|
||||
void wc_Arc4Free(Arc4* arc4)
|
||||
{
|
||||
if (arc4 == NULL)
|
||||
return;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ARC4)
|
||||
wolfAsync_DevCtxFree(&arc4->asyncDev, WOLFSSL_ASYNC_MARKER_ARC4);
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
}
|
||||
|
||||
#endif /* NO_RC4 */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,198 +0,0 @@
|
||||
/* compress.c
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
||||
|
||||
#include <wolfssl/wolfcrypt/compress.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#define WOLFSSL_MISC_INCLUDED
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
||||
/* alloc user allocs to work with zlib */
|
||||
static void* myAlloc(void* opaque, unsigned int item, unsigned int size)
|
||||
{
|
||||
(void)opaque;
|
||||
return XMALLOC(item * size, opaque, DYNAMIC_TYPE_LIBZ);
|
||||
}
|
||||
|
||||
|
||||
static void myFree(void* opaque, void* memory)
|
||||
{
|
||||
(void)opaque;
|
||||
XFREE(memory, opaque, DYNAMIC_TYPE_LIBZ);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_MCAPI
|
||||
#define DEFLATE_DEFAULT_WINDOWBITS 11
|
||||
#define DEFLATE_DEFAULT_MEMLEVEL 1
|
||||
#else
|
||||
#define DEFLATE_DEFAULT_WINDOWBITS 15
|
||||
#define DEFLATE_DEFAULT_MEMLEVEL 8
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* out - pointer to destination buffer
|
||||
* outSz - size of destination buffer
|
||||
* in - pointer to source buffer to compress
|
||||
* inSz - size of source to compress
|
||||
* flags - flags to control how compress operates
|
||||
*
|
||||
* return:
|
||||
* negative - error code
|
||||
* positive - bytes stored in out buffer
|
||||
*
|
||||
* Note, the output buffer still needs to be larger than the input buffer.
|
||||
* The right chunk of data won't compress at all, and the lookup table will
|
||||
* add to the size of the output. The libz code says the compressed
|
||||
* buffer should be srcSz + 0.1% + 12.
|
||||
*/
|
||||
int wc_Compress_ex(byte* out, word32 outSz, const byte* in, word32 inSz,
|
||||
word32 flags, word32 windowBits)
|
||||
{
|
||||
z_stream stream;
|
||||
int result = 0;
|
||||
|
||||
stream.next_in = (Bytef*)in;
|
||||
stream.avail_in = (uInt)inSz;
|
||||
#ifdef MAXSEG_64K
|
||||
/* Check for source > 64K on 16-bit machine: */
|
||||
if ((uLong)stream.avail_in != inSz) return COMPRESS_INIT_E;
|
||||
#endif
|
||||
stream.next_out = out;
|
||||
stream.avail_out = (uInt)outSz;
|
||||
if ((uLong)stream.avail_out != outSz) return COMPRESS_INIT_E;
|
||||
|
||||
stream.zalloc = (alloc_func)myAlloc;
|
||||
stream.zfree = (free_func)myFree;
|
||||
stream.opaque = (voidpf)0;
|
||||
|
||||
if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
|
||||
DEFLATE_DEFAULT_WINDOWBITS | windowBits,
|
||||
DEFLATE_DEFAULT_MEMLEVEL,
|
||||
flags ? Z_FIXED : Z_DEFAULT_STRATEGY) != Z_OK)
|
||||
return COMPRESS_INIT_E;
|
||||
|
||||
if (deflate(&stream, Z_FINISH) != Z_STREAM_END) {
|
||||
deflateEnd(&stream);
|
||||
return COMPRESS_E;
|
||||
}
|
||||
|
||||
result = (int)stream.total_out;
|
||||
|
||||
if (deflateEnd(&stream) != Z_OK)
|
||||
result = COMPRESS_E;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int wc_Compress(byte* out, word32 outSz, const byte* in, word32 inSz, word32 flags)
|
||||
{
|
||||
return wc_Compress_ex(out, outSz, in, inSz, flags, 0);
|
||||
}
|
||||
|
||||
|
||||
/* windowBits:
|
||||
* deflateInit() and inflateInit(), as well as deflateInit2() and inflateInit2()
|
||||
with windowBits in 0..15 all process zlib-wrapped deflate data.
|
||||
(See RFC 1950 and RFC 1951.)
|
||||
* deflateInit2() and inflateInit2() with negative windowBits in -1..-15 process
|
||||
raw deflate data with no header or trailer.
|
||||
* deflateInit2() and inflateInit2() with windowBits in 16..31, i.e. 16
|
||||
added to 0..15, process gzip-wrapped deflate data (RFC 1952).
|
||||
* inflateInit2() with windowBits in 32..47 (32 added to 0..15) will
|
||||
automatically detect either a gzip or zlib header (but not raw deflate
|
||||
data), and decompress accordingly.
|
||||
*/
|
||||
int wc_DeCompress_ex(byte* out, word32 outSz, const byte* in, word32 inSz,
|
||||
int windowBits)
|
||||
/*
|
||||
* out - pointer to destination buffer
|
||||
* outSz - size of destination buffer
|
||||
* in - pointer to source buffer to compress
|
||||
* inSz - size of source to compress
|
||||
* windowBits - flags to control how decompress operates
|
||||
*
|
||||
* return:
|
||||
* negative - error code
|
||||
* positive - bytes stored in out buffer
|
||||
*/
|
||||
{
|
||||
z_stream stream;
|
||||
int result = 0;
|
||||
|
||||
stream.next_in = (Bytef*)in;
|
||||
stream.avail_in = (uInt)inSz;
|
||||
/* Check for source > 64K on 16-bit machine: */
|
||||
if ((uLong)stream.avail_in != inSz) return DECOMPRESS_INIT_E;
|
||||
|
||||
stream.next_out = out;
|
||||
stream.avail_out = (uInt)outSz;
|
||||
if ((uLong)stream.avail_out != outSz) return DECOMPRESS_INIT_E;
|
||||
|
||||
stream.zalloc = (alloc_func)myAlloc;
|
||||
stream.zfree = (free_func)myFree;
|
||||
stream.opaque = (voidpf)0;
|
||||
|
||||
if (inflateInit2(&stream, DEFLATE_DEFAULT_WINDOWBITS | windowBits) != Z_OK)
|
||||
return DECOMPRESS_INIT_E;
|
||||
|
||||
result = inflate(&stream, Z_FINISH);
|
||||
if (result != Z_STREAM_END) {
|
||||
inflateEnd(&stream);
|
||||
return DECOMPRESS_E;
|
||||
}
|
||||
|
||||
result = (int)stream.total_out;
|
||||
|
||||
if (inflateEnd(&stream) != Z_OK)
|
||||
result = DECOMPRESS_E;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int wc_DeCompress(byte* out, word32 outSz, const byte* in, word32 inSz)
|
||||
{
|
||||
return wc_DeCompress_ex(out, outSz, in, inSz, 0);
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
/* cpuid.c
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/cpuid.h>
|
||||
|
||||
#if (defined(WOLFSSL_X86_64_BUILD) || defined(USE_INTEL_SPEEDUP) || \
|
||||
defined(WOLFSSL_AESNI)) && !defined(WOLFSSL_NO_ASM)
|
||||
/* Each platform needs to query info type 1 from cpuid to see if aesni is
|
||||
* supported. Also, let's setup a macro for proper linkage w/o ABI conflicts
|
||||
*/
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define cpuid(reg, leaf, sub)\
|
||||
__asm__ __volatile__ ("cpuid":\
|
||||
"=a" (reg[0]), "=b" (reg[1]), "=c" (reg[2]), "=d" (reg[3]) :\
|
||||
"a" (leaf), "c"(sub));
|
||||
|
||||
#define XASM_LINK(f) asm(f)
|
||||
#else
|
||||
#include <intrin.h>
|
||||
|
||||
#define cpuid(a,b,c) __cpuidex((int*)a,b,c)
|
||||
|
||||
#define XASM_LINK(f)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#define EAX 0
|
||||
#define EBX 1
|
||||
#define ECX 2
|
||||
#define EDX 3
|
||||
|
||||
static word32 cpuid_check = 0;
|
||||
static word32 cpuid_flags = 0;
|
||||
|
||||
static word32 cpuid_flag(word32 leaf, word32 sub, word32 num, word32 bit)
|
||||
{
|
||||
int got_intel_cpu = 0;
|
||||
int got_amd_cpu = 0;
|
||||
unsigned int reg[5];
|
||||
reg[4] = '\0';
|
||||
cpuid(reg, 0, 0);
|
||||
|
||||
/* check for Intel cpu */
|
||||
if (XMEMCMP((char *)&(reg[EBX]), "Genu", 4) == 0 &&
|
||||
XMEMCMP((char *)&(reg[EDX]), "ineI", 4) == 0 &&
|
||||
XMEMCMP((char *)&(reg[ECX]), "ntel", 4) == 0) {
|
||||
got_intel_cpu = 1;
|
||||
}
|
||||
|
||||
/* check for AMD cpu */
|
||||
if (XMEMCMP((char *)&(reg[EBX]), "Auth", 4) == 0 &&
|
||||
XMEMCMP((char *)&(reg[EDX]), "enti", 4) == 0 &&
|
||||
XMEMCMP((char *)&(reg[ECX]), "cAMD", 4) == 0) {
|
||||
got_amd_cpu = 1;
|
||||
}
|
||||
|
||||
if (got_intel_cpu || got_amd_cpu) {
|
||||
cpuid(reg, leaf, sub);
|
||||
return ((reg[num] >> bit) & 0x1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void cpuid_set_flags(void)
|
||||
{
|
||||
if (!cpuid_check) {
|
||||
if (cpuid_flag(1, 0, ECX, 28)) { cpuid_flags |= CPUID_AVX1 ; }
|
||||
if (cpuid_flag(7, 0, EBX, 5)) { cpuid_flags |= CPUID_AVX2 ; }
|
||||
if (cpuid_flag(7, 0, EBX, 8)) { cpuid_flags |= CPUID_BMI2 ; }
|
||||
if (cpuid_flag(1, 0, ECX, 30)) { cpuid_flags |= CPUID_RDRAND; }
|
||||
if (cpuid_flag(7, 0, EBX, 18)) { cpuid_flags |= CPUID_RDSEED; }
|
||||
if (cpuid_flag(1, 0, ECX, 25)) { cpuid_flags |= CPUID_AESNI ; }
|
||||
if (cpuid_flag(7, 0, EBX, 19)) { cpuid_flags |= CPUID_ADX ; }
|
||||
if (cpuid_flag(1, 0, ECX, 22)) { cpuid_flags |= CPUID_MOVBE ; }
|
||||
cpuid_check = 1;
|
||||
}
|
||||
}
|
||||
|
||||
word32 cpuid_get_flags(void)
|
||||
{
|
||||
if (!cpuid_check)
|
||||
cpuid_set_flags();
|
||||
return cpuid_flags;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
/* dummy ecc_fp.c for dist */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,147 +0,0 @@
|
||||
/* fp_mul_comba_12.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL12
|
||||
int fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[24];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 24, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 12 * sizeof(fp_digit));
|
||||
XMEMCPY(at+12, B->dp, 12 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[12]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[13]); MULADD(at[1], at[12]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[14]); MULADD(at[1], at[13]); MULADD(at[2], at[12]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[15]); MULADD(at[1], at[14]); MULADD(at[2], at[13]); MULADD(at[3], at[12]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[16]); MULADD(at[1], at[15]); MULADD(at[2], at[14]); MULADD(at[3], at[13]); MULADD(at[4], at[12]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[17]); MULADD(at[1], at[16]); MULADD(at[2], at[15]); MULADD(at[3], at[14]); MULADD(at[4], at[13]); MULADD(at[5], at[12]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[18]); MULADD(at[1], at[17]); MULADD(at[2], at[16]); MULADD(at[3], at[15]); MULADD(at[4], at[14]); MULADD(at[5], at[13]); MULADD(at[6], at[12]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[19]); MULADD(at[1], at[18]); MULADD(at[2], at[17]); MULADD(at[3], at[16]); MULADD(at[4], at[15]); MULADD(at[5], at[14]); MULADD(at[6], at[13]); MULADD(at[7], at[12]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[20]); MULADD(at[1], at[19]); MULADD(at[2], at[18]); MULADD(at[3], at[17]); MULADD(at[4], at[16]); MULADD(at[5], at[15]); MULADD(at[6], at[14]); MULADD(at[7], at[13]); MULADD(at[8], at[12]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[21]); MULADD(at[1], at[20]); MULADD(at[2], at[19]); MULADD(at[3], at[18]); MULADD(at[4], at[17]); MULADD(at[5], at[16]); MULADD(at[6], at[15]); MULADD(at[7], at[14]); MULADD(at[8], at[13]); MULADD(at[9], at[12]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[22]); MULADD(at[1], at[21]); MULADD(at[2], at[20]); MULADD(at[3], at[19]); MULADD(at[4], at[18]); MULADD(at[5], at[17]); MULADD(at[6], at[16]); MULADD(at[7], at[15]); MULADD(at[8], at[14]); MULADD(at[9], at[13]); MULADD(at[10], at[12]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
/* 11 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[23]); MULADD(at[1], at[22]); MULADD(at[2], at[21]); MULADD(at[3], at[20]); MULADD(at[4], at[19]); MULADD(at[5], at[18]); MULADD(at[6], at[17]); MULADD(at[7], at[16]); MULADD(at[8], at[15]); MULADD(at[9], at[14]); MULADD(at[10], at[13]); MULADD(at[11], at[12]);
|
||||
COMBA_STORE(C->dp[11]);
|
||||
/* 12 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[23]); MULADD(at[2], at[22]); MULADD(at[3], at[21]); MULADD(at[4], at[20]); MULADD(at[5], at[19]); MULADD(at[6], at[18]); MULADD(at[7], at[17]); MULADD(at[8], at[16]); MULADD(at[9], at[15]); MULADD(at[10], at[14]); MULADD(at[11], at[13]);
|
||||
COMBA_STORE(C->dp[12]);
|
||||
/* 13 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[23]); MULADD(at[3], at[22]); MULADD(at[4], at[21]); MULADD(at[5], at[20]); MULADD(at[6], at[19]); MULADD(at[7], at[18]); MULADD(at[8], at[17]); MULADD(at[9], at[16]); MULADD(at[10], at[15]); MULADD(at[11], at[14]);
|
||||
COMBA_STORE(C->dp[13]);
|
||||
/* 14 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[23]); MULADD(at[4], at[22]); MULADD(at[5], at[21]); MULADD(at[6], at[20]); MULADD(at[7], at[19]); MULADD(at[8], at[18]); MULADD(at[9], at[17]); MULADD(at[10], at[16]); MULADD(at[11], at[15]);
|
||||
COMBA_STORE(C->dp[14]);
|
||||
/* 15 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[23]); MULADD(at[5], at[22]); MULADD(at[6], at[21]); MULADD(at[7], at[20]); MULADD(at[8], at[19]); MULADD(at[9], at[18]); MULADD(at[10], at[17]); MULADD(at[11], at[16]);
|
||||
COMBA_STORE(C->dp[15]);
|
||||
/* 16 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[23]); MULADD(at[6], at[22]); MULADD(at[7], at[21]); MULADD(at[8], at[20]); MULADD(at[9], at[19]); MULADD(at[10], at[18]); MULADD(at[11], at[17]);
|
||||
COMBA_STORE(C->dp[16]);
|
||||
/* 17 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[6], at[23]); MULADD(at[7], at[22]); MULADD(at[8], at[21]); MULADD(at[9], at[20]); MULADD(at[10], at[19]); MULADD(at[11], at[18]);
|
||||
COMBA_STORE(C->dp[17]);
|
||||
/* 18 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[7], at[23]); MULADD(at[8], at[22]); MULADD(at[9], at[21]); MULADD(at[10], at[20]); MULADD(at[11], at[19]);
|
||||
COMBA_STORE(C->dp[18]);
|
||||
/* 19 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[8], at[23]); MULADD(at[9], at[22]); MULADD(at[10], at[21]); MULADD(at[11], at[20]);
|
||||
COMBA_STORE(C->dp[19]);
|
||||
/* 20 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[9], at[23]); MULADD(at[10], at[22]); MULADD(at[11], at[21]);
|
||||
COMBA_STORE(C->dp[20]);
|
||||
/* 21 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[10], at[23]); MULADD(at[11], at[22]);
|
||||
COMBA_STORE(C->dp[21]);
|
||||
/* 22 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[11], at[23]);
|
||||
COMBA_STORE(C->dp[22]);
|
||||
COMBA_STORE2(C->dp[23]);
|
||||
C->used = 24;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
@@ -1,187 +0,0 @@
|
||||
/* fp_mul_comba_17.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL17
|
||||
int fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[34];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 34, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 17 * sizeof(fp_digit));
|
||||
XMEMCPY(at+17, B->dp, 17 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[17]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[18]); MULADD(at[1], at[17]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[19]); MULADD(at[1], at[18]); MULADD(at[2], at[17]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[20]); MULADD(at[1], at[19]); MULADD(at[2], at[18]); MULADD(at[3], at[17]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[21]); MULADD(at[1], at[20]); MULADD(at[2], at[19]); MULADD(at[3], at[18]); MULADD(at[4], at[17]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[22]); MULADD(at[1], at[21]); MULADD(at[2], at[20]); MULADD(at[3], at[19]); MULADD(at[4], at[18]); MULADD(at[5], at[17]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[23]); MULADD(at[1], at[22]); MULADD(at[2], at[21]); MULADD(at[3], at[20]); MULADD(at[4], at[19]); MULADD(at[5], at[18]); MULADD(at[6], at[17]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[24]); MULADD(at[1], at[23]); MULADD(at[2], at[22]); MULADD(at[3], at[21]); MULADD(at[4], at[20]); MULADD(at[5], at[19]); MULADD(at[6], at[18]); MULADD(at[7], at[17]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[25]); MULADD(at[1], at[24]); MULADD(at[2], at[23]); MULADD(at[3], at[22]); MULADD(at[4], at[21]); MULADD(at[5], at[20]); MULADD(at[6], at[19]); MULADD(at[7], at[18]); MULADD(at[8], at[17]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[26]); MULADD(at[1], at[25]); MULADD(at[2], at[24]); MULADD(at[3], at[23]); MULADD(at[4], at[22]); MULADD(at[5], at[21]); MULADD(at[6], at[20]); MULADD(at[7], at[19]); MULADD(at[8], at[18]); MULADD(at[9], at[17]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[27]); MULADD(at[1], at[26]); MULADD(at[2], at[25]); MULADD(at[3], at[24]); MULADD(at[4], at[23]); MULADD(at[5], at[22]); MULADD(at[6], at[21]); MULADD(at[7], at[20]); MULADD(at[8], at[19]); MULADD(at[9], at[18]); MULADD(at[10], at[17]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
/* 11 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[28]); MULADD(at[1], at[27]); MULADD(at[2], at[26]); MULADD(at[3], at[25]); MULADD(at[4], at[24]); MULADD(at[5], at[23]); MULADD(at[6], at[22]); MULADD(at[7], at[21]); MULADD(at[8], at[20]); MULADD(at[9], at[19]); MULADD(at[10], at[18]); MULADD(at[11], at[17]);
|
||||
COMBA_STORE(C->dp[11]);
|
||||
/* 12 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[29]); MULADD(at[1], at[28]); MULADD(at[2], at[27]); MULADD(at[3], at[26]); MULADD(at[4], at[25]); MULADD(at[5], at[24]); MULADD(at[6], at[23]); MULADD(at[7], at[22]); MULADD(at[8], at[21]); MULADD(at[9], at[20]); MULADD(at[10], at[19]); MULADD(at[11], at[18]); MULADD(at[12], at[17]);
|
||||
COMBA_STORE(C->dp[12]);
|
||||
/* 13 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[30]); MULADD(at[1], at[29]); MULADD(at[2], at[28]); MULADD(at[3], at[27]); MULADD(at[4], at[26]); MULADD(at[5], at[25]); MULADD(at[6], at[24]); MULADD(at[7], at[23]); MULADD(at[8], at[22]); MULADD(at[9], at[21]); MULADD(at[10], at[20]); MULADD(at[11], at[19]); MULADD(at[12], at[18]); MULADD(at[13], at[17]);
|
||||
COMBA_STORE(C->dp[13]);
|
||||
/* 14 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[31]); MULADD(at[1], at[30]); MULADD(at[2], at[29]); MULADD(at[3], at[28]); MULADD(at[4], at[27]); MULADD(at[5], at[26]); MULADD(at[6], at[25]); MULADD(at[7], at[24]); MULADD(at[8], at[23]); MULADD(at[9], at[22]); MULADD(at[10], at[21]); MULADD(at[11], at[20]); MULADD(at[12], at[19]); MULADD(at[13], at[18]); MULADD(at[14], at[17]);
|
||||
COMBA_STORE(C->dp[14]);
|
||||
/* 15 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[32]); MULADD(at[1], at[31]); MULADD(at[2], at[30]); MULADD(at[3], at[29]); MULADD(at[4], at[28]); MULADD(at[5], at[27]); MULADD(at[6], at[26]); MULADD(at[7], at[25]); MULADD(at[8], at[24]); MULADD(at[9], at[23]); MULADD(at[10], at[22]); MULADD(at[11], at[21]); MULADD(at[12], at[20]); MULADD(at[13], at[19]); MULADD(at[14], at[18]); MULADD(at[15], at[17]);
|
||||
COMBA_STORE(C->dp[15]);
|
||||
/* 16 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[33]); MULADD(at[1], at[32]); MULADD(at[2], at[31]); MULADD(at[3], at[30]); MULADD(at[4], at[29]); MULADD(at[5], at[28]); MULADD(at[6], at[27]); MULADD(at[7], at[26]); MULADD(at[8], at[25]); MULADD(at[9], at[24]); MULADD(at[10], at[23]); MULADD(at[11], at[22]); MULADD(at[12], at[21]); MULADD(at[13], at[20]); MULADD(at[14], at[19]); MULADD(at[15], at[18]); MULADD(at[16], at[17]);
|
||||
COMBA_STORE(C->dp[16]);
|
||||
/* 17 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[33]); MULADD(at[2], at[32]); MULADD(at[3], at[31]); MULADD(at[4], at[30]); MULADD(at[5], at[29]); MULADD(at[6], at[28]); MULADD(at[7], at[27]); MULADD(at[8], at[26]); MULADD(at[9], at[25]); MULADD(at[10], at[24]); MULADD(at[11], at[23]); MULADD(at[12], at[22]); MULADD(at[13], at[21]); MULADD(at[14], at[20]); MULADD(at[15], at[19]); MULADD(at[16], at[18]);
|
||||
COMBA_STORE(C->dp[17]);
|
||||
/* 18 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[33]); MULADD(at[3], at[32]); MULADD(at[4], at[31]); MULADD(at[5], at[30]); MULADD(at[6], at[29]); MULADD(at[7], at[28]); MULADD(at[8], at[27]); MULADD(at[9], at[26]); MULADD(at[10], at[25]); MULADD(at[11], at[24]); MULADD(at[12], at[23]); MULADD(at[13], at[22]); MULADD(at[14], at[21]); MULADD(at[15], at[20]); MULADD(at[16], at[19]);
|
||||
COMBA_STORE(C->dp[18]);
|
||||
/* 19 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[33]); MULADD(at[4], at[32]); MULADD(at[5], at[31]); MULADD(at[6], at[30]); MULADD(at[7], at[29]); MULADD(at[8], at[28]); MULADD(at[9], at[27]); MULADD(at[10], at[26]); MULADD(at[11], at[25]); MULADD(at[12], at[24]); MULADD(at[13], at[23]); MULADD(at[14], at[22]); MULADD(at[15], at[21]); MULADD(at[16], at[20]);
|
||||
COMBA_STORE(C->dp[19]);
|
||||
/* 20 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[33]); MULADD(at[5], at[32]); MULADD(at[6], at[31]); MULADD(at[7], at[30]); MULADD(at[8], at[29]); MULADD(at[9], at[28]); MULADD(at[10], at[27]); MULADD(at[11], at[26]); MULADD(at[12], at[25]); MULADD(at[13], at[24]); MULADD(at[14], at[23]); MULADD(at[15], at[22]); MULADD(at[16], at[21]);
|
||||
COMBA_STORE(C->dp[20]);
|
||||
/* 21 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[33]); MULADD(at[6], at[32]); MULADD(at[7], at[31]); MULADD(at[8], at[30]); MULADD(at[9], at[29]); MULADD(at[10], at[28]); MULADD(at[11], at[27]); MULADD(at[12], at[26]); MULADD(at[13], at[25]); MULADD(at[14], at[24]); MULADD(at[15], at[23]); MULADD(at[16], at[22]);
|
||||
COMBA_STORE(C->dp[21]);
|
||||
/* 22 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[6], at[33]); MULADD(at[7], at[32]); MULADD(at[8], at[31]); MULADD(at[9], at[30]); MULADD(at[10], at[29]); MULADD(at[11], at[28]); MULADD(at[12], at[27]); MULADD(at[13], at[26]); MULADD(at[14], at[25]); MULADD(at[15], at[24]); MULADD(at[16], at[23]);
|
||||
COMBA_STORE(C->dp[22]);
|
||||
/* 23 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[7], at[33]); MULADD(at[8], at[32]); MULADD(at[9], at[31]); MULADD(at[10], at[30]); MULADD(at[11], at[29]); MULADD(at[12], at[28]); MULADD(at[13], at[27]); MULADD(at[14], at[26]); MULADD(at[15], at[25]); MULADD(at[16], at[24]);
|
||||
COMBA_STORE(C->dp[23]);
|
||||
/* 24 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[8], at[33]); MULADD(at[9], at[32]); MULADD(at[10], at[31]); MULADD(at[11], at[30]); MULADD(at[12], at[29]); MULADD(at[13], at[28]); MULADD(at[14], at[27]); MULADD(at[15], at[26]); MULADD(at[16], at[25]);
|
||||
COMBA_STORE(C->dp[24]);
|
||||
/* 25 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[9], at[33]); MULADD(at[10], at[32]); MULADD(at[11], at[31]); MULADD(at[12], at[30]); MULADD(at[13], at[29]); MULADD(at[14], at[28]); MULADD(at[15], at[27]); MULADD(at[16], at[26]);
|
||||
COMBA_STORE(C->dp[25]);
|
||||
/* 26 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[10], at[33]); MULADD(at[11], at[32]); MULADD(at[12], at[31]); MULADD(at[13], at[30]); MULADD(at[14], at[29]); MULADD(at[15], at[28]); MULADD(at[16], at[27]);
|
||||
COMBA_STORE(C->dp[26]);
|
||||
/* 27 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[11], at[33]); MULADD(at[12], at[32]); MULADD(at[13], at[31]); MULADD(at[14], at[30]); MULADD(at[15], at[29]); MULADD(at[16], at[28]);
|
||||
COMBA_STORE(C->dp[27]);
|
||||
/* 28 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[12], at[33]); MULADD(at[13], at[32]); MULADD(at[14], at[31]); MULADD(at[15], at[30]); MULADD(at[16], at[29]);
|
||||
COMBA_STORE(C->dp[28]);
|
||||
/* 29 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[13], at[33]); MULADD(at[14], at[32]); MULADD(at[15], at[31]); MULADD(at[16], at[30]);
|
||||
COMBA_STORE(C->dp[29]);
|
||||
/* 30 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[14], at[33]); MULADD(at[15], at[32]); MULADD(at[16], at[31]);
|
||||
COMBA_STORE(C->dp[30]);
|
||||
/* 31 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[15], at[33]); MULADD(at[16], at[32]);
|
||||
COMBA_STORE(C->dp[31]);
|
||||
/* 32 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[16], at[33]);
|
||||
COMBA_STORE(C->dp[32]);
|
||||
COMBA_STORE2(C->dp[33]);
|
||||
C->used = 34;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,61 +0,0 @@
|
||||
/* fp_mul_comba_3.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL3
|
||||
int fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2, at[6];
|
||||
|
||||
XMEMCPY(at, A->dp, 3 * sizeof(fp_digit));
|
||||
XMEMCPY(at+3, B->dp, 3 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[3]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[4]); MULADD(at[1], at[3]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[5]); MULADD(at[1], at[4]); MULADD(at[2], at[3]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[5]); MULADD(at[2], at[4]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[5]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
COMBA_STORE2(C->dp[5]);
|
||||
C->used = 6;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,83 +0,0 @@
|
||||
/* fp_mul_comba_4.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL4
|
||||
int fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[8];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 8, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 4 * sizeof(fp_digit));
|
||||
XMEMCPY(at+4, B->dp, 4 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[4]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[5]); MULADD(at[1], at[4]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[6]); MULADD(at[1], at[5]); MULADD(at[2], at[4]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[7]); MULADD(at[1], at[6]); MULADD(at[2], at[5]); MULADD(at[3], at[4]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[7]); MULADD(at[2], at[6]); MULADD(at[3], at[5]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[7]); MULADD(at[3], at[6]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[7]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
COMBA_STORE2(C->dp[7]);
|
||||
C->used = 8;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,99 +0,0 @@
|
||||
/* fp_mul_comba_6.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL6
|
||||
int fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[12];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 12, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 6 * sizeof(fp_digit));
|
||||
XMEMCPY(at+6, B->dp, 6 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[6]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[7]); MULADD(at[1], at[6]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[8]); MULADD(at[1], at[7]); MULADD(at[2], at[6]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[9]); MULADD(at[1], at[8]); MULADD(at[2], at[7]); MULADD(at[3], at[6]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[10]); MULADD(at[1], at[9]); MULADD(at[2], at[8]); MULADD(at[3], at[7]); MULADD(at[4], at[6]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[11]); MULADD(at[1], at[10]); MULADD(at[2], at[9]); MULADD(at[3], at[8]); MULADD(at[4], at[7]); MULADD(at[5], at[6]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[11]); MULADD(at[2], at[10]); MULADD(at[3], at[9]); MULADD(at[4], at[8]); MULADD(at[5], at[7]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[11]); MULADD(at[3], at[10]); MULADD(at[4], at[9]); MULADD(at[5], at[8]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[11]); MULADD(at[4], at[10]); MULADD(at[5], at[9]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[11]); MULADD(at[5], at[10]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[11]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
COMBA_STORE2(C->dp[11]);
|
||||
C->used = 12;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,107 +0,0 @@
|
||||
/* fp_mul_comba_7.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL7
|
||||
int fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[14];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 14, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 7 * sizeof(fp_digit));
|
||||
XMEMCPY(at+7, B->dp, 7 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[7]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[8]); MULADD(at[1], at[7]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[9]); MULADD(at[1], at[8]); MULADD(at[2], at[7]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[10]); MULADD(at[1], at[9]); MULADD(at[2], at[8]); MULADD(at[3], at[7]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[11]); MULADD(at[1], at[10]); MULADD(at[2], at[9]); MULADD(at[3], at[8]); MULADD(at[4], at[7]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[12]); MULADD(at[1], at[11]); MULADD(at[2], at[10]); MULADD(at[3], at[9]); MULADD(at[4], at[8]); MULADD(at[5], at[7]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[13]); MULADD(at[1], at[12]); MULADD(at[2], at[11]); MULADD(at[3], at[10]); MULADD(at[4], at[9]); MULADD(at[5], at[8]); MULADD(at[6], at[7]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[13]); MULADD(at[2], at[12]); MULADD(at[3], at[11]); MULADD(at[4], at[10]); MULADD(at[5], at[9]); MULADD(at[6], at[8]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[13]); MULADD(at[3], at[12]); MULADD(at[4], at[11]); MULADD(at[5], at[10]); MULADD(at[6], at[9]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[13]); MULADD(at[4], at[12]); MULADD(at[5], at[11]); MULADD(at[6], at[10]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[13]); MULADD(at[5], at[12]); MULADD(at[6], at[11]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
/* 11 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[13]); MULADD(at[6], at[12]);
|
||||
COMBA_STORE(C->dp[11]);
|
||||
/* 12 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[6], at[13]);
|
||||
COMBA_STORE(C->dp[12]);
|
||||
COMBA_STORE2(C->dp[13]);
|
||||
C->used = 14;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
@@ -1,115 +0,0 @@
|
||||
/* fp_mul_comba_8.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL8
|
||||
int fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[16];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 16, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 8 * sizeof(fp_digit));
|
||||
XMEMCPY(at+8, B->dp, 8 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[8]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[9]); MULADD(at[1], at[8]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[10]); MULADD(at[1], at[9]); MULADD(at[2], at[8]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[11]); MULADD(at[1], at[10]); MULADD(at[2], at[9]); MULADD(at[3], at[8]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[12]); MULADD(at[1], at[11]); MULADD(at[2], at[10]); MULADD(at[3], at[9]); MULADD(at[4], at[8]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[13]); MULADD(at[1], at[12]); MULADD(at[2], at[11]); MULADD(at[3], at[10]); MULADD(at[4], at[9]); MULADD(at[5], at[8]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[14]); MULADD(at[1], at[13]); MULADD(at[2], at[12]); MULADD(at[3], at[11]); MULADD(at[4], at[10]); MULADD(at[5], at[9]); MULADD(at[6], at[8]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[15]); MULADD(at[1], at[14]); MULADD(at[2], at[13]); MULADD(at[3], at[12]); MULADD(at[4], at[11]); MULADD(at[5], at[10]); MULADD(at[6], at[9]); MULADD(at[7], at[8]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[15]); MULADD(at[2], at[14]); MULADD(at[3], at[13]); MULADD(at[4], at[12]); MULADD(at[5], at[11]); MULADD(at[6], at[10]); MULADD(at[7], at[9]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[15]); MULADD(at[3], at[14]); MULADD(at[4], at[13]); MULADD(at[5], at[12]); MULADD(at[6], at[11]); MULADD(at[7], at[10]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[15]); MULADD(at[4], at[14]); MULADD(at[5], at[13]); MULADD(at[6], at[12]); MULADD(at[7], at[11]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
/* 11 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[15]); MULADD(at[5], at[14]); MULADD(at[6], at[13]); MULADD(at[7], at[12]);
|
||||
COMBA_STORE(C->dp[11]);
|
||||
/* 12 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[15]); MULADD(at[6], at[14]); MULADD(at[7], at[13]);
|
||||
COMBA_STORE(C->dp[12]);
|
||||
/* 13 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[6], at[15]); MULADD(at[7], at[14]);
|
||||
COMBA_STORE(C->dp[13]);
|
||||
/* 14 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[7], at[15]);
|
||||
COMBA_STORE(C->dp[14]);
|
||||
COMBA_STORE2(C->dp[15]);
|
||||
C->used = 16;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
@@ -1,123 +0,0 @@
|
||||
/* fp_mul_comba_9.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_MUL9
|
||||
int fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C)
|
||||
{
|
||||
fp_digit c0, c1, c2;
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit at[18];
|
||||
#else
|
||||
fp_digit *at;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 18, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (at == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
XMEMCPY(at, A->dp, 9 * sizeof(fp_digit));
|
||||
XMEMCPY(at+9, B->dp, 9 * sizeof(fp_digit));
|
||||
COMBA_START;
|
||||
|
||||
COMBA_CLEAR;
|
||||
/* 0 */
|
||||
MULADD(at[0], at[9]);
|
||||
COMBA_STORE(C->dp[0]);
|
||||
/* 1 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[10]); MULADD(at[1], at[9]);
|
||||
COMBA_STORE(C->dp[1]);
|
||||
/* 2 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[11]); MULADD(at[1], at[10]); MULADD(at[2], at[9]);
|
||||
COMBA_STORE(C->dp[2]);
|
||||
/* 3 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[12]); MULADD(at[1], at[11]); MULADD(at[2], at[10]); MULADD(at[3], at[9]);
|
||||
COMBA_STORE(C->dp[3]);
|
||||
/* 4 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[13]); MULADD(at[1], at[12]); MULADD(at[2], at[11]); MULADD(at[3], at[10]); MULADD(at[4], at[9]);
|
||||
COMBA_STORE(C->dp[4]);
|
||||
/* 5 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[14]); MULADD(at[1], at[13]); MULADD(at[2], at[12]); MULADD(at[3], at[11]); MULADD(at[4], at[10]); MULADD(at[5], at[9]);
|
||||
COMBA_STORE(C->dp[5]);
|
||||
/* 6 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[15]); MULADD(at[1], at[14]); MULADD(at[2], at[13]); MULADD(at[3], at[12]); MULADD(at[4], at[11]); MULADD(at[5], at[10]); MULADD(at[6], at[9]);
|
||||
COMBA_STORE(C->dp[6]);
|
||||
/* 7 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[16]); MULADD(at[1], at[15]); MULADD(at[2], at[14]); MULADD(at[3], at[13]); MULADD(at[4], at[12]); MULADD(at[5], at[11]); MULADD(at[6], at[10]); MULADD(at[7], at[9]);
|
||||
COMBA_STORE(C->dp[7]);
|
||||
/* 8 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[0], at[17]); MULADD(at[1], at[16]); MULADD(at[2], at[15]); MULADD(at[3], at[14]); MULADD(at[4], at[13]); MULADD(at[5], at[12]); MULADD(at[6], at[11]); MULADD(at[7], at[10]); MULADD(at[8], at[9]);
|
||||
COMBA_STORE(C->dp[8]);
|
||||
/* 9 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[1], at[17]); MULADD(at[2], at[16]); MULADD(at[3], at[15]); MULADD(at[4], at[14]); MULADD(at[5], at[13]); MULADD(at[6], at[12]); MULADD(at[7], at[11]); MULADD(at[8], at[10]);
|
||||
COMBA_STORE(C->dp[9]);
|
||||
/* 10 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[2], at[17]); MULADD(at[3], at[16]); MULADD(at[4], at[15]); MULADD(at[5], at[14]); MULADD(at[6], at[13]); MULADD(at[7], at[12]); MULADD(at[8], at[11]);
|
||||
COMBA_STORE(C->dp[10]);
|
||||
/* 11 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[3], at[17]); MULADD(at[4], at[16]); MULADD(at[5], at[15]); MULADD(at[6], at[14]); MULADD(at[7], at[13]); MULADD(at[8], at[12]);
|
||||
COMBA_STORE(C->dp[11]);
|
||||
/* 12 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[4], at[17]); MULADD(at[5], at[16]); MULADD(at[6], at[15]); MULADD(at[7], at[14]); MULADD(at[8], at[13]);
|
||||
COMBA_STORE(C->dp[12]);
|
||||
/* 13 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[5], at[17]); MULADD(at[6], at[16]); MULADD(at[7], at[15]); MULADD(at[8], at[14]);
|
||||
COMBA_STORE(C->dp[13]);
|
||||
/* 14 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[6], at[17]); MULADD(at[7], at[16]); MULADD(at[8], at[15]);
|
||||
COMBA_STORE(C->dp[14]);
|
||||
/* 15 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[7], at[17]); MULADD(at[8], at[16]);
|
||||
COMBA_STORE(C->dp[15]);
|
||||
/* 16 */
|
||||
COMBA_FORWARD;
|
||||
MULADD(at[8], at[17]);
|
||||
COMBA_STORE(C->dp[16]);
|
||||
COMBA_STORE2(C->dp[17]);
|
||||
C->used = 18;
|
||||
C->sign = A->sign ^ B->sign;
|
||||
fp_clamp(C);
|
||||
COMBA_FINI;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,177 +0,0 @@
|
||||
/* fp_sqr_comba_12.i
|
||||
*
|
||||
* Copyright (C) 2006-2020 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef TFM_SQR12
|
||||
int fp_sqr_comba12(fp_int *A, fp_int *B)
|
||||
{
|
||||
fp_digit *a, c0, c1, c2, sc0 = 0, sc1 = 0, sc2 = 0;
|
||||
#ifdef TFM_ISO
|
||||
fp_word tt;
|
||||
#endif
|
||||
#ifndef WOLFSSL_SMALL_STACK
|
||||
fp_digit b[24];
|
||||
#else
|
||||
fp_digit *b;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
b = (fp_digit*)XMALLOC(sizeof(fp_digit) * 24, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (b == NULL)
|
||||
return FP_MEM;
|
||||
#endif
|
||||
|
||||
a = A->dp;
|
||||
COMBA_START;
|
||||
|
||||
/* clear carries */
|
||||
CLEAR_CARRY;
|
||||
|
||||
/* output 0 */
|
||||
SQRADD(a[0],a[0]);
|
||||
COMBA_STORE(b[0]);
|
||||
|
||||
/* output 1 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[0], a[1]);
|
||||
COMBA_STORE(b[1]);
|
||||
|
||||
/* output 2 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[0], a[2]); SQRADD(a[1], a[1]);
|
||||
COMBA_STORE(b[2]);
|
||||
|
||||
/* output 3 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[0], a[3]); SQRADD2(a[1], a[2]);
|
||||
COMBA_STORE(b[3]);
|
||||
|
||||
/* output 4 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[0], a[4]); SQRADD2(a[1], a[3]); SQRADD(a[2], a[2]);
|
||||
COMBA_STORE(b[4]);
|
||||
|
||||
/* output 5 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[5]); SQRADDAC(a[1], a[4]); SQRADDAC(a[2], a[3]); SQRADDDB;
|
||||
COMBA_STORE(b[5]);
|
||||
|
||||
/* output 6 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[6]); SQRADDAC(a[1], a[5]); SQRADDAC(a[2], a[4]); SQRADDDB; SQRADD(a[3], a[3]);
|
||||
COMBA_STORE(b[6]);
|
||||
|
||||
/* output 7 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[7]); SQRADDAC(a[1], a[6]); SQRADDAC(a[2], a[5]); SQRADDAC(a[3], a[4]); SQRADDDB;
|
||||
COMBA_STORE(b[7]);
|
||||
|
||||
/* output 8 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[8]); SQRADDAC(a[1], a[7]); SQRADDAC(a[2], a[6]); SQRADDAC(a[3], a[5]); SQRADDDB; SQRADD(a[4], a[4]);
|
||||
COMBA_STORE(b[8]);
|
||||
|
||||
/* output 9 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[9]); SQRADDAC(a[1], a[8]); SQRADDAC(a[2], a[7]); SQRADDAC(a[3], a[6]); SQRADDAC(a[4], a[5]); SQRADDDB;
|
||||
COMBA_STORE(b[9]);
|
||||
|
||||
/* output 10 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[10]); SQRADDAC(a[1], a[9]); SQRADDAC(a[2], a[8]); SQRADDAC(a[3], a[7]); SQRADDAC(a[4], a[6]); SQRADDDB; SQRADD(a[5], a[5]);
|
||||
COMBA_STORE(b[10]);
|
||||
|
||||
/* output 11 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[0], a[11]); SQRADDAC(a[1], a[10]); SQRADDAC(a[2], a[9]); SQRADDAC(a[3], a[8]); SQRADDAC(a[4], a[7]); SQRADDAC(a[5], a[6]); SQRADDDB;
|
||||
COMBA_STORE(b[11]);
|
||||
|
||||
/* output 12 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[1], a[11]); SQRADDAC(a[2], a[10]); SQRADDAC(a[3], a[9]); SQRADDAC(a[4], a[8]); SQRADDAC(a[5], a[7]); SQRADDDB; SQRADD(a[6], a[6]);
|
||||
COMBA_STORE(b[12]);
|
||||
|
||||
/* output 13 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[2], a[11]); SQRADDAC(a[3], a[10]); SQRADDAC(a[4], a[9]); SQRADDAC(a[5], a[8]); SQRADDAC(a[6], a[7]); SQRADDDB;
|
||||
COMBA_STORE(b[13]);
|
||||
|
||||
/* output 14 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[3], a[11]); SQRADDAC(a[4], a[10]); SQRADDAC(a[5], a[9]); SQRADDAC(a[6], a[8]); SQRADDDB; SQRADD(a[7], a[7]);
|
||||
COMBA_STORE(b[14]);
|
||||
|
||||
/* output 15 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[4], a[11]); SQRADDAC(a[5], a[10]); SQRADDAC(a[6], a[9]); SQRADDAC(a[7], a[8]); SQRADDDB;
|
||||
COMBA_STORE(b[15]);
|
||||
|
||||
/* output 16 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[5], a[11]); SQRADDAC(a[6], a[10]); SQRADDAC(a[7], a[9]); SQRADDDB; SQRADD(a[8], a[8]);
|
||||
COMBA_STORE(b[16]);
|
||||
|
||||
/* output 17 */
|
||||
CARRY_FORWARD;
|
||||
SQRADDSC(a[6], a[11]); SQRADDAC(a[7], a[10]); SQRADDAC(a[8], a[9]); SQRADDDB;
|
||||
COMBA_STORE(b[17]);
|
||||
|
||||
/* output 18 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[7], a[11]); SQRADD2(a[8], a[10]); SQRADD(a[9], a[9]);
|
||||
COMBA_STORE(b[18]);
|
||||
|
||||
/* output 19 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[8], a[11]); SQRADD2(a[9], a[10]);
|
||||
COMBA_STORE(b[19]);
|
||||
|
||||
/* output 20 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[9], a[11]); SQRADD(a[10], a[10]);
|
||||
COMBA_STORE(b[20]);
|
||||
|
||||
/* output 21 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD2(a[10], a[11]);
|
||||
COMBA_STORE(b[21]);
|
||||
|
||||
/* output 22 */
|
||||
CARRY_FORWARD;
|
||||
SQRADD(a[11], a[11]);
|
||||
COMBA_STORE(b[22]);
|
||||
COMBA_STORE2(b[23]);
|
||||
COMBA_FINI;
|
||||
|
||||
B->used = 24;
|
||||
B->sign = FP_ZPOS;
|
||||
XMEMCPY(B->dp, b, 24 * sizeof(fp_digit));
|
||||
fp_clamp(B);
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(b, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return FP_OKAY;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user