Merge branch 'master' into blake2
This commit is contained in:
commit
48303918c2
2
.gitignore
vendored
2
.gitignore
vendored
@ -75,3 +75,5 @@ swig/cyassl_wrap.c
|
||||
stamp-h1
|
||||
clang_output_*
|
||||
internal.plist
|
||||
cov-int
|
||||
cyassl.tgz
|
||||
|
@ -34,9 +34,11 @@ EXTRA_DIST+= cyassl-iphone.xcodeproj/project.pbxproj
|
||||
EXTRA_DIST+= cyassl-ntru.sln
|
||||
EXTRA_DIST+= cyassl.sln
|
||||
EXTRA_DIST+= valgrind-error.sh
|
||||
EXTRA_DIST+= gencertbuf.pl
|
||||
|
||||
include cyassl/include.am
|
||||
include certs/include.am
|
||||
include certs/1024/include.am
|
||||
include certs/crl/include.am
|
||||
include doc/include.am
|
||||
include swig/include.am
|
||||
@ -53,6 +55,13 @@ include testsuite/include.am
|
||||
include tests/include.am
|
||||
include sslSniffer/sslSnifferTest/include.am
|
||||
include rpm/include.am
|
||||
include mqx/ctaocrypt_test/Sources/include.am
|
||||
include mqx/cyassl/include.am
|
||||
include mqx/cyassl_client/Sources/include.am
|
||||
include mqx/util_lib/Sources/include.am
|
||||
include mplabx/ctaocrypt_benchmark.X/nbproject/include.am
|
||||
include mplabx/ctaocrypt_test.X/nbproject/include.am
|
||||
include mplabx/cyassl.X/nbproject/include.am
|
||||
|
||||
if USE_VALGRIND
|
||||
TESTS_ENVIRONMENT=./valgrind-error.sh
|
||||
|
46
README
46
README
@ -32,18 +32,58 @@ SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
|
||||
before calling SSL_new(); Though it's not recommended.
|
||||
|
||||
*** end Notes ***
|
||||
|
||||
|
||||
CyaSSL Release 2.5.0 (02/04/2013)
|
||||
|
||||
Release 2.5.0 CyaSSL has bug fixes and new features including:
|
||||
- Fix for TLS CBC padding timing attack identified by Nadhem Alfardan and
|
||||
Kenny Paterson: http://www.isg.rhul.ac.uk/tls/
|
||||
- Microchip PIC32 (MIPS16, MIPS32) support
|
||||
- Microchip MPLAB X example projects for PIC32 Ethernet Starter Kit
|
||||
- Updated CTaoCrypt benchmark app for embedded systems
|
||||
- 1024-bit test certs/keys and cert/key buffers
|
||||
- AES-CCM-8 crypto and cipher suites
|
||||
- Camellia crypto and cipher suites
|
||||
- Bumped minimum autoconf version to 2.65, automake version to 1.12
|
||||
- Addition of OCSP callbacks
|
||||
- STM32F2 support with hardware crypto and RNG
|
||||
- Cavium NITROX support
|
||||
|
||||
CTaoCrypt now has support for the Microchip PIC32 and has been tested with
|
||||
the Microchip PIC32 Ethernet Starter Kit, the XC32 compiler and
|
||||
MPLAB X IDE in both MIPS16 and MIPS32 instruction set modes. See the README
|
||||
located under the <cyassl_root>/mplabx directory for more details.
|
||||
|
||||
To add Cavium NITROX support do:
|
||||
|
||||
./configure --with-cavium=/home/user/cavium/software
|
||||
|
||||
pointing to your licensed cavium/software directory. Since Cavium doesn't
|
||||
build a library we pull in the cavium_common.o file which gives a libtool
|
||||
warning about the portability of this. Also, if you're using the github source
|
||||
tree you'll need to remove the -Wredundant-decls warning from the generated
|
||||
Makefile because the cavium headers don't conform to this warning. Currently
|
||||
CyaSSL supports Cavium RNG, AES, 3DES, RC4, HMAC, and RSA directly at the crypto
|
||||
layer. Support at the SSL level is parital and currently just does AES, 3DES,
|
||||
and RC4. RSA and HMAC are slower until the Cavium calls can be utilized in non
|
||||
blocking mode. The example client turns on cavium support as does the crypto
|
||||
test and benchmark. Please see the HAVE_CAVIUM define.
|
||||
|
||||
Note 3)
|
||||
CyaSSL is able to use the STM32F2 hardware-based cryptography and random number
|
||||
generator through the STM32F2 Standard Peripheral Library. For necessary
|
||||
defines, see the CYASSL_STM32F2 define in settings.h. Documentation for the
|
||||
STM32F2 Standard Peripheral Library can be found in the following document:
|
||||
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/DM00023896.pdf
|
||||
|
||||
*** end Notes ***
|
||||
The CyaSSL manual is available at:
|
||||
http://www.yassl.com/documentation/CyaSSL-Manual.pdf. For build instructions
|
||||
and comments about the new features please check the manual.
|
||||
|
||||
|
||||
CyaSSL Release 2.4.6 (12/20/2012)
|
||||
|
||||
*************** CyaSSL Release 2.4.6 (12/20/2012)
|
||||
|
||||
Release 2.4.6 CyaSSL has bug fixes and a few new features including:
|
||||
- ECC into main version
|
||||
|
BIN
certs/1024/client-cert.der
Normal file
BIN
certs/1024/client-cert.der
Normal file
Binary file not shown.
59
certs/1024/client-cert.pem
Normal file
59
certs/1024/client-cert.pem
Normal file
@ -0,0 +1,59 @@
|
||||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number: 10163970144298616102 (0x8d0dacfec6984526)
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=Programming, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Validity
|
||||
Not Before: Jan 18 21:42:49 2013 GMT
|
||||
Not After : Oct 15 21:42:49 2015 GMT
|
||||
Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=Programming, CN=www.yassl.com/emailAddress=info@yassl.com
|
||||
Subject Public Key Info:
|
||||
Public Key Algorithm: rsaEncryption
|
||||
Public-Key: (1024 bit)
|
||||
Modulus:
|
||||
00:bc:73:0e:a8:49:f3:74:a2:a9:ef:18:a5:da:55:
|
||||
99:21:f9:c8:ec:b3:6d:48:e5:35:35:75:77:37:ec:
|
||||
d1:61:90:5f:3e:d9:e4:d5:df:94:ca:c1:a9:d7:19:
|
||||
da:86:c9:e8:4d:c4:61:36:82:fe:ab:ad:7e:77:25:
|
||||
bb:8d:11:a5:bc:62:3a:a8:38:cc:39:a2:04:66:b4:
|
||||
f7:f7:f3:aa:da:4d:02:0e:bb:5e:8d:69:48:dc:77:
|
||||
c9:28:0e:22:e9:6b:a4:26:ba:4c:e8:c1:fd:4a:6f:
|
||||
2b:1f:ef:8a:ae:f6:90:62:e5:64:1e:eb:2b:3c:67:
|
||||
c8:dc:27:00:f6:91:68:65:a9
|
||||
Exponent: 65537 (0x10001)
|
||||
X509v3 extensions:
|
||||
X509v3 Subject Key Identifier:
|
||||
81:69:0F:F8:DF:DD:CF:34:29:D5:67:75:71:85:C7:75:10:69:59:EC
|
||||
X509v3 Authority Key Identifier:
|
||||
keyid:81:69:0F:F8:DF:DD:CF:34:29:D5:67:75:71:85:C7:75:10:69:59:EC
|
||||
|
||||
X509v3 Basic Constraints:
|
||||
CA:TRUE
|
||||
Signature Algorithm: sha1WithRSAEncryption
|
||||
72:66:0f:6a:a1:85:95:06:e6:87:1a:ed:2b:da:ed:84:90:89:
|
||||
a6:31:4d:60:f2:7b:63:0c:dc:9b:44:4c:d6:62:41:24:74:30:
|
||||
70:4e:07:10:05:12:5e:14:b3:dd:cf:58:27:93:cf:aa:4f:85:
|
||||
2c:35:0e:ff:5b:a8:6b:b5:95:32:d5:cc:73:68:5b:1b:c4:f8:
|
||||
89:5e:3d:f8:02:39:32:7d:06:a4:32:e9:b3:ef:62:a0:43:5d:
|
||||
4f:fb:ce:3d:08:33:af:3d:7f:12:cb:8a:5a:c2:63:db:3e:dd:
|
||||
ea:5b:67:10:49:9f:5b:96:1b:4e:5d:bc:4e:9a:7c:1f:ab:56:
|
||||
47:4a
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC7DCCAlWgAwIBAgIJAI0NrP7GmEUmMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYD
|
||||
VQQGEwJVUzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDEOMAwG
|
||||
A1UECgwFeWFTU0wxFDASBgNVBAsMC1Byb2dyYW1taW5nMRYwFAYDVQQDDA13d3cu
|
||||
eWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0xMzAx
|
||||
MTgyMTQyNDlaFw0xNTEwMTUyMTQyNDlaMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UE
|
||||
CAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDEOMAwGA1UECgwFeWFTU0wxFDAS
|
||||
BgNVBAsMC1Byb2dyYW1taW5nMRYwFAYDVQQDDA13d3cueWFzc2wuY29tMR0wGwYJ
|
||||
KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
|
||||
gYkCgYEAvHMOqEnzdKKp7xil2lWZIfnI7LNtSOU1NXV3N+zRYZBfPtnk1d+UysGp
|
||||
1xnahsnoTcRhNoL+q61+dyW7jRGlvGI6qDjMOaIEZrT39/Oq2k0CDrtejWlI3HfJ
|
||||
KA4i6WukJrpM6MH9Sm8rH++KrvaQYuVkHusrPGfI3CcA9pFoZakCAwEAAaNQME4w
|
||||
HQYDVR0OBBYEFIFpD/jf3c80KdVndXGFx3UQaVnsMB8GA1UdIwQYMBaAFIFpD/jf
|
||||
3c80KdVndXGFx3UQaVnsMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA
|
||||
cmYPaqGFlQbmhxrtK9rthJCJpjFNYPJ7Ywzcm0RM1mJBJHQwcE4HEAUSXhSz3c9Y
|
||||
J5PPqk+FLDUO/1uoa7WVMtXMc2hbG8T4iV49+AI5Mn0GpDLps+9ioENdT/vOPQgz
|
||||
rz1/EsuKWsJj2z7d6ltnEEmfW5YbTl28Tpp8H6tWR0o=
|
||||
-----END CERTIFICATE-----
|
BIN
certs/1024/client-key.der
Normal file
BIN
certs/1024/client-key.der
Normal file
Binary file not shown.
15
certs/1024/client-key.pem
Normal file
15
certs/1024/client-key.pem
Normal file
@ -0,0 +1,15 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQC8cw6oSfN0oqnvGKXaVZkh+cjss21I5TU1dXc37NFhkF8+2eTV
|
||||
35TKwanXGdqGyehNxGE2gv6rrX53JbuNEaW8YjqoOMw5ogRmtPf386raTQIOu16N
|
||||
aUjcd8koDiLpa6Qmukzowf1Kbysf74qu9pBi5WQe6ys8Z8jcJwD2kWhlqQIDAQAB
|
||||
AoGAE5fq6Dh4JaJcBM4NQHwx5cRwzZuCO1gJhjtmX9wxkPFP1dsV3d7XO5WTMRgx
|
||||
Dl6j1qIacW6BSBxLz9uOeoZhMtz7VcEWbSeSJEWL8bhIsUsdrN7a3Y4vwpH7palu
|
||||
+Dpq8f1QGO+f58PKeOpW09NyW5bdTgZOOsPZvnK2ZQcHTAECQQD6R9R6fJI8Ve+B
|
||||
8EEwLaPPjxzmhycFcA3fmDXW8Ys4LyS10IS2eU9xKZRa8GRqrOdyxu1NWZg+Zzrz
|
||||
dCz5YRdpAkEAwMGCDQzrxi/ckvmdghox6en3S/KChxzuFmrRHRiCcPPAti/28/cd
|
||||
8YYjyE7rj1aOj/W/8fcrtcw9xlc5DBtUQQJBAJ1+Bd7t9Ley+/wwS1Ud4y8BR5Zp
|
||||
Bc0OLiy9g2O2q3y3bcpbZKfOvobfO1PeYdIe66X2N+2sq3jZTOdV+9cRmcECQBiY
|
||||
GCnmHic5cCForAovoXLBIYaVOMZYkKBXnLrjp7EVyN72G8JhI3bvsJ0cRL4TQzln
|
||||
F8idyvv1RWSLOIIs8oECQDmJ5ZwZVTC6t0iMSBQO9J9+d5dD4bQZNTEjdZw7RK1p
|
||||
ElbuAGFkFmbTfHQrFbSi/r8IaxpdP5ASsQWGMSnb2eI=
|
||||
-----END RSA PRIVATE KEY-----
|
BIN
certs/1024/dh1024.der
Normal file
BIN
certs/1024/dh1024.der
Normal file
Binary file not shown.
17
certs/1024/dh1024.pem
Normal file
17
certs/1024/dh1024.pem
Normal file
@ -0,0 +1,17 @@
|
||||
PKCS#3 DH Parameters: (1024 bit)
|
||||
prime:
|
||||
00:a4:d2:b8:6e:78:f5:d9:ed:2d:7c:dd:b6:16:86:
|
||||
5a:4b:05:76:90:dd:66:61:b9:6d:52:a7:1c:af:62:
|
||||
c6:69:47:7b:39:f2:fb:94:ec:bc:79:ff:24:5e:ef:
|
||||
79:bb:59:b2:fc:ca:07:d6:f4:e9:34:f7:e8:38:e7:
|
||||
d7:33:44:1d:a3:64:76:1a:84:97:54:74:40:84:1f:
|
||||
15:fe:7c:25:2a:2b:25:fd:9e:c1:89:33:8c:39:25:
|
||||
2b:40:e6:cd:f8:a8:a1:8a:53:c6:47:b2:a0:d7:8f:
|
||||
eb:2e:60:0a:0d:4b:f8:b4:94:8c:63:0a:ad:c7:10:
|
||||
ea:c7:a1:b9:9d:f2:a8:37:73
|
||||
generator: 2 (0x2)
|
||||
-----BEGIN DH PARAMETERS-----
|
||||
MIGHAoGBAKTSuG549dntLXzdthaGWksFdpDdZmG5bVKnHK9ixmlHezny+5TsvHn/
|
||||
JF7vebtZsvzKB9b06TT36Djn1zNEHaNkdhqEl1R0QIQfFf58JSorJf2ewYkzjDkl
|
||||
K0DmzfiooYpTxkeyoNeP6y5gCg1L+LSUjGMKrccQ6sehuZ3yqDdzAgEC
|
||||
-----END DH PARAMETERS-----
|
BIN
certs/1024/dsa1024.der
Normal file
BIN
certs/1024/dsa1024.der
Normal file
Binary file not shown.
12
certs/1024/dsa1024.pem
Normal file
12
certs/1024/dsa1024.pem
Normal file
@ -0,0 +1,12 @@
|
||||
-----BEGIN DSA PRIVATE KEY-----
|
||||
MIIBvAIBAAKBgQD3S/m7FZjr3d4eTnGIhfK3uuJK2nZAzWlInoN8EfdlMXj1JS33
|
||||
t/hSP77YtsX+GBVbudWShryyF3zYsL6gfPLVc3pYj43lSgCZg0rAnhYJoRA01Rm7
|
||||
Y+Pdg3R/EMpzde4xSt2f4AJqne6yS6drKmzHhnfoBBXckrR6KR9Og2OFVQIVANIF
|
||||
5HP7wZnF3GikjZInPeJSX4mLAoGBAKohAglDbvuiVBSFCvQofMvM2/UeohipId6I
|
||||
iDOMLuuNo/AdyI/2fvjPEvW0oRFvDNTwBq3E/BRFx5QVvBlLru+Tak/MFNhHizlm
|
||||
hwLUKAq47gk39ACgBKd5p9I89zRDVo7QfMLYTQ+J7RTBLJxMGZue3FMJn98t8Awn
|
||||
VDp3FC3eAoGBAOgffLfAVFGnKC1YfN7UXN3VdoQ8NiDAwyXXOjjhVMj9QGgaIVQm
|
||||
ORS/9qOcXtkr98klugAJy38MSiT9FRYVSM0LUkRAe5BjK5AixRgFgFOvgx9U4rCi
|
||||
C1qSJOFiKD+3yrmJ1qC3ra4F4cFZQO1KG2ine/vDIIHvS/NpkbDOOrA4AhQlODuh
|
||||
GXXfm/VyU0854RzsE4SCGA==
|
||||
-----END DSA PRIVATE KEY-----
|
17
certs/1024/include.am
Normal file
17
certs/1024/include.am
Normal file
@ -0,0 +1,17 @@
|
||||
# vim:ft=automake
|
||||
# All paths should be given relative to the root
|
||||
#
|
||||
|
||||
EXTRA_DIST += \
|
||||
certs/1024/client-cert.pem \
|
||||
certs/1024/client-key.pem \
|
||||
certs/1024/dh1024.pem \
|
||||
certs/1024/dsa1024.pem
|
||||
|
||||
EXTRA_DIST += \
|
||||
certs/1024/client-cert.der \
|
||||
certs/1024/client-key.der \
|
||||
certs/1024/dh1024.der \
|
||||
certs/1024/dsa1024.der \
|
||||
certs/1024/rsa1024.der
|
||||
|
BIN
certs/1024/rsa1024.der
Normal file
BIN
certs/1024/rsa1024.der
Normal file
Binary file not shown.
37
configure.ac
37
configure.ac
@ -1,12 +1,12 @@
|
||||
# configure.ac
|
||||
#
|
||||
# Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
# Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
#
|
||||
# This file is part of CyaSSL.
|
||||
#
|
||||
#
|
||||
|
||||
AC_INIT([cyassl],[2.4.7],[http://www.yassl.com])
|
||||
AC_INIT([cyassl],[2.5.1],[http://www.yassl.com])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
@ -439,7 +439,7 @@ AC_ARG_ENABLE([sha512],
|
||||
|
||||
if test "$ENABLED_SHA512" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512"
|
||||
AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_FORTRESS" = "yes"
|
||||
@ -729,6 +729,7 @@ AS_IF([test "x$ENABLED_SINGLETHREADED" = "xyes"], [ENABLED_EXAMPLES="no"])
|
||||
AS_IF([test "x$ENABLED_NOFILESYSTEM" = "xyes"], [ENABLED_EXAMPLES="no"])
|
||||
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
|
||||
|
||||
|
||||
# LIBZ
|
||||
trylibzdir=""
|
||||
AC_ARG_WITH([libz],
|
||||
@ -766,6 +767,36 @@ AC_ARG_WITH([libz],
|
||||
)
|
||||
|
||||
|
||||
# cavium
|
||||
trycaviumdir=""
|
||||
AC_ARG_WITH([cavium],
|
||||
[ --with-cavium=PATH PATH to cavium/software dir ],
|
||||
[
|
||||
AC_MSG_CHECKING([for cavium])
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
|
||||
|
||||
if test "x$withval" == "xyes" ; then
|
||||
AC_MSG_ERROR([need a PATH for --with-cavium])
|
||||
fi
|
||||
if test "x$withval" != "xno" ; then
|
||||
trycaviumdir=$withval
|
||||
fi
|
||||
|
||||
LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
|
||||
CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
|
||||
|
||||
if test "x$cavium_linked" == "xno" ; then
|
||||
AC_MSG_ERROR([cavium isn't found.
|
||||
If it's already installed, specify its path using --with-cavium=/dir/])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
enable_shared=no
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# OPTIMIZE FLAGS
|
||||
if test "$GCC" = "yes"
|
||||
then
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* benchmark.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -44,6 +44,16 @@
|
||||
#include <cyassl/ctaocrypt/ecc.h>
|
||||
|
||||
#include <cyassl/ctaocrypt/dh.h>
|
||||
#ifdef HAVE_CAVIUM
|
||||
#include "cavium_sysdep.h"
|
||||
#include "cavium_common.h"
|
||||
#include "cavium_ioctl.h"
|
||||
#endif
|
||||
#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
|
||||
/* include test cert and key buffers for use with NO_FILESYSTEM */
|
||||
#include <cyassl/certs_test.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_BLAKE2
|
||||
#include <cyassl/ctaocrypt/blake2.h>
|
||||
@ -78,14 +88,47 @@ void bench_eccKeyGen(void);
|
||||
void bench_eccKeyAgree(void);
|
||||
#endif
|
||||
|
||||
double current_time(void);
|
||||
double current_time(int);
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
static int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
{
|
||||
Csp1CoreAssignment core_assign;
|
||||
Uint32 device;
|
||||
|
||||
if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
|
||||
return -1;
|
||||
if (Csp1GetDevType(&device))
|
||||
return -1;
|
||||
if (device != NPX_DEVICE) {
|
||||
if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
|
||||
(Uint32 *)&core_assign)!= 0)
|
||||
return -1;
|
||||
}
|
||||
CspShutdown(CAVIUM_DEV_ID);
|
||||
|
||||
return CspInitialize(dma_mode, dev_id);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* so embedded projects can pull in tests on their own */
|
||||
#ifndef NO_MAIN_DRIVER
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
#ifdef HAVE_CAVIUM
|
||||
int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
||||
if (ret != 0) {
|
||||
printf("Cavium OpenNitroxDevice failed\n");
|
||||
exit(-1);
|
||||
}
|
||||
#endif /* HAVE_CAVIUM */
|
||||
#ifndef NO_AES
|
||||
bench_aes(0);
|
||||
bench_aes(1);
|
||||
@ -153,8 +196,17 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int megs = 5; /* how many megs to test (en/de)cryption */
|
||||
const int times = 100; /* public key iterations */
|
||||
#endif /* NO_MAIN_DRIVER */
|
||||
|
||||
#ifdef BENCH_EMBEDDED
|
||||
const int numBlocks = 25; /* how many kB/megs to test (en/de)cryption */
|
||||
const char blockType[] = "kB"; /* used in printf output */
|
||||
const int times = 1; /* public key iterations */
|
||||
#else
|
||||
const int numBlocks = 5;
|
||||
const char blockType[] = "megs";
|
||||
const int times = 100;
|
||||
#endif
|
||||
|
||||
const byte key[] =
|
||||
{
|
||||
@ -172,8 +224,14 @@ const byte iv[] =
|
||||
};
|
||||
|
||||
|
||||
/* use kB instead of mB for embedded benchmarking */
|
||||
#ifdef BENCH_EMBEDDED
|
||||
byte plain [1024];
|
||||
byte cipher[1024];
|
||||
#else
|
||||
byte plain [1024*1024];
|
||||
byte cipher[1024*1024];
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_AES
|
||||
@ -183,19 +241,31 @@ void bench_aes(int show)
|
||||
double start, total, persec;
|
||||
int i;
|
||||
|
||||
AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION);
|
||||
start = current_time();
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
printf("aes init cavium failed\n");
|
||||
#endif
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION);
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
AesCbcEncrypt(&enc, plain, cipher, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * megs;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
if (show)
|
||||
printf("AES %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("AES %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
#ifdef HAVE_CAVIUM
|
||||
AesFreeCavium(&enc);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -212,17 +282,22 @@ void bench_aesgcm(void)
|
||||
int i;
|
||||
|
||||
AesGcmSetKey(&enc, key, 16);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12,
|
||||
tag, 16, additional, 13);
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * megs;
|
||||
printf("AES-GCM %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("AES-GCM %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -235,17 +310,22 @@ void bench_aesccm(void)
|
||||
int i;
|
||||
|
||||
AesCcmSetKey(&enc, key, 16);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
AesCcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12,
|
||||
tag, 16, additional, 13);
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * megs;
|
||||
printf("AES-CCM %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("AES-CCM %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -258,16 +338,21 @@ void bench_camellia(void)
|
||||
int i;
|
||||
|
||||
CamelliaSetKey(&cam, key, 16, iv);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
CamelliaCbcEncrypt(&cam, plain, cipher, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * megs;
|
||||
printf("Camellia %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("Camellia %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -279,18 +364,29 @@ void bench_des(void)
|
||||
double start, total, persec;
|
||||
int i;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
printf("des3 init cavium failed\n");
|
||||
#endif
|
||||
Des3_SetKey(&enc, key, iv, DES_ENCRYPTION);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Des3_CbcEncrypt(&enc, plain, cipher, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
|
||||
persec = 1 / total * megs;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("3DES %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("3DES %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
#ifdef HAVE_CAVIUM
|
||||
Des3_FreeCavium(&enc);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -302,17 +398,29 @@ void bench_arc4(void)
|
||||
double start, total, persec;
|
||||
int i;
|
||||
|
||||
Arc4SetKey(&enc, key, 16);
|
||||
start = current_time();
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
printf("arc4 init cavium failed\n");
|
||||
#endif
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
Arc4SetKey(&enc, key, 16);
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Arc4Process(&enc, cipher, plain, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("ARC4 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("ARC4 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
#ifdef HAVE_CAVIUM
|
||||
Arc4FreeCavium(&enc);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -325,16 +433,20 @@ void bench_hc128(void)
|
||||
int i;
|
||||
|
||||
Hc128_SetKey(&enc, key, iv);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Hc128_Process(&enc, cipher, plain, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("HC128 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("HC128 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif /* HAVE_HC128 */
|
||||
|
||||
@ -347,16 +459,20 @@ void bench_rabbit(void)
|
||||
int i;
|
||||
|
||||
RabbitSetKey(&enc, key, iv);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
RabbitProcess(&enc, cipher, plain, sizeof(plain));
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("RABBIT %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("RABBIT %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif /* NO_RABBIT */
|
||||
|
||||
@ -370,18 +486,22 @@ void bench_md5(void)
|
||||
int i;
|
||||
|
||||
InitMd5(&hash);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Md5Update(&hash, plain, sizeof(plain));
|
||||
|
||||
Md5Final(&hash, digest);
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("MD5 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("MD5 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif /* NO_MD5 */
|
||||
|
||||
@ -394,18 +514,22 @@ void bench_sha(void)
|
||||
int i;
|
||||
|
||||
InitSha(&hash);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
ShaUpdate(&hash, plain, sizeof(plain));
|
||||
|
||||
ShaFinal(&hash, digest);
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("SHA %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("SHA %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
|
||||
|
||||
@ -418,18 +542,22 @@ void bench_sha256(void)
|
||||
int i;
|
||||
|
||||
InitSha256(&hash);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Sha256Update(&hash, plain, sizeof(plain));
|
||||
|
||||
Sha256Final(&hash, digest);
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("SHA-256 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("SHA-256 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -442,18 +570,22 @@ void bench_sha512(void)
|
||||
int i;
|
||||
|
||||
InitSha512(&hash);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
Sha512Update(&hash, plain, sizeof(plain));
|
||||
|
||||
Sha512Final(&hash, digest);
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("SHA-512 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("SHA-512 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -466,18 +598,22 @@ void bench_ripemd(void)
|
||||
int i;
|
||||
|
||||
InitRipeMd(&hash);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < megs; i++)
|
||||
for(i = 0; i < numBlocks; i++)
|
||||
RipeMdUpdate(&hash, plain, sizeof(plain));
|
||||
|
||||
RipeMdFinal(&hash, digest);
|
||||
|
||||
total = current_time() - start;
|
||||
persec = 1 / total * megs;
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("RIPEMD %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
|
||||
persec);
|
||||
printf("RIPEMD %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
|
||||
blockType, total, persec);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -516,6 +652,7 @@ RNG rng;
|
||||
void bench_rsa(void)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
byte tmp[3072];
|
||||
size_t bytes;
|
||||
word32 idx = 0;
|
||||
@ -526,6 +663,16 @@ void bench_rsa(void)
|
||||
double start, total, each, milliEach;
|
||||
|
||||
RsaKey rsaKey;
|
||||
int rsaKeySz = 2048; /* used in printf */
|
||||
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, rsa_key_der_1024, sizeof(rsa_key_der_1024));
|
||||
bytes = sizeof(rsa_key_der_1024);
|
||||
rsaKeySz = 1024;
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, rsa_key_der_2048, sizeof(rsa_key_der_2048));
|
||||
bytes = sizeof(rsa_key_der_2048);
|
||||
#else
|
||||
FILE* file = fopen("./certs/rsa2048.der", "rb");
|
||||
|
||||
if (!file) {
|
||||
@ -533,40 +680,58 @@ void bench_rsa(void)
|
||||
"Please run from CyaSSL home dir\n");
|
||||
return;
|
||||
}
|
||||
|
||||
InitRng(&rng);
|
||||
bytes = fread(tmp, 1, sizeof(tmp), file);
|
||||
InitRsaKey(&rsaKey, 0);
|
||||
bytes = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes);
|
||||
|
||||
start = current_time();
|
||||
bytes = fread(tmp, 1, sizeof(tmp), file);
|
||||
fclose(file);
|
||||
#endif /* USE_CERT_BUFFERS */
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (RsaInitCavium(&rsaKey, CAVIUM_DEV_ID) != 0)
|
||||
printf("RSA init cavium failed\n");
|
||||
#endif
|
||||
ret = InitRng(&rng);
|
||||
if (ret < 0) {
|
||||
printf("InitRNG failed\n");
|
||||
return;
|
||||
}
|
||||
InitRsaKey(&rsaKey, 0);
|
||||
ret = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes);
|
||||
|
||||
start = current_time(1);
|
||||
|
||||
for (i = 0; i < times; i++)
|
||||
bytes = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng);
|
||||
ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng);
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / times; /* per second */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
|
||||
printf("RSA 2048 encryption took %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, times);
|
||||
printf("RSA %d encryption took %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", rsaKeySz, milliEach, times);
|
||||
|
||||
start = current_time();
|
||||
if (ret < 0) {
|
||||
printf("Rsa Public Encrypt failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
start = current_time(1);
|
||||
|
||||
for (i = 0; i < times; i++) {
|
||||
byte out[512]; /* for up to 4096 bit */
|
||||
RsaPrivateDecrypt(enc, (word32)bytes, out, sizeof(out), &rsaKey);
|
||||
RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / times; /* per second */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
|
||||
printf("RSA 2048 decryption took %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, times);
|
||||
printf("RSA %d decryption took %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", rsaKeySz, milliEach, times);
|
||||
|
||||
fclose(file);
|
||||
FreeRsaKey(&rsaKey);
|
||||
#ifdef HAVE_CAVIUM
|
||||
RsaFreeCavium(&rsaKey);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -587,6 +752,16 @@ void bench_dh(void)
|
||||
|
||||
double start, total, each, milliEach;
|
||||
DhKey dhKey;
|
||||
int dhKeySz = 2048; /* used in printf */
|
||||
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, dh_key_der_1024, sizeof(dh_key_der_1024));
|
||||
bytes = sizeof(dh_key_der_1024);
|
||||
dhKeySz = 1024;
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, dh_key_der_2048, sizeof(dh_key_der_2048));
|
||||
bytes = sizeof(dh_key_der_2048);
|
||||
#else
|
||||
FILE* file = fopen("./certs/dh2048.der", "rb");
|
||||
|
||||
if (!file) {
|
||||
@ -596,39 +771,46 @@ void bench_dh(void)
|
||||
}
|
||||
|
||||
bytes = fread(tmp, 1, sizeof(tmp), file);
|
||||
#endif /* USE_CERT_BUFFERS */
|
||||
|
||||
InitDhKey(&dhKey);
|
||||
bytes = DhKeyDecode(tmp, &idx, &dhKey, (word32)bytes);
|
||||
if (bytes != 0) {
|
||||
printf("dhekydecode failed, can't benchmark\n");
|
||||
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
fclose(file);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for (i = 0; i < times; i++)
|
||||
DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz);
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / times; /* per second */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
|
||||
printf("DH 2048 key generation %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, times);
|
||||
printf("DH %d key generation %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", dhKeySz, milliEach, times);
|
||||
|
||||
DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2);
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for (i = 0; i < times; i++)
|
||||
DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2);
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / times; /* per second */
|
||||
milliEach = each * 1000; /* milliseconds */
|
||||
|
||||
printf("DH 2048 key agreement %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, times);
|
||||
printf("DH %d key agreement %6.2f milliseconds, avg over %d"
|
||||
" iterations\n", dhKeySz, milliEach, times);
|
||||
|
||||
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
fclose(file);
|
||||
#endif
|
||||
FreeDhKey(&dhKey);
|
||||
}
|
||||
#endif
|
||||
@ -642,7 +824,7 @@ void bench_rsaKeyGen(void)
|
||||
const int genTimes = 5;
|
||||
|
||||
/* 1024 bit */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < genTimes; i++) {
|
||||
InitRsaKey(&genKey, 0);
|
||||
@ -650,7 +832,7 @@ void bench_rsaKeyGen(void)
|
||||
FreeRsaKey(&genKey);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
printf("\n");
|
||||
@ -658,7 +840,7 @@ void bench_rsaKeyGen(void)
|
||||
" iterations\n", milliEach, genTimes);
|
||||
|
||||
/* 2048 bit */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < genTimes; i++) {
|
||||
InitRsaKey(&genKey, 0);
|
||||
@ -666,7 +848,7 @@ void bench_rsaKeyGen(void)
|
||||
FreeRsaKey(&genKey);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
printf("RSA 2048 key generation %6.2f milliseconds, avg over %d"
|
||||
@ -683,14 +865,14 @@ void bench_eccKeyGen(void)
|
||||
const int genTimes = 5;
|
||||
|
||||
/* 256 bit */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < genTimes; i++) {
|
||||
ecc_make_key(&rng, 32, &genKey);
|
||||
ecc_free(&genKey);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / genTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
printf("\n");
|
||||
@ -703,25 +885,36 @@ void bench_eccKeyAgree(void)
|
||||
{
|
||||
ecc_key genKey, genKey2;
|
||||
double start, total, each, milliEach;
|
||||
int i;
|
||||
int i, ret;
|
||||
const int agreeTimes = 5;
|
||||
byte shared[1024];
|
||||
byte sig[1024];
|
||||
byte digest[32];
|
||||
word32 x;
|
||||
|
||||
ecc_make_key(&rng, 32, &genKey);
|
||||
ecc_make_key(&rng, 32, &genKey2);
|
||||
|
||||
ecc_init(&genKey);
|
||||
ecc_init(&genKey2);
|
||||
|
||||
ret = ecc_make_key(&rng, 32, &genKey);
|
||||
if (ret != 0) {
|
||||
printf("ecc_make_key failed\n");
|
||||
return;
|
||||
}
|
||||
ret = ecc_make_key(&rng, 32, &genKey2);
|
||||
if (ret != 0) {
|
||||
printf("ecc_make_key failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 256 bit */
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < agreeTimes; i++) {
|
||||
x = sizeof(shared);
|
||||
ecc_shared_secret(&genKey, &genKey2, shared, &x);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
printf("EC-DHE key agreement %6.2f milliseconds, avg over %d"
|
||||
@ -732,14 +925,14 @@ void bench_eccKeyAgree(void)
|
||||
digest[i] = i;
|
||||
|
||||
|
||||
start = current_time();
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < agreeTimes; i++) {
|
||||
x = sizeof(sig);
|
||||
ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &genKey);
|
||||
}
|
||||
|
||||
total = current_time() - start;
|
||||
total = current_time(0) - start;
|
||||
each = total / agreeTimes; /* per second */
|
||||
milliEach = each * 1000; /* millisconds */
|
||||
printf("EC-DSA sign time %6.2f milliseconds, avg over %d"
|
||||
@ -756,8 +949,10 @@ void bench_eccKeyAgree(void)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
double current_time()
|
||||
double current_time(int reset)
|
||||
{
|
||||
(void)reset;
|
||||
|
||||
static int init = 0;
|
||||
static LARGE_INTEGER freq;
|
||||
|
||||
@ -773,12 +968,38 @@ void bench_eccKeyAgree(void)
|
||||
return (double)count.QuadPart / freq.QuadPart;
|
||||
}
|
||||
|
||||
#elif defined MICROCHIP_PIC32
|
||||
|
||||
#include <peripheral/timer.h>
|
||||
|
||||
double current_time(int reset)
|
||||
{
|
||||
/* NOTE: core timer tick rate = 40 Mhz, 1 tick = 25 ns */
|
||||
|
||||
unsigned int ns;
|
||||
|
||||
/* should we reset our timer back to zero? Helps prevent timer
|
||||
rollover */
|
||||
|
||||
if (reset) {
|
||||
WriteCoreTimer(0);
|
||||
}
|
||||
|
||||
/* get timer in ns */
|
||||
ns = ReadCoreTimer() * 25;
|
||||
|
||||
/* return seconds as a double */
|
||||
return ( ns / 1000000000.0 );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
double current_time(void)
|
||||
double current_time(int reset)
|
||||
{
|
||||
(void) reset;
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* aes.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -41,6 +41,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static int AesCaviumSetKey(Aes* aes, const byte* key, word32 length,
|
||||
const byte* iv);
|
||||
static void AesCaviumCbcEncrypt(Aes* aes, byte* out, const byte* in,
|
||||
word32 length);
|
||||
static void AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
|
||||
word32 length);
|
||||
#endif
|
||||
|
||||
#ifdef STM32F2_CRYPTO
|
||||
/*
|
||||
* STM32F2 hardware AES support through the STM32F2 standard peripheral
|
||||
@ -1349,6 +1358,11 @@ int AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
|
||||
if (!((keylen == 16) || (keylen == 24) || (keylen == 32)))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (aes->magic == CYASSL_AES_CAVIUM_MAGIC)
|
||||
return AesCaviumSetKey(aes, userKey, keylen, iv);
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_AESNI
|
||||
if (checkAESNI == 0) {
|
||||
haveAESNI = Check_CPU_support_AES();
|
||||
@ -1661,6 +1675,11 @@ void AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
word32 blocks = sz / AES_BLOCK_SIZE;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (aes->magic == CYASSL_AES_CAVIUM_MAGIC)
|
||||
return AesCaviumCbcEncrypt(aes, out, in, sz);
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_AESNI
|
||||
if (haveAESNI) {
|
||||
#ifdef DEBUG_AESNI
|
||||
@ -1695,6 +1714,11 @@ void AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
word32 blocks = sz / AES_BLOCK_SIZE;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (aes->magic == CYASSL_AES_CAVIUM_MAGIC)
|
||||
return AesCaviumCbcDecrypt(aes, out, in, sz);
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_AESNI
|
||||
if (haveAESNI) {
|
||||
#ifdef DEBUG_AESNI
|
||||
@ -2738,5 +2762,122 @@ int AesSetIV(Aes* aes, const byte* iv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Aes for use with Nitrox device */
|
||||
int AesInitCavium(Aes* aes, int devId)
|
||||
{
|
||||
if (aes == NULL)
|
||||
return -1;
|
||||
|
||||
if (CspAllocContext(CONTEXT_SSL, &aes->contextHandle, devId) != 0)
|
||||
return -1;
|
||||
|
||||
aes->devId = devId;
|
||||
aes->magic = CYASSL_AES_CAVIUM_MAGIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free Aes from use with Nitrox device */
|
||||
void AesFreeCavium(Aes* aes)
|
||||
{
|
||||
if (aes == NULL)
|
||||
return;
|
||||
|
||||
if (aes->magic != CYASSL_AES_CAVIUM_MAGIC)
|
||||
return;
|
||||
|
||||
CspFreeContext(CONTEXT_SSL, aes->contextHandle, aes->devId);
|
||||
aes->magic = 0;
|
||||
}
|
||||
|
||||
|
||||
static int AesCaviumSetKey(Aes* aes, const byte* key, word32 length,
|
||||
const byte* iv)
|
||||
{
|
||||
if (aes == NULL)
|
||||
return -1;
|
||||
|
||||
XMEMCPY(aes->key, key, length); /* key still holds key, iv still in reg */
|
||||
if (length == 16)
|
||||
aes->type = AES_128;
|
||||
else if (length == 24)
|
||||
aes->type = AES_192;
|
||||
else if (length == 32)
|
||||
aes->type = AES_256;
|
||||
|
||||
return AesSetIV(aes, iv);
|
||||
}
|
||||
|
||||
|
||||
static void AesCaviumCbcEncrypt(Aes* aes, byte* out, const byte* in,
|
||||
word32 length)
|
||||
{
|
||||
word offset = 0;
|
||||
word32 requestId;
|
||||
|
||||
while (length > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
if (CspEncryptAes(CAVIUM_BLOCKING, aes->contextHandle, CAVIUM_NO_UPDATE,
|
||||
aes->type, slen, (byte*)in + offset, out + offset,
|
||||
(byte*)aes->reg, (byte*)aes->key, &requestId,
|
||||
aes->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Aes Encrypt");
|
||||
}
|
||||
length -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
XMEMCPY(aes->reg, out + offset - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
}
|
||||
if (length) {
|
||||
word16 slen = (word16)length;
|
||||
if (CspEncryptAes(CAVIUM_BLOCKING, aes->contextHandle, CAVIUM_NO_UPDATE,
|
||||
aes->type, slen, (byte*)in + offset, out + offset,
|
||||
(byte*)aes->reg, (byte*)aes->key, &requestId,
|
||||
aes->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Aes Encrypt");
|
||||
}
|
||||
XMEMCPY(aes->reg, out + offset+length - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static void AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
|
||||
word32 length)
|
||||
{
|
||||
word32 requestId;
|
||||
word offset = 0;
|
||||
|
||||
while (length > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
XMEMCPY(aes->tmp, in + offset + slen - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
if (CspDecryptAes(CAVIUM_BLOCKING, aes->contextHandle, CAVIUM_NO_UPDATE,
|
||||
aes->type, slen, (byte*)in + offset, out + offset,
|
||||
(byte*)aes->reg, (byte*)aes->key, &requestId,
|
||||
aes->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Aes Decrypt");
|
||||
}
|
||||
length -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
XMEMCPY(aes->reg, aes->tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
if (length) {
|
||||
word16 slen = (word16)length;
|
||||
XMEMCPY(aes->tmp, in + offset + slen - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
if (CspDecryptAes(CAVIUM_BLOCKING, aes->contextHandle, CAVIUM_NO_UPDATE,
|
||||
aes->type, slen, (byte*)in + offset, out + offset,
|
||||
(byte*)aes->reg, (byte*)aes->key, &requestId,
|
||||
aes->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Aes Decrypt");
|
||||
}
|
||||
XMEMCPY(aes->reg, aes->tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_AES */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* aes_asm.s
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* arc4.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -26,11 +26,23 @@
|
||||
#include <cyassl/ctaocrypt/arc4.h>
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static void Arc4CaviumSetKey(Arc4* arc4, const byte* key, word32 length);
|
||||
static void Arc4CaviumProcess(Arc4* arc4, byte* out, const byte* in,
|
||||
word32 length);
|
||||
#endif
|
||||
|
||||
|
||||
void Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
{
|
||||
word32 i;
|
||||
word32 keyIndex = 0, stateIndex = 0;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (arc4->magic == CYASSL_ARC4_CAVIUM_MAGIC)
|
||||
return Arc4CaviumSetKey(arc4, key, length);
|
||||
#endif
|
||||
|
||||
arc4->x = 1;
|
||||
arc4->y = 0;
|
||||
|
||||
@ -66,8 +78,16 @@ static INLINE byte MakeByte(word32* x, word32* y, byte* s)
|
||||
|
||||
void Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
{
|
||||
word32 x = arc4->x;
|
||||
word32 y = arc4->y;
|
||||
word32 x;
|
||||
word32 y;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (arc4->magic == CYASSL_ARC4_CAVIUM_MAGIC)
|
||||
return Arc4CaviumProcess(arc4, out, in, length);
|
||||
#endif
|
||||
|
||||
x = arc4->x;
|
||||
y = arc4->y;
|
||||
|
||||
while(length--)
|
||||
*out++ = *in++ ^ MakeByte(&x, &y, arc4->state);
|
||||
@ -76,3 +96,77 @@ void Arc4Process(Arc4* arc4, byte* out, const byte* in, word32 length)
|
||||
arc4->y = (byte)y;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Arc4 for use with Nitrox device */
|
||||
int Arc4InitCavium(Arc4* arc4, int devId)
|
||||
{
|
||||
if (arc4 == NULL)
|
||||
return -1;
|
||||
|
||||
if (CspAllocContext(CONTEXT_SSL, &arc4->contextHandle, devId) != 0)
|
||||
return -1;
|
||||
|
||||
arc4->devId = devId;
|
||||
arc4->magic = CYASSL_ARC4_CAVIUM_MAGIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free Arc4 from use with Nitrox device */
|
||||
void Arc4FreeCavium(Arc4* arc4)
|
||||
{
|
||||
if (arc4 == NULL)
|
||||
return;
|
||||
|
||||
if (arc4->magic != CYASSL_ARC4_CAVIUM_MAGIC)
|
||||
return;
|
||||
|
||||
CspFreeContext(CONTEXT_SSL, arc4->contextHandle, arc4->devId);
|
||||
arc4->magic = 0;
|
||||
}
|
||||
|
||||
|
||||
static void Arc4CaviumSetKey(Arc4* arc4, const byte* key, word32 length)
|
||||
{
|
||||
word32 requestId;
|
||||
|
||||
if (CspInitializeRc4(CAVIUM_BLOCKING, arc4->contextHandle, length,
|
||||
(byte*)key, &requestId, arc4->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Arc4 Init");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Arc4CaviumProcess(Arc4* arc4, byte* out, const byte* in,
|
||||
word32 length)
|
||||
{
|
||||
word offset = 0;
|
||||
word32 requestId;
|
||||
|
||||
while (length > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
if (CspEncryptRc4(CAVIUM_BLOCKING, arc4->contextHandle,CAVIUM_UPDATE,
|
||||
slen, (byte*)in + offset, out + offset, &requestId,
|
||||
arc4->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Arc4 Encrypt");
|
||||
}
|
||||
length -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
}
|
||||
if (length) {
|
||||
word16 slen = (word16)length;
|
||||
if (CspEncryptRc4(CAVIUM_BLOCKING, arc4->contextHandle,CAVIUM_UPDATE,
|
||||
slen, (byte*)in + offset, out + offset, &requestId,
|
||||
arc4->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium Arc4 Encrypt");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* asm.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* asn.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -531,11 +531,78 @@ static int GetAlgoId(const byte* input, word32* inOutIdx, word32* oid,
|
||||
|
||||
#ifndef NO_RSA
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
static int GetCaviumInt(byte** buff, word16* buffSz, const byte* input,
|
||||
word32* inOutIdx, word32 maxIdx, void* heap)
|
||||
{
|
||||
word32 i = *inOutIdx;
|
||||
byte b = input[i++];
|
||||
int length;
|
||||
|
||||
if (b != ASN_INTEGER)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
if (GetLength(input, &i, &length, maxIdx) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
if ( (b = input[i++]) == 0x00)
|
||||
length--;
|
||||
else
|
||||
i--;
|
||||
|
||||
*buffSz = (word16)length;
|
||||
*buff = XMALLOC(*buffSz, heap, DYNAMIC_TYPE_CAVIUM_RSA);
|
||||
if (*buff == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
XMEMCPY(*buff, input + i, *buffSz);
|
||||
|
||||
*inOutIdx = i + length;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CaviumRsaPrivateKeyDecode(const byte* input, word32* inOutIdx,
|
||||
RsaKey* key, word32 inSz)
|
||||
{
|
||||
int version, length;
|
||||
void* h = key->heap;
|
||||
|
||||
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
if (GetMyVersion(input, inOutIdx, &version) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
key->type = RSA_PRIVATE;
|
||||
|
||||
if (GetCaviumInt(&key->c_n, &key->c_nSz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_e, &key->c_eSz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_d, &key->c_dSz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_p, &key->c_pSz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_q, &key->c_qSz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_dP, &key->c_dP_Sz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_dQ, &key->c_dQ_Sz, input, inOutIdx, inSz, h) < 0 ||
|
||||
GetCaviumInt(&key->c_u, &key->c_uSz, input, inOutIdx, inSz, h) < 0 )
|
||||
return ASN_RSA_KEY_E;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
int RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey* key,
|
||||
word32 inSz)
|
||||
{
|
||||
int version, length;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return CaviumRsaPrivateKeyDecode(input, inOutIdx, key, inSz);
|
||||
#endif
|
||||
|
||||
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
@ -724,6 +791,8 @@ static int DecryptKey(const char* password, int passwordSz, byte* salt,
|
||||
ret += PKCS12_PBKDF(cbcIv, unicodePasswd, idx, salt, saltSz,
|
||||
iterations, 8, typeH, 2);
|
||||
}
|
||||
else
|
||||
return ALGO_ID_E;
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
@ -1543,7 +1612,7 @@ static int GetName(DecodedCert* cert, int nameType)
|
||||
}
|
||||
|
||||
if (email) {
|
||||
if (14 > (ASN_NAME_MAX - idx)) {
|
||||
if ( (14 + adv) > (int)(ASN_NAME_MAX - idx)) {
|
||||
CYASSL_MSG("ASN name too big, skipping");
|
||||
tooBig = TRUE;
|
||||
}
|
||||
@ -1566,7 +1635,7 @@ static int GetName(DecodedCert* cert, int nameType)
|
||||
}
|
||||
|
||||
if (uid) {
|
||||
if (5 > (ASN_NAME_MAX - idx)) {
|
||||
if ( (5 + adv) > (int)(ASN_NAME_MAX - idx)) {
|
||||
CYASSL_MSG("ASN name too big, skipping");
|
||||
tooBig = TRUE;
|
||||
}
|
||||
@ -3355,6 +3424,10 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, RNG* rng,
|
||||
{
|
||||
(void)ntruKey;
|
||||
(void)ntruSz;
|
||||
|
||||
/* init */
|
||||
XMEMSET(der, 0, sizeof(DerCert));
|
||||
|
||||
/* version */
|
||||
der->versionSz = SetMyVersion(cert->version, der->version, TRUE);
|
||||
|
||||
@ -4226,7 +4299,8 @@ static int DecodeSingleResponse(byte* source,
|
||||
break;
|
||||
case (ASN_CONTEXT_SPECIFIC | ASN_CONSTRUCTED | CERT_REVOKED):
|
||||
cs->status = CERT_REVOKED;
|
||||
GetLength(source, &idx, &length, size);
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
idx += length;
|
||||
break;
|
||||
case (ASN_CONTEXT_SPECIFIC | CERT_UNKNOWN):
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
/* camellia.c
|
||||
*
|
||||
* Copyright (C) 2006-2013 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* coding.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* des3.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -34,6 +34,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static void Des3_CaviumSetKey(Des3* des3, const byte* key, const byte* iv);
|
||||
static void Des3_CaviumCbcEncrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length);
|
||||
static void Des3_CaviumCbcDecrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length);
|
||||
#endif
|
||||
|
||||
#ifdef STM32F2_CRYPTO
|
||||
/*
|
||||
* STM32F2 hardware DES/3DES support through the STM32F2 standard
|
||||
@ -554,6 +562,11 @@ void Des_SetKey(Des* des, const byte* key, const byte* iv, int dir)
|
||||
|
||||
void Des3_SetKey(Des3* des, const byte* key, const byte* iv, int dir)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (des->magic == CYASSL_3DES_CAVIUM_MAGIC)
|
||||
return Des3_CaviumSetKey(des, key, iv);
|
||||
#endif
|
||||
|
||||
DesSetKey(key + (dir == DES_ENCRYPTION ? 0 : 16), dir, des->key[0]);
|
||||
DesSetKey(key + 8, Reverse(dir), des->key[1]);
|
||||
DesSetKey(key + (dir == DES_DECRYPTION ? 0 : 16), dir, des->key[2]);
|
||||
@ -682,8 +695,14 @@ void Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz)
|
||||
|
||||
void Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
word32 blocks = sz / DES_BLOCK_SIZE;
|
||||
word32 blocks;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (des->magic == CYASSL_3DES_CAVIUM_MAGIC)
|
||||
return Des3_CaviumCbcEncrypt(des, out, in, sz);
|
||||
#endif
|
||||
|
||||
blocks = sz / DES_BLOCK_SIZE;
|
||||
while (blocks--) {
|
||||
xorbuf((byte*)des->reg, in, DES_BLOCK_SIZE);
|
||||
Des3ProcessBlock(des, (byte*)des->reg, (byte*)des->reg);
|
||||
@ -697,8 +716,14 @@ void Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||
|
||||
void Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
word32 blocks = sz / DES_BLOCK_SIZE;
|
||||
word32 blocks;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (des->magic == CYASSL_3DES_CAVIUM_MAGIC)
|
||||
return Des3_CaviumCbcDecrypt(des, out, in, sz);
|
||||
#endif
|
||||
|
||||
blocks = sz / DES_BLOCK_SIZE;
|
||||
while (blocks--) {
|
||||
XMEMCPY(des->tmp, in, DES_BLOCK_SIZE);
|
||||
Des3ProcessBlock(des, (byte*)des->tmp, out);
|
||||
@ -743,4 +768,116 @@ void Des3_SetIV(Des3* des, const byte* iv)
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze Des3 for use with Nitrox device */
|
||||
int Des3_InitCavium(Des3* des3, int devId)
|
||||
{
|
||||
if (des3 == NULL)
|
||||
return -1;
|
||||
|
||||
if (CspAllocContext(CONTEXT_SSL, &des3->contextHandle, devId) != 0)
|
||||
return -1;
|
||||
|
||||
des3->devId = devId;
|
||||
des3->magic = CYASSL_3DES_CAVIUM_MAGIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free Des3 from use with Nitrox device */
|
||||
void Des3_FreeCavium(Des3* des3)
|
||||
{
|
||||
if (des3 == NULL)
|
||||
return;
|
||||
|
||||
if (des3->magic != CYASSL_3DES_CAVIUM_MAGIC)
|
||||
return;
|
||||
|
||||
CspFreeContext(CONTEXT_SSL, des3->contextHandle, des3->devId);
|
||||
des3->magic = 0;
|
||||
}
|
||||
|
||||
|
||||
static void Des3_CaviumSetKey(Des3* des3, const byte* key, const byte* iv)
|
||||
{
|
||||
if (des3 == NULL)
|
||||
return;
|
||||
|
||||
/* key[0] holds key, iv in reg */
|
||||
XMEMCPY(des3->key[0], key, DES_BLOCK_SIZE*3);
|
||||
|
||||
Des3_SetIV(des3, iv);
|
||||
}
|
||||
|
||||
|
||||
static void Des3_CaviumCbcEncrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length)
|
||||
{
|
||||
word offset = 0;
|
||||
word32 requestId;
|
||||
|
||||
while (length > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
if (CspEncrypt3Des(CAVIUM_BLOCKING, des3->contextHandle,
|
||||
CAVIUM_NO_UPDATE, slen, (byte*)in + offset,
|
||||
out + offset, (byte*)des3->reg, (byte*)des3->key[0],
|
||||
&requestId, des3->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium 3DES Cbc Encrypt");
|
||||
}
|
||||
length -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
XMEMCPY(des3->reg, out + offset - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
|
||||
}
|
||||
if (length) {
|
||||
word16 slen = (word16)length;
|
||||
|
||||
if (CspEncrypt3Des(CAVIUM_BLOCKING, des3->contextHandle,
|
||||
CAVIUM_NO_UPDATE, slen, (byte*)in + offset,
|
||||
out + offset, (byte*)des3->reg, (byte*)des3->key[0],
|
||||
&requestId, des3->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium 3DES Cbc Encrypt");
|
||||
}
|
||||
XMEMCPY(des3->reg, out+offset+length - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static void Des3_CaviumCbcDecrypt(Des3* des3, byte* out, const byte* in,
|
||||
word32 length)
|
||||
{
|
||||
word32 requestId;
|
||||
word offset = 0;
|
||||
|
||||
while (length > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
XMEMCPY(des3->tmp, in + offset + slen - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
|
||||
if (CspDecrypt3Des(CAVIUM_BLOCKING, des3->contextHandle,
|
||||
CAVIUM_NO_UPDATE, slen, (byte*)in+offset, out+offset,
|
||||
(byte*)des3->reg, (byte*)des3->key[0], &requestId,
|
||||
des3->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium 3Des Decrypt");
|
||||
}
|
||||
length -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
XMEMCPY(des3->reg, des3->tmp, DES_BLOCK_SIZE);
|
||||
}
|
||||
if (length) {
|
||||
word16 slen = (word16)length;
|
||||
XMEMCPY(des3->tmp, in + offset + slen - DES_BLOCK_SIZE,DES_BLOCK_SIZE);
|
||||
if (CspDecrypt3Des(CAVIUM_BLOCKING, des3->contextHandle,
|
||||
CAVIUM_NO_UPDATE, slen, (byte*)in+offset, out+offset,
|
||||
(byte*)des3->reg, (byte*)des3->key[0], &requestId,
|
||||
des3->devId) != 0) {
|
||||
CYASSL_MSG("Bad Cavium 3Des Decrypt");
|
||||
}
|
||||
XMEMCPY(des3->reg, des3->tmp, DES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_DES3 */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* dh.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* dsa.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ecc.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* error.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -277,6 +277,10 @@ void CTaoCryptErrorString(int error, char* buffer)
|
||||
XSTRNCPY(buffer, "AES-CCM Authentication check fail", max);
|
||||
break;
|
||||
|
||||
case CAVIUM_INIT_E:
|
||||
XSTRNCPY(buffer, "Cavium Init type error", max);
|
||||
break;
|
||||
|
||||
default:
|
||||
XSTRNCPY(buffer, "unknown error number", max);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mont_small.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_12.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_17.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_20.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_24.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_28.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_3.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_32.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_4.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_48.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_6.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_64.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_7.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_8.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_9.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_mul_comba_small_set.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_12.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_17.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_20.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_24.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_28.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_3.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_32.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_4.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_48.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_6.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_64.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_7.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_8.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_9.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* fp_sqr_comba_small_set.i
|
||||
*
|
||||
* Copyright (C) 2006-2011 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* hc128.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* hmac.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -29,6 +29,14 @@
|
||||
#include <cyassl/ctaocrypt/error.h>
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static void HmacCaviumFinal(Hmac* hmac, byte* hash);
|
||||
static void HmacCaviumUpdate(Hmac* hmac, const byte* msg, word32 length);
|
||||
static void HmacCaviumSetKey(Hmac* hmac, int type, const byte* key,
|
||||
word32 length);
|
||||
#endif
|
||||
|
||||
|
||||
static int InitHmac(Hmac* hmac, int type)
|
||||
{
|
||||
hmac->innerHashKeyed = 0;
|
||||
@ -74,6 +82,11 @@ void HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length)
|
||||
byte* op = (byte*) hmac->opad;
|
||||
word32 i, hmac_block_size = SHA_BLOCK_SIZE;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (hmac->magic == CYASSL_HMAC_CAVIUM_MAGIC)
|
||||
return HmacCaviumSetKey(hmac, type, key, length);
|
||||
#endif
|
||||
|
||||
InitHmac(hmac, type);
|
||||
|
||||
switch (hmac->macType) {
|
||||
@ -141,7 +154,8 @@ void HmacSetKey(Hmac* hmac, int type, const byte* key, word32 length)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
XMEMSET(ip + length, 0, hmac_block_size - length);
|
||||
if (length < hmac_block_size)
|
||||
XMEMSET(ip + length, 0, hmac_block_size - length);
|
||||
|
||||
for(i = 0; i < hmac_block_size; i++) {
|
||||
op[i] = ip[i] ^ OPAD;
|
||||
@ -187,6 +201,11 @@ static void HmacKeyInnerHash(Hmac* hmac)
|
||||
|
||||
void HmacUpdate(Hmac* hmac, const byte* msg, word32 length)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (hmac->magic == CYASSL_HMAC_CAVIUM_MAGIC)
|
||||
return HmacCaviumUpdate(hmac, msg, length);
|
||||
#endif
|
||||
|
||||
if (!hmac->innerHashKeyed)
|
||||
HmacKeyInnerHash(hmac);
|
||||
|
||||
@ -222,6 +241,11 @@ void HmacUpdate(Hmac* hmac, const byte* msg, word32 length)
|
||||
|
||||
void HmacFinal(Hmac* hmac, byte* hash)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (hmac->magic == CYASSL_HMAC_CAVIUM_MAGIC)
|
||||
return HmacCaviumFinal(hmac, hash);
|
||||
#endif
|
||||
|
||||
if (!hmac->innerHashKeyed)
|
||||
HmacKeyInnerHash(hmac);
|
||||
|
||||
@ -290,5 +314,115 @@ void HmacFinal(Hmac* hmac, byte* hash)
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
/* Initiliaze Hmac for use with Nitrox device */
|
||||
int HmacInitCavium(Hmac* hmac, int devId)
|
||||
{
|
||||
if (hmac == NULL)
|
||||
return -1;
|
||||
|
||||
if (CspAllocContext(CONTEXT_SSL, &hmac->contextHandle, devId) != 0)
|
||||
return -1;
|
||||
|
||||
hmac->keyLen = 0;
|
||||
hmac->dataLen = 0;
|
||||
hmac->type = 0;
|
||||
hmac->devId = devId;
|
||||
hmac->magic = CYASSL_HMAC_CAVIUM_MAGIC;
|
||||
hmac->data = NULL; /* buffered input data */
|
||||
|
||||
hmac->innerHashKeyed = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free Hmac from use with Nitrox device */
|
||||
void HmacFreeCavium(Hmac* hmac)
|
||||
{
|
||||
if (hmac == NULL)
|
||||
return;
|
||||
|
||||
CspFreeContext(CONTEXT_SSL, hmac->contextHandle, hmac->devId);
|
||||
hmac->magic = 0;
|
||||
XFREE(hmac->data, NULL, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
hmac->data = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void HmacCaviumFinal(Hmac* hmac, byte* hash)
|
||||
{
|
||||
word32 requestId;
|
||||
|
||||
if (CspHmac(CAVIUM_BLOCKING, hmac->type, NULL, hmac->keyLen,
|
||||
(byte*)hmac->ipad, hmac->dataLen, hmac->data, hash, &requestId,
|
||||
hmac->devId) != 0) {
|
||||
CYASSL_MSG("Cavium Hmac failed");
|
||||
}
|
||||
hmac->innerHashKeyed = 0; /* tell update to start over if used again */
|
||||
}
|
||||
|
||||
|
||||
static void HmacCaviumUpdate(Hmac* hmac, const byte* msg, word32 length)
|
||||
{
|
||||
word16 add = (word16)length;
|
||||
word32 total;
|
||||
byte* tmp;
|
||||
|
||||
if (length > CYASSL_MAX_16BIT) {
|
||||
CYASSL_MSG("Too big msg for cavium hmac");
|
||||
return;
|
||||
}
|
||||
|
||||
if (hmac->innerHashKeyed == 0) { /* starting new */
|
||||
hmac->dataLen = 0;
|
||||
hmac->innerHashKeyed = 1;
|
||||
}
|
||||
|
||||
total = add + hmac->dataLen;
|
||||
if (total > CYASSL_MAX_16BIT) {
|
||||
CYASSL_MSG("Too big msg for cavium hmac");
|
||||
return;
|
||||
}
|
||||
|
||||
tmp = XMALLOC(hmac->dataLen + add, NULL,DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
if (tmp == NULL) {
|
||||
CYASSL_MSG("Out of memory for cavium update");
|
||||
return;
|
||||
}
|
||||
if (hmac->dataLen)
|
||||
XMEMCPY(tmp, hmac->data, hmac->dataLen);
|
||||
XMEMCPY(tmp + hmac->dataLen, msg, add);
|
||||
|
||||
hmac->dataLen += add;
|
||||
XFREE(hmac->data, NULL, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
hmac->data = tmp;
|
||||
}
|
||||
|
||||
|
||||
static void HmacCaviumSetKey(Hmac* hmac, int type, const byte* key,
|
||||
word32 length)
|
||||
{
|
||||
hmac->macType = (byte)type;
|
||||
if (type == MD5)
|
||||
hmac->type = MD5_TYPE;
|
||||
else if (type == SHA)
|
||||
hmac->type = SHA1_TYPE;
|
||||
else if (type == SHA256)
|
||||
hmac->type = SHA256_TYPE;
|
||||
else {
|
||||
CYASSL_MSG("unsupported cavium hmac type");
|
||||
}
|
||||
|
||||
hmac->innerHashKeyed = 0; /* should we key Startup flag */
|
||||
|
||||
hmac->keyLen = (word16)length;
|
||||
/* store key in ipad */
|
||||
XMEMCPY(hmac->ipad, key, length);
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_HMAC */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* integer.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* logging.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md2.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md4.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md5.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* memory.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* misc.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* pwdbased.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -103,7 +103,11 @@ int PBKDF2(byte* output, const byte* passwd, int pLen, const byte* salt,
|
||||
int hLen;
|
||||
int j;
|
||||
Hmac hmac;
|
||||
byte buffer[INNER_HASH_SIZE]; /* max size */
|
||||
#ifdef CYASSL_SHA512
|
||||
byte buffer[SHA512_DIGEST_SIZE];
|
||||
#else
|
||||
byte buffer[INNER_HASH_SIZE]; /* max size, doesn't handle 512 yet */
|
||||
#endif
|
||||
|
||||
if (hashType == MD5) {
|
||||
hLen = MD5_DIGEST_SIZE;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* rabbit.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* random.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -307,8 +307,13 @@ int InitRng(RNG* rng)
|
||||
{
|
||||
byte key[32];
|
||||
byte junk[256];
|
||||
int ret;
|
||||
|
||||
int ret = GenerateSeed(&rng->seed, key, sizeof(key));
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (rng->magic == CYASSL_RNG_CAVIUM_MAGIC)
|
||||
return 0;
|
||||
#endif
|
||||
ret = GenerateSeed(&rng->seed, key, sizeof(key));
|
||||
|
||||
if (ret == 0) {
|
||||
Arc4SetKey(&rng->cipher, key, sizeof(key));
|
||||
@ -318,10 +323,17 @@ int InitRng(RNG* rng)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static void CaviumRNG_GenerateBlock(RNG* rng, byte* output, word32 sz);
|
||||
#endif
|
||||
|
||||
/* place a generated block in output */
|
||||
void RNG_GenerateBlock(RNG* rng, byte* output, word32 sz)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (rng->magic == CYASSL_RNG_CAVIUM_MAGIC)
|
||||
return CaviumRNG_GenerateBlock(rng, output, sz);
|
||||
#endif
|
||||
XMEMSET(output, 0, sz);
|
||||
Arc4Process(&rng->cipher, output, output, sz);
|
||||
}
|
||||
@ -335,6 +347,50 @@ byte RNG_GenerateByte(RNG* rng)
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze RNG for use with Nitrox device */
|
||||
int InitRngCavium(RNG* rng, int devId)
|
||||
{
|
||||
if (rng == NULL)
|
||||
return -1;
|
||||
|
||||
rng->devId = devId;
|
||||
rng->magic = CYASSL_RNG_CAVIUM_MAGIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void CaviumRNG_GenerateBlock(RNG* rng, byte* output, word32 sz)
|
||||
{
|
||||
word offset = 0;
|
||||
word32 requestId;
|
||||
|
||||
while (sz > CYASSL_MAX_16BIT) {
|
||||
word16 slen = (word16)CYASSL_MAX_16BIT;
|
||||
if (CspRandom(CAVIUM_BLOCKING, slen, output + offset, &requestId,
|
||||
rng->devId) != 0) {
|
||||
CYASSL_MSG("Cavium RNG failed");
|
||||
}
|
||||
sz -= CYASSL_MAX_16BIT;
|
||||
offset += CYASSL_MAX_16BIT;
|
||||
}
|
||||
if (sz) {
|
||||
word16 slen = (word16)sz;
|
||||
if (CspRandom(CAVIUM_BLOCKING, slen, output + offset, &requestId,
|
||||
rng->devId) != 0) {
|
||||
CYASSL_MSG("Cavium RNG failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_RC4 */
|
||||
|
||||
|
||||
@ -399,6 +455,25 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(MICROCHIP_PIC32)
|
||||
|
||||
#include <peripheral/timer.h>
|
||||
|
||||
/* uses the core timer, in nanoseconds to seed srand */
|
||||
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
{
|
||||
int i;
|
||||
srand(ReadCoreTimer() * 25);
|
||||
|
||||
for (i = 0; i < sz; i++ ) {
|
||||
output[i] = rand() % 256;
|
||||
if ( (i % 8) == 7)
|
||||
srand(ReadCoreTimer() * 25);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(CYASSL_SAFERTOS) || defined(CYASSL_LEANPSK)
|
||||
|
||||
#warning "write a real random seed!!!!, just for testing now"
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ripemd.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* rsa.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -39,6 +39,18 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
static void InitCaviumRsaKey(RsaKey* key, void* heap);
|
||||
static void FreeCaviumRsaKey(RsaKey* key);
|
||||
static int CaviumRsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key);
|
||||
static int CaviumRsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key);
|
||||
static int CaviumRsaSSL_Sign(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key);
|
||||
static int CaviumRsaSSL_Verify(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key);
|
||||
#endif
|
||||
|
||||
enum {
|
||||
RSA_PUBLIC_ENCRYPT = 0,
|
||||
@ -58,6 +70,11 @@ enum {
|
||||
|
||||
void InitRsaKey(RsaKey* key, void* heap)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return InitCaviumRsaKey(key, heap);
|
||||
#endif
|
||||
|
||||
key->type = -1; /* haven't decided yet */
|
||||
key->heap = heap;
|
||||
|
||||
@ -75,6 +92,12 @@ void InitRsaKey(RsaKey* key, void* heap)
|
||||
void FreeRsaKey(RsaKey* key)
|
||||
{
|
||||
(void)key;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return FreeCaviumRsaKey(key);
|
||||
#endif
|
||||
|
||||
/* TomsFastMath doesn't use memory allocation */
|
||||
#ifndef USE_FAST_MATH
|
||||
if (key->type == RSA_PRIVATE) {
|
||||
@ -249,8 +272,14 @@ done:
|
||||
int RsaPublicEncrypt(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
RsaKey* key, RNG* rng)
|
||||
{
|
||||
int sz = mp_unsigned_bin_size(&key->n), ret;
|
||||
int sz, ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return CaviumRsaPublicEncrypt(in, inLen, out, outLen, key);
|
||||
#endif
|
||||
|
||||
sz = mp_unsigned_bin_size(&key->n);
|
||||
if (sz > (int)outLen)
|
||||
return RSA_BUFFER_E;
|
||||
|
||||
@ -270,6 +299,15 @@ int RsaPrivateDecryptInline(byte* in, word32 inLen, byte** out, RsaKey* key)
|
||||
{
|
||||
int plainLen, ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC) {
|
||||
ret = CaviumRsaPrivateDecrypt(in, inLen, in, inLen, key);
|
||||
if (ret > 0)
|
||||
*out = in;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = RsaFunction(in, inLen, in, &inLen, RSA_PRIVATE_DECRYPT, key))
|
||||
< 0) {
|
||||
return ret;
|
||||
@ -288,6 +326,11 @@ int RsaPrivateDecrypt(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
byte* tmp;
|
||||
byte* pad = 0;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return CaviumRsaPrivateDecrypt(in, inLen, out, outLen, key);
|
||||
#endif
|
||||
|
||||
tmp = (byte*)XMALLOC(inLen, key->heap, DYNAMIC_TYPE_RSA);
|
||||
if (tmp == NULL) {
|
||||
return MEMORY_E;
|
||||
@ -316,6 +359,15 @@ int RsaSSL_VerifyInline(byte* in, word32 inLen, byte** out, RsaKey* key)
|
||||
{
|
||||
int plainLen, ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC) {
|
||||
ret = CaviumRsaSSL_Verify(in, inLen, in, inLen, key);
|
||||
if (ret > 0)
|
||||
*out = in;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ret = RsaFunction(in, inLen, in, &inLen, RSA_PUBLIC_DECRYPT, key))
|
||||
< 0) {
|
||||
return ret;
|
||||
@ -334,6 +386,11 @@ int RsaSSL_Verify(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
byte* tmp;
|
||||
byte* pad = 0;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return CaviumRsaSSL_Verify(in, inLen, out, outLen, key);
|
||||
#endif
|
||||
|
||||
tmp = (byte*)XMALLOC(inLen, key->heap, DYNAMIC_TYPE_RSA);
|
||||
if (tmp == NULL) {
|
||||
return MEMORY_E;
|
||||
@ -362,8 +419,14 @@ int RsaSSL_Verify(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
int RsaSSL_Sign(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
RsaKey* key, RNG* rng)
|
||||
{
|
||||
int sz = mp_unsigned_bin_size(&key->n), ret;
|
||||
int sz, ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return CaviumRsaSSL_Sign(in, inLen, out, outLen, key);
|
||||
#endif
|
||||
|
||||
sz = mp_unsigned_bin_size(&key->n);
|
||||
if (sz > (int)outLen)
|
||||
return RSA_BUFFER_E;
|
||||
|
||||
@ -381,6 +444,10 @@ int RsaSSL_Sign(const byte* in, word32 inLen, byte* out, word32 outLen,
|
||||
|
||||
int RsaEncryptSize(RsaKey* key)
|
||||
{
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (key->magic == CYASSL_RSA_CAVIUM_MAGIC)
|
||||
return key->c_nSz;
|
||||
#endif
|
||||
return mp_unsigned_bin_size(&key->n);
|
||||
}
|
||||
|
||||
@ -561,4 +628,180 @@ int MakeRsaKey(RsaKey* key, int size, long e, RNG* rng)
|
||||
|
||||
#endif /* CYASSL_KEY_GEN */
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
|
||||
/* Initiliaze RSA for use with Nitrox device */
|
||||
int RsaInitCavium(RsaKey* rsa, int devId)
|
||||
{
|
||||
if (rsa == NULL)
|
||||
return -1;
|
||||
|
||||
if (CspAllocContext(CONTEXT_SSL, &rsa->contextHandle, devId) != 0)
|
||||
return -1;
|
||||
|
||||
rsa->devId = devId;
|
||||
rsa->magic = CYASSL_RSA_CAVIUM_MAGIC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free RSA from use with Nitrox device */
|
||||
void RsaFreeCavium(RsaKey* rsa)
|
||||
{
|
||||
if (rsa == NULL)
|
||||
return;
|
||||
|
||||
CspFreeContext(CONTEXT_SSL, rsa->contextHandle, rsa->devId);
|
||||
rsa->magic = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize cavium RSA key */
|
||||
static void InitCaviumRsaKey(RsaKey* key, void* heap)
|
||||
{
|
||||
if (key == NULL)
|
||||
return;
|
||||
|
||||
key->heap = heap;
|
||||
key->type = -1; /* don't know yet */
|
||||
|
||||
key->c_n = NULL;
|
||||
key->c_e = NULL;
|
||||
key->c_d = NULL;
|
||||
key->c_p = NULL;
|
||||
key->c_q = NULL;
|
||||
key->c_dP = NULL;
|
||||
key->c_dQ = NULL;
|
||||
key->c_u = NULL;
|
||||
|
||||
key->c_nSz = 0;
|
||||
key->c_eSz = 0;
|
||||
key->c_dSz = 0;
|
||||
key->c_pSz = 0;
|
||||
key->c_qSz = 0;
|
||||
key->c_dP_Sz = 0;
|
||||
key->c_dQ_Sz = 0;
|
||||
key->c_uSz = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Free cavium RSA key */
|
||||
static void FreeCaviumRsaKey(RsaKey* key)
|
||||
{
|
||||
if (key == NULL)
|
||||
return;
|
||||
|
||||
XFREE(key->c_n, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_e, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_d, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_p, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_q, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_dP, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_dQ, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(key->c_u, key->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
|
||||
InitCaviumRsaKey(key, key->heap); /* reset pointers */
|
||||
}
|
||||
|
||||
|
||||
static int CaviumRsaPublicEncrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
word32 requestId;
|
||||
word32 ret;
|
||||
|
||||
if (key == NULL || in == NULL || out == NULL || outLen < (word32)key->c_nSz)
|
||||
return -1;
|
||||
|
||||
ret = CspPkcs1v15Enc(CAVIUM_BLOCKING, BT2, key->c_nSz, key->c_eSz,
|
||||
(word16)inLen, key->c_n, key->c_e, (byte*)in, out,
|
||||
&requestId, key->devId);
|
||||
if (ret != 0) {
|
||||
CYASSL_MSG("Cavium Enc BT2 failed");
|
||||
return -1;
|
||||
}
|
||||
return key->c_nSz;
|
||||
}
|
||||
|
||||
|
||||
static INLINE void ato16(const byte* c, word16* u16)
|
||||
{
|
||||
*u16 = (c[0] << 8) | (c[1]);
|
||||
}
|
||||
|
||||
|
||||
static int CaviumRsaPrivateDecrypt(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
word32 requestId;
|
||||
word32 ret;
|
||||
word16 outSz = (word16)outLen;
|
||||
|
||||
if (key == NULL || in == NULL || out == NULL || inLen != (word32)key->c_nSz)
|
||||
return -1;
|
||||
|
||||
ret = CspPkcs1v15CrtDec(CAVIUM_BLOCKING, BT2, key->c_nSz, key->c_q,
|
||||
key->c_dQ, key->c_p, key->c_dP, key->c_u,
|
||||
(byte*)in, &outSz, out, &requestId, key->devId);
|
||||
if (ret != 0) {
|
||||
CYASSL_MSG("Cavium CRT Dec BT2 failed");
|
||||
return -1;
|
||||
}
|
||||
ato16((const byte*)&outSz, &outSz);
|
||||
|
||||
return outSz;
|
||||
}
|
||||
|
||||
|
||||
static int CaviumRsaSSL_Sign(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
word32 requestId;
|
||||
word32 ret;
|
||||
|
||||
if (key == NULL || in == NULL || out == NULL || inLen == 0 || outLen <
|
||||
(word32)key->c_nSz)
|
||||
return -1;
|
||||
|
||||
ret = CspPkcs1v15CrtEnc(CAVIUM_BLOCKING, BT1, key->c_nSz, (word16)inLen,
|
||||
key->c_q, key->c_dQ, key->c_p, key->c_dP, key->c_u,
|
||||
(byte*)in, out, &requestId, key->devId);
|
||||
if (ret != 0) {
|
||||
CYASSL_MSG("Cavium CRT Enc BT1 failed");
|
||||
return -1;
|
||||
}
|
||||
return key->c_nSz;
|
||||
}
|
||||
|
||||
|
||||
static int CaviumRsaSSL_Verify(const byte* in, word32 inLen, byte* out,
|
||||
word32 outLen, RsaKey* key)
|
||||
{
|
||||
word32 requestId;
|
||||
word32 ret;
|
||||
word16 outSz = (word16)outLen;
|
||||
|
||||
if (key == NULL || in == NULL || out == NULL || inLen != (word32)key->c_nSz)
|
||||
return -1;
|
||||
|
||||
ret = CspPkcs1v15Dec(CAVIUM_BLOCKING, BT1, key->c_nSz, key->c_eSz,
|
||||
key->c_n, key->c_e, (byte*)in, &outSz, out,
|
||||
&requestId, key->devId);
|
||||
if (ret != 0) {
|
||||
CYASSL_MSG("Cavium Dec BT1 failed");
|
||||
return -1;
|
||||
}
|
||||
outSz = ntohs(outSz);
|
||||
|
||||
return outSz;
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* NO_RSA */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* sha.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* sha256.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* sha512.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* tfm.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* test.c
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -64,9 +64,19 @@
|
||||
#include <cyassl/openssl/des.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
|
||||
/* include test cert and key buffers for use with NO_FILESYSTEM */
|
||||
#include <cyassl/certs_test.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
#include "crypto_ntru.h"
|
||||
#endif
|
||||
#ifdef HAVE_CAVIUM
|
||||
#include "cavium_sysdep.h"
|
||||
#include "cavium_common.h"
|
||||
#include "cavium_ioctl.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef FREESCALE_MQX
|
||||
@ -149,6 +159,7 @@ typedef struct func_args {
|
||||
} func_args;
|
||||
|
||||
|
||||
|
||||
void ctaocrypt_test(void* args)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -165,6 +176,7 @@ void ctaocrypt_test(void* args)
|
||||
#endif /* USE_FAST_MATH */
|
||||
#endif /* !CYASSL_LEANPSK */
|
||||
|
||||
|
||||
#ifndef NO_MD5
|
||||
if ( (ret = md5_test()) )
|
||||
err_sys("MD5 test failed!\n", ret);
|
||||
@ -358,21 +370,56 @@ void ctaocrypt_test(void* args)
|
||||
printf( "ECC test passed!\n");
|
||||
#endif
|
||||
|
||||
|
||||
((func_args*)args)->return_code = ret;
|
||||
}
|
||||
|
||||
|
||||
/* so overall tests can pull in test function */
|
||||
#ifndef NO_MAIN_DRIVER
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
|
||||
static int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
{
|
||||
Csp1CoreAssignment core_assign;
|
||||
Uint32 device;
|
||||
|
||||
if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
|
||||
return -1;
|
||||
if (Csp1GetDevType(&device))
|
||||
return -1;
|
||||
if (device != NPX_DEVICE) {
|
||||
if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
|
||||
(Uint32 *)&core_assign)!= 0)
|
||||
return -1;
|
||||
}
|
||||
CspShutdown(CAVIUM_DEV_ID);
|
||||
|
||||
return CspInitialize(dma_mode, dev_id);
|
||||
}
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
/* so overall tests can pull in test function */
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
func_args args;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
||||
if (ret != 0)
|
||||
err_sys("Cavium OpenNitroxDevice failed", -1236);
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
|
||||
ctaocrypt_test(&args);
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CspShutdown(CAVIUM_DEV_ID);
|
||||
#endif
|
||||
return args.return_code;
|
||||
}
|
||||
|
||||
@ -393,45 +440,45 @@ int md2_test()
|
||||
a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
|
||||
"\x27\x73";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
b.input = "a";
|
||||
b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
|
||||
"\xb5\xd1";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
c.input = "abc";
|
||||
c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
|
||||
"\xd6\xbb";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
d.input = "message digest";
|
||||
d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
|
||||
"\x06\xb0";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
e.input = "abcdefghijklmnopqrstuvwxyz";
|
||||
e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
|
||||
"\x94\x0b";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
e.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
|
||||
"6789";
|
||||
f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
|
||||
"\x38\xcd";
|
||||
f.inLen = strlen(f.input);
|
||||
f.outLen = strlen(f.output);
|
||||
f.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
g.input = "1234567890123456789012345678901234567890123456789012345678"
|
||||
"9012345678901234567890";
|
||||
g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
|
||||
"\xef\xd8";
|
||||
g.inLen = strlen(g.input);
|
||||
g.outLen = strlen(g.output);
|
||||
g.outLen = MD2_DIGEST_SIZE;
|
||||
|
||||
test_md2[0] = a;
|
||||
test_md2[1] = b;
|
||||
@ -469,33 +516,33 @@ int md5_test(void)
|
||||
a.output = "\x90\x01\x50\x98\x3c\xd2\x4f\xb0\xd6\x96\x3f\x7d\x28\xe1\x7f"
|
||||
"\x72";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
b.input = "message digest";
|
||||
b.output = "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d\x52\x5a\x2f\x31\xaa\xf1\x61"
|
||||
"\xd0";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
c.input = "abcdefghijklmnopqrstuvwxyz";
|
||||
c.output = "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00\x7d\xfb\x49\x6c\xca\x67\xe1"
|
||||
"\x3b";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
d.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
|
||||
"6789";
|
||||
d.output = "\xd1\x74\xab\x98\xd2\x77\xd9\xf5\xa5\x61\x1c\x2c\x9f\x41\x9d"
|
||||
"\x9f";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
e.input = "1234567890123456789012345678901234567890123456789012345678"
|
||||
"9012345678901234567890";
|
||||
e.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
|
||||
"\x7a";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
e.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
test_md5[0] = a;
|
||||
test_md5[1] = b;
|
||||
@ -533,45 +580,45 @@ int md4_test(void)
|
||||
a.output = "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89"
|
||||
"\xc0";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
b.input = "a";
|
||||
b.output = "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb"
|
||||
"\x24";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
c.input = "abc";
|
||||
c.output = "\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72"
|
||||
"\x9d";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
d.input = "message digest";
|
||||
d.output = "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01"
|
||||
"\x4b";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
e.input = "abcdefghijklmnopqrstuvwxyz";
|
||||
e.output = "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d"
|
||||
"\xa9";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
e.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
|
||||
"6789";
|
||||
f.output = "\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0"
|
||||
"\xe4";
|
||||
f.inLen = strlen(f.input);
|
||||
f.outLen = strlen(f.output);
|
||||
f.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
g.input = "1234567890123456789012345678901234567890123456789012345678"
|
||||
"9012345678901234567890";
|
||||
g.output = "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05"
|
||||
"\x36";
|
||||
g.inLen = strlen(g.input);
|
||||
g.outLen = strlen(g.output);
|
||||
g.outLen = MD4_DIGEST_SIZE;
|
||||
|
||||
test_md4[0] = a;
|
||||
test_md4[1] = b;
|
||||
@ -609,20 +656,20 @@ int sha_test(void)
|
||||
a.output = "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2"
|
||||
"\x6C\x9C\xD0\xD8\x9D";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
b.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
b.output = "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29"
|
||||
"\xE5\xE5\x46\x70\xF1";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
c.input = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaa";
|
||||
c.output = "\x00\x98\xBA\x82\x4B\x5C\x16\x42\x7B\xD7\xA1\x12\x2A\x5A\x44"
|
||||
"\x2A\x25\xEC\x64\x4D";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
d.input = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
@ -630,7 +677,7 @@ int sha_test(void)
|
||||
d.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
|
||||
"\x53\x99\x5E\x26\xA0";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
@ -665,26 +712,26 @@ int ripemd_test(void)
|
||||
a.output = "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04\x4a\x8e\x98\xc6"
|
||||
"\xb0\x87\xf1\x5a\x0b\xfc";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = RIPEMD_DIGEST_SIZE;
|
||||
|
||||
b.input = "message digest";
|
||||
b.output = "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8\x81\xb1\x23\xa8"
|
||||
"\x5f\xfa\x21\x59\x5f\x36";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = RIPEMD_DIGEST_SIZE;
|
||||
|
||||
c.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
c.output = "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05\xa0\x6c\x27\xdc"
|
||||
"\xf4\x9a\xda\x62\xeb\x2b";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = RIPEMD_DIGEST_SIZE;
|
||||
|
||||
d.input = "12345678901234567890123456789012345678901234567890123456"
|
||||
"789012345678901234567890";
|
||||
d.output = "\x9b\x75\x2e\x45\x57\x3d\x4b\x39\xf4\xdb\xd3\x32\x3c\xab"
|
||||
"\x82\xbf\x63\x32\x6b\xfb";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = RIPEMD_DIGEST_SIZE;
|
||||
|
||||
test_ripemd[0] = a;
|
||||
test_ripemd[1] = b;
|
||||
@ -722,14 +769,14 @@ int sha256_test(void)
|
||||
"\x23\xB0\x03\x61\xA3\x96\x17\x7A\x9C\xB4\x10\xFF\x61\xF2\x00"
|
||||
"\x15\xAD";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
b.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
b.output = "\x24\x8D\x6A\x61\xD2\x06\x38\xB8\xE5\xC0\x26\x93\x0C\x3E\x60"
|
||||
"\x39\xA3\x3C\xE4\x59\x64\xFF\x21\x67\xF6\xEC\xED\xD4\x19\xDB"
|
||||
"\x06\xC1";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
@ -766,7 +813,7 @@ int sha512_test(void)
|
||||
"\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f"
|
||||
"\xa5\x4c\xa4\x9f";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA512_DIGEST_SIZE;
|
||||
|
||||
b.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
|
||||
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
|
||||
@ -776,7 +823,7 @@ int sha512_test(void)
|
||||
"\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
|
||||
"\x87\x4b\xe9\x09";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA512_DIGEST_SIZE;
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
@ -812,7 +859,7 @@ int sha384_test(void)
|
||||
"\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34"
|
||||
"\xc8\x25\xa7";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
b.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
|
||||
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
|
||||
@ -821,7 +868,7 @@ int sha384_test(void)
|
||||
"\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91"
|
||||
"\x74\x60\x39";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
@ -863,13 +910,13 @@ int hmac_md5_test(void)
|
||||
a.output = "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc"
|
||||
"\x9d";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
|
||||
"\x38";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
@ -878,13 +925,19 @@ int hmac_md5_test(void)
|
||||
c.output = "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3"
|
||||
"\xf6";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (i == 1)
|
||||
continue; /* driver can't handle keys <= bytes */
|
||||
if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
|
||||
return -20009;
|
||||
#endif
|
||||
HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
@ -892,6 +945,9 @@ int hmac_md5_test(void)
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
#ifdef HAVE_CAVIUM
|
||||
HmacFreeCavium(&hmac);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -922,13 +978,13 @@ int hmac_sha_test(void)
|
||||
a.output = "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c"
|
||||
"\x8e\xf1\x46\xbe\x00";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf"
|
||||
"\x9c\x25\x9a\x7c\x79";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
@ -937,13 +993,19 @@ int hmac_sha_test(void)
|
||||
c.output = "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b"
|
||||
"\x4f\x63\xf1\x75\xd3";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (i == 1)
|
||||
continue; /* driver can't handle keys <= bytes */
|
||||
if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
|
||||
return -20010;
|
||||
#endif
|
||||
HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
@ -951,6 +1013,9 @@ int hmac_sha_test(void)
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
#ifdef HAVE_CAVIUM
|
||||
HmacFreeCavium(&hmac);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -983,14 +1048,14 @@ int hmac_sha256_test(void)
|
||||
"\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32"
|
||||
"\xcf\xf7";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75"
|
||||
"\xc7\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec"
|
||||
"\x38\x43";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
@ -1000,13 +1065,19 @@ int hmac_sha256_test(void)
|
||||
"\xa7\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5"
|
||||
"\x65\xfe";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (i == 1)
|
||||
continue; /* driver can't handle keys <= bytes */
|
||||
if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
|
||||
return -20011;
|
||||
#endif
|
||||
HmacSetKey(&hmac, SHA256, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
@ -1014,6 +1085,9 @@ int hmac_sha256_test(void)
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
#ifdef HAVE_CAVIUM
|
||||
HmacFreeCavium(&hmac);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1047,7 +1121,7 @@ int hmac_sha384_test(void)
|
||||
"\xc5\x9c\xfa\xea\x9e\xa9\x07\x6e\xde\x7f\x4a\xf1\x52\xe8\xb2"
|
||||
"\xfa\x9c\xb6";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5\x8a\x6b"
|
||||
@ -1055,7 +1129,7 @@ int hmac_sha384_test(void)
|
||||
"\x44\x5e\x8e\x22\x40\xca\x5e\x69\xe2\xc7\x8b\x32\x39\xec\xfa"
|
||||
"\xb2\x16\x49";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
@ -1066,7 +1140,7 @@ int hmac_sha384_test(void)
|
||||
"\x14\x4b\x2a\x5a\xb3\x9d\xc1\x38\x14\xb9\x4e\x3a\xb6\xe1\x01"
|
||||
"\xa3\x4f\x27";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
@ -1108,23 +1182,23 @@ int arc4_test(void)
|
||||
|
||||
a.input = "\x01\x23\x45\x67\x89\xab\xcd\xef";
|
||||
a.output = "\x75\xb7\x87\x80\x99\xe0\xc5\x96";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.inLen = 8;
|
||||
a.outLen = 8;
|
||||
|
||||
b.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
b.output = "\x74\x94\xc2\xe7\x10\x4b\x08\x79";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.inLen = 8;
|
||||
b.outLen = 8;
|
||||
|
||||
c.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
c.output = "\xde\x18\x89\x41\xa3\x37\x5d\x3a";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.inLen = 8;
|
||||
c.outLen = 8;
|
||||
|
||||
d.input = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
d.output = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf\xbd\x61";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.inLen = 10;
|
||||
d.outLen = 10;
|
||||
|
||||
test_arc4[0] = a;
|
||||
test_arc4[1] = b;
|
||||
@ -1134,9 +1208,19 @@ int arc4_test(void)
|
||||
for (i = 0; i < times; ++i) {
|
||||
Arc4 enc;
|
||||
Arc4 dec;
|
||||
int keylen = 8; /* strlen with key 0x00 not good */
|
||||
if (i == 3)
|
||||
keylen = 4;
|
||||
|
||||
Arc4SetKey(&enc, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
Arc4SetKey(&dec, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
return -20001;
|
||||
if (Arc4InitCavium(&dec, CAVIUM_DEV_ID) != 0)
|
||||
return -20002;
|
||||
#endif
|
||||
|
||||
Arc4SetKey(&enc, (byte*)keys[i], keylen);
|
||||
Arc4SetKey(&dec, (byte*)keys[i], keylen);
|
||||
|
||||
Arc4Process(&enc, cipher, (byte*)test_arc4[i].input,
|
||||
(word32)test_arc4[i].outLen);
|
||||
@ -1147,6 +1231,11 @@ int arc4_test(void)
|
||||
|
||||
if (memcmp(cipher, test_arc4[i].output, test_arc4[i].outLen))
|
||||
return -20 - 5 - i;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
Arc4FreeCavium(&enc);
|
||||
Arc4FreeCavium(&dec);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1184,23 +1273,23 @@ int hc128_test(void)
|
||||
|
||||
a.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
a.output = "\x37\x86\x02\xB9\x8F\x32\xA7\x48";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.inLen = 8;
|
||||
a.outLen = 8;
|
||||
|
||||
b.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
b.output = "\x33\x7F\x86\x11\xC6\xED\x61\x5F";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.inLen = 8;
|
||||
b.outLen = 8;
|
||||
|
||||
c.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
c.output = "\x2E\x1E\xD1\x2A\x85\x51\xC0\x5A";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.inLen = 8;
|
||||
c.outLen = 8;
|
||||
|
||||
d.input = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
d.output = "\x1C\xD8\xAE\xDD\xFE\x52\xE2\x17\xE8\x35\xD0\xB7\xE8\x4E\x29";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.inLen = 15;
|
||||
d.outLen = 15;
|
||||
|
||||
test_hc128[0] = a;
|
||||
test_hc128[1] = b;
|
||||
@ -1262,18 +1351,18 @@ int rabbit_test(void)
|
||||
|
||||
a.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
a.output = "\xED\xB7\x05\x67\x37\x5D\xCD\x7C";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.inLen = 8;
|
||||
a.outLen = 8;
|
||||
|
||||
b.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
b.output = "\x6D\x7D\x01\x22\x92\xCC\xDC\xE0";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.inLen = 8;
|
||||
b.outLen = 8;
|
||||
|
||||
c.input = "\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
c.output = "\x9C\x51\xE2\x87\x84\xC3\x7F\xE9";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.inLen = 8;
|
||||
c.outLen = 8;
|
||||
|
||||
test_rabbit[0] = a;
|
||||
test_rabbit[1] = b;
|
||||
@ -1397,9 +1486,15 @@ int des3_test(void)
|
||||
};
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
return -20005;
|
||||
if (Des3_InitCavium(&dec, CAVIUM_DEV_ID) != 0)
|
||||
return -20006;
|
||||
#endif
|
||||
Des3_SetKey(&enc, key3, iv3, DES_ENCRYPTION);
|
||||
Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
|
||||
Des3_SetKey(&dec, key3, iv3, DES_DECRYPTION);
|
||||
Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
|
||||
Des3_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
|
||||
|
||||
if (memcmp(plain, vector, sizeof(plain)))
|
||||
@ -1408,6 +1503,10 @@ int des3_test(void)
|
||||
if (memcmp(cipher, verify3, sizeof(cipher)))
|
||||
return -34;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
Des3_FreeCavium(&enc);
|
||||
Des3_FreeCavium(&dec);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_DES */
|
||||
@ -1437,6 +1536,12 @@ int aes_test(void)
|
||||
byte cipher[AES_BLOCK_SIZE * 4];
|
||||
byte plain [AES_BLOCK_SIZE * 4];
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0)
|
||||
return -20003;
|
||||
if (AesInitCavium(&dec, CAVIUM_DEV_ID) != 0)
|
||||
return -20004;
|
||||
#endif
|
||||
AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
AesSetKey(&dec, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
|
||||
|
||||
@ -1449,6 +1554,10 @@ int aes_test(void)
|
||||
if (memcmp(cipher, verify, AES_BLOCK_SIZE))
|
||||
return -61;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
AesFreeCavium(&enc);
|
||||
AesFreeCavium(&dec);
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
{
|
||||
const byte ctrKey[] =
|
||||
@ -1895,7 +2004,13 @@ int random_test(void)
|
||||
{
|
||||
RNG rng;
|
||||
byte block[32];
|
||||
int ret = InitRng(&rng);
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
ret = InitRngCavium(&rng, CAVIUM_DEV_ID);
|
||||
if (ret != 0) return -2007;
|
||||
#endif
|
||||
ret = InitRng(&rng);
|
||||
if (ret != 0) return -39;
|
||||
|
||||
RNG_GenerateBlock(&rng, block, sizeof(block));
|
||||
@ -1947,7 +2062,7 @@ byte GetEntropy(ENTROPY_CMD cmd, byte* out)
|
||||
static const char* caKeyFile = "a:\certs\\ca-key.der";
|
||||
static const char* caCertFile = "a:\certs\\ca-cert.pem";
|
||||
#endif
|
||||
#else
|
||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
static const char* clientKey = "./certs/client-key.der";
|
||||
static const char* clientCert = "./certs/client-cert.der";
|
||||
#ifdef CYASSL_CERT_GEN
|
||||
@ -1970,7 +2085,9 @@ int rsa_test(void)
|
||||
word32 inLen = (word32)strlen((char*)in);
|
||||
byte out[256];
|
||||
byte plain[256];
|
||||
#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
FILE* file, * file2;
|
||||
#endif
|
||||
#ifdef CYASSL_TEST_CERT
|
||||
DecodedCert cert;
|
||||
#endif
|
||||
@ -1979,6 +2096,13 @@ int rsa_test(void)
|
||||
if (tmp == NULL)
|
||||
return -40;
|
||||
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, client_key_der_1024, sizeof(client_key_der_1024));
|
||||
bytes = sizeof(client_key_der_1024);
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, client_key_der_2048, sizeof(client_key_der_2048));
|
||||
bytes = sizeof(client_key_der_2048);
|
||||
#else
|
||||
file = fopen(clientKey, "rb");
|
||||
|
||||
if (!file)
|
||||
@ -1986,7 +2110,12 @@ int rsa_test(void)
|
||||
"Please run from CyaSSL home dir", -40);
|
||||
|
||||
bytes = fread(tmp, 1, FOURK_BUF, file);
|
||||
|
||||
fclose(file);
|
||||
#endif /* USE_CERT_BUFFERS */
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
RsaInitCavium(&key, CAVIUM_DEV_ID);
|
||||
#endif
|
||||
InitRsaKey(&key, 0);
|
||||
ret = RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
|
||||
if (ret != 0) return -41;
|
||||
@ -2011,11 +2140,20 @@ int rsa_test(void)
|
||||
|
||||
if (memcmp(plain, in, ret)) return -48;
|
||||
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, client_cert_der_1024, sizeof(client_cert_der_1024));
|
||||
bytes = sizeof(client_cert_der_1024);
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, client_cert_der_2048, sizeof(client_cert_der_2048));
|
||||
bytes = sizeof(client_cert_der_2048);
|
||||
#else
|
||||
file2 = fopen(clientCert, "rb");
|
||||
if (!file2)
|
||||
return -49;
|
||||
|
||||
bytes = fread(tmp, 1, FOURK_BUF, file2);
|
||||
fclose(file2);
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_TEST_CERT
|
||||
InitDecodedCert(&cert, tmp, (word32)bytes, 0);
|
||||
@ -2028,8 +2166,6 @@ int rsa_test(void)
|
||||
(void)bytes;
|
||||
#endif
|
||||
|
||||
fclose(file2);
|
||||
fclose(file);
|
||||
|
||||
#ifdef CYASSL_KEY_GEN
|
||||
{
|
||||
@ -2356,6 +2492,9 @@ int rsa_test(void)
|
||||
#endif /* CYASSL_CERT_GEN */
|
||||
|
||||
FreeRsaKey(&key);
|
||||
#ifdef HAVE_CAVIUM
|
||||
RsaFreeCavium(&key);
|
||||
#endif
|
||||
free(tmp);
|
||||
|
||||
return 0;
|
||||
@ -2368,7 +2507,7 @@ int rsa_test(void)
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
static const char* dhKey = "a:\certs\\dh2048.der";
|
||||
#else
|
||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
static const char* dhKey = "./certs/dh2048.der";
|
||||
#endif
|
||||
|
||||
@ -2387,12 +2526,21 @@ int dh_test(void)
|
||||
DhKey key;
|
||||
DhKey key2;
|
||||
RNG rng;
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, dh_key_der_1024, sizeof(dh_key_der_1024));
|
||||
bytes = sizeof(dh_key_der_1024);
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, dh_key_der_2048, sizeof(dh_key_der_2048));
|
||||
bytes = sizeof(dh_key_der_2048);
|
||||
#else
|
||||
FILE* file = fopen(dhKey, "rb");
|
||||
|
||||
if (!file)
|
||||
return -50;
|
||||
|
||||
bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
|
||||
fclose(file);
|
||||
#endif /* USE_CERT_BUFFERS */
|
||||
|
||||
InitDhKey(&key);
|
||||
InitDhKey(&key2);
|
||||
@ -2424,7 +2572,6 @@ int dh_test(void)
|
||||
|
||||
FreeDhKey(&key);
|
||||
FreeDhKey(&key2);
|
||||
fclose(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2436,7 +2583,7 @@ int dh_test(void)
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
static const char* dsaKey = "a:\certs\\dsa2048.der";
|
||||
#else
|
||||
#elif !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
|
||||
static const char* dsaKey = "./certs/dsa2048.der";
|
||||
#endif
|
||||
|
||||
@ -2448,15 +2595,24 @@ int dsa_test(void)
|
||||
byte tmp[1024];
|
||||
DsaKey key;
|
||||
RNG rng;
|
||||
FILE* file = fopen(dsaKey, "rb");
|
||||
Sha sha;
|
||||
byte hash[SHA_DIGEST_SIZE];
|
||||
byte signature[40];
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
XMEMCPY(tmp, dsa_key_der_1024, sizeof(dsa_key_der_1024));
|
||||
bytes = sizeof(dsa_key_der_1024);
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
XMEMCPY(tmp, dsa_key_der_2048, sizeof(dsa_key_der_2048));
|
||||
bytes = sizeof(dsa_key_der_2048);
|
||||
#else
|
||||
FILE* file = fopen(dsaKey, "rb");
|
||||
|
||||
if (!file)
|
||||
return -60;
|
||||
|
||||
bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
|
||||
fclose(file);
|
||||
#endif /* USE_CERT_BUFFERS */
|
||||
|
||||
InitSha(&sha);
|
||||
ShaUpdate(&sha, tmp, bytes);
|
||||
@ -2477,7 +2633,6 @@ int dsa_test(void)
|
||||
if (answer != 1) return -65;
|
||||
|
||||
FreeDsaKey(&key);
|
||||
fclose(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2501,7 +2656,7 @@ int openssl_test(void)
|
||||
a.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
|
||||
"\x7a";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
a.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_DigestInit(&md_ctx, EVP_md5());
|
||||
@ -2518,7 +2673,7 @@ int openssl_test(void)
|
||||
b.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
|
||||
"\x53\x99\x5E\x26\xA0";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
b.outLen = SHA_DIGEST_SIZE;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_DigestInit(&md_ctx, EVP_sha1());
|
||||
@ -2535,7 +2690,7 @@ int openssl_test(void)
|
||||
"\x39\xA3\x3C\xE4\x59\x64\xFF\x21\x67\xF6\xEC\xED\xD4\x19\xDB"
|
||||
"\x06\xC1";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
d.outLen = SHA256_DIGEST_SIZE;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_DigestInit(&md_ctx, EVP_sha256());
|
||||
@ -2555,7 +2710,7 @@ int openssl_test(void)
|
||||
"\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91"
|
||||
"\x74\x60\x39";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
e.outLen = SHA384_DIGEST_SIZE;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_DigestInit(&md_ctx, EVP_sha384());
|
||||
@ -2579,7 +2734,7 @@ int openssl_test(void)
|
||||
"\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
|
||||
"\x87\x4b\xe9\x09";
|
||||
f.inLen = strlen(f.input);
|
||||
f.outLen = strlen(f.output);
|
||||
f.outLen = SHA512_DIGEST_SIZE;
|
||||
|
||||
EVP_MD_CTX_init(&md_ctx);
|
||||
EVP_DigestInit(&md_ctx, EVP_sha512());
|
||||
@ -2600,7 +2755,7 @@ int openssl_test(void)
|
||||
c.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
|
||||
"\x38";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
c.outLen = MD5_DIGEST_SIZE;
|
||||
|
||||
HMAC(EVP_md5(), "Jefe", 4, (byte*)c.input, (int)c.inLen, hash, 0);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ctaocrypt/test/test.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* cyassl_callbacks.h
|
||||
*
|
||||
* Copyright (C) 2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
790
cyassl/certs_test.h
Normal file
790
cyassl/certs_test.h
Normal file
@ -0,0 +1,790 @@
|
||||
/* certs_test.h */
|
||||
|
||||
#ifndef CYASSL_CERTS_TEST_H
|
||||
#define CYASSL_CERTS_TEST_H
|
||||
|
||||
#ifdef USE_CERT_BUFFERS_1024
|
||||
|
||||
/* ./certs/1024/client-key.der, 1024-bit */
|
||||
const unsigned char client_key_der_1024[] =
|
||||
{
|
||||
0x30, 0x82, 0x02, 0x5C, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
|
||||
0x00, 0xBC, 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2, 0xA9,
|
||||
0xEF, 0x18, 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8, 0xEC,
|
||||
0xB3, 0x6D, 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37, 0xEC,
|
||||
0xD1, 0x61, 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF, 0x94,
|
||||
0xCA, 0xC1, 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8, 0x4D,
|
||||
0xC4, 0x61, 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77, 0x25,
|
||||
0xBB, 0x8D, 0x11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 0x41, 0x02,
|
||||
0x41, 0x00, 0x9D, 0x7E, 0x05, 0xDE, 0xED, 0xF4, 0xB7, 0xB2,
|
||||
0xFB, 0xFC, 0x30, 0x4B, 0x55, 0x1D, 0xE3, 0x2F, 0x01, 0x47,
|
||||
0x96, 0x69, 0x05, 0xCD, 0x0E, 0x2E, 0x2C, 0xBD, 0x83, 0x63,
|
||||
0xB6, 0xAB, 0x7C, 0xB7, 0x6D, 0xCA, 0x5B, 0x64, 0xA7, 0xCE,
|
||||
0xBE, 0x86, 0xDF, 0x3B, 0x53, 0xDE, 0x61, 0xD2, 0x1E, 0xEB,
|
||||
0xA5, 0xF6, 0x37, 0xED, 0xAC, 0xAB, 0x78, 0xD9, 0x4C, 0xE7,
|
||||
0x55, 0xFB, 0xD7, 0x11, 0x99, 0xC1, 0x02, 0x40, 0x18, 0x98,
|
||||
0x18, 0x29, 0xE6, 0x1E, 0x27, 0x39, 0x70, 0x21, 0x68, 0xAC,
|
||||
0x0A, 0x2F, 0xA1, 0x72, 0xC1, 0x21, 0x86, 0x95, 0x38, 0xC6,
|
||||
0x58, 0x90, 0xA0, 0x57, 0x9C, 0xBA, 0xE3, 0xA7, 0xB1, 0x15,
|
||||
0xC8, 0xDE, 0xF6, 0x1B, 0xC2, 0x61, 0x23, 0x76, 0xEF, 0xB0,
|
||||
0x9D, 0x1C, 0x44, 0xBE, 0x13, 0x43, 0x39, 0x67, 0x17, 0xC8,
|
||||
0x9D, 0xCA, 0xFB, 0xF5, 0x45, 0x64, 0x8B, 0x38, 0x82, 0x2C,
|
||||
0xF2, 0x81, 0x02, 0x40, 0x39, 0x89, 0xE5, 0x9C, 0x19, 0x55,
|
||||
0x30, 0xBA, 0xB7, 0x48, 0x8C, 0x48, 0x14, 0x0E, 0xF4, 0x9F,
|
||||
0x7E, 0x77, 0x97, 0x43, 0xE1, 0xB4, 0x19, 0x35, 0x31, 0x23,
|
||||
0x75, 0x9C, 0x3B, 0x44, 0xAD, 0x69, 0x12, 0x56, 0xEE, 0x00,
|
||||
0x61, 0x64, 0x16, 0x66, 0xD3, 0x7C, 0x74, 0x2B, 0x15, 0xB4,
|
||||
0xA2, 0xFE, 0xBF, 0x08, 0x6B, 0x1A, 0x5D, 0x3F, 0x90, 0x12,
|
||||
0xB1, 0x05, 0x86, 0x31, 0x29, 0xDB, 0xD9, 0xE2
|
||||
};
|
||||
|
||||
/* ./certs/1024/client-cert.der, 1024-bit */
|
||||
const unsigned char client_cert_der_1024[] =
|
||||
{
|
||||
0x30, 0x82, 0x02, 0xEC, 0x30, 0x82, 0x02, 0x55, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x8D, 0x0D, 0xAC, 0xFE,
|
||||
0xC6, 0x98, 0x45, 0x26, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
|
||||
0x81, 0x8E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06,
|
||||
0x03, 0x55, 0x04, 0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67,
|
||||
0x6F, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04,
|
||||
0x07, 0x0C, 0x08, 0x50, 0x6F, 0x72, 0x74, 0x6C, 0x61, 0x6E,
|
||||
0x64, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A,
|
||||
0x0C, 0x05, 0x79, 0x61, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30,
|
||||
0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x50, 0x72,
|
||||
0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x31,
|
||||
0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0D,
|
||||
0x77, 0x77, 0x77, 0x2E, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E,
|
||||
0x63, 0x6F, 0x6D, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x09, 0x2A,
|
||||
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0E,
|
||||
0x69, 0x6E, 0x66, 0x6F, 0x40, 0x79, 0x61, 0x73, 0x73, 0x6C,
|
||||
0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x33,
|
||||
0x30, 0x31, 0x31, 0x38, 0x32, 0x31, 0x34, 0x32, 0x34, 0x39,
|
||||
0x5A, 0x17, 0x0D, 0x31, 0x35, 0x31, 0x30, 0x31, 0x35, 0x32,
|
||||
0x31, 0x34, 0x32, 0x34, 0x39, 0x5A, 0x30, 0x81, 0x8E, 0x31,
|
||||
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04,
|
||||
0x08, 0x0C, 0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31,
|
||||
0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x08,
|
||||
0x50, 0x6F, 0x72, 0x74, 0x6C, 0x61, 0x6E, 0x64, 0x31, 0x0E,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x79,
|
||||
0x61, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03,
|
||||
0x55, 0x04, 0x0B, 0x0C, 0x0B, 0x50, 0x72, 0x6F, 0x67, 0x72,
|
||||
0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x31, 0x16, 0x30, 0x14,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0D, 0x77, 0x77, 0x77,
|
||||
0x2E, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
|
||||
0x31, 0x1D, 0x30, 0x1B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0E, 0x69, 0x6E, 0x66,
|
||||
0x6F, 0x40, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
|
||||
0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
|
||||
0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00,
|
||||
0xBC, 0x73, 0x0E, 0xA8, 0x49, 0xF3, 0x74, 0xA2, 0xA9, 0xEF,
|
||||
0x18, 0xA5, 0xDA, 0x55, 0x99, 0x21, 0xF9, 0xC8, 0xEC, 0xB3,
|
||||
0x6D, 0x48, 0xE5, 0x35, 0x35, 0x75, 0x77, 0x37, 0xEC, 0xD1,
|
||||
0x61, 0x90, 0x5F, 0x3E, 0xD9, 0xE4, 0xD5, 0xDF, 0x94, 0xCA,
|
||||
0xC1, 0xA9, 0xD7, 0x19, 0xDA, 0x86, 0xC9, 0xE8, 0x4D, 0xC4,
|
||||
0x61, 0x36, 0x82, 0xFE, 0xAB, 0xAD, 0x7E, 0x77, 0x25, 0xBB,
|
||||
0x8D, 0x11, 0xA5, 0xBC, 0x62, 0x3A, 0xA8, 0x38, 0xCC, 0x39,
|
||||
0xA2, 0x04, 0x66, 0xB4, 0xF7, 0xF7, 0xF3, 0xAA, 0xDA, 0x4D,
|
||||
0x02, 0x0E, 0xBB, 0x5E, 0x8D, 0x69, 0x48, 0xDC, 0x77, 0xC9,
|
||||
0x28, 0x0E, 0x22, 0xE9, 0x6B, 0xA4, 0x26, 0xBA, 0x4C, 0xE8,
|
||||
0xC1, 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A, 0xAE, 0xF6,
|
||||
0x90, 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C, 0x67, 0xC8,
|
||||
0xDC, 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9, 0x02, 0x03,
|
||||
0x01, 0x00, 0x01, 0xA3, 0x50, 0x30, 0x4E, 0x30, 0x1D, 0x06,
|
||||
0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x81, 0x69,
|
||||
0x0F, 0xF8, 0xDF, 0xDD, 0xCF, 0x34, 0x29, 0xD5, 0x67, 0x75,
|
||||
0x71, 0x85, 0xC7, 0x75, 0x10, 0x69, 0x59, 0xEC, 0x30, 0x1F,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
|
||||
0x14, 0x81, 0x69, 0x0F, 0xF8, 0xDF, 0xDD, 0xCF, 0x34, 0x29,
|
||||
0xD5, 0x67, 0x75, 0x71, 0x85, 0xC7, 0x75, 0x10, 0x69, 0x59,
|
||||
0xEC, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05,
|
||||
0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A,
|
||||
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00,
|
||||
0x03, 0x81, 0x81, 0x00, 0x72, 0x66, 0x0F, 0x6A, 0xA1, 0x85,
|
||||
0x95, 0x06, 0xE6, 0x87, 0x1A, 0xED, 0x2B, 0xDA, 0xED, 0x84,
|
||||
0x90, 0x89, 0xA6, 0x31, 0x4D, 0x60, 0xF2, 0x7B, 0x63, 0x0C,
|
||||
0xDC, 0x9B, 0x44, 0x4C, 0xD6, 0x62, 0x41, 0x24, 0x74, 0x30,
|
||||
0x70, 0x4E, 0x07, 0x10, 0x05, 0x12, 0x5E, 0x14, 0xB3, 0xDD,
|
||||
0xCF, 0x58, 0x27, 0x93, 0xCF, 0xAA, 0x4F, 0x85, 0x2C, 0x35,
|
||||
0x0E, 0xFF, 0x5B, 0xA8, 0x6B, 0xB5, 0x95, 0x32, 0xD5, 0xCC,
|
||||
0x73, 0x68, 0x5B, 0x1B, 0xC4, 0xF8, 0x89, 0x5E, 0x3D, 0xF8,
|
||||
0x02, 0x39, 0x32, 0x7D, 0x06, 0xA4, 0x32, 0xE9, 0xB3, 0xEF,
|
||||
0x62, 0xA0, 0x43, 0x5D, 0x4F, 0xFB, 0xCE, 0x3D, 0x08, 0x33,
|
||||
0xAF, 0x3D, 0x7F, 0x12, 0xCB, 0x8A, 0x5A, 0xC2, 0x63, 0xDB,
|
||||
0x3E, 0xDD, 0xEA, 0x5B, 0x67, 0x10, 0x49, 0x9F, 0x5B, 0x96,
|
||||
0x1B, 0x4E, 0x5D, 0xBC, 0x4E, 0x9A, 0x7C, 0x1F, 0xAB, 0x56,
|
||||
0x47, 0x4A
|
||||
};
|
||||
|
||||
/* ./certs/1024/dh1024.der, 1024-bit */
|
||||
const unsigned char dh_key_der_1024[] =
|
||||
{
|
||||
0x30, 0x81, 0x87, 0x02, 0x81, 0x81, 0x00, 0xA4, 0xD2, 0xB8,
|
||||
0x6E, 0x78, 0xF5, 0xD9, 0xED, 0x2D, 0x7C, 0xDD, 0xB6, 0x16,
|
||||
0x86, 0x5A, 0x4B, 0x05, 0x76, 0x90, 0xDD, 0x66, 0x61, 0xB9,
|
||||
0x6D, 0x52, 0xA7, 0x1C, 0xAF, 0x62, 0xC6, 0x69, 0x47, 0x7B,
|
||||
0x39, 0xF2, 0xFB, 0x94, 0xEC, 0xBC, 0x79, 0xFF, 0x24, 0x5E,
|
||||
0xEF, 0x79, 0xBB, 0x59, 0xB2, 0xFC, 0xCA, 0x07, 0xD6, 0xF4,
|
||||
0xE9, 0x34, 0xF7, 0xE8, 0x38, 0xE7, 0xD7, 0x33, 0x44, 0x1D,
|
||||
0xA3, 0x64, 0x76, 0x1A, 0x84, 0x97, 0x54, 0x74, 0x40, 0x84,
|
||||
0x1F, 0x15, 0xFE, 0x7C, 0x25, 0x2A, 0x2B, 0x25, 0xFD, 0x9E,
|
||||
0xC1, 0x89, 0x33, 0x8C, 0x39, 0x25, 0x2B, 0x40, 0xE6, 0xCD,
|
||||
0xF8, 0xA8, 0xA1, 0x8A, 0x53, 0xC6, 0x47, 0xB2, 0xA0, 0xD7,
|
||||
0x8F, 0xEB, 0x2E, 0x60, 0x0A, 0x0D, 0x4B, 0xF8, 0xB4, 0x94,
|
||||
0x8C, 0x63, 0x0A, 0xAD, 0xC7, 0x10, 0xEA, 0xC7, 0xA1, 0xB9,
|
||||
0x9D, 0xF2, 0xA8, 0x37, 0x73, 0x02, 0x01, 0x02
|
||||
};
|
||||
|
||||
/* ./certs/1024/dsa1024.der, 1024-bit */
|
||||
const unsigned char dsa_key_der_1024[] =
|
||||
{
|
||||
0x30, 0x82, 0x01, 0xBC, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
|
||||
0x00, 0xF7, 0x4B, 0xF9, 0xBB, 0x15, 0x98, 0xEB, 0xDD, 0xDE,
|
||||
0x1E, 0x4E, 0x71, 0x88, 0x85, 0xF2, 0xB7, 0xBA, 0xE2, 0x4A,
|
||||
0xDA, 0x76, 0x40, 0xCD, 0x69, 0x48, 0x9E, 0x83, 0x7C, 0x11,
|
||||
0xF7, 0x65, 0x31, 0x78, 0xF5, 0x25, 0x2D, 0xF7, 0xB7, 0xF8,
|
||||
0x52, 0x3F, 0xBE, 0xD8, 0xB6, 0xC5, 0xFE, 0x18, 0x15, 0x5B,
|
||||
0xB9, 0xD5, 0x92, 0x86, 0xBC, 0xB2, 0x17, 0x7C, 0xD8, 0xB0,
|
||||
0xBE, 0xA0, 0x7C, 0xF2, 0xD5, 0x73, 0x7A, 0x58, 0x8F, 0x8D,
|
||||
0xE5, 0x4A, 0x00, 0x99, 0x83, 0x4A, 0xC0, 0x9E, 0x16, 0x09,
|
||||
0xA1, 0x10, 0x34, 0xD5, 0x19, 0xBB, 0x63, 0xE3, 0xDD, 0x83,
|
||||
0x74, 0x7F, 0x10, 0xCA, 0x73, 0x75, 0xEE, 0x31, 0x4A, 0xDD,
|
||||
0x9F, 0xE0, 0x02, 0x6A, 0x9D, 0xEE, 0xB2, 0x4B, 0xA7, 0x6B,
|
||||
0x2A, 0x6C, 0xC7, 0x86, 0x77, 0xE8, 0x04, 0x15, 0xDC, 0x92,
|
||||
0xB4, 0x7A, 0x29, 0x1F, 0x4E, 0x83, 0x63, 0x85, 0x55, 0x02,
|
||||
0x15, 0x00, 0xD2, 0x05, 0xE4, 0x73, 0xFB, 0xC1, 0x99, 0xC5,
|
||||
0xDC, 0x68, 0xA4, 0x8D, 0x92, 0x27, 0x3D, 0xE2, 0x52, 0x5F,
|
||||
0x89, 0x8B, 0x02, 0x81, 0x81, 0x00, 0xAA, 0x21, 0x02, 0x09,
|
||||
0x43, 0x6E, 0xFB, 0xA2, 0x54, 0x14, 0x85, 0x0A, 0xF4, 0x28,
|
||||
0x7C, 0xCB, 0xCC, 0xDB, 0xF5, 0x1E, 0xA2, 0x18, 0xA9, 0x21,
|
||||
0xDE, 0x88, 0x88, 0x33, 0x8C, 0x2E, 0xEB, 0x8D, 0xA3, 0xF0,
|
||||
0x1D, 0xC8, 0x8F, 0xF6, 0x7E, 0xF8, 0xCF, 0x12, 0xF5, 0xB4,
|
||||
0xA1, 0x11, 0x6F, 0x0C, 0xD4, 0xF0, 0x06, 0xAD, 0xC4, 0xFC,
|
||||
0x14, 0x45, 0xC7, 0x94, 0x15, 0xBC, 0x19, 0x4B, 0xAE, 0xEF,
|
||||
0x93, 0x6A, 0x4F, 0xCC, 0x14, 0xD8, 0x47, 0x8B, 0x39, 0x66,
|
||||
0x87, 0x02, 0xD4, 0x28, 0x0A, 0xB8, 0xEE, 0x09, 0x37, 0xF4,
|
||||
0x00, 0xA0, 0x04, 0xA7, 0x79, 0xA7, 0xD2, 0x3C, 0xF7, 0x34,
|
||||
0x43, 0x56, 0x8E, 0xD0, 0x7C, 0xC2, 0xD8, 0x4D, 0x0F, 0x89,
|
||||
0xED, 0x14, 0xC1, 0x2C, 0x9C, 0x4C, 0x19, 0x9B, 0x9E, 0xDC,
|
||||
0x53, 0x09, 0x9F, 0xDF, 0x2D, 0xF0, 0x0C, 0x27, 0x54, 0x3A,
|
||||
0x77, 0x14, 0x2D, 0xDE, 0x02, 0x81, 0x81, 0x00, 0xE8, 0x1F,
|
||||
0x7C, 0xB7, 0xC0, 0x54, 0x51, 0xA7, 0x28, 0x2D, 0x58, 0x7C,
|
||||
0xDE, 0xD4, 0x5C, 0xDD, 0xD5, 0x76, 0x84, 0x3C, 0x36, 0x20,
|
||||
0xC0, 0xC3, 0x25, 0xD7, 0x3A, 0x38, 0xE1, 0x54, 0xC8, 0xFD,
|
||||
0x40, 0x68, 0x1A, 0x21, 0x54, 0x26, 0x39, 0x14, 0xBF, 0xF6,
|
||||
0xA3, 0x9C, 0x5E, 0xD9, 0x2B, 0xF7, 0xC9, 0x25, 0xBA, 0x00,
|
||||
0x09, 0xCB, 0x7F, 0x0C, 0x4A, 0x24, 0xFD, 0x15, 0x16, 0x15,
|
||||
0x48, 0xCD, 0x0B, 0x52, 0x44, 0x40, 0x7B, 0x90, 0x63, 0x2B,
|
||||
0x90, 0x22, 0xC5, 0x18, 0x05, 0x80, 0x53, 0xAF, 0x83, 0x1F,
|
||||
0x54, 0xE2, 0xB0, 0xA2, 0x0B, 0x5A, 0x92, 0x24, 0xE1, 0x62,
|
||||
0x28, 0x3F, 0xB7, 0xCA, 0xB9, 0x89, 0xD6, 0xA0, 0xB7, 0xAD,
|
||||
0xAE, 0x05, 0xE1, 0xC1, 0x59, 0x40, 0xED, 0x4A, 0x1B, 0x68,
|
||||
0xA7, 0x7B, 0xFB, 0xC3, 0x20, 0x81, 0xEF, 0x4B, 0xF3, 0x69,
|
||||
0x91, 0xB0, 0xCE, 0x3A, 0xB0, 0x38, 0x02, 0x14, 0x25, 0x38,
|
||||
0x3B, 0xA1, 0x19, 0x75, 0xDF, 0x9B, 0xF5, 0x72, 0x53, 0x4F,
|
||||
0x39, 0xE1, 0x1C, 0xEC, 0x13, 0x84, 0x82, 0x18
|
||||
};
|
||||
|
||||
/* ./certs/1024/rsa1024.der, 1024-bit */
|
||||
const unsigned char rsa_key_der_1024[] =
|
||||
{
|
||||
0x30, 0x82, 0x02, 0x5D, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81,
|
||||
0x00, 0xBE, 0x70, 0x70, 0xB8, 0x04, 0x18, 0xE5, 0x28, 0xFE,
|
||||
0x66, 0xD8, 0x90, 0x88, 0xE0, 0xF1, 0xB7, 0xC3, 0xD0, 0xD2,
|
||||
0x3E, 0xE6, 0x4B, 0x94, 0x74, 0xB0, 0xFF, 0xB0, 0xF7, 0x63,
|
||||
0xA5, 0xAB, 0x7E, 0xAF, 0xB6, 0x2B, 0xB7, 0x38, 0x16, 0x1A,
|
||||
0x50, 0xBF, 0xF1, 0xCA, 0x87, 0x3A, 0xD5, 0xB0, 0xDA, 0xF8,
|
||||
0x43, 0x7A, 0x15, 0xB9, 0x7E, 0xEA, 0x2A, 0x80, 0xD2, 0x51,
|
||||
0xB0, 0x35, 0xAF, 0x07, 0xF3, 0xF2, 0x5D, 0x24, 0x3A, 0x4B,
|
||||
0x87, 0x56, 0x48, 0x1B, 0x3C, 0x24, 0x9A, 0xDA, 0x70, 0x80,
|
||||
0xBD, 0x3C, 0x8B, 0x03, 0x4A, 0x0C, 0x83, 0x71, 0xDE, 0xE3,
|
||||
0x03, 0x70, 0xA2, 0xB7, 0x60, 0x09, 0x1B, 0x5E, 0xC7, 0x3D,
|
||||
0xA0, 0x64, 0x60, 0xE3, 0xA9, 0x06, 0x8D, 0xD3, 0xFF, 0x42,
|
||||
0xBB, 0x0A, 0x94, 0x27, 0x2D, 0x57, 0x42, 0x0D, 0xB0, 0x2D,
|
||||
0xE0, 0xBA, 0x18, 0x25, 0x60, 0x92, 0x11, 0x92, 0xF3, 0x02,
|
||||
0x03, 0x01, 0x00, 0x01, 0x02, 0x81, 0x80, 0x0E, 0xEE, 0x1D,
|
||||
0xC8, 0x2F, 0x7A, 0x0C, 0x2D, 0x44, 0x94, 0xA7, 0x91, 0xDD,
|
||||
0x49, 0x55, 0x6A, 0x04, 0xCE, 0x10, 0x4D, 0xA2, 0x1C, 0x76,
|
||||
0xCD, 0x17, 0x3B, 0x54, 0x92, 0x70, 0x9B, 0x82, 0x70, 0x72,
|
||||
0x32, 0x24, 0x07, 0x3F, 0x3C, 0x6C, 0x5F, 0xBC, 0x4C, 0xA6,
|
||||
0x86, 0x27, 0x94, 0xAD, 0x42, 0xDD, 0x87, 0xDC, 0xC0, 0x6B,
|
||||
0x44, 0x89, 0xF3, 0x3F, 0x1A, 0x3E, 0x11, 0x44, 0x84, 0x2E,
|
||||
0x69, 0x4C, 0xBB, 0x4A, 0x71, 0x1A, 0xBB, 0x9A, 0x52, 0x3C,
|
||||
0x6B, 0xDE, 0xBC, 0xB2, 0x7C, 0x51, 0xEF, 0x4F, 0x8F, 0x3A,
|
||||
0xDC, 0x50, 0x04, 0x4E, 0xB6, 0x31, 0x66, 0xA8, 0x8E, 0x06,
|
||||
0x3B, 0x51, 0xA9, 0xC1, 0x8A, 0xCB, 0xC4, 0x81, 0xCA, 0x2D,
|
||||
0x69, 0xEC, 0x88, 0xFC, 0x33, 0x88, 0xD1, 0xD4, 0x29, 0x47,
|
||||
0x87, 0x37, 0xF9, 0x6A, 0x22, 0x69, 0xB9, 0xC9, 0xFE, 0xEB,
|
||||
0x8C, 0xC5, 0x21, 0x41, 0x71, 0x02, 0x41, 0x00, 0xFD, 0x17,
|
||||
0x98, 0x42, 0x54, 0x1C, 0x23, 0xF8, 0xD7, 0x5D, 0xEF, 0x49,
|
||||
0x4F,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 0x43,
|
||||
0x78, 0x46, 0x17, 0x51, 0x86, 0xC9, 0xFC, 0xEB, 0x8B, 0x8F,
|
||||
0x41, 0xCA, 0x08, 0x9B, 0xBF, 0x02, 0x41, 0x00, 0xAD, 0x9B,
|
||||
0x89, 0xB6, 0xF2, 0x8C, 0x70, 0xDA, 0xE4, 0x10, 0x04, 0x6B,
|
||||
0x11, 0x92, 0xAF, 0x5A, 0xCA, 0x08, 0x25, 0xBF, 0x60, 0x07,
|
||||
0x11, 0x1D, 0x68, 0x7F, 0x5A, 0x1F, 0x55, 0x28, 0x74, 0x0B,
|
||||
0x21, 0x8D, 0x21, 0x0D, 0x6A, 0x6A, 0xFB, 0xD9, 0xB5, 0x4A,
|
||||
0x7F, 0x47, 0xF7, 0xD0, 0xB6, 0xC6, 0x41, 0x02, 0x97, 0x07,
|
||||
0x49, 0x93, 0x1A, 0x9B, 0x33, 0x68, 0xB3, 0xA2, 0x61, 0x32,
|
||||
0xA5, 0x89, 0x02, 0x41, 0x00, 0x8F, 0xEF, 0xAD, 0xB5, 0xB0,
|
||||
0xB0, 0x7E, 0x86, 0x03, 0x43, 0x93, 0x6E, 0xDD, 0x3C, 0x2D,
|
||||
0x9B, 0x6A, 0x55, 0xFF, 0x6F, 0x3E, 0x70, 0x2A, 0xD4, 0xBF,
|
||||
0x1F, 0x8C, 0x93, 0x60, 0x9E, 0x6D, 0x2F, 0x18, 0x6C, 0x11,
|
||||
0x36, 0x98, 0x3F, 0x10, 0x78, 0xE8, 0x3E, 0x8F, 0xFE, 0x55,
|
||||
0xB9, 0x9E, 0xD5, 0x5B, 0x2E, 0x87, 0x1C, 0x58, 0xD0, 0x37,
|
||||
0x89, 0x96, 0xEC, 0x48, 0x54, 0xF5, 0x9F, 0x0F, 0xB3
|
||||
};
|
||||
|
||||
#elif defined(USE_CERT_BUFFERS_2048)
|
||||
|
||||
/* ./certs/client-key.der, 2048-bit */
|
||||
const unsigned char client_key_der_2048[] =
|
||||
{
|
||||
0x30, 0x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xC6, 0x96, 0xB2, 0xA5, 0xD5, 0x92,
|
||||
0x0D, 0x9B, 0x09, 0x42, 0x68, 0x24, 0x10, 0x45, 0xD4, 0x50,
|
||||
0xE4, 0x17, 0x39, 0x48, 0xD0, 0x35, 0x8B, 0x94, 0x6D, 0x11,
|
||||
0xDE, 0x8F, 0xCA, 0x59, 0x02, 0x81, 0x81, 0x00, 0xEA, 0x24,
|
||||
0xA7, 0xF9, 0x69, 0x33, 0xE9, 0x71, 0xDC, 0x52, 0x7D, 0x88,
|
||||
0x21, 0x28, 0x2F, 0x49, 0xDE, 0xBA, 0x72, 0x16, 0xE9, 0xCC,
|
||||
0x47, 0x7A, 0x88, 0x0D, 0x94, 0x57, 0x84, 0x58, 0x16, 0x3A,
|
||||
0x81, 0xB0, 0x3F, 0xA2, 0xCF, 0xA6, 0x6C, 0x1E, 0xB0, 0x06,
|
||||
0x29, 0x00, 0x8F, 0xE7, 0x77, 0x76, 0xAC, 0xDB, 0xCA, 0xC7,
|
||||
0xD9, 0x5E, 0x9B, 0x3F, 0x26, 0x90, 0x52, 0xAE, 0xFC, 0x38,
|
||||
0x90, 0x00, 0x14, 0xBB, 0xB4, 0x0F, 0x58, 0x94, 0xE7, 0x2F,
|
||||
0x6A, 0x7E, 0x1C, 0x4F, 0x41, 0x21, 0xD4, 0x31, 0x59, 0x1F,
|
||||
0x4E, 0x8A, 0x1A, 0x8D, 0xA7, 0x57, 0x6C, 0x22, 0xD8, 0xE5,
|
||||
0xF4, 0x7E, 0x32, 0xA6, 0x10, 0xCB, 0x64, 0xA5, 0x55, 0x03,
|
||||
0x87, 0xA6, 0x27, 0x05, 0x8C, 0xC3, 0xD7, 0xB6, 0x27, 0xB2,
|
||||
0x4D, 0xBA, 0x30, 0xDA, 0x47, 0x8F, 0x54, 0xD3, 0x3D, 0x8B,
|
||||
0x84, 0x8D, 0x94, 0x98, 0x58, 0xA5, 0x02, 0x81, 0x81, 0x00,
|
||||
0xD5, 0x38, 0x1B, 0xC3, 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, 0x93, 0x53, 0x34, 0xA1,
|
||||
0x45, 0x5D, 0x13, 0x39, 0x65, 0x42, 0x46, 0xA1, 0x9F, 0xCD,
|
||||
0xF5, 0xBF
|
||||
};
|
||||
|
||||
/* ./certs/client-cert.der, 2048-bit */
|
||||
const unsigned char client_cert_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0x98, 0x30, 0x82, 0x03, 0x80, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x87, 0x4A, 0x75, 0xBE,
|
||||
0x91, 0x66, 0xD8, 0x3D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
|
||||
0x81, 0x8E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06,
|
||||
0x03, 0x55, 0x04, 0x08, 0x13, 0x06, 0x4F, 0x72, 0x65, 0x67,
|
||||
0x6F, 0x6E, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04,
|
||||
0x07, 0x13, 0x08, 0x50, 0x6F, 0x72, 0x74, 0x6C, 0x61, 0x6E,
|
||||
0x64, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A,
|
||||
0x13, 0x05, 0x79, 0x61, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30,
|
||||
0x12, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x0B, 0x50, 0x72,
|
||||
0x6F, 0x67, 0x72, 0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x31,
|
||||
0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0D,
|
||||
0x77, 0x77, 0x77, 0x2E, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E,
|
||||
0x63, 0x6F, 0x6D, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x09, 0x2A,
|
||||
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0E,
|
||||
0x69, 0x6E, 0x66, 0x6F, 0x40, 0x79, 0x61, 0x73, 0x73, 0x6C,
|
||||
0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x31,
|
||||
0x31, 0x30, 0x32, 0x34, 0x31, 0x38, 0x32, 0x31, 0x35, 0x35,
|
||||
0x5A, 0x17, 0x0D, 0x31, 0x34, 0x30, 0x37, 0x32, 0x30, 0x31,
|
||||
0x38, 0x32, 0x31, 0x35, 0x35, 0x5A, 0x30, 0x81, 0x8E, 0x31,
|
||||
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04,
|
||||
0x08, 0x13, 0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31,
|
||||
0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x08,
|
||||
0x50, 0x6F, 0x72, 0x74, 0x6C, 0x61, 0x6E, 0x64, 0x31, 0x0E,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x05, 0x79,
|
||||
0x61, 0x53, 0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03,
|
||||
0x55, 0x04, 0x0B, 0x13, 0x0B, 0x50, 0x72, 0x6F, 0x67, 0x72,
|
||||
0x61, 0x6D, 0x6D, 0x69, 0x6E, 0x67, 0x31, 0x16, 0x30, 0x14,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0D, 0x77, 0x77, 0x77,
|
||||
0x2E, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
|
||||
0x31, 0x1D, 0x30, 0x1B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x0E, 0x69, 0x6E, 0x66,
|
||||
0x6F, 0x40, 0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F,
|
||||
0x6D, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A,
|
||||
0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
|
||||
0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02,
|
||||
0x82, 0x01, 0x01, 0x00, 0xC3, 0x03, 0xD1, 0x2B, 0xFE, 0x39,
|
||||
0xA4, 0x32, 0x45, 0x3B, 0x53, 0xC8, 0x84, 0x2B, 0x2A, 0x7C,
|
||||
0x74, 0x9A, 0xBD, 0xAA, 0x2A, 0x52, 0x07, 0x47, 0xD6, 0xA6,
|
||||
0x36, 0xB2, 0x07, 0x32, 0x8E, 0xD0, 0xBA, 0x69, 0x7B, 0xC6,
|
||||
0xC3, 0x44, 0x9E, 0xD4, 0x81, 0x48, 0xFD, 0x2D, 0x68, 0xA2,
|
||||
0x8B, 0x67, 0xBB, 0xA1, 0x75, 0xC8, 0x36, 0x2C, 0x4A, 0xD2,
|
||||
0x1B, 0xF7, 0x8B, 0xBA, 0xCF, 0x0D, 0xF9, 0xEF, 0xEC, 0xF1,
|
||||
0x81, 0x1E, 0x7B, 0x9B, 0x03, 0x47, 0x9A, 0xBF, 0x65, 0xCC,
|
||||
0x7F, 0x65, 0x24, 0x69, 0xA6, 0xE8, 0x14, 0x89, 0x5B, 0xE4,
|
||||
0x34, 0xF7, 0xC5, 0xB0, 0x14, 0x93, 0xF5, 0x67, 0x7B, 0x3A,
|
||||
0x7A, 0x78, 0xE1, 0x01, 0x56, 0x56, 0x91, 0xA6, 0x13, 0x42,
|
||||
0x8D, 0xD2, 0x3C, 0x40, 0x9C, 0x4C, 0xEF, 0xD1, 0x86, 0xDF,
|
||||
0x37, 0x51, 0x1B, 0x0C, 0xA1, 0x3B, 0xF5, 0xF1, 0xA3, 0x4A,
|
||||
0x35, 0xE4, 0xE1, 0xCE, 0x96, 0xDF, 0x1B, 0x7E, 0xBF, 0x4E,
|
||||
0x97, 0xD0, 0x10, 0xE8, 0xA8, 0x08, 0x30, 0x81, 0xAF, 0x20,
|
||||
0x0B, 0x43, 0x14, 0xC5, 0x74, 0x67, 0xB4, 0x32, 0x82, 0x6F,
|
||||
0x8D, 0x86, 0xC2, 0x88, 0x40, 0x99, 0x36, 0x83, 0xBA, 0x1E,
|
||||
0x40, 0x72, 0x22, 0x17, 0xD7, 0x52, 0x65, 0x24, 0x73, 0xB0,
|
||||
0xCE, 0xEF, 0x19, 0xCD, 0xAE, 0xFF, 0x78, 0x6C, 0x7B, 0xC0,
|
||||
0x12, 0x03, 0xD4, 0x4E, 0x72, 0x0D, 0x50, 0x6D, 0x3B, 0xA3,
|
||||
0x3B, 0xA3, 0x99, 0x5E, 0x9D, 0xC8, 0xD9, 0x0C, 0x85, 0xB3,
|
||||
0xD9, 0x8A, 0xD9, 0x54, 0x26, 0xDB, 0x6D, 0xFA, 0xAC, 0xBB,
|
||||
0xFF, 0x25, 0x4C, 0xC4, 0xD1, 0x79, 0xF4, 0x71, 0xD3, 0x86,
|
||||
0x40, 0x18, 0x13, 0xB0, 0x63, 0xB5, 0x72, 0x4E, 0x30, 0xC4,
|
||||
0x97, 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15, 0xF7, 0x7F,
|
||||
0xC0, 0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1, 0xBA, 0xD3,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xF6, 0x30, 0x81,
|
||||
0xF3, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
|
||||
0x04, 0x14, 0x33, 0xD8, 0x45, 0x66, 0xD7, 0x68, 0x87, 0x18,
|
||||
0x7E, 0x54, 0x0D, 0x70, 0x27, 0x91, 0xC7, 0x26, 0xD7, 0x85,
|
||||
0x65, 0xC0, 0x30, 0x81, 0xC3, 0x06, 0x03, 0x55, 0x1D, 0x23,
|
||||
0x04, 0x81, 0xBB, 0x30, 0x81, 0xB8, 0x80, 0x14, 0x33, 0xD8,
|
||||
0x45, 0x66, 0xD7, 0x68, 0x87, 0x18, 0x7E, 0x54, 0x0D, 0x70,
|
||||
0x27, 0x91, 0xC7, 0x26, 0xD7, 0x85, 0x65, 0xC0, 0xA1, 0x81,
|
||||
0x94, 0xA4, 0x81, 0x91, 0x30, 0x81, 0x8E, 0x31, 0x0B, 0x30,
|
||||
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
|
||||
0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
|
||||
0x06, 0x4F, 0x72, 0x65, 0x67, 0x6F, 0x6E, 0x31, 0x11, 0x30,
|
||||
0x0F, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x50, 0x6F,
|
||||
0x72, 0x74, 0x6C, 0x61, 0x6E, 0x64, 0x31, 0x0E, 0x30, 0x0C,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x05, 0x79, 0x61, 0x53,
|
||||
0x53, 0x4C, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04,
|
||||
0x0B, 0x13, 0x0B, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D,
|
||||
0x6D, 0x69, 0x6E, 0x67, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03,
|
||||
0x55, 0x04, 0x03, 0x13, 0x0D, 0x77, 0x77, 0x77, 0x2E, 0x79,
|
||||
0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1D,
|
||||
0x30, 0x1B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
|
||||
0x01, 0x09, 0x01, 0x16, 0x0E, 0x69, 0x6E, 0x66, 0x6F, 0x40,
|
||||
0x79, 0x61, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82,
|
||||
0x09, 0x00, 0x87, 0x4A, 0x75, 0xBE, 0x91, 0x66, 0xD8, 0x3D,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30,
|
||||
0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03,
|
||||
0x82, 0x01, 0x01, 0x00, 0x1C, 0x7C, 0x42, 0x81, 0x29, 0x9E,
|
||||
0x21, 0xCF, 0xD0, 0xD8, 0xC1, 0x54, 0x6F, 0xCC, 0xAE, 0x14,
|
||||
0x09, 0x38, 0xFF, 0x68, 0x98, 0x9A, 0x95, 0x53, 0x76, 0x18,
|
||||
0x7B, 0xE6, 0x30, 0x76, 0xEC, 0x28, 0x0D, 0x75, 0xA7, 0xDE,
|
||||
0xE0, 0xCD, 0x8E, 0xD5, 0x55, 0x23, 0x6A, 0x47, 0x2B, 0x4E,
|
||||
0x8D, 0xFC, 0x7D, 0x06, 0xA3, 0xD8, 0x0F, 0xAD, 0x5E, 0xD6,
|
||||
0x04, 0xC9, 0x00, 0x33, 0xFB, 0x77, 0x27, 0xD3, 0xB5, 0x03,
|
||||
0xB3, 0x7B, 0x21, 0x74, 0x31, 0x0B, 0x4A, 0xAF, 0x2D, 0x1A,
|
||||
0xB3, 0x93, 0x8E, 0xCC, 0xF3, 0x5F, 0x3D, 0x90, 0x3F, 0xCC,
|
||||
0xE3, 0x55, 0x19, 0x91, 0x7B, 0x78,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||
/* ./certs/dh2048.der, 2048-bit */
|
||||
const unsigned char dh_key_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x01, 0x08, 0x02, 0x82, 0x01, 0x01, 0x00, 0xB0,
|
||||
0xA1, 0x08, 0x06, 0x9C, 0x08, 0x13, 0xBA, 0x59, 0x06, 0x3C,
|
||||
0xBC, 0x30, 0xD5, 0xF5, 0x00, 0xC1, 0x4F, 0x44, 0xA7, 0xD6,
|
||||
0xEF, 0x4A, 0xC6, 0x25, 0x27, 0x1C, 0xE8, 0xD2, 0x96, 0x53,
|
||||
0x0A, 0x5C, 0x91, 0xDD, 0xA2, 0xC2, 0x94, 0x84, 0xBF, 0x7D,
|
||||
0xB2, 0x44, 0x9F, 0x9B, 0xD2, 0xC1, 0x8A, 0xC5, 0xBE, 0x72,
|
||||
0x5C, 0xA7, 0xE7, 0x91, 0xE6, 0xD4, 0x9F, 0x73, 0x07, 0x85,
|
||||
0x5B, 0x66, 0x48, 0xC7, 0x70, 0xFA, 0xB4, 0xEE, 0x02, 0xC9,
|
||||
0x3D, 0x9A, 0x4A, 0xDA, 0x3D, 0xC1, 0x46, 0x3E, 0x19, 0x69,
|
||||
0xD1, 0x17, 0x46, 0x07, 0xA3, 0x4D, 0x9F, 0x2B, 0x96, 0x17,
|
||||
0x39, 0x6D, 0x30, 0x8D, 0x2A, 0xF3, 0x94, 0xD3, 0x75, 0xCF,
|
||||
0xA0, 0x75, 0xE6, 0xF2, 0x92, 0x1F, 0x1A, 0x70, 0x05, 0xAA,
|
||||
0x04, 0x83, 0x57, 0x30, 0xFB, 0xDA, 0x76, 0x93, 0x38, 0x50,
|
||||
0xE8, 0x27, 0xFD, 0x63, 0xEE, 0x3C, 0xE5, 0xB7, 0xC8, 0x09,
|
||||
0xAE, 0x6F, 0x50, 0x35, 0x8E, 0x84, 0xCE, 0x4A, 0x00, 0xE9,
|
||||
0x12, 0x7E, 0x5A, 0x31, 0xD7, 0x33, 0xFC, 0x21, 0x13, 0x76,
|
||||
0xCC, 0x16, 0x30, 0xDB, 0x0C, 0xFC, 0xC5, 0x62, 0xA7, 0x35,
|
||||
0xB8, 0xEF, 0xB7, 0xB0, 0xAC, 0xC0, 0x36, 0xF6, 0xD9, 0xC9,
|
||||
0x46, 0x48, 0xF9, 0x40, 0x90, 0x00, 0x2B, 0x1B, 0xAA, 0x6C,
|
||||
0xE3, 0x1A, 0xC3, 0x0B, 0x03, 0x9E, 0x1B, 0xC2, 0x46, 0xE4,
|
||||
0x48, 0x4E, 0x22, 0x73, 0x6F, 0xC3, 0x5F, 0xD4, 0x9A, 0xD6,
|
||||
0x30, 0x07, 0x48, 0xD6, 0x8C, 0x90, 0xAB, 0xD4, 0xF6, 0xF1,
|
||||
0xE3, 0x48, 0xD3, 0x58, 0x4B, 0xA6, 0xB9, 0xCD, 0x29, 0xBF,
|
||||
0x68, 0x1F, 0x08, 0x4B, 0x63, 0x86, 0x2F, 0x5C, 0x6B, 0xD6,
|
||||
0xB6, 0x06, 0x65, 0xF7, 0xA6, 0xDC, 0x00, 0x67, 0x6B, 0xBB,
|
||||
0xC3, 0xA9, 0x41, 0x83, 0xFB, 0xC7, 0xFA, 0xC8, 0xE2, 0x1E,
|
||||
0x7E, 0xAF, 0x00, 0x3F, 0x93, 0x02, 0x01, 0x02
|
||||
};
|
||||
|
||||
/* ./certs/dsa2048.der, 2048-bit */
|
||||
const unsigned char dsa_key_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x03, 0x3F, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
|
||||
0x01, 0x00, 0xCC, 0x8E, 0xC9, 0xA0, 0xD5, 0x9A, 0x27, 0x1C,
|
||||
0xDA, 0x52, 0xDF, 0xC7, 0xC0, 0xE6, 0x06, 0xA4, 0x3E, 0x8A,
|
||||
0x66, 0x49, 0xD0, 0x59, 0x33, 0x51, 0x69, 0xC4, 0x9C, 0x5E,
|
||||
0x64, 0x85, 0xC7, 0xF1, 0xAB, 0xD5, 0xD9, 0x62, 0xAC, 0xFD,
|
||||
0xA1, 0xE0, 0x1B, 0x57, 0xFF, 0x96, 0xEF, 0x0C, 0x9F, 0xC8,
|
||||
0x44, 0x87, 0xEB, 0x5C, 0x91, 0xD0, 0x46, 0x42, 0x09, 0x50,
|
||||
0x6A, 0x23, 0xCB, 0x89, 0x6F, 0x55, 0xE9, 0x6A, 0x11, 0xA9,
|
||||
0xA8, 0x32, 0xAB, 0x33, 0x0D, 0x51, 0xB5, 0x79, 0x51, 0xB4,
|
||||
0xAB, 0xA2, 0x25, 0x11, 0x8D, 0xE5, 0x24, 0xBE, 0xD8, 0xF1,
|
||||
0x9D, 0x4E, 0x12, 0x6F, 0xAC, 0x44, 0x54, 0x80, 0xA9, 0xB4,
|
||||
0x81, 0x68, 0x4E, 0x44, 0x0E, 0xB8, 0x39, 0xF3, 0xBE, 0x83,
|
||||
0x08, 0x74, 0xA2, 0xC6, 0x7A, 0xD7, 0x6A, 0x7D, 0x0A, 0x88,
|
||||
0x57, 0x83, 0x48, 0xDC, 0xCF, 0x5E, 0x6F, 0xEE, 0x68, 0x0C,
|
||||
0xF7, 0xFF, 0x03, 0x04, 0x90, 0xAA, 0xF7, 0x07, 0x98, 0xF8,
|
||||
0x67, 0x5A, 0x83, 0x23, 0x66, 0x47, 0x60, 0xC3, 0x43, 0x6E,
|
||||
0x03, 0x91, 0xAC, 0x28, 0x66, 0xCB, 0xF0, 0xD3, 0x05, 0xC8,
|
||||
0x09, 0x97, 0xB5, 0xAE, 0x01, 0x5E, 0x80, 0x3B, 0x9D, 0x4F,
|
||||
0xDE, 0x3E, 0x94, 0xFE, 0xCB, 0x82, 0xB0, 0xB1, 0xFC, 0x91,
|
||||
0x8B, 0x1D, 0x8A, 0xEE, 0xC6, 0x06, 0x1F, 0x37, 0x91, 0x48,
|
||||
0xD2, 0xF8, 0x6C, 0x5D, 0x60, 0x13, 0x83, 0xA7, 0x81, 0xAC,
|
||||
0xCA, 0x8D, 0xD0, 0x6A, 0x04, 0x0A,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4, 0x02, 0x82, 0x01, 0x00, 0x66, 0x4B, 0xBB, 0xB7,
|
||||
0xC9, 0x48, 0x95, 0x0D, 0x5A, 0xA6, 0x2D, 0xA1, 0x7F, 0xDF,
|
||||
0x1F, 0x67, 0x6D, 0xED, 0x52, 0x4B, 0x16, 0x6C, 0x17, 0xC6,
|
||||
0xAE, 0xF8, 0x6A, 0xC4, 0x57, 0xED, 0x2F, 0xB3, 0xF0, 0x2A,
|
||||
0x55, 0xAB, 0xBA, 0xCA, 0xEA, 0x17, 0xE8, 0x35, 0x7C, 0xE5,
|
||||
0x31, 0x0D, 0x4A, 0x95, 0xFC, 0x43, 0x6F, 0x97, 0x3C, 0x5C,
|
||||
0x67, 0xAC, 0xBE, 0x67, 0x7F, 0xE9, 0x4E, 0xAA, 0x48, 0xB3,
|
||||
0x92, 0xA1, 0x76, 0x75, 0xEA, 0x04, 0x34, 0x7F, 0x87, 0x33,
|
||||
0x2D, 0x24, 0xB6, 0x29, 0x97, 0xE3, 0x04, 0x77, 0x93, 0x89,
|
||||
0x13, 0xDB, 0x1B, 0x93, 0xB8, 0x2C, 0x90, 0x1A, 0x09, 0x3B,
|
||||
0x26, 0xD9, 0x59, 0xF3, 0x2A, 0x09, 0x58, 0xDC, 0xAC, 0x25,
|
||||
0xB4, 0xA9, 0x45, 0x3B, 0xA2, 0x3A, 0x6C, 0x61, 0x84, 0xBF,
|
||||
0x68, 0xD4, 0xEA, 0x9B, 0xC5, 0x29, 0x48, 0x60, 0x15, 0x10,
|
||||
0x35, 0x2C, 0x44, 0x1D, 0xB5, 0x9A, 0xEE, 0xAC, 0xC1, 0x68,
|
||||
0xE8, 0x47, 0xB7, 0x41, 0x34, 0x39, 0x9A, 0xF8, 0xA5, 0x20,
|
||||
0xE9, 0x24, 0xC4, 0x2C, 0x58, 0x3F, 0x4C, 0x41, 0x30, 0x3A,
|
||||
0x14, 0x6E, 0x8D, 0xEA, 0xAD, 0xBA, 0x9B, 0x43, 0xD3, 0x98,
|
||||
0x2F, 0x83, 0xD8, 0x14, 0x67, 0xE8, 0xF8, 0xD5, 0x4F, 0xAC,
|
||||
0xE0, 0x3B, 0xBF, 0xA7, 0x54, 0x16, 0x5E, 0x49, 0x64, 0x26,
|
||||
0x54, 0xA4, 0x6B, 0x69, 0x7C, 0xBA, 0x8A, 0x83, 0xD9, 0x2E,
|
||||
0x65, 0x0A, 0xA2, 0x27, 0xEF, 0x99, 0x99, 0x08, 0xD7, 0xB5,
|
||||
0x9F, 0xA0, 0x01, 0xEF, 0x7E, 0x17, 0xBF, 0x83, 0x6B, 0x2E,
|
||||
0xDD, 0xC0, 0x39, 0x38, 0x23, 0x68, 0xB4, 0x76, 0x6B, 0xE5,
|
||||
0xCA, 0xF7, 0x7C, 0xEE, 0xC0, 0x52, 0xE2, 0xDD, 0xAD, 0x59,
|
||||
0x3A, 0x42, 0x06, 0x45, 0xB0, 0xC7, 0xC1, 0x77, 0x05, 0xB2,
|
||||
0x0C, 0x32, 0x40, 0x46, 0xAA, 0xDA, 0x79, 0x77, 0x04, 0x71,
|
||||
0xDF, 0x7A, 0x02, 0x15, 0x00, 0x98, 0xEE, 0xB9, 0x51, 0x37,
|
||||
0x3E, 0x75, 0x13, 0x13, 0x06, 0x8F, 0x94, 0xD3, 0xE6, 0xE9,
|
||||
0x00, 0xCB, 0x62, 0x6D, 0x9A
|
||||
};
|
||||
|
||||
/* ./certs/rsa2048.der, 2048-bit */
|
||||
const unsigned char rsa_key_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0xA3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
|
||||
0x01, 0x00, 0xE9, 0x8A, 0x5D, 0x15, 0xA4, 0xD4, 0x34, 0xB9,
|
||||
0x59, 0xA2, 0xDA, 0xAF, 0x74, 0xC8, 0xC9, 0x03, 0x26, 0x38,
|
||||
0xFA, 0x48, 0xFC, 0x4D, 0x30, 0x6E, 0xEA, 0x76, 0x89, 0xCE,
|
||||
0x4F, 0xF6, 0x87, 0xDE, 0x32, 0x3A, 0x46, 0x6E, 0x38, 0x12,
|
||||
0x58, 0x37, 0x22, 0x0D, 0x80, 0xAC, 0x2D, 0xAF, 0x2F, 0x12,
|
||||
0x3E, 0x62, 0x73, 0x60, 0x66, 0x68, 0x90, 0xB2, 0x6F, 0x47,
|
||||
0x17, 0x04, 0x2B, 0xCA, 0xB7, 0x26, 0xB7, 0x10, 0xC2, 0x13,
|
||||
0xF9, 0x7A, 0x62, 0x0A, 0x93, 0x32, 0x90, 0x42, 0x0D, 0x16,
|
||||
0x2E, 0xFA, 0xD7, 0x29, 0xD7, 0x9F, 0x54, 0xE4, 0xFC, 0x65,
|
||||
0x74, 0xF8, 0xF6, 0x43, 0x6B, 0x4E, 0x9E, 0x34, 0x7F, 0xCB,
|
||||
0x6B, 0x1C, 0x1A, 0xDE, 0x82, 0x81, 0xBF, 0x08, 0x5D, 0x3F,
|
||||
0xC0, 0xB6, 0xB1, 0xA8, 0xA5, 0x9C, 0x81, 0x70, 0xA7, 0x4E,
|
||||
0x32, 0x87, 0x15, 0x1C, 0x78, 0x0E, 0xF0, 0x18, 0xFE, 0xEB,
|
||||
0x4B, 0x37, 0x2B, 0xE9, 0xE1, 0xF7, 0xFA, 0x51, 0xC6, 0x58,
|
||||
0xB9, 0xD8, 0x06, 0x03, 0xED, 0xC0, 0x03, 0x18, 0x55, 0x8B,
|
||||
0x98, 0xFE, 0xB1, 0xF6, 0xD0, 0x3D, 0xFA, 0x63, 0xC0, 0x38,
|
||||
0x19, 0xC7, 0x00, 0xEF, 0x4D, 0x99, 0x60, 0xB4, 0xBA, 0xCE,
|
||||
0xE3, 0xCE, 0xD9, 0x6B, 0x2D, 0x76, 0x94, 0xFF, 0xFB, 0x77,
|
||||
0x18, 0x4A, 0xFE, 0x65, 0xF0, 0x0A, 0x91, 0x5C, 0x3B, 0x22,
|
||||
0x94, 0x85, 0xD0, 0x20, 0x18, 0x59, 0x2E, 0xA5, 0x33, 0x03,
|
||||
0xAC, 0x1B, 0x5F, 0x78, 0x32, 0x11, 0x25, 0xEE, 0x7F, 0x96,
|
||||
0x21, 0xA9, 0xD6, 0x76, 0x97, 0x8D, 0x66, 0x7E, 0xB2, 0x91,
|
||||
0xD0, 0x36, 0x2E, 0xA3, 0x1D, 0xBF, 0xF1, 0x85, 0xED, 0xC0,
|
||||
0x3E, 0x60, 0xB8, 0x5A, 0x9F, 0xAB, 0x80, 0xE0, 0xEA, 0x5D,
|
||||
0x5F, 0x75, 0x56, 0xC7, 0x4D, 0x51, 0x8E, 0xD4, 0x1F, 0x34,
|
||||
0xA6, 0x36, 0xF1, 0x30, 0x1F, 0x51, 0x99, 0x2F, 0x02, 0x03,
|
||||
0x01, 0x00, 0x01, 0x02, 0x82, 0x01, 0x00, 0x52, 0x11, 0x33,
|
||||
0x40, 0xC5, 0xD9, 0x64, 0x65, 0xB5, 0xE0, 0x0A, 0xA5, 0x19,
|
||||
0x8E, 0xED, 0x44, 0x54, 0x0C, 0x35, 0xB7, 0xAC, 0x21, 0x9B,
|
||||
0xE1, 0x7E, 0x37, 0x05, 0x9A, 0x20, 0x73, 0x6B, 0xAF, 0x63,
|
||||
0x4B, 0x23, 0x30, 0xDC, 0x37, 0x66, 0x14, 0x89, 0xBC, 0xE0,
|
||||
0xF8, 0xA0, 0x5D, 0x2D, 0x57, 0x65, 0xE0, 0xC6, 0xD6, 0x9B,
|
||||
0x66, 0x27, 0x62, 0xEC, 0xC3, 0xB8, 0x8C, 0xD8, 0xAE, 0xB5,
|
||||
0xC9, 0xBF, 0x0E, 0xFE, 0x84, 0x72, 0x68, 0xD5, 0x47, 0x0E,
|
||||
0x0E, 0xF8, 0xAE, 0x9D, 0x56, 0xAC, 0x4F, 0xAD, 0x88, 0xA0,
|
||||
0xA2, 0xF6, 0xFC, 0x38, 0xCD, 0x96, 0x5B, 0x5E, 0x7E, 0xB6,
|
||||
0x98, 0xBB, 0xF3, 0x8A, 0xEC, 0xFA, 0xC8, 0xB7, 0x90, 0x75,
|
||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
||||
0xB2, 0xF6, 0x09, 0xEA, 0x32, 0x14, 0x0F, 0xCF, 0x9A, 0x41,
|
||||
0x02, 0x81, 0x80, 0x77, 0x3F, 0xB6, 0x14, 0x8D, 0xC5, 0x13,
|
||||
0x08, 0x7E, 0xC9, 0xC4, 0xEA, 0xD4, 0xBA, 0x0D, 0xA4, 0x9E,
|
||||
0xB3, 0x6E, 0xDE, 0x1A, 0x7A, 0xF8, 0x89, 0x88, 0xEF, 0x36,
|
||||
0x3C, 0x11, 0xBC, 0x83, 0xE8, 0x30, 0x6C, 0x81, 0x7C, 0x47,
|
||||
0xF3, 0x4D, 0xCA, 0xEA, 0x56, 0x01, 0x62, 0x55, 0x2E, 0x4B,
|
||||
0x89, 0xA9, 0xBD, 0x6F, 0x01, 0xF6, 0x74, 0x02, 0xAA, 0xE3,
|
||||
0x84, 0x66, 0x06, 0x95, 0x34, 0xA1, 0xE2, 0xCA, 0x65, 0xFE,
|
||||
0xA3, 0x2D, 0x43, 0x97, 0x95, 0x6C, 0x6F, 0xD5, 0xB4, 0x38,
|
||||
0xF6, 0xF9, 0x95, 0x30, 0xFA, 0xF8, 0x9C, 0x25, 0x2B, 0xB6,
|
||||
0x14, 0x51, 0xCC, 0x2E, 0xB3, 0x5B, 0xD6, 0xDC, 0x1A, 0xEC,
|
||||
0x2D, 0x09, 0x5B, 0x3F, 0x3A, 0xD0, 0xB8, 0x4E, 0x27, 0x1F,
|
||||
0xDC, 0x2A, 0xEE, 0xAC, 0xA9, 0x59, 0x5D, 0x07, 0x63, 0x11,
|
||||
0x83, 0x0B, 0xD4, 0x74, 0x80, 0xB6, 0x7D, 0x62, 0x45, 0xBF,
|
||||
0x56
|
||||
};
|
||||
|
||||
#endif /* USE_CERT_BUFFERS_1024 */
|
||||
|
||||
#endif /* CYASSL_CERTS_TEST_H */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* crl.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* aes.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -28,6 +28,11 @@
|
||||
|
||||
#include <cyassl/ctaocrypt/types.h>
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_AESNI
|
||||
|
||||
#include <wmmintrin.h>
|
||||
@ -53,6 +58,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define CYASSL_AES_CAVIUM_MAGIC 0xBEEF0002
|
||||
|
||||
enum {
|
||||
AES_ENC_TYPE = 1, /* cipher unique type */
|
||||
AES_ENCRYPTION = 0,
|
||||
@ -79,6 +86,12 @@ typedef struct Aes {
|
||||
#ifdef CYASSL_AESNI
|
||||
byte use_aesni;
|
||||
#endif /* CYASSL_AESNI */
|
||||
#ifdef HAVE_CAVIUM
|
||||
AesType type; /* aes key type */
|
||||
int devId; /* nitrox device id */
|
||||
word32 magic; /* using cavium magic */
|
||||
word64 contextHandle; /* nitrox context memory handle */
|
||||
#endif
|
||||
} Aes;
|
||||
|
||||
|
||||
@ -115,6 +128,10 @@ CYASSL_API int AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
const byte* authIn, word32 authInSz);
|
||||
#endif /* HAVE_AESCCM */
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CYASSL_API int AesInitCavium(Aes*, int);
|
||||
CYASSL_API void AesFreeCavium(Aes*);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* arc4.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -32,6 +32,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define CYASSL_ARC4_CAVIUM_MAGIC 0xBEEF0001
|
||||
|
||||
enum {
|
||||
ARC4_ENC_TYPE = 4, /* cipher unique type */
|
||||
ARC4_STATE_SIZE = 256
|
||||
@ -42,11 +44,20 @@ typedef struct Arc4 {
|
||||
byte x;
|
||||
byte y;
|
||||
byte state[ARC4_STATE_SIZE];
|
||||
#ifdef HAVE_CAVIUM
|
||||
int devId; /* nitrox device id */
|
||||
word32 magic; /* using cavium magic */
|
||||
word64 contextHandle; /* nitrox context memory handle */
|
||||
#endif
|
||||
} Arc4;
|
||||
|
||||
CYASSL_API void Arc4Process(Arc4*, byte*, const byte*, word32);
|
||||
CYASSL_API void Arc4SetKey(Arc4*, const byte*, word32);
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CYASSL_API int Arc4InitCavium(Arc4*, int);
|
||||
CYASSL_API void Arc4FreeCavium(Arc4*);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* asn.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* asn_public.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
/* camellia.h
|
||||
*
|
||||
* Copyright (C) 2006-2013 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* coding.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* des3.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -33,6 +33,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CYASSL_3DES_CAVIUM_MAGIC 0xBEEF0003
|
||||
|
||||
enum {
|
||||
DES_ENC_TYPE = 2, /* cipher unique type */
|
||||
DES3_ENC_TYPE = 3, /* cipher unique type */
|
||||
@ -64,6 +66,11 @@ typedef struct Des3 {
|
||||
word32 key[3][DES_KS_SIZE];
|
||||
word32 reg[DES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */
|
||||
word32 tmp[DES_BLOCK_SIZE / sizeof(word32)]; /* same */
|
||||
#ifdef HAVE_CAVIUM
|
||||
int devId; /* nitrox device id */
|
||||
word32 magic; /* using cavium magic */
|
||||
word64 contextHandle; /* nitrox context memory handle */
|
||||
#endif
|
||||
} Des3;
|
||||
|
||||
|
||||
@ -79,6 +86,12 @@ CYASSL_API void Des3_CbcEncrypt(Des3* des, byte* out, const byte* in,word32 sz);
|
||||
CYASSL_API void Des3_CbcDecrypt(Des3* des, byte* out, const byte* in,word32 sz);
|
||||
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CYASSL_API int Des3_InitCavium(Des3*, int);
|
||||
CYASSL_API void Des3_FreeCavium(Des3*);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* dh.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* dsa.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ecc.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* error.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -101,6 +101,8 @@ enum {
|
||||
AES_GCM_AUTH_E = -180, /* AES-GCM Authentication check failure */
|
||||
AES_CCM_AUTH_E = -181, /* AES-CCM Authentication check failure */
|
||||
|
||||
CAVIUM_INIT_E = -182, /* Cavium Init type error */
|
||||
|
||||
MIN_CODE_E = -200 /* errors -101 - -199 */
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* hc128.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* hmac.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
@ -39,11 +39,18 @@
|
||||
#include <cyassl/ctaocrypt/sha512.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include "cavium_common.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define CYASSL_HMAC_CAVIUM_MAGIC 0xBEEF0005
|
||||
|
||||
enum {
|
||||
IPAD = 0x36,
|
||||
OPAD = 0x5C,
|
||||
@ -88,6 +95,15 @@ typedef struct Hmac {
|
||||
word32 innerHash[INNER_HASH_SIZE / sizeof(word32)]; /* max size */
|
||||
byte macType; /* md5 sha or sha256 */
|
||||
byte innerHashKeyed; /* keyed flag */
|
||||
#ifdef HAVE_CAVIUM
|
||||
word16 keyLen; /* hmac key length */
|
||||
word16 dataLen;
|
||||
HashType type; /* hmac key type */
|
||||
int devId; /* nitrox device id */
|
||||
word32 magic; /* using cavium magic */
|
||||
word64 contextHandle; /* nitrox context memory handle */
|
||||
byte* data; /* buffered input data for one call */
|
||||
#endif
|
||||
} Hmac;
|
||||
|
||||
|
||||
@ -96,6 +112,11 @@ CYASSL_API void HmacSetKey(Hmac*, int type, const byte* key, word32 keySz);
|
||||
CYASSL_API void HmacUpdate(Hmac*, const byte*, word32);
|
||||
CYASSL_API void HmacFinal(Hmac*, byte*);
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CYASSL_API int HmacInitCavium(Hmac*, int);
|
||||
CYASSL_API void HmacFreeCavium(Hmac*);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* integer.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* logging.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md2.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md4.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* md5.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* memory.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2013 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user