motion-openssl 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +53 -0
  3. data/lib/OpenSSL/aes.h +149 -0
  4. data/lib/OpenSSL/asn1.h +1419 -0
  5. data/lib/OpenSSL/asn1_mac.h +579 -0
  6. data/lib/OpenSSL/asn1t.h +973 -0
  7. data/lib/OpenSSL/bio.h +879 -0
  8. data/lib/OpenSSL/blowfish.h +130 -0
  9. data/lib/OpenSSL/bn.h +939 -0
  10. data/lib/OpenSSL/buffer.h +125 -0
  11. data/lib/OpenSSL/camellia.h +132 -0
  12. data/lib/OpenSSL/cast.h +107 -0
  13. data/lib/OpenSSL/cmac.h +82 -0
  14. data/lib/OpenSSL/cms.h +555 -0
  15. data/lib/OpenSSL/comp.h +79 -0
  16. data/lib/OpenSSL/conf.h +267 -0
  17. data/lib/OpenSSL/conf_api.h +89 -0
  18. data/lib/OpenSSL/crypto.h +661 -0
  19. data/lib/OpenSSL/des.h +257 -0
  20. data/lib/OpenSSL/des_old.h +497 -0
  21. data/lib/OpenSSL/dh.h +392 -0
  22. data/lib/OpenSSL/dsa.h +332 -0
  23. data/lib/OpenSSL/dso.h +451 -0
  24. data/lib/OpenSSL/dtls1.h +272 -0
  25. data/lib/OpenSSL/e_os2.h +328 -0
  26. data/lib/OpenSSL/ebcdic.h +26 -0
  27. data/lib/OpenSSL/ec.h +1282 -0
  28. data/lib/OpenSSL/ecdh.h +134 -0
  29. data/lib/OpenSSL/ecdsa.h +335 -0
  30. data/lib/OpenSSL/engine.h +960 -0
  31. data/lib/OpenSSL/err.h +389 -0
  32. data/lib/OpenSSL/evp.h +1534 -0
  33. data/lib/OpenSSL/hmac.h +109 -0
  34. data/lib/OpenSSL/idea.h +105 -0
  35. data/lib/OpenSSL/krb5_asn.h +240 -0
  36. data/lib/OpenSSL/kssl.h +197 -0
  37. data/lib/OpenSSL/lhash.h +240 -0
  38. data/lib/OpenSSL/libcrypto-tvOS.a +0 -0
  39. data/lib/OpenSSL/libcrypto.a +0 -0
  40. data/lib/OpenSSL/libssl-tvOS.a +0 -0
  41. data/lib/OpenSSL/libssl.a +0 -0
  42. data/lib/OpenSSL/md4.h +119 -0
  43. data/lib/OpenSSL/md5.h +119 -0
  44. data/lib/OpenSSL/mdc2.h +94 -0
  45. data/lib/OpenSSL/modes.h +163 -0
  46. data/lib/OpenSSL/obj_mac.h +4194 -0
  47. data/lib/OpenSSL/objects.h +1143 -0
  48. data/lib/OpenSSL/ocsp.h +637 -0
  49. data/lib/OpenSSL/opensslconf.h +262 -0
  50. data/lib/OpenSSL/opensslv.h +97 -0
  51. data/lib/OpenSSL/ossl_typ.h +211 -0
  52. data/lib/OpenSSL/pem.h +615 -0
  53. data/lib/OpenSSL/pem2.h +70 -0
  54. data/lib/OpenSSL/pkcs12.h +342 -0
  55. data/lib/OpenSSL/pkcs7.h +481 -0
  56. data/lib/OpenSSL/pqueue.h +99 -0
  57. data/lib/OpenSSL/rand.h +150 -0
  58. data/lib/OpenSSL/rc2.h +103 -0
  59. data/lib/OpenSSL/rc4.h +88 -0
  60. data/lib/OpenSSL/ripemd.h +105 -0
  61. data/lib/OpenSSL/rsa.h +664 -0
  62. data/lib/OpenSSL/safestack.h +2672 -0
  63. data/lib/OpenSSL/seed.h +149 -0
  64. data/lib/OpenSSL/sha.h +214 -0
  65. data/lib/OpenSSL/srp.h +169 -0
  66. data/lib/OpenSSL/srtp.h +147 -0
  67. data/lib/OpenSSL/ssl.h +3168 -0
  68. data/lib/OpenSSL/ssl2.h +265 -0
  69. data/lib/OpenSSL/ssl23.h +84 -0
  70. data/lib/OpenSSL/ssl3.h +774 -0
  71. data/lib/OpenSSL/stack.h +107 -0
  72. data/lib/OpenSSL/symhacks.h +516 -0
  73. data/lib/OpenSSL/tls1.h +810 -0
  74. data/lib/OpenSSL/ts.h +862 -0
  75. data/lib/OpenSSL/txt_db.h +112 -0
  76. data/lib/OpenSSL/ui.h +415 -0
  77. data/lib/OpenSSL/ui_compat.h +88 -0
  78. data/lib/OpenSSL/whrlpool.h +41 -0
  79. data/lib/OpenSSL/x509.h +1327 -0
  80. data/lib/OpenSSL/x509_vfy.h +647 -0
  81. data/lib/OpenSSL/x509v3.h +1055 -0
  82. data/lib/motion-openssl.rb +8 -0
  83. data/lib/motion-openssl/hooks.rb +8 -0
  84. data/lib/motion-openssl/hooks/openssl.rb +20 -0
  85. data/lib/motion-openssl/version.rb +5 -0
  86. data/motion/openssl.rb +1 -0
  87. data/motion/openssl/random.rb +18 -0
  88. metadata +229 -0
