ring-native 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGES.md +7 -0
- data/Makefile +5 -0
- data/README.md +12 -5
- data/Rakefile +4 -0
- data/ext/ring/extconf.rb +4 -5
- data/lib/ring/native.rb +3 -1
- data/lib/ring/native/version.rb +5 -1
- data/ring-native.gemspec +6 -6
- data/vendor/ring-ffi/Cargo.lock +26 -0
- data/vendor/ring-ffi/Cargo.toml +45 -0
- data/vendor/ring-ffi/LICENSE +16 -0
- data/vendor/ring-ffi/README.md +59 -0
- data/vendor/ring-ffi/src/lib.rs +79 -0
- metadata +10 -255
- data/vendor/ring/BUILDING.md +0 -40
- data/vendor/ring/Cargo.toml +0 -43
- data/vendor/ring/LICENSE +0 -185
- data/vendor/ring/Makefile +0 -35
- data/vendor/ring/PORTING.md +0 -163
- data/vendor/ring/README.md +0 -113
- data/vendor/ring/STYLE.md +0 -197
- data/vendor/ring/appveyor.yml +0 -27
- data/vendor/ring/build.rs +0 -108
- data/vendor/ring/crypto/aes/aes.c +0 -1142
- data/vendor/ring/crypto/aes/aes_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/aes/aes_test.cc +0 -93
- data/vendor/ring/crypto/aes/asm/aes-586.pl +0 -2368
- data/vendor/ring/crypto/aes/asm/aes-armv4.pl +0 -1249
- data/vendor/ring/crypto/aes/asm/aes-x86_64.pl +0 -2246
- data/vendor/ring/crypto/aes/asm/aesni-x86.pl +0 -1318
- data/vendor/ring/crypto/aes/asm/aesni-x86_64.pl +0 -2084
- data/vendor/ring/crypto/aes/asm/aesv8-armx.pl +0 -675
- data/vendor/ring/crypto/aes/asm/bsaes-armv7.pl +0 -1364
- data/vendor/ring/crypto/aes/asm/bsaes-x86_64.pl +0 -1565
- data/vendor/ring/crypto/aes/asm/vpaes-x86.pl +0 -841
- data/vendor/ring/crypto/aes/asm/vpaes-x86_64.pl +0 -1116
- data/vendor/ring/crypto/aes/internal.h +0 -87
- data/vendor/ring/crypto/aes/mode_wrappers.c +0 -61
- data/vendor/ring/crypto/bn/add.c +0 -394
- data/vendor/ring/crypto/bn/asm/armv4-mont.pl +0 -694
- data/vendor/ring/crypto/bn/asm/armv8-mont.pl +0 -1503
- data/vendor/ring/crypto/bn/asm/bn-586.pl +0 -774
- data/vendor/ring/crypto/bn/asm/co-586.pl +0 -287
- data/vendor/ring/crypto/bn/asm/rsaz-avx2.pl +0 -1882
- data/vendor/ring/crypto/bn/asm/x86-mont.pl +0 -592
- data/vendor/ring/crypto/bn/asm/x86_64-gcc.c +0 -599
- data/vendor/ring/crypto/bn/asm/x86_64-mont.pl +0 -1393
- data/vendor/ring/crypto/bn/asm/x86_64-mont5.pl +0 -3507
- data/vendor/ring/crypto/bn/bn.c +0 -352
- data/vendor/ring/crypto/bn/bn_asn1.c +0 -74
- data/vendor/ring/crypto/bn/bn_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/bn/bn_test.cc +0 -1696
- data/vendor/ring/crypto/bn/cmp.c +0 -200
- data/vendor/ring/crypto/bn/convert.c +0 -433
- data/vendor/ring/crypto/bn/ctx.c +0 -311
- data/vendor/ring/crypto/bn/div.c +0 -594
- data/vendor/ring/crypto/bn/exponentiation.c +0 -1335
- data/vendor/ring/crypto/bn/gcd.c +0 -711
- data/vendor/ring/crypto/bn/generic.c +0 -1019
- data/vendor/ring/crypto/bn/internal.h +0 -316
- data/vendor/ring/crypto/bn/montgomery.c +0 -516
- data/vendor/ring/crypto/bn/mul.c +0 -888
- data/vendor/ring/crypto/bn/prime.c +0 -829
- data/vendor/ring/crypto/bn/random.c +0 -334
- data/vendor/ring/crypto/bn/rsaz_exp.c +0 -262
- data/vendor/ring/crypto/bn/rsaz_exp.h +0 -53
- data/vendor/ring/crypto/bn/shift.c +0 -276
- data/vendor/ring/crypto/bytestring/bytestring_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/bytestring/bytestring_test.cc +0 -421
- data/vendor/ring/crypto/bytestring/cbb.c +0 -399
- data/vendor/ring/crypto/bytestring/cbs.c +0 -227
- data/vendor/ring/crypto/bytestring/internal.h +0 -46
- data/vendor/ring/crypto/chacha/chacha_generic.c +0 -140
- data/vendor/ring/crypto/chacha/chacha_vec.c +0 -323
- data/vendor/ring/crypto/chacha/chacha_vec_arm.S +0 -1447
- data/vendor/ring/crypto/chacha/chacha_vec_arm_generate.go +0 -153
- data/vendor/ring/crypto/cipher/cipher_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/cipher/e_aes.c +0 -390
- data/vendor/ring/crypto/cipher/e_chacha20poly1305.c +0 -208
- data/vendor/ring/crypto/cipher/internal.h +0 -173
- data/vendor/ring/crypto/cipher/test/aes_128_gcm_tests.txt +0 -543
- data/vendor/ring/crypto/cipher/test/aes_128_key_wrap_tests.txt +0 -9
- data/vendor/ring/crypto/cipher/test/aes_256_gcm_tests.txt +0 -475
- data/vendor/ring/crypto/cipher/test/aes_256_key_wrap_tests.txt +0 -23
- data/vendor/ring/crypto/cipher/test/chacha20_poly1305_old_tests.txt +0 -422
- data/vendor/ring/crypto/cipher/test/chacha20_poly1305_tests.txt +0 -484
- data/vendor/ring/crypto/cipher/test/cipher_test.txt +0 -100
- data/vendor/ring/crypto/constant_time_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/constant_time_test.c +0 -304
- data/vendor/ring/crypto/cpu-arm-asm.S +0 -32
- data/vendor/ring/crypto/cpu-arm.c +0 -199
- data/vendor/ring/crypto/cpu-intel.c +0 -261
- data/vendor/ring/crypto/crypto.c +0 -151
- data/vendor/ring/crypto/curve25519/asm/x25519-arm.S +0 -2118
- data/vendor/ring/crypto/curve25519/curve25519.c +0 -4888
- data/vendor/ring/crypto/curve25519/x25519_test.cc +0 -128
- data/vendor/ring/crypto/digest/md32_common.h +0 -181
- data/vendor/ring/crypto/ec/asm/p256-x86_64-asm.pl +0 -2725
- data/vendor/ring/crypto/ec/ec.c +0 -193
- data/vendor/ring/crypto/ec/ec_curves.c +0 -61
- data/vendor/ring/crypto/ec/ec_key.c +0 -228
- data/vendor/ring/crypto/ec/ec_montgomery.c +0 -114
- data/vendor/ring/crypto/ec/example_mul.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/ec/internal.h +0 -243
- data/vendor/ring/crypto/ec/oct.c +0 -253
- data/vendor/ring/crypto/ec/p256-64.c +0 -1794
- data/vendor/ring/crypto/ec/p256-x86_64-table.h +0 -9548
- data/vendor/ring/crypto/ec/p256-x86_64.c +0 -509
- data/vendor/ring/crypto/ec/simple.c +0 -1007
- data/vendor/ring/crypto/ec/util-64.c +0 -183
- data/vendor/ring/crypto/ec/wnaf.c +0 -508
- data/vendor/ring/crypto/ecdh/ecdh.c +0 -155
- data/vendor/ring/crypto/ecdsa/ecdsa.c +0 -304
- data/vendor/ring/crypto/ecdsa/ecdsa_asn1.c +0 -193
- data/vendor/ring/crypto/ecdsa/ecdsa_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/ecdsa/ecdsa_test.cc +0 -327
- data/vendor/ring/crypto/header_removed.h +0 -17
- data/vendor/ring/crypto/internal.h +0 -495
- data/vendor/ring/crypto/libring.Windows.vcxproj +0 -101
- data/vendor/ring/crypto/mem.c +0 -98
- data/vendor/ring/crypto/modes/asm/aesni-gcm-x86_64.pl +0 -1045
- data/vendor/ring/crypto/modes/asm/ghash-armv4.pl +0 -517
- data/vendor/ring/crypto/modes/asm/ghash-x86.pl +0 -1393
- data/vendor/ring/crypto/modes/asm/ghash-x86_64.pl +0 -1741
- data/vendor/ring/crypto/modes/asm/ghashv8-armx.pl +0 -422
- data/vendor/ring/crypto/modes/ctr.c +0 -226
- data/vendor/ring/crypto/modes/gcm.c +0 -1206
- data/vendor/ring/crypto/modes/gcm_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/modes/gcm_test.c +0 -348
- data/vendor/ring/crypto/modes/internal.h +0 -299
- data/vendor/ring/crypto/perlasm/arm-xlate.pl +0 -170
- data/vendor/ring/crypto/perlasm/readme +0 -100
- data/vendor/ring/crypto/perlasm/x86_64-xlate.pl +0 -1164
- data/vendor/ring/crypto/perlasm/x86asm.pl +0 -292
- data/vendor/ring/crypto/perlasm/x86gas.pl +0 -263
- data/vendor/ring/crypto/perlasm/x86masm.pl +0 -200
- data/vendor/ring/crypto/perlasm/x86nasm.pl +0 -187
- data/vendor/ring/crypto/poly1305/poly1305.c +0 -331
- data/vendor/ring/crypto/poly1305/poly1305_arm.c +0 -301
- data/vendor/ring/crypto/poly1305/poly1305_arm_asm.S +0 -2015
- data/vendor/ring/crypto/poly1305/poly1305_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/poly1305/poly1305_test.cc +0 -80
- data/vendor/ring/crypto/poly1305/poly1305_test.txt +0 -52
- data/vendor/ring/crypto/poly1305/poly1305_vec.c +0 -892
- data/vendor/ring/crypto/rand/asm/rdrand-x86_64.pl +0 -75
- data/vendor/ring/crypto/rand/internal.h +0 -32
- data/vendor/ring/crypto/rand/rand.c +0 -189
- data/vendor/ring/crypto/rand/urandom.c +0 -219
- data/vendor/ring/crypto/rand/windows.c +0 -56
- data/vendor/ring/crypto/refcount_c11.c +0 -66
- data/vendor/ring/crypto/refcount_lock.c +0 -53
- data/vendor/ring/crypto/refcount_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/refcount_test.c +0 -58
- data/vendor/ring/crypto/rsa/blinding.c +0 -462
- data/vendor/ring/crypto/rsa/internal.h +0 -108
- data/vendor/ring/crypto/rsa/padding.c +0 -300
- data/vendor/ring/crypto/rsa/rsa.c +0 -450
- data/vendor/ring/crypto/rsa/rsa_asn1.c +0 -261
- data/vendor/ring/crypto/rsa/rsa_impl.c +0 -944
- data/vendor/ring/crypto/rsa/rsa_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/rsa/rsa_test.cc +0 -437
- data/vendor/ring/crypto/sha/asm/sha-armv8.pl +0 -436
- data/vendor/ring/crypto/sha/asm/sha-x86_64.pl +0 -2390
- data/vendor/ring/crypto/sha/asm/sha256-586.pl +0 -1275
- data/vendor/ring/crypto/sha/asm/sha256-armv4.pl +0 -735
- data/vendor/ring/crypto/sha/asm/sha256-armv8.pl +0 -14
- data/vendor/ring/crypto/sha/asm/sha256-x86_64.pl +0 -14
- data/vendor/ring/crypto/sha/asm/sha512-586.pl +0 -911
- data/vendor/ring/crypto/sha/asm/sha512-armv4.pl +0 -666
- data/vendor/ring/crypto/sha/asm/sha512-armv8.pl +0 -14
- data/vendor/ring/crypto/sha/asm/sha512-x86_64.pl +0 -14
- data/vendor/ring/crypto/sha/sha1.c +0 -271
- data/vendor/ring/crypto/sha/sha256.c +0 -204
- data/vendor/ring/crypto/sha/sha512.c +0 -355
- data/vendor/ring/crypto/test/file_test.cc +0 -326
- data/vendor/ring/crypto/test/file_test.h +0 -181
- data/vendor/ring/crypto/test/malloc.cc +0 -150
- data/vendor/ring/crypto/test/scoped_types.h +0 -95
- data/vendor/ring/crypto/test/test.Windows.vcxproj +0 -35
- data/vendor/ring/crypto/test/test_util.cc +0 -46
- data/vendor/ring/crypto/test/test_util.h +0 -41
- data/vendor/ring/crypto/thread_none.c +0 -55
- data/vendor/ring/crypto/thread_pthread.c +0 -165
- data/vendor/ring/crypto/thread_test.Windows.vcxproj +0 -25
- data/vendor/ring/crypto/thread_test.c +0 -200
- data/vendor/ring/crypto/thread_win.c +0 -282
- data/vendor/ring/examples/checkdigest.rs +0 -103
- data/vendor/ring/include/openssl/aes.h +0 -121
- data/vendor/ring/include/openssl/arm_arch.h +0 -129
- data/vendor/ring/include/openssl/base.h +0 -156
- data/vendor/ring/include/openssl/bn.h +0 -794
- data/vendor/ring/include/openssl/buffer.h +0 -18
- data/vendor/ring/include/openssl/bytestring.h +0 -235
- data/vendor/ring/include/openssl/chacha.h +0 -37
- data/vendor/ring/include/openssl/cmac.h +0 -76
- data/vendor/ring/include/openssl/cpu.h +0 -184
- data/vendor/ring/include/openssl/crypto.h +0 -43
- data/vendor/ring/include/openssl/curve25519.h +0 -88
- data/vendor/ring/include/openssl/ec.h +0 -225
- data/vendor/ring/include/openssl/ec_key.h +0 -129
- data/vendor/ring/include/openssl/ecdh.h +0 -110
- data/vendor/ring/include/openssl/ecdsa.h +0 -156
- data/vendor/ring/include/openssl/err.h +0 -201
- data/vendor/ring/include/openssl/mem.h +0 -101
- data/vendor/ring/include/openssl/obj_mac.h +0 -71
- data/vendor/ring/include/openssl/opensslfeatures.h +0 -68
- data/vendor/ring/include/openssl/opensslv.h +0 -18
- data/vendor/ring/include/openssl/ossl_typ.h +0 -18
- data/vendor/ring/include/openssl/poly1305.h +0 -51
- data/vendor/ring/include/openssl/rand.h +0 -70
- data/vendor/ring/include/openssl/rsa.h +0 -399
- data/vendor/ring/include/openssl/thread.h +0 -133
- data/vendor/ring/include/openssl/type_check.h +0 -71
- data/vendor/ring/mk/Common.props +0 -63
- data/vendor/ring/mk/Windows.props +0 -42
- data/vendor/ring/mk/WindowsTest.props +0 -18
- data/vendor/ring/mk/appveyor.bat +0 -62
- data/vendor/ring/mk/bottom_of_makefile.mk +0 -54
- data/vendor/ring/mk/ring.mk +0 -266
- data/vendor/ring/mk/top_of_makefile.mk +0 -214
- data/vendor/ring/mk/travis.sh +0 -40
- data/vendor/ring/mk/update-travis-yml.py +0 -229
- data/vendor/ring/ring.sln +0 -153
- data/vendor/ring/src/aead.rs +0 -682
- data/vendor/ring/src/agreement.rs +0 -248
- data/vendor/ring/src/c.rs +0 -129
- data/vendor/ring/src/constant_time.rs +0 -37
- data/vendor/ring/src/der.rs +0 -96
- data/vendor/ring/src/digest.rs +0 -690
- data/vendor/ring/src/digest_tests.txt +0 -57
- data/vendor/ring/src/ecc.rs +0 -28
- data/vendor/ring/src/ecc_build.rs +0 -279
- data/vendor/ring/src/ecc_curves.rs +0 -117
- data/vendor/ring/src/ed25519_tests.txt +0 -2579
- data/vendor/ring/src/exe_tests.rs +0 -46
- data/vendor/ring/src/ffi.rs +0 -29
- data/vendor/ring/src/file_test.rs +0 -187
- data/vendor/ring/src/hkdf.rs +0 -153
- data/vendor/ring/src/hkdf_tests.txt +0 -59
- data/vendor/ring/src/hmac.rs +0 -414
- data/vendor/ring/src/hmac_tests.txt +0 -97
- data/vendor/ring/src/input.rs +0 -312
- data/vendor/ring/src/lib.rs +0 -41
- data/vendor/ring/src/pbkdf2.rs +0 -265
- data/vendor/ring/src/pbkdf2_tests.txt +0 -113
- data/vendor/ring/src/polyfill.rs +0 -57
- data/vendor/ring/src/rand.rs +0 -28
- data/vendor/ring/src/signature.rs +0 -314
- data/vendor/ring/third-party/NIST/README.md +0 -9
- data/vendor/ring/third-party/NIST/SHAVS/SHA1LongMsg.rsp +0 -263
- data/vendor/ring/third-party/NIST/SHAVS/SHA1Monte.rsp +0 -309
- data/vendor/ring/third-party/NIST/SHAVS/SHA1ShortMsg.rsp +0 -267
- data/vendor/ring/third-party/NIST/SHAVS/SHA224LongMsg.rsp +0 -263
- data/vendor/ring/third-party/NIST/SHAVS/SHA224Monte.rsp +0 -309
- data/vendor/ring/third-party/NIST/SHAVS/SHA224ShortMsg.rsp +0 -267
- data/vendor/ring/third-party/NIST/SHAVS/SHA256LongMsg.rsp +0 -263
- data/vendor/ring/third-party/NIST/SHAVS/SHA256Monte.rsp +0 -309
- data/vendor/ring/third-party/NIST/SHAVS/SHA256ShortMsg.rsp +0 -267
- data/vendor/ring/third-party/NIST/SHAVS/SHA384LongMsg.rsp +0 -519
- data/vendor/ring/third-party/NIST/SHAVS/SHA384Monte.rsp +0 -309
- data/vendor/ring/third-party/NIST/SHAVS/SHA384ShortMsg.rsp +0 -523
- data/vendor/ring/third-party/NIST/SHAVS/SHA512LongMsg.rsp +0 -519
- data/vendor/ring/third-party/NIST/SHAVS/SHA512Monte.rsp +0 -309
- data/vendor/ring/third-party/NIST/SHAVS/SHA512ShortMsg.rsp +0 -523
- data/vendor/ring/third-party/NIST/sha256sums.txt +0 -1
@@ -1,101 +0,0 @@
|
|
1
|
-
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
2
|
-
* All rights reserved.
|
3
|
-
*
|
4
|
-
* This package is an SSL implementation written
|
5
|
-
* by Eric Young (eay@cryptsoft.com).
|
6
|
-
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
-
*
|
8
|
-
* This library is free for commercial and non-commercial use as long as
|
9
|
-
* the following conditions are aheared to. The following conditions
|
10
|
-
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
-
* included with this distribution is covered by the same copyright terms
|
13
|
-
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
-
*
|
15
|
-
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
-
* the code are not to be removed.
|
17
|
-
* If this package is used in a product, Eric Young should be given attribution
|
18
|
-
* as the author of the parts of the library used.
|
19
|
-
* This can be in the form of a textual message at program startup or
|
20
|
-
* in documentation (online or textual) provided with the package.
|
21
|
-
*
|
22
|
-
* Redistribution and use in source and binary forms, with or without
|
23
|
-
* modification, are permitted provided that the following conditions
|
24
|
-
* are met:
|
25
|
-
* 1. Redistributions of source code must retain the copyright
|
26
|
-
* notice, this list of conditions and the following disclaimer.
|
27
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
-
* notice, this list of conditions and the following disclaimer in the
|
29
|
-
* documentation and/or other materials provided with the distribution.
|
30
|
-
* 3. All advertising materials mentioning features or use of this software
|
31
|
-
* must display the following acknowledgement:
|
32
|
-
* "This product includes cryptographic software written by
|
33
|
-
* Eric Young (eay@cryptsoft.com)"
|
34
|
-
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
-
* being used are not cryptographic related :-).
|
36
|
-
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
-
* the apps directory (application code) you must include an acknowledgement:
|
38
|
-
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
-
*
|
40
|
-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
-
* SUCH DAMAGE.
|
51
|
-
*
|
52
|
-
* The licence and distribution terms for any publically available version or
|
53
|
-
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
-
* copied and put under another distribution licence
|
55
|
-
* [including the GNU Public Licence.] */
|
56
|
-
|
57
|
-
#ifndef OPENSSL_HEADER_MEM_H
|
58
|
-
#define OPENSSL_HEADER_MEM_H
|
59
|
-
|
60
|
-
#include <openssl/base.h>
|
61
|
-
|
62
|
-
#include <stdlib.h>
|
63
|
-
|
64
|
-
#if defined(__cplusplus)
|
65
|
-
extern "C" {
|
66
|
-
#endif
|
67
|
-
|
68
|
-
|
69
|
-
/* Memory and string functions, see also buf.h.
|
70
|
-
*
|
71
|
-
* OpenSSL has, historically, had a complex set of malloc debugging options.
|
72
|
-
* However, that was written in a time before Valgrind and ASAN. Since we now
|
73
|
-
* have those tools, the OpenSSL allocation functions are simply macros around
|
74
|
-
* the standard memory functions. */
|
75
|
-
|
76
|
-
|
77
|
-
#define OPENSSL_malloc malloc
|
78
|
-
#define OPENSSL_realloc realloc
|
79
|
-
#define OPENSSL_free free
|
80
|
-
|
81
|
-
/* OPENSSL_cleanse zeros out |len| bytes of memory at |ptr|. This is similar to
|
82
|
-
* |memset_s| from C11. */
|
83
|
-
OPENSSL_EXPORT void OPENSSL_cleanse(void *ptr, size_t len);
|
84
|
-
|
85
|
-
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
|
86
|
-
* takes an amount of time dependent on |len|, but independent of the contents
|
87
|
-
* of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
|
88
|
-
* defined order as the return value when a != b is undefined, other than to be
|
89
|
-
* non-zero. */
|
90
|
-
OPENSSL_EXPORT int CRYPTO_memcmp(const void *a, const void *b, size_t len);
|
91
|
-
|
92
|
-
/* DECIMAL_SIZE returns an upper bound for the length of the decimal
|
93
|
-
* representation of the given type. */
|
94
|
-
#define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
|
95
|
-
|
96
|
-
|
97
|
-
#if defined(__cplusplus)
|
98
|
-
} /* extern C */
|
99
|
-
#endif
|
100
|
-
|
101
|
-
#endif /* OPENSSL_HEADER_MEM_H */
|
@@ -1,71 +0,0 @@
|
|
1
|
-
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
2
|
-
* All rights reserved.
|
3
|
-
*
|
4
|
-
* This package is an SSL implementation written
|
5
|
-
* by Eric Young (eay@cryptsoft.com).
|
6
|
-
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
-
*
|
8
|
-
* This library is free for commercial and non-commercial use as long as
|
9
|
-
* the following conditions are aheared to. The following conditions
|
10
|
-
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
-
* included with this distribution is covered by the same copyright terms
|
13
|
-
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
-
*
|
15
|
-
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
-
* the code are not to be removed.
|
17
|
-
* If this package is used in a product, Eric Young should be given attribution
|
18
|
-
* as the author of the parts of the library used.
|
19
|
-
* This can be in the form of a textual message at program startup or
|
20
|
-
* in documentation (online or textual) provided with the package.
|
21
|
-
*
|
22
|
-
* Redistribution and use in source and binary forms, with or without
|
23
|
-
* modification, are permitted provided that the following conditions
|
24
|
-
* are met:
|
25
|
-
* 1. Redistributions of source code must retain the copyright
|
26
|
-
* notice, this list of conditions and the following disclaimer.
|
27
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
-
* notice, this list of conditions and the following disclaimer in the
|
29
|
-
* documentation and/or other materials provided with the distribution.
|
30
|
-
* 3. All advertising materials mentioning features or use of this software
|
31
|
-
* must display the following acknowledgement:
|
32
|
-
* "This product includes cryptographic software written by
|
33
|
-
* Eric Young (eay@cryptsoft.com)"
|
34
|
-
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
-
* being used are not cryptographic related :-).
|
36
|
-
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
-
* the apps directory (application code) you must include an acknowledgement:
|
38
|
-
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
-
*
|
40
|
-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
-
* SUCH DAMAGE.
|
51
|
-
*
|
52
|
-
* The licence and distribution terms for any publically available version or
|
53
|
-
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
-
* copied and put under another distribution licence
|
55
|
-
* [including the GNU Public Licence.]
|
56
|
-
*/
|
57
|
-
|
58
|
-
#define NID_undef 0
|
59
|
-
|
60
|
-
/* Digest algorithms */
|
61
|
-
#define NID_md5_sha1 114
|
62
|
-
#define NID_sha1 64
|
63
|
-
#define NID_sha256 672
|
64
|
-
#define NID_sha384 673
|
65
|
-
#define NID_sha512 674
|
66
|
-
|
67
|
-
/* ECC named curves */
|
68
|
-
#define NID_secp224r1 713
|
69
|
-
#define NID_X9_62_prime256v1 415
|
70
|
-
#define NID_secp384r1 715
|
71
|
-
#define NID_secp521r1 716
|
@@ -1,68 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
/* This header is provided in order to make compiling against code that expects
|
16
|
-
OpenSSL easier. */
|
17
|
-
|
18
|
-
#ifndef OPENSSL_HEADER_OPENSSLFEATURES_H
|
19
|
-
#define OPENSSL_HEADER_OPENSSLFEATURES_H
|
20
|
-
|
21
|
-
|
22
|
-
#define OPENSSL_NO_BF
|
23
|
-
#define OPENSSL_NO_BUF_FREELISTS
|
24
|
-
#define OPENSSL_NO_CAMELLIA
|
25
|
-
#define OPENSSL_NO_CAPIENG
|
26
|
-
#define OPENSSL_NO_CAST
|
27
|
-
#define OPENSSL_NO_CMS
|
28
|
-
#define OPENSSL_NO_COMP
|
29
|
-
#define OPENSSL_NO_DANE
|
30
|
-
#define OPENSSL_NO_DEPRECATED
|
31
|
-
#define OPENSSL_NO_DSA
|
32
|
-
#define OPENSSL_NO_DTLS1
|
33
|
-
#define OPENSSL_NO_DYNAMIC_ENGINE
|
34
|
-
#define OPENSSL_NO_EC_NISTP_64_GCC_128
|
35
|
-
#define OPENSSL_NO_EC2M
|
36
|
-
#define OPENSSL_NO_ENGINE
|
37
|
-
#define OPENSSL_NO_GMP
|
38
|
-
#define OPENSSL_NO_GOST
|
39
|
-
#define OPENSSL_NO_HEARTBEATS
|
40
|
-
#define OPENSSL_NO_HW
|
41
|
-
#define OPENSSL_NO_IDEA
|
42
|
-
#define OPENSSL_NO_JPAKE
|
43
|
-
#define OPENSSL_NO_KRB5
|
44
|
-
#define OPENSSL_NO_MD2
|
45
|
-
#define OPENSSL_NO_MDC2
|
46
|
-
#define OPENSSL_NO_NEXTPROTONEG
|
47
|
-
#define OPENSSL_NO_OCB
|
48
|
-
#define OPENSSL_NO_OCSP
|
49
|
-
#define OPENSSL_NO_PSK
|
50
|
-
#define OPENSSL_NO_RC2
|
51
|
-
#define OPENSSL_NO_RC5
|
52
|
-
#define OPENSSL_NO_RFC3779
|
53
|
-
#define OPENSSL_NO_RIPEMD
|
54
|
-
#define OPENSSL_NO_RMD160
|
55
|
-
#define OPENSSL_NO_SCTP
|
56
|
-
#define OPENSSL_NO_SRTP
|
57
|
-
#define OPENSSL_NO_SEED
|
58
|
-
#define OPENSSL_NO_SRP
|
59
|
-
#define OPENSSL_NO_SSL_TRACE
|
60
|
-
#define OPENSSL_NO_SSL2
|
61
|
-
#define OPENSSL_NO_SSL3
|
62
|
-
#define OPENSSL_NO_SSL3_METHOD
|
63
|
-
#define OPENSSL_NO_STATIC_ENGINE
|
64
|
-
#define OPENSSL_NO_STORE
|
65
|
-
#define OPENSSL_NO_WHIRLPOOL
|
66
|
-
|
67
|
-
|
68
|
-
#endif /* OPENSSL_HEADER_OPENSSLFEATURES_H */
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
/* This header is provided in order to make compiling against code that expects
|
16
|
-
OpenSSL easier. */
|
17
|
-
|
18
|
-
#include "crypto.h"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
/* This header is provided in order to make compiling against code that expects
|
16
|
-
OpenSSL easier. */
|
17
|
-
|
18
|
-
#include "base.h"
|
@@ -1,51 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
#ifndef OPENSSL_HEADER_POLY1305_H
|
16
|
-
#define OPENSSL_HEADER_POLY1305_H
|
17
|
-
|
18
|
-
#include <openssl/base.h>
|
19
|
-
|
20
|
-
#ifdef __cplusplus
|
21
|
-
extern "C" {
|
22
|
-
#endif
|
23
|
-
|
24
|
-
|
25
|
-
typedef uint8_t poly1305_state[512];
|
26
|
-
|
27
|
-
/* CRYPTO_poly1305_init sets up |state| so that it can be used to calculate an
|
28
|
-
* authentication tag with the one-time key |key|. Note that |key| is a
|
29
|
-
* one-time key and therefore there is no `reset' method because that would
|
30
|
-
* enable several messages to be authenticated with the same key. */
|
31
|
-
OPENSSL_EXPORT void CRYPTO_poly1305_init(poly1305_state* state,
|
32
|
-
const uint8_t key[32]);
|
33
|
-
|
34
|
-
/* CRYPTO_poly1305_update processes |in_len| bytes from |in|. It can be called
|
35
|
-
* zero or more times after poly1305_init. */
|
36
|
-
OPENSSL_EXPORT void CRYPTO_poly1305_update(poly1305_state* state,
|
37
|
-
const uint8_t* in,
|
38
|
-
size_t in_len);
|
39
|
-
|
40
|
-
/* CRYPTO_poly1305_finish completes the poly1305 calculation and writes a 16
|
41
|
-
* byte authentication tag to |mac|. The |mac| address must be 16-byte
|
42
|
-
* aligned. */
|
43
|
-
OPENSSL_EXPORT void CRYPTO_poly1305_finish(poly1305_state* state,
|
44
|
-
uint8_t mac[16]);
|
45
|
-
|
46
|
-
|
47
|
-
#if defined(__cplusplus)
|
48
|
-
} /* extern C */
|
49
|
-
#endif
|
50
|
-
|
51
|
-
#endif /* OPENSSL_HEADER_POLY1305_H */
|
@@ -1,70 +0,0 @@
|
|
1
|
-
/* Copyright (c) 2014, Google Inc.
|
2
|
-
*
|
3
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
4
|
-
* purpose with or without fee is hereby granted, provided that the above
|
5
|
-
* copyright notice and this permission notice appear in all copies.
|
6
|
-
*
|
7
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
10
|
-
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
12
|
-
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
13
|
-
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
14
|
-
|
15
|
-
#ifndef OPENSSL_HEADER_RAND_H
|
16
|
-
#define OPENSSL_HEADER_RAND_H
|
17
|
-
|
18
|
-
#include <openssl/base.h>
|
19
|
-
|
20
|
-
#if defined(__cplusplus)
|
21
|
-
extern "C" {
|
22
|
-
#endif
|
23
|
-
|
24
|
-
|
25
|
-
/* Random number generation. */
|
26
|
-
|
27
|
-
|
28
|
-
/* RAND_bytes writes |len| bytes of random data to |buf| and returns one. */
|
29
|
-
OPENSSL_EXPORT int RAND_bytes(uint8_t *buf, size_t len);
|
30
|
-
|
31
|
-
/* RAND_cleanup frees any resources used by the RNG. This is not safe if other
|
32
|
-
* threads might still be calling |RAND_bytes|. */
|
33
|
-
OPENSSL_EXPORT void RAND_cleanup(void);
|
34
|
-
|
35
|
-
|
36
|
-
/* Obscure functions. */
|
37
|
-
|
38
|
-
#if !defined(OPENSSL_WINDOWS)
|
39
|
-
/* RAND_set_urandom_fd causes the module to use a copy of |fd| for system
|
40
|
-
* randomness rather opening /dev/urandom internally. The caller retains
|
41
|
-
* ownership of |fd| and is at liberty to close it at any time. This is useful
|
42
|
-
* if, due to a sandbox, /dev/urandom isn't available. If used, it must be
|
43
|
-
* called before the first call to |RAND_bytes|, and it is mutually exclusive
|
44
|
-
* with |RAND_enable_fork_unsafe_buffering|.
|
45
|
-
*
|
46
|
-
* |RAND_set_urandom_fd| does not buffer any entropy, so it is safe to call
|
47
|
-
* |fork| at any time after calling |RAND_set_urandom_fd|. */
|
48
|
-
OPENSSL_EXPORT void RAND_set_urandom_fd(int fd);
|
49
|
-
|
50
|
-
/* RAND_enable_fork_unsafe_buffering enables efficient buffered reading of
|
51
|
-
* /dev/urandom. It adds an overhead of a few KB of memory per thread. It must
|
52
|
-
* be called before the first call to |RAND_bytes| and it is mutually exclusive
|
53
|
-
* with calls to |RAND_set_urandom_fd|.
|
54
|
-
*
|
55
|
-
* If |fd| is non-negative then a copy of |fd| will be used rather than opening
|
56
|
-
* /dev/urandom internally. Like |RAND_set_urandom_fd|, the caller retains
|
57
|
-
* ownership of |fd|. If |fd| is negative then /dev/urandom will be opened and
|
58
|
-
* any error from open(2) crashes the address space.
|
59
|
-
*
|
60
|
-
* It has an unusual name because the buffer is unsafe across calls to |fork|.
|
61
|
-
* Hence, this function should never be called by libraries. */
|
62
|
-
OPENSSL_EXPORT void RAND_enable_fork_unsafe_buffering(int fd);
|
63
|
-
#endif
|
64
|
-
|
65
|
-
|
66
|
-
#if defined(__cplusplus)
|
67
|
-
} /* extern C */
|
68
|
-
#endif
|
69
|
-
|
70
|
-
#endif /* OPENSSL_HEADER_RAND_H */
|
@@ -1,399 +0,0 @@
|
|
1
|
-
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
2
|
-
* All rights reserved.
|
3
|
-
*
|
4
|
-
* This package is an SSL implementation written
|
5
|
-
* by Eric Young (eay@cryptsoft.com).
|
6
|
-
* The implementation was written so as to conform with Netscapes SSL.
|
7
|
-
*
|
8
|
-
* This library is free for commercial and non-commercial use as long as
|
9
|
-
* the following conditions are aheared to. The following conditions
|
10
|
-
* apply to all code found in this distribution, be it the RC4, RSA,
|
11
|
-
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
12
|
-
* included with this distribution is covered by the same copyright terms
|
13
|
-
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
14
|
-
*
|
15
|
-
* Copyright remains Eric Young's, and as such any Copyright notices in
|
16
|
-
* the code are not to be removed.
|
17
|
-
* If this package is used in a product, Eric Young should be given attribution
|
18
|
-
* as the author of the parts of the library used.
|
19
|
-
* This can be in the form of a textual message at program startup or
|
20
|
-
* in documentation (online or textual) provided with the package.
|
21
|
-
*
|
22
|
-
* Redistribution and use in source and binary forms, with or without
|
23
|
-
* modification, are permitted provided that the following conditions
|
24
|
-
* are met:
|
25
|
-
* 1. Redistributions of source code must retain the copyright
|
26
|
-
* notice, this list of conditions and the following disclaimer.
|
27
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
28
|
-
* notice, this list of conditions and the following disclaimer in the
|
29
|
-
* documentation and/or other materials provided with the distribution.
|
30
|
-
* 3. All advertising materials mentioning features or use of this software
|
31
|
-
* must display the following acknowledgement:
|
32
|
-
* "This product includes cryptographic software written by
|
33
|
-
* Eric Young (eay@cryptsoft.com)"
|
34
|
-
* The word 'cryptographic' can be left out if the rouines from the library
|
35
|
-
* being used are not cryptographic related :-).
|
36
|
-
* 4. If you include any Windows specific code (or a derivative thereof) from
|
37
|
-
* the apps directory (application code) you must include an acknowledgement:
|
38
|
-
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
39
|
-
*
|
40
|
-
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
41
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42
|
-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43
|
-
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
44
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46
|
-
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
-
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48
|
-
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49
|
-
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50
|
-
* SUCH DAMAGE.
|
51
|
-
*
|
52
|
-
* The licence and distribution terms for any publically available version or
|
53
|
-
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
54
|
-
* copied and put under another distribution licence
|
55
|
-
* [including the GNU Public Licence.] */
|
56
|
-
|
57
|
-
#ifndef OPENSSL_HEADER_RSA_H
|
58
|
-
#define OPENSSL_HEADER_RSA_H
|
59
|
-
|
60
|
-
#include <openssl/base.h>
|
61
|
-
|
62
|
-
#include <openssl/thread.h>
|
63
|
-
|
64
|
-
#if defined(__cplusplus)
|
65
|
-
extern "C" {
|
66
|
-
#endif
|
67
|
-
|
68
|
-
|
69
|
-
/* rsa.h contains functions for handling encryption and signature using RSA. */
|
70
|
-
|
71
|
-
|
72
|
-
/* Simplified interface. */
|
73
|
-
|
74
|
-
/* Verify an encoded PKCS#1 signature. */
|
75
|
-
OPENSSL_EXPORT int RSA_verify_pkcs1_signed_digest(size_t min_bits,
|
76
|
-
size_t max_bits, int hash_nid,
|
77
|
-
const uint8_t *digest,
|
78
|
-
size_t digest_len,
|
79
|
-
const uint8_t *sig,
|
80
|
-
size_t sig_len,
|
81
|
-
const uint8_t *rsa_key,
|
82
|
-
const size_t rsa_key_len);
|
83
|
-
|
84
|
-
/* Allocation and destruction. */
|
85
|
-
|
86
|
-
/* RSA_new returns a new, empty RSA object or NULL on error. */
|
87
|
-
OPENSSL_EXPORT RSA *RSA_new(void);
|
88
|
-
|
89
|
-
/* RSA_new_method acts the same as |RSA_new| but takes an explicit |ENGINE|. */
|
90
|
-
OPENSSL_EXPORT RSA *RSA_new_method(const ENGINE *engine);
|
91
|
-
|
92
|
-
/* RSA_free decrements the reference count of |rsa| and frees it if the
|
93
|
-
* reference count drops to zero. */
|
94
|
-
OPENSSL_EXPORT void RSA_free(RSA *rsa);
|
95
|
-
|
96
|
-
/* RSA_up_ref increments the reference count of |rsa|. */
|
97
|
-
OPENSSL_EXPORT int RSA_up_ref(RSA *rsa);
|
98
|
-
|
99
|
-
|
100
|
-
/* Key generation. */
|
101
|
-
|
102
|
-
/* RSA_generate_key_ex generates a new RSA key where the modulus has size
|
103
|
-
* |bits| and the public exponent is |e|. If unsure, |RSA_F4| is a good value
|
104
|
-
* for |e|. If |cb| is not NULL then it is called during the key generation
|
105
|
-
* process. In addition to the calls documented for |BN_generate_prime_ex|, it
|
106
|
-
* is called with event=2 when the n'th prime is rejected as unsuitable and
|
107
|
-
* with event=3 when a suitable value for |p| is found.
|
108
|
-
*
|
109
|
-
* It returns one on success or zero on error. */
|
110
|
-
OPENSSL_EXPORT int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e,
|
111
|
-
BN_GENCB *cb);
|
112
|
-
|
113
|
-
|
114
|
-
/* Encryption / Decryption */
|
115
|
-
|
116
|
-
/* Padding types for encryption. */
|
117
|
-
#define RSA_PKCS1_PADDING 1
|
118
|
-
#define RSA_NO_PADDING 3
|
119
|
-
#define RSA_PKCS1_OAEP_PADDING 4
|
120
|
-
/* RSA_PKCS1_PSS_PADDING can only be used via the EVP interface. */
|
121
|
-
#define RSA_PKCS1_PSS_PADDING 6
|
122
|
-
|
123
|
-
/* RSA_encrypt encrypts |in_len| bytes from |in| to the public key from |rsa|
|
124
|
-
* and writes, at most, |max_out| bytes of encrypted data to |out|. The
|
125
|
-
* |max_out| argument must be, at least, |RSA_size| in order to ensure success.
|
126
|
-
*
|
127
|
-
* It returns 1 on success or zero on error.
|
128
|
-
*
|
129
|
-
* The |padding| argument must be one of the |RSA_*_PADDING| values. If in
|
130
|
-
* doubt, |RSA_PKCS1_PADDING| is the most common but |RSA_PKCS1_OAEP_PADDING|
|
131
|
-
* is the most secure. */
|
132
|
-
OPENSSL_EXPORT int RSA_encrypt(RSA *rsa, size_t *out_len, uint8_t *out,
|
133
|
-
size_t max_out, const uint8_t *in, size_t in_len,
|
134
|
-
int padding);
|
135
|
-
|
136
|
-
/* RSA_decrypt decrypts |in_len| bytes from |in| with the private key from
|
137
|
-
* |rsa| and writes, at most, |max_out| bytes of plaintext to |out|. The
|
138
|
-
* |max_out| argument must be, at least, |RSA_size| in order to ensure success.
|
139
|
-
*
|
140
|
-
* It returns 1 on success or zero on error.
|
141
|
-
*
|
142
|
-
* The |padding| argument must be one of the |RSA_*_PADDING| values. If in
|
143
|
-
* doubt, |RSA_PKCS1_PADDING| is the most common but |RSA_PKCS1_OAEP_PADDING|
|
144
|
-
* is the most secure. */
|
145
|
-
OPENSSL_EXPORT int RSA_decrypt(RSA *rsa, size_t *out_len, uint8_t *out,
|
146
|
-
size_t max_out, const uint8_t *in, size_t in_len,
|
147
|
-
int padding);
|
148
|
-
|
149
|
-
/* RSA_message_index_PKCS1_type_2 performs the first step of a PKCS #1 padding
|
150
|
-
* check for decryption. If the |from_len| bytes pointed to at |from| are a
|
151
|
-
* valid PKCS #1 message, it returns one and sets |*out_index| to the start of
|
152
|
-
* the unpadded message. The unpadded message is a suffix of the input and has
|
153
|
-
* length |from_len - *out_index|. Otherwise, it returns zero and sets
|
154
|
-
* |*out_index| to zero. This function runs in time independent of the input
|
155
|
-
* data and is intended to be used directly to avoid Bleichenbacher's attack.
|
156
|
-
*
|
157
|
-
* WARNING: This function behaves differently from the usual OpenSSL convention
|
158
|
-
* in that it does NOT put an error on the queue in the error case. */
|
159
|
-
OPENSSL_EXPORT int RSA_message_index_PKCS1_type_2(const uint8_t *from,
|
160
|
-
size_t from_len,
|
161
|
-
size_t *out_index);
|
162
|
-
|
163
|
-
|
164
|
-
/* Signing / Verification */
|
165
|
-
|
166
|
-
/* RSA_sign signs |in_len| bytes of digest from |in| with |rsa| and writes, at
|
167
|
-
* most, |RSA_size(rsa)| bytes to |out|. On successful return, the actual
|
168
|
-
* number of bytes written is written to |*out_len|.
|
169
|
-
*
|
170
|
-
* The |hash_nid| argument identifies the hash function used to calculate |in|
|
171
|
-
* and is embedded in the resulting signature. For example, it might be
|
172
|
-
* |NID_sha256|.
|
173
|
-
*
|
174
|
-
* It returns 1 on success and zero on error. */
|
175
|
-
OPENSSL_EXPORT int RSA_sign(int hash_nid, const uint8_t *in,
|
176
|
-
unsigned int in_len, uint8_t *out,
|
177
|
-
unsigned int *out_len, RSA *rsa);
|
178
|
-
|
179
|
-
/* RSA_sign_raw signs |in_len| bytes from |in| with the public key from |rsa|
|
180
|
-
* and writes, at most, |max_out| bytes of signature data to |out|. The
|
181
|
-
* |max_out| argument must be, at least, |RSA_size| in order to ensure success.
|
182
|
-
*
|
183
|
-
* It returns 1 on success or zero on error.
|
184
|
-
*
|
185
|
-
* The |padding| argument must be one of the |RSA_*_PADDING| values. If in
|
186
|
-
* doubt, |RSA_PKCS1_PADDING| is the most common. */
|
187
|
-
OPENSSL_EXPORT int RSA_sign_raw(RSA *rsa, size_t *out_len, uint8_t *out,
|
188
|
-
size_t max_out, const uint8_t *in,
|
189
|
-
size_t in_len, int padding);
|
190
|
-
|
191
|
-
/* RSA_verify verifies that |sig_len| bytes from |sig| are a valid, PKCS#1
|
192
|
-
* signature of |msg_len| bytes at |msg| by |rsa|.
|
193
|
-
*
|
194
|
-
* The |hash_nid| argument identifies the hash function used to calculate |in|
|
195
|
-
* and is embedded in the resulting signature in order to prevent hash
|
196
|
-
* confusion attacks. For example, it might be |NID_sha256|.
|
197
|
-
*
|
198
|
-
* It returns one if the signature is valid and zero otherwise.
|
199
|
-
*
|
200
|
-
* WARNING: this differs from the original, OpenSSL function which additionally
|
201
|
-
* returned -1 on error. */
|
202
|
-
OPENSSL_EXPORT int RSA_verify(int hash_nid, const uint8_t *msg, size_t msg_len,
|
203
|
-
const uint8_t *sig, size_t sig_len, RSA *rsa);
|
204
|
-
|
205
|
-
/* RSA_verify_raw verifies |in_len| bytes of signature from |in| using the
|
206
|
-
* public key from |rsa| and writes, at most, |max_out| bytes of plaintext to
|
207
|
-
* |out|. The |max_out| argument must be, at least, |RSA_size| in order to
|
208
|
-
* ensure success.
|
209
|
-
*
|
210
|
-
* It returns 1 on success or zero on error.
|
211
|
-
*
|
212
|
-
* The |padding| argument must be one of the |RSA_*_PADDING| values. If in
|
213
|
-
* doubt, |RSA_PKCS1_PADDING| is the most common. */
|
214
|
-
OPENSSL_EXPORT int RSA_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out,
|
215
|
-
size_t max_out, const uint8_t *in,
|
216
|
-
size_t in_len, int padding);
|
217
|
-
|
218
|
-
|
219
|
-
/* Utility functions. */
|
220
|
-
|
221
|
-
/* RSA_size returns the number of bytes in the modulus, which is also the size
|
222
|
-
* of a signature or encrypted value using |rsa|. */
|
223
|
-
OPENSSL_EXPORT unsigned RSA_size(const RSA *rsa);
|
224
|
-
|
225
|
-
/* RSAPublicKey_dup allocates a fresh |RSA| and copies the public key from
|
226
|
-
* |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */
|
227
|
-
OPENSSL_EXPORT RSA *RSAPublicKey_dup(const RSA *rsa);
|
228
|
-
|
229
|
-
/* RSAPrivateKey_dup allocates a fresh |RSA| and copies the private key from
|
230
|
-
* |rsa| into it. It returns the fresh |RSA| object, or NULL on error. */
|
231
|
-
OPENSSL_EXPORT RSA *RSAPrivateKey_dup(const RSA *rsa);
|
232
|
-
|
233
|
-
/* RSA_check_key performs basic validatity tests on |rsa|. It returns one if
|
234
|
-
* they pass and zero otherwise. Opaque keys and public keys always pass. If it
|
235
|
-
* returns zero then a more detailed error is available on the error queue. */
|
236
|
-
OPENSSL_EXPORT int RSA_check_key(const RSA *rsa);
|
237
|
-
|
238
|
-
/* RSA_add_pkcs1_prefix builds a version of |msg| prefixed with the DigestInfo
|
239
|
-
* header for the given hash function and sets |out_msg| to point to it. On
|
240
|
-
* successful return, |*out_msg| may be allocated memory and, if so,
|
241
|
-
* |*is_alloced| will be 1. */
|
242
|
-
OPENSSL_EXPORT int RSA_add_pkcs1_prefix(uint8_t **out_msg, size_t *out_msg_len,
|
243
|
-
int *is_alloced, int hash_nid,
|
244
|
-
const uint8_t *msg, size_t msg_len);
|
245
|
-
|
246
|
-
|
247
|
-
/* ASN.1 functions. */
|
248
|
-
|
249
|
-
/* RSA_parse_public_key parses a DER-encoded RSAPublicKey structure (RFC 3447)
|
250
|
-
* from |cbs| and advances |cbs|. It returns a newly-allocated |RSA| or NULL on
|
251
|
-
* error. */
|
252
|
-
OPENSSL_EXPORT RSA *RSA_parse_public_key(CBS *cbs);
|
253
|
-
|
254
|
-
/* RSA_public_key_from_bytes parses |in| as a DER-encoded RSAPublicKey structure
|
255
|
-
* (RFC 3447). It returns a newly-allocated |RSA| or NULL on error. */
|
256
|
-
OPENSSL_EXPORT RSA *RSA_public_key_from_bytes(const uint8_t *in, size_t in_len);
|
257
|
-
|
258
|
-
/* RSA_marshal_public_key marshals |rsa| as a DER-encoded RSAPublicKey structure
|
259
|
-
* (RFC 3447) and appends the result to |cbb|. It returns one on success and
|
260
|
-
* zero on failure. */
|
261
|
-
OPENSSL_EXPORT int RSA_marshal_public_key(CBB *cbb, const RSA *rsa);
|
262
|
-
|
263
|
-
/* RSA_public_key_to_bytes marshals |rsa| as a DER-encoded RSAPublicKey
|
264
|
-
* structure (RFC 3447) and, on success, sets |*out_bytes| to a newly allocated
|
265
|
-
* buffer containing the result and returns one. Otherwise, it returns zero. The
|
266
|
-
* result should be freed with |OPENSSL_free|. */
|
267
|
-
OPENSSL_EXPORT int RSA_public_key_to_bytes(uint8_t **out_bytes, size_t *out_len,
|
268
|
-
const RSA *rsa);
|
269
|
-
|
270
|
-
/* RSA_parse_private_key parses a DER-encoded RSAPrivateKey structure (RFC 3447)
|
271
|
-
* from |cbs| and advances |cbs|. It returns a newly-allocated |RSA| or NULL on
|
272
|
-
* error. */
|
273
|
-
OPENSSL_EXPORT RSA *RSA_parse_private_key(CBS *cbs);
|
274
|
-
|
275
|
-
/* RSA_private_key_from_bytes parses |in| as a DER-encoded RSAPrivateKey
|
276
|
-
* structure (RFC 3447). It returns a newly-allocated |RSA| or NULL on error. */
|
277
|
-
OPENSSL_EXPORT RSA *RSA_private_key_from_bytes(const uint8_t *in,
|
278
|
-
size_t in_len);
|
279
|
-
|
280
|
-
/* RSA_marshal_private_key marshals |rsa| as a DER-encoded RSAPrivateKey
|
281
|
-
* structure (RFC 3447) and appends the result to |cbb|. It returns one on
|
282
|
-
* success and zero on failure. */
|
283
|
-
OPENSSL_EXPORT int RSA_marshal_private_key(CBB *cbb, const RSA *rsa);
|
284
|
-
|
285
|
-
/* RSA_private_key_to_bytes marshals |rsa| as a DER-encoded RSAPrivateKey
|
286
|
-
* structure (RFC 3447) and, on success, sets |*out_bytes| to a newly allocated
|
287
|
-
* buffer containing the result and returns one. Otherwise, it returns zero. The
|
288
|
-
* result should be freed with |OPENSSL_free|. */
|
289
|
-
OPENSSL_EXPORT int RSA_private_key_to_bytes(uint8_t **out_bytes,
|
290
|
-
size_t *out_len, const RSA *rsa);
|
291
|
-
|
292
|
-
|
293
|
-
/* Flags. */
|
294
|
-
|
295
|
-
/* RSA_FLAG_CACHE_PUBLIC causes a precomputed Montgomery context to be created,
|
296
|
-
* on demand, for the public key operations. */
|
297
|
-
#define RSA_FLAG_CACHE_PUBLIC 2
|
298
|
-
|
299
|
-
/* RSA_FLAG_CACHE_PRIVATE causes a precomputed Montgomery context to be
|
300
|
-
* created, on demand, for the private key operations. */
|
301
|
-
#define RSA_FLAG_CACHE_PRIVATE 4
|
302
|
-
|
303
|
-
/* RSA_FLAG_NO_BLINDING disables blinding of private operations. */
|
304
|
-
#define RSA_FLAG_NO_BLINDING 8
|
305
|
-
|
306
|
-
|
307
|
-
/* RSA public exponent values. */
|
308
|
-
|
309
|
-
#define RSA_3 0x3
|
310
|
-
#define RSA_F4 0x10001
|
311
|
-
|
312
|
-
|
313
|
-
/* Private functions. */
|
314
|
-
|
315
|
-
typedef struct bn_blinding_st BN_BLINDING;
|
316
|
-
|
317
|
-
struct rsa_st {
|
318
|
-
BIGNUM *n;
|
319
|
-
BIGNUM *e;
|
320
|
-
BIGNUM *d;
|
321
|
-
BIGNUM *p;
|
322
|
-
BIGNUM *q;
|
323
|
-
BIGNUM *dmp1;
|
324
|
-
BIGNUM *dmq1;
|
325
|
-
BIGNUM *iqmp;
|
326
|
-
|
327
|
-
CRYPTO_refcount_t references;
|
328
|
-
int flags;
|
329
|
-
|
330
|
-
CRYPTO_MUTEX lock;
|
331
|
-
|
332
|
-
/* Used to cache montgomery values. The creation of these values is protected
|
333
|
-
* by |lock|. */
|
334
|
-
BN_MONT_CTX *mont_n;
|
335
|
-
BN_MONT_CTX *mont_p;
|
336
|
-
BN_MONT_CTX *mont_q;
|
337
|
-
|
338
|
-
/* num_blindings contains the size of the |blindings| and |blindings_inuse|
|
339
|
-
* arrays. This member and the |blindings_inuse| array are protected by
|
340
|
-
* |lock|. */
|
341
|
-
unsigned num_blindings;
|
342
|
-
/* blindings is an array of BN_BLINDING structures that can be reserved by a
|
343
|
-
* thread by locking |lock| and changing the corresponding element in
|
344
|
-
* |blindings_inuse| from 0 to 1. */
|
345
|
-
BN_BLINDING **blindings;
|
346
|
-
unsigned char *blindings_inuse;
|
347
|
-
};
|
348
|
-
|
349
|
-
|
350
|
-
#if defined(__cplusplus)
|
351
|
-
} /* extern C */
|
352
|
-
#endif
|
353
|
-
|
354
|
-
#define RSA_R_BAD_E_VALUE 100
|
355
|
-
#define RSA_R_BAD_FIXED_HEADER_DECRYPT 101
|
356
|
-
#define RSA_R_BAD_PAD_BYTE_COUNT 102
|
357
|
-
#define RSA_R_BAD_RSA_PARAMETERS 103
|
358
|
-
#define RSA_R_BAD_SIGNATURE 104
|
359
|
-
#define RSA_R_BLOCK_TYPE_IS_NOT_01 105
|
360
|
-
#define RSA_R_BN_NOT_INITIALIZED 106
|
361
|
-
#define RSA_R_CRT_PARAMS_ALREADY_GIVEN 107
|
362
|
-
#define RSA_R_CRT_VALUES_INCORRECT 108
|
363
|
-
#define RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN 109
|
364
|
-
#define RSA_R_DATA_TOO_LARGE 110
|
365
|
-
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 111
|
366
|
-
#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 112
|
367
|
-
#define RSA_R_DATA_TOO_SMALL 113
|
368
|
-
#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 114
|
369
|
-
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 115
|
370
|
-
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 116
|
371
|
-
#define RSA_R_EMPTY_PUBLIC_KEY 117
|
372
|
-
#define RSA_R_FIRST_OCTET_INVALID 118
|
373
|
-
#define RSA_R_INCONSISTENT_SET_OF_CRT_VALUES 119
|
374
|
-
#define RSA_R_INTERNAL_ERROR 120
|
375
|
-
#define RSA_R_INVALID_MESSAGE_LENGTH 121
|
376
|
-
#define RSA_R_KEY_SIZE_TOO_SMALL 122
|
377
|
-
#define RSA_R_LAST_OCTET_INVALID 123
|
378
|
-
#define RSA_R_MODULUS_TOO_LARGE 124
|
379
|
-
#define RSA_R_NO_PUBLIC_EXPONENT 125
|
380
|
-
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 126
|
381
|
-
#define RSA_R_N_NOT_EQUAL_P_Q 127
|
382
|
-
#define RSA_R_OAEP_DECODING_ERROR 128
|
383
|
-
#define RSA_R_ONLY_ONE_OF_P_Q_GIVEN 129
|
384
|
-
#define RSA_R_OUTPUT_BUFFER_TOO_SMALL 130
|
385
|
-
#define RSA_R_PADDING_CHECK_FAILED 131
|
386
|
-
#define RSA_R_PKCS_DECODING_ERROR 132
|
387
|
-
#define RSA_R_SLEN_CHECK_FAILED 133
|
388
|
-
#define RSA_R_SLEN_RECOVERY_FAILED 134
|
389
|
-
#define RSA_R_TOO_LONG 135
|
390
|
-
#define RSA_R_TOO_MANY_ITERATIONS 136
|
391
|
-
#define RSA_R_UNKNOWN_ALGORITHM_TYPE 137
|
392
|
-
#define RSA_R_UNKNOWN_PADDING_TYPE 138
|
393
|
-
#define RSA_R_VALUE_MISSING 139
|
394
|
-
#define RSA_R_WRONG_SIGNATURE_LENGTH 140
|
395
|
-
#define RSA_R_BAD_ENCODING 143
|
396
|
-
#define RSA_R_ENCODE_ERROR 144
|
397
|
-
#define RSA_R_BAD_VERSION 145
|
398
|
-
|
399
|
-
#endif /* OPENSSL_HEADER_RSA_H */
|