@@ -0,0 +1,149 @@
1
+ /*
2
+ * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
3
+ *
4
+ * Redistribution and use in source and binary forms, with or without
5
+ * modification, are permitted provided that the following conditions
6
+ * are met:
7
+ * 1. Redistributions of source code must retain the above copyright
8
+ * notice, this list of conditions and the following disclaimer.
9
+ * 2. Neither the name of author nor the names of its contributors may
10
+ * be used to endorse or promote products derived from this software
11
+ * without specific prior written permission.
12
+ *
13
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
+ * SUCH DAMAGE.
24
+ *
25
+ */
26
+ /* ====================================================================
27
+ * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
28
+ *
29
+ * Redistribution and use in source and binary forms, with or without
30
+ * modification, are permitted provided that the following conditions
31
+ * are met:
32
+ *
33
+ * 1. Redistributions of source code must retain the above copyright
34
+ * notice, this list of conditions and the following disclaimer.
35
+ *
36
+ * 2. Redistributions in binary form must reproduce the above copyright
37
+ * notice, this list of conditions and the following disclaimer in
38
+ * the documentation and/or other materials provided with the
39
+ * distribution.
40
+ *
41
+ * 3. All advertising materials mentioning features or use of this
42
+ * software must display the following acknowledgment:
43
+ * "This product includes software developed by the OpenSSL Project
44
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
45
+ *
46
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
47
+ * endorse or promote products derived from this software without
48
+ * prior written permission. For written permission, please contact
49
+ * openssl-core@openssl.org.
50
+ *
51
+ * 5. Products derived from this software may not be called "OpenSSL"
52
+ * nor may "OpenSSL" appear in their names without prior written
53
+ * permission of the OpenSSL Project.
54
+ *
55
+ * 6. Redistributions of any form whatsoever must retain the following
56
+ * acknowledgment:
57
+ * "This product includes software developed by the OpenSSL Project
58
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
59
+ *
60
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
61
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
63
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
64
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
65
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
66
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
67
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
69
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
70
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
71
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
72
+ * ====================================================================
73
+ *
74
+ * This product includes cryptographic software written by Eric Young
75
+ * (eay@cryptsoft.com). This product includes software written by Tim
76
+ * Hudson (tjh@cryptsoft.com).
77
+ *
78
+ */
79
+
80
+ #ifndef HEADER_SEED_H
81
+ # define HEADER_SEED_H
82
+
83
+ # include <openssl/opensslconf.h>
84
+ # include <openssl/e_os2.h>
85
+ # include <openssl/crypto.h>
86
+
87
+ # ifdef OPENSSL_NO_SEED
88
+ # error SEED is disabled.
89
+ # endif
90
+
91
+ /* look whether we need 'long' to get 32 bits */
92
+ # ifdef AES_LONG
93
+ # ifndef SEED_LONG
94
+ # define SEED_LONG 1
95
+ # endif
96
+ # endif
97
+
98
+ # if !defined(NO_SYS_TYPES_H)
99
+ # include <sys/types.h>
100
+ # endif
101
+
102
+ # define SEED_BLOCK_SIZE 16
103
+ # define SEED_KEY_LENGTH 16
104
+
105
+
106
+ #ifdef __cplusplus
107
+ extern "C" {
108
+ #endif
109
+
110
+ typedef struct seed_key_st {
111
+ # ifdef SEED_LONG
112
+ unsigned long data[32];
113
+ # else
114
+ unsigned int data[32];
115
+ # endif
116
+ } SEED_KEY_SCHEDULE;
117
+
118
+ # ifdef OPENSSL_FIPS
119
+ void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
120
+ SEED_KEY_SCHEDULE *ks);
121
+ # endif
122
+ void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
123
+ SEED_KEY_SCHEDULE *ks);
124
+
125
+ void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],
126
+ unsigned char d[SEED_BLOCK_SIZE],
127
+ const SEED_KEY_SCHEDULE *ks);
128
+ void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],
129
+ unsigned char d[SEED_BLOCK_SIZE],
130
+ const SEED_KEY_SCHEDULE *ks);
131
+
132
+ void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out,
133
+ const SEED_KEY_SCHEDULE *ks, int enc);
134
+ void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
135
+ const SEED_KEY_SCHEDULE *ks,
136
+ unsigned char ivec[SEED_BLOCK_SIZE], int enc);
137
+ void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
138
+ size_t len, const SEED_KEY_SCHEDULE *ks,
139
+ unsigned char ivec[SEED_BLOCK_SIZE], int *num,
140
+ int enc);
141
+ void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
142
+ size_t len, const SEED_KEY_SCHEDULE *ks,
143
+ unsigned char ivec[SEED_BLOCK_SIZE], int *num);
144
+
145
+ #ifdef __cplusplus
146
+ }
147
+ #endif
148
+
149
+ #endif /* HEADER_SEED_H */
@@ -0,0 +1,214 @@
1
+ /* crypto/sha/sha.h */
2
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3
+ * All rights reserved.
4
+ *
5
+ * This package is an SSL implementation written
6
+ * by Eric Young (eay@cryptsoft.com).
7
+ * The implementation was written so as to conform with Netscapes SSL.
8
+ *
9
+ * This library is free for commercial and non-commercial use as long as
10
+ * the following conditions are aheared to. The following conditions
11
+ * apply to all code found in this distribution, be it the RC4, RSA,
12
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13
+ * included with this distribution is covered by the same copyright terms
14
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15
+ *
16
+ * Copyright remains Eric Young's, and as such any Copyright notices in
17
+ * the code are not to be removed.
18
+ * If this package is used in a product, Eric Young should be given attribution
19
+ * as the author of the parts of the library used.
20
+ * This can be in the form of a textual message at program startup or
21
+ * in documentation (online or textual) provided with the package.
22
+ *
23
+ * Redistribution and use in source and binary forms, with or without
24
+ * modification, are permitted provided that the following conditions
25
+ * are met:
26
+ * 1. Redistributions of source code must retain the copyright
27
+ * notice, this list of conditions and the following disclaimer.
28
+ * 2. Redistributions in binary form must reproduce the above copyright
29
+ * notice, this list of conditions and the following disclaimer in the
30
+ * documentation and/or other materials provided with the distribution.
31
+ * 3. All advertising materials mentioning features or use of this software
32
+ * must display the following acknowledgement:
33
+ * "This product includes cryptographic software written by
34
+ * Eric Young (eay@cryptsoft.com)"
35
+ * The word 'cryptographic' can be left out if the rouines from the library
36
+ * being used are not cryptographic related :-).
37
+ * 4. If you include any Windows specific code (or a derivative thereof) from
38
+ * the apps directory (application code) you must include an acknowledgement:
39
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51
+ * SUCH DAMAGE.
52
+ *
53
+ * The licence and distribution terms for any publically available version or
54
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
55
+ * copied and put under another distribution licence
56
+ * [including the GNU Public Licence.]
57
+ */
58
+
59
+ #ifndef HEADER_SHA_H
60
+ # define HEADER_SHA_H
61
+
62
+ # include <openssl/e_os2.h>
63
+ # include <stddef.h>
64
+
65
+ #ifdef __cplusplus
66
+ extern "C" {
67
+ #endif
68
+
69
+ # if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))
70
+ # error SHA is disabled.
71
+ # endif
72
+
73
+ # if defined(OPENSSL_FIPS)
74
+ # define FIPS_SHA_SIZE_T size_t
75
+ # endif
76
+
77
+ /*-
78
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
79
+ * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
80
+ * ! SHA_LONG_LOG2 has to be defined along. !
81
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
82
+ */
83
+
84
+ # if defined(__LP32__)
85
+ # define SHA_LONG unsigned long
86
+ # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
87
+ # define SHA_LONG unsigned long
88
+ # define SHA_LONG_LOG2 3
89
+ # else
90
+ # define SHA_LONG unsigned int
91
+ # endif
92
+
93
+ # define SHA_LBLOCK 16
94
+ # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a
95
+ * contiguous array of 32 bit wide
96
+ * big-endian values. */
97
+ # define SHA_LAST_BLOCK (SHA_CBLOCK-8)
98
+ # define SHA_DIGEST_LENGTH 20
99
+
100
+ typedef struct SHAstate_st {
101
+ SHA_LONG h0, h1, h2, h3, h4;
102
+ SHA_LONG Nl, Nh;
103
+ SHA_LONG data[SHA_LBLOCK];
104
+ unsigned int num;
105
+ } SHA_CTX;
106
+
107
+ # ifndef OPENSSL_NO_SHA0
108
+ # ifdef OPENSSL_FIPS
109
+ int private_SHA_Init(SHA_CTX *c);
110
+ # endif
111
+ int SHA_Init(SHA_CTX *c);
112
+ int SHA_Update(SHA_CTX *c, const void *data, size_t len);
113
+ int SHA_Final(unsigned char *md, SHA_CTX *c);
114
+ unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
115
+ void SHA_Transform(SHA_CTX *c, const unsigned char *data);
116
+ # endif
117
+ # ifndef OPENSSL_NO_SHA1
118
+ # ifdef OPENSSL_FIPS
119
+ int private_SHA1_Init(SHA_CTX *c);
120
+ # endif
121
+ int SHA1_Init(SHA_CTX *c);
122
+ int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
123
+ int SHA1_Final(unsigned char *md, SHA_CTX *c);
124
+ unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
125
+ void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
126
+ # endif
127
+
128
+ # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a
129
+ * contiguous array of 32 bit wide
130
+ * big-endian values. */
131
+ # define SHA224_DIGEST_LENGTH 28
132
+ # define SHA256_DIGEST_LENGTH 32
133
+
134
+ typedef struct SHA256state_st {
135
+ SHA_LONG h[8];
136
+ SHA_LONG Nl, Nh;
137
+ SHA_LONG data[SHA_LBLOCK];
138
+ unsigned int num, md_len;
139
+ } SHA256_CTX;
140
+
141
+ # ifndef OPENSSL_NO_SHA256
142
+ # ifdef OPENSSL_FIPS
143
+ int private_SHA224_Init(SHA256_CTX *c);
144
+ int private_SHA256_Init(SHA256_CTX *c);
145
+ # endif
146
+ int SHA224_Init(SHA256_CTX *c);
147
+ int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
148
+ int SHA224_Final(unsigned char *md, SHA256_CTX *c);
149
+ unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md);
150
+ int SHA256_Init(SHA256_CTX *c);
151
+ int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
152
+ int SHA256_Final(unsigned char *md, SHA256_CTX *c);
153
+ unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md);
154
+ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
155
+ # endif
156
+
157
+ # define SHA384_DIGEST_LENGTH 48
158
+ # define SHA512_DIGEST_LENGTH 64
159
+
160
+ # ifndef OPENSSL_NO_SHA512
161
+ /*
162
+ * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
163
+ * being exactly 64-bit wide. See Implementation Notes in sha512.c
164
+ * for further details.
165
+ */
166
+ /*
167
+ * SHA-512 treats input data as a
168
+ * contiguous array of 64 bit
169
+ * wide big-endian values.
170
+ */
171
+ # define SHA512_CBLOCK (SHA_LBLOCK*8)
172
+ # if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
173
+ # define SHA_LONG64 unsigned __int64
174
+ # define U64(C) C##UI64
175
+ # elif defined(__arch64__)
176
+ # define SHA_LONG64 unsigned long
177
+ # define U64(C) C##UL
178
+ # else
179
+ # define SHA_LONG64 unsigned long long
180
+ # define U64(C) C##ULL
181
+ # endif
182
+
183
+ typedef struct SHA512state_st {
184
+ SHA_LONG64 h[8];
185
+ SHA_LONG64 Nl, Nh;
186
+ union {
187
+ SHA_LONG64 d[SHA_LBLOCK];
188
+ unsigned char p[SHA512_CBLOCK];
189
+ } u;
190
+ unsigned int num, md_len;
191
+ } SHA512_CTX;
192
+ # endif
193
+
194
+ # ifndef OPENSSL_NO_SHA512
195
+ # ifdef OPENSSL_FIPS
196
+ int private_SHA384_Init(SHA512_CTX *c);
197
+ int private_SHA512_Init(SHA512_CTX *c);
198
+ # endif
199
+ int SHA384_Init(SHA512_CTX *c);
200
+ int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
201
+ int SHA384_Final(unsigned char *md, SHA512_CTX *c);
202
+ unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md);
203
+ int SHA512_Init(SHA512_CTX *c);
204
+ int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
205
+ int SHA512_Final(unsigned char *md, SHA512_CTX *c);
206
+ unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md);
207
+ void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
208
+ # endif
209
+
210
+ #ifdef __cplusplus
211
+ }
212
+ #endif
213
+
214
+ #endif
@@ -0,0 +1,169 @@
1
+ /* crypto/srp/srp.h */
2
+ /*
3
+ * Written by Christophe Renou (christophe.renou@edelweb.fr) with the
4
+ * precious help of Peter Sylvester (peter.sylvester@edelweb.fr) for the
5
+ * EdelKey project and contributed to the OpenSSL project 2004.
6
+ */
7
+ /* ====================================================================
8
+ * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ *
14
+ * 1. Redistributions of source code must retain the above copyright
15
+ * notice, this list of conditions and the following disclaimer.
16
+ *
17
+ * 2. Redistributions in binary form must reproduce the above copyright
18
+ * notice, this list of conditions and the following disclaimer in
19
+ * the documentation and/or other materials provided with the
20
+ * distribution.
21
+ *
22
+ * 3. All advertising materials mentioning features or use of this
23
+ * software must display the following acknowledgment:
24
+ * "This product includes software developed by the OpenSSL Project
25
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
26
+ *
27
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28
+ * endorse or promote products derived from this software without
29
+ * prior written permission. For written permission, please contact
30
+ * licensing@OpenSSL.org.
31
+ *
32
+ * 5. Products derived from this software may not be called "OpenSSL"
33
+ * nor may "OpenSSL" appear in their names without prior written
34
+ * permission of the OpenSSL Project.
35
+ *
36
+ * 6. Redistributions of any form whatsoever must retain the following
37
+ * acknowledgment:
38
+ * "This product includes software developed by the OpenSSL Project
39
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
45
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
53
+ * ====================================================================
54
+ *
55
+ * This product includes cryptographic software written by Eric Young
56
+ * (eay@cryptsoft.com). This product includes software written by Tim
57
+ * Hudson (tjh@cryptsoft.com).
58
+ *
59
+ */
60
+ #ifndef __SRP_H__
61
+ # define __SRP_H__
62
+
63
+ # ifndef OPENSSL_NO_SRP
64
+
65
+ # include <stdio.h>
66
+ # include <string.h>
67
+
68
+ #ifdef __cplusplus
69
+ extern "C" {
70
+ #endif
71
+
72
+ # include <openssl/safestack.h>
73
+ # include <openssl/bn.h>
74
+ # include <openssl/crypto.h>
75
+
76
+ typedef struct SRP_gN_cache_st {
77
+ char *b64_bn;
78
+ BIGNUM *bn;
79
+ } SRP_gN_cache;
80
+
81
+
82
+ DECLARE_STACK_OF(SRP_gN_cache)
83
+
84
+ typedef struct SRP_user_pwd_st {
85
+ char *id;
86
+ BIGNUM *s;
87
+ BIGNUM *v;
88
+ const BIGNUM *g;
89
+ const BIGNUM *N;
90
+ char *info;
91
+ } SRP_user_pwd;
92
+
93
+ DECLARE_STACK_OF(SRP_user_pwd)
94
+
95
+ typedef struct SRP_VBASE_st {
96
+ STACK_OF(SRP_user_pwd) *users_pwd;
97
+ STACK_OF(SRP_gN_cache) *gN_cache;
98
+ /* to simulate a user */
99
+ char *seed_key;
100
+ BIGNUM *default_g;
101
+ BIGNUM *default_N;
102
+ } SRP_VBASE;
103
+
104
+ /*
105
+ * Structure interne pour retenir les couples N et g
106
+ */
107
+ typedef struct SRP_gN_st {
108
+ char *id;
109
+ BIGNUM *g;
110
+ BIGNUM *N;
111
+ } SRP_gN;
112
+
113
+ DECLARE_STACK_OF(SRP_gN)
114
+
115
+ SRP_VBASE *SRP_VBASE_new(char *seed_key);
116
+ int SRP_VBASE_free(SRP_VBASE *vb);
117
+ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
118
+ SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
119
+ char *SRP_create_verifier(const char *user, const char *pass, char **salt,
120
+ char **verifier, const char *N, const char *g);
121
+ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
122
+ BIGNUM **verifier, BIGNUM *N, BIGNUM *g);
123
+
124
+ # define SRP_NO_ERROR 0
125
+ # define SRP_ERR_VBASE_INCOMPLETE_FILE 1
126
+ # define SRP_ERR_VBASE_BN_LIB 2
127
+ # define SRP_ERR_OPEN_FILE 3
128
+ # define SRP_ERR_MEMORY 4
129
+
130
+ # define DB_srptype 0
131
+ # define DB_srpverifier 1
132
+ # define DB_srpsalt 2
133
+ # define DB_srpid 3
134
+ # define DB_srpgN 4
135
+ # define DB_srpinfo 5
136
+ # undef DB_NUMBER
137
+ # define DB_NUMBER 6
138
+
139
+ # define DB_SRP_INDEX 'I'
140
+ # define DB_SRP_VALID 'V'
141
+ # define DB_SRP_REVOKED 'R'
142
+ # define DB_SRP_MODIF 'v'
143
+
144
+ /* see srp.c */
145
+ char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N);
146
+ SRP_gN *SRP_get_default_gN(const char *id);
147
+
148
+ /* server side .... */
149
+ BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,
150
+ BIGNUM *N);
151
+ BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);
152
+ int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);
153
+ BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N);
154
+
155
+ /* client side .... */
156
+ BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);
157
+ BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);
158
+ BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
159
+ BIGNUM *a, BIGNUM *u);
160
+ int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
161
+
162
+ # define SRP_MINIMAL_N 1024
163
+
164
+ #ifdef __cplusplus
165
+ }
166
+ #endif
167
+
168
+ # endif
169
+ #endif