openssl_rsa_pss_verify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +2 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +35 -0
  7. data/README +1 -0
  8. data/Rakefile +4 -0
  9. data/ext/openssl_rsa_pss_verify/extconf.rb +15 -0
  10. data/ext/openssl_rsa_pss_verify/openssl_rsa_pss_verify_ext.c +56 -0
  11. data/lib/openssl_rsa_pss_verify/version.rb +3 -0
  12. data/lib/openssl_rsa_pss_verify.rb +2 -0
  13. data/openssl_rsa_pss_verify.gemspec +26 -0
  14. data/tasks/compile.rake +12 -0
  15. data/tasks/rspec.rake +12 -0
  16. data/vendor/openssl/include/openssl/aes.h +147 -0
  17. data/vendor/openssl/include/openssl/asn1.h +1404 -0
  18. data/vendor/openssl/include/openssl/asn1_mac.h +578 -0
  19. data/vendor/openssl/include/openssl/asn1t.h +960 -0
  20. data/vendor/openssl/include/openssl/bio.h +847 -0
  21. data/vendor/openssl/include/openssl/blowfish.h +129 -0
  22. data/vendor/openssl/include/openssl/bn.h +891 -0
  23. data/vendor/openssl/include/openssl/buffer.h +119 -0
  24. data/vendor/openssl/include/openssl/camellia.h +130 -0
  25. data/vendor/openssl/include/openssl/cast.h +107 -0
  26. data/vendor/openssl/include/openssl/cmac.h +82 -0
  27. data/vendor/openssl/include/openssl/cms.h +501 -0
  28. data/vendor/openssl/include/openssl/comp.h +80 -0
  29. data/vendor/openssl/include/openssl/conf.h +263 -0
  30. data/vendor/openssl/include/openssl/conf_api.h +89 -0
  31. data/vendor/openssl/include/openssl/crypto.h +611 -0
  32. data/vendor/openssl/include/openssl/des.h +248 -0
  33. data/vendor/openssl/include/openssl/des_old.h +446 -0
  34. data/vendor/openssl/include/openssl/dh.h +280 -0
  35. data/vendor/openssl/include/openssl/dsa.h +327 -0
  36. data/vendor/openssl/include/openssl/dso.h +409 -0
  37. data/vendor/openssl/include/openssl/dtls1.h +287 -0
  38. data/vendor/openssl/include/openssl/e_os2.h +315 -0
  39. data/vendor/openssl/include/openssl/ebcdic.h +19 -0
  40. data/vendor/openssl/include/openssl/ec.h +1167 -0
  41. data/vendor/openssl/include/openssl/ecdh.h +125 -0
  42. data/vendor/openssl/include/openssl/ecdsa.h +260 -0
  43. data/vendor/openssl/include/openssl/engine.h +842 -0
  44. data/vendor/openssl/include/openssl/err.h +386 -0
  45. data/vendor/openssl/include/openssl/evp.h +1409 -0
  46. data/vendor/openssl/include/openssl/hmac.h +110 -0
  47. data/vendor/openssl/include/openssl/idea.h +103 -0
  48. data/vendor/openssl/include/openssl/krb5_asn.h +256 -0
  49. data/vendor/openssl/include/openssl/kssl.h +183 -0
  50. data/vendor/openssl/include/openssl/lhash.h +241 -0
  51. data/vendor/openssl/include/openssl/md4.h +120 -0
  52. data/vendor/openssl/include/openssl/md5.h +120 -0
  53. data/vendor/openssl/include/openssl/mdc2.h +98 -0
  54. data/vendor/openssl/include/openssl/modes.h +135 -0
  55. data/vendor/openssl/include/openssl/obj_mac.h +4032 -0
  56. data/vendor/openssl/include/openssl/objects.h +1138 -0
  57. data/vendor/openssl/include/openssl/ocsp.h +623 -0
  58. data/vendor/openssl/include/openssl/opensslconf.h +234 -0
  59. data/vendor/openssl/include/openssl/opensslv.h +89 -0
  60. data/vendor/openssl/include/openssl/ossl_typ.h +202 -0
  61. data/vendor/openssl/include/openssl/pem.h +641 -0
  62. data/vendor/openssl/include/openssl/pem2.h +70 -0
  63. data/vendor/openssl/include/openssl/pkcs12.h +331 -0
  64. data/vendor/openssl/include/openssl/pkcs7.h +499 -0
  65. data/vendor/openssl/include/openssl/pqueue.h +94 -0
  66. data/vendor/openssl/include/openssl/rand.h +149 -0
  67. data/vendor/openssl/include/openssl/rc2.h +103 -0
  68. data/vendor/openssl/include/openssl/rc4.h +90 -0
  69. data/vendor/openssl/include/openssl/ripemd.h +107 -0
  70. data/vendor/openssl/include/openssl/rsa.h +582 -0
  71. data/vendor/openssl/include/openssl/safestack.h +2663 -0
  72. data/vendor/openssl/include/openssl/seed.h +139 -0
  73. data/vendor/openssl/include/openssl/sha.h +214 -0
  74. data/vendor/openssl/include/openssl/srp.h +172 -0
  75. data/vendor/openssl/include/openssl/srtp.h +145 -0
  76. data/vendor/openssl/include/openssl/ssl.h +2579 -0
  77. data/vendor/openssl/include/openssl/ssl2.h +272 -0
  78. data/vendor/openssl/include/openssl/ssl23.h +83 -0
  79. data/vendor/openssl/include/openssl/ssl3.h +684 -0
  80. data/vendor/openssl/include/openssl/stack.h +108 -0
  81. data/vendor/openssl/include/openssl/symhacks.h +475 -0
  82. data/vendor/openssl/include/openssl/tls1.h +735 -0
  83. data/vendor/openssl/include/openssl/ts.h +858 -0
  84. data/vendor/openssl/include/openssl/txt_db.h +112 -0
  85. data/vendor/openssl/include/openssl/ui.h +383 -0
  86. data/vendor/openssl/include/openssl/ui_compat.h +83 -0
  87. data/vendor/openssl/include/openssl/whrlpool.h +41 -0
  88. data/vendor/openssl/include/openssl/x509.h +1297 -0
  89. data/vendor/openssl/include/openssl/x509_vfy.h +567 -0
  90. data/vendor/openssl/include/openssl/x509v3.h +1007 -0
  91. data/vendor/openssl/lib/engines/lib4758cca.so +0 -0
  92. data/vendor/openssl/lib/engines/libaep.so +0 -0
  93. data/vendor/openssl/lib/engines/libatalla.so +0 -0
  94. data/vendor/openssl/lib/engines/libcapi.so +0 -0
  95. data/vendor/openssl/lib/engines/libchil.so +0 -0
  96. data/vendor/openssl/lib/engines/libcswift.so +0 -0
  97. data/vendor/openssl/lib/engines/libgmp.so +0 -0
  98. data/vendor/openssl/lib/engines/libgost.so +0 -0
  99. data/vendor/openssl/lib/engines/libnuron.so +0 -0
  100. data/vendor/openssl/lib/engines/libpadlock.so +0 -0
  101. data/vendor/openssl/lib/engines/libsureware.so +0 -0
  102. data/vendor/openssl/lib/engines/libubsec.so +0 -0
  103. data/vendor/openssl/lib/libcrypto.a +0 -0
  104. data/vendor/openssl/lib/libcrypto.so +0 -0
  105. data/vendor/openssl/lib/libcrypto.so.1.0.0 +0 -0
  106. data/vendor/openssl/lib/libssl.a +0 -0
  107. data/vendor/openssl/lib/libssl.so +0 -0
  108. data/vendor/openssl/lib/libssl.so.1.0.0 +0 -0
  109. data/vendor/openssl/lib/pkgconfig/libcrypto.pc +12 -0
  110. data/vendor/openssl/lib/pkgconfig/libssl.pc +12 -0
  111. data/vendor/openssl/lib/pkgconfig/openssl.pc +12 -0
  112. metadata +208 -0
@@ -0,0 +1,409 @@
1
+ /* dso.h -*- mode:C; c-file-style: "eay" -*- */
2
+ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3
+ * project 2000.
4
+ */
5
+ /* ====================================================================
6
+ * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ *
12
+ * 1. Redistributions of source code must retain the above copyright
13
+ * notice, this list of conditions and the following disclaimer.
14
+ *
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in
17
+ * the documentation and/or other materials provided with the
18
+ * distribution.
19
+ *
20
+ * 3. All advertising materials mentioning features or use of this
21
+ * software must display the following acknowledgment:
22
+ * "This product includes software developed by the OpenSSL Project
23
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24
+ *
25
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26
+ * endorse or promote products derived from this software without
27
+ * prior written permission. For written permission, please contact
28
+ * licensing@OpenSSL.org.
29
+ *
30
+ * 5. Products derived from this software may not be called "OpenSSL"
31
+ * nor may "OpenSSL" appear in their names without prior written
32
+ * permission of the OpenSSL Project.
33
+ *
34
+ * 6. Redistributions of any form whatsoever must retain the following
35
+ * acknowledgment:
36
+ * "This product includes software developed by the OpenSSL Project
37
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38
+ *
39
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
51
+ * ====================================================================
52
+ *
53
+ * This product includes cryptographic software written by Eric Young
54
+ * (eay@cryptsoft.com). This product includes software written by Tim
55
+ * Hudson (tjh@cryptsoft.com).
56
+ *
57
+ */
58
+
59
+ #ifndef HEADER_DSO_H
60
+ #define HEADER_DSO_H
61
+
62
+ #include <openssl/crypto.h>
63
+
64
+ #ifdef __cplusplus
65
+ extern "C" {
66
+ #endif
67
+
68
+ /* These values are used as commands to DSO_ctrl() */
69
+ #define DSO_CTRL_GET_FLAGS 1
70
+ #define DSO_CTRL_SET_FLAGS 2
71
+ #define DSO_CTRL_OR_FLAGS 3
72
+
73
+ /* By default, DSO_load() will translate the provided filename into a form
74
+ * typical for the platform (more specifically the DSO_METHOD) using the
75
+ * dso_name_converter function of the method. Eg. win32 will transform "blah"
76
+ * into "blah.dll", and dlfcn will transform it into "libblah.so". The
77
+ * behaviour can be overriden by setting the name_converter callback in the DSO
78
+ * object (using DSO_set_name_converter()). This callback could even utilise
79
+ * the DSO_METHOD's converter too if it only wants to override behaviour for
80
+ * one or two possible DSO methods. However, the following flag can be set in a
81
+ * DSO to prevent *any* native name-translation at all - eg. if the caller has
82
+ * prompted the user for a path to a driver library so the filename should be
83
+ * interpreted as-is. */
84
+ #define DSO_FLAG_NO_NAME_TRANSLATION 0x01
85
+ /* An extra flag to give if only the extension should be added as
86
+ * translation. This is obviously only of importance on Unix and
87
+ * other operating systems where the translation also may prefix
88
+ * the name with something, like 'lib', and ignored everywhere else.
89
+ * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used
90
+ * at the same time. */
91
+ #define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02
92
+
93
+ /* The following flag controls the translation of symbol names to upper
94
+ * case. This is currently only being implemented for OpenVMS.
95
+ */
96
+ #define DSO_FLAG_UPCASE_SYMBOL 0x10
97
+
98
+ /* This flag loads the library with public symbols.
99
+ * Meaning: The exported symbols of this library are public
100
+ * to all libraries loaded after this library.
101
+ * At the moment only implemented in unix.
102
+ */
103
+ #define DSO_FLAG_GLOBAL_SYMBOLS 0x20
104
+
105
+
106
+ typedef void (*DSO_FUNC_TYPE)(void);
107
+
108
+ typedef struct dso_st DSO;
109
+
110
+ /* The function prototype used for method functions (or caller-provided
111
+ * callbacks) that transform filenames. They are passed a DSO structure pointer
112
+ * (or NULL if they are to be used independantly of a DSO object) and a
113
+ * filename to transform. They should either return NULL (if there is an error
114
+ * condition) or a newly allocated string containing the transformed form that
115
+ * the caller will need to free with OPENSSL_free() when done. */
116
+ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
117
+ /* The function prototype used for method functions (or caller-provided
118
+ * callbacks) that merge two file specifications. They are passed a
119
+ * DSO structure pointer (or NULL if they are to be used independantly of
120
+ * a DSO object) and two file specifications to merge. They should
121
+ * either return NULL (if there is an error condition) or a newly allocated
122
+ * string containing the result of merging that the caller will need
123
+ * to free with OPENSSL_free() when done.
124
+ * Here, merging means that bits and pieces are taken from each of the
125
+ * file specifications and added together in whatever fashion that is
126
+ * sensible for the DSO method in question. The only rule that really
127
+ * applies is that if the two specification contain pieces of the same
128
+ * type, the copy from the first string takes priority. One could see
129
+ * it as the first specification is the one given by the user and the
130
+ * second being a bunch of defaults to add on if they're missing in the
131
+ * first. */
132
+ typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
133
+
134
+ typedef struct dso_meth_st
135
+ {
136
+ const char *name;
137
+ /* Loads a shared library, NB: new DSO_METHODs must ensure that a
138
+ * successful load populates the loaded_filename field, and likewise a
139
+ * successful unload OPENSSL_frees and NULLs it out. */
140
+ int (*dso_load)(DSO *dso);
141
+ /* Unloads a shared library */
142
+ int (*dso_unload)(DSO *dso);
143
+ /* Binds a variable */
144
+ void *(*dso_bind_var)(DSO *dso, const char *symname);
145
+ /* Binds a function - assumes a return type of DSO_FUNC_TYPE.
146
+ * This should be cast to the real function prototype by the
147
+ * caller. Platforms that don't have compatible representations
148
+ * for different prototypes (this is possible within ANSI C)
149
+ * are highly unlikely to have shared libraries at all, let
150
+ * alone a DSO_METHOD implemented for them. */
151
+ DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname);
152
+
153
+ /* I don't think this would actually be used in any circumstances. */
154
+ #if 0
155
+ /* Unbinds a variable */
156
+ int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr);
157
+ /* Unbinds a function */
158
+ int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
159
+ #endif
160
+ /* The generic (yuck) "ctrl()" function. NB: Negative return
161
+ * values (rather than zero) indicate errors. */
162
+ long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg);
163
+ /* The default DSO_METHOD-specific function for converting filenames to
164
+ * a canonical native form. */
165
+ DSO_NAME_CONVERTER_FUNC dso_name_converter;
166
+ /* The default DSO_METHOD-specific function for converting filenames to
167
+ * a canonical native form. */
168
+ DSO_MERGER_FUNC dso_merger;
169
+
170
+ /* [De]Initialisation handlers. */
171
+ int (*init)(DSO *dso);
172
+ int (*finish)(DSO *dso);
173
+
174
+ /* Return pathname of the module containing location */
175
+ int (*pathbyaddr)(void *addr,char *path,int sz);
176
+ /* Perform global symbol lookup, i.e. among *all* modules */
177
+ void *(*globallookup)(const char *symname);
178
+ } DSO_METHOD;
179
+
180
+ /**********************************************************************/
181
+ /* The low-level handle type used to refer to a loaded shared library */
182
+
183
+ struct dso_st
184
+ {
185
+ DSO_METHOD *meth;
186
+ /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS
187
+ * doesn't use anything but will need to cache the filename
188
+ * for use in the dso_bind handler. All in all, let each
189
+ * method control its own destiny. "Handles" and such go in
190
+ * a STACK. */
191
+ STACK_OF(void) *meth_data;
192
+ int references;
193
+ int flags;
194
+ /* For use by applications etc ... use this for your bits'n'pieces,
195
+ * don't touch meth_data! */
196
+ CRYPTO_EX_DATA ex_data;
197
+ /* If this callback function pointer is set to non-NULL, then it will
198
+ * be used in DSO_load() in place of meth->dso_name_converter. NB: This
199
+ * should normally set using DSO_set_name_converter(). */
200
+ DSO_NAME_CONVERTER_FUNC name_converter;
201
+ /* If this callback function pointer is set to non-NULL, then it will
202
+ * be used in DSO_load() in place of meth->dso_merger. NB: This
203
+ * should normally set using DSO_set_merger(). */
204
+ DSO_MERGER_FUNC merger;
205
+ /* This is populated with (a copy of) the platform-independant
206
+ * filename used for this DSO. */
207
+ char *filename;
208
+ /* This is populated with (a copy of) the translated filename by which
209
+ * the DSO was actually loaded. It is NULL iff the DSO is not currently
210
+ * loaded. NB: This is here because the filename translation process
211
+ * may involve a callback being invoked more than once not only to
212
+ * convert to a platform-specific form, but also to try different
213
+ * filenames in the process of trying to perform a load. As such, this
214
+ * variable can be used to indicate (a) whether this DSO structure
215
+ * corresponds to a loaded library or not, and (b) the filename with
216
+ * which it was actually loaded. */
217
+ char *loaded_filename;
218
+ };
219
+
220
+
221
+ DSO * DSO_new(void);
222
+ DSO * DSO_new_method(DSO_METHOD *method);
223
+ int DSO_free(DSO *dso);
224
+ int DSO_flags(DSO *dso);
225
+ int DSO_up_ref(DSO *dso);
226
+ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg);
227
+
228
+ /* This function sets the DSO's name_converter callback. If it is non-NULL,
229
+ * then it will be used instead of the associated DSO_METHOD's function. If
230
+ * oldcb is non-NULL then it is set to the function pointer value being
231
+ * replaced. Return value is non-zero for success. */
232
+ int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,
233
+ DSO_NAME_CONVERTER_FUNC *oldcb);
234
+ /* These functions can be used to get/set the platform-independant filename
235
+ * used for a DSO. NB: set will fail if the DSO is already loaded. */
236
+ const char *DSO_get_filename(DSO *dso);
237
+ int DSO_set_filename(DSO *dso, const char *filename);
238
+ /* This function will invoke the DSO's name_converter callback to translate a
239
+ * filename, or if the callback isn't set it will instead use the DSO_METHOD's
240
+ * converter. If "filename" is NULL, the "filename" in the DSO itself will be
241
+ * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is
242
+ * simply duplicated. NB: This function is usually called from within a
243
+ * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that
244
+ * caller-created DSO_METHODs can do the same thing. A non-NULL return value
245
+ * will need to be OPENSSL_free()'d. */
246
+ char *DSO_convert_filename(DSO *dso, const char *filename);
247
+ /* This function will invoke the DSO's merger callback to merge two file
248
+ * specifications, or if the callback isn't set it will instead use the
249
+ * DSO_METHOD's merger. A non-NULL return value will need to be
250
+ * OPENSSL_free()'d. */
251
+ char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
252
+ /* If the DSO is currently loaded, this returns the filename that it was loaded
253
+ * under, otherwise it returns NULL. So it is also useful as a test as to
254
+ * whether the DSO is currently loaded. NB: This will not necessarily return
255
+ * the same value as DSO_convert_filename(dso, dso->filename), because the
256
+ * DSO_METHOD's load function may have tried a variety of filenames (with
257
+ * and/or without the aid of the converters) before settling on the one it
258
+ * actually loaded. */
259
+ const char *DSO_get_loaded_filename(DSO *dso);
260
+
261
+ void DSO_set_default_method(DSO_METHOD *meth);
262
+ DSO_METHOD *DSO_get_default_method(void);
263
+ DSO_METHOD *DSO_get_method(DSO *dso);
264
+ DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
265
+
266
+ /* The all-singing all-dancing load function, you normally pass NULL
267
+ * for the first and third parameters. Use DSO_up and DSO_free for
268
+ * subsequent reference count handling. Any flags passed in will be set
269
+ * in the constructed DSO after its init() function but before the
270
+ * load operation. If 'dso' is non-NULL, 'flags' is ignored. */
271
+ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);
272
+
273
+ /* This function binds to a variable inside a shared library. */
274
+ void *DSO_bind_var(DSO *dso, const char *symname);
275
+
276
+ /* This function binds to a function inside a shared library. */
277
+ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);
278
+
279
+ /* This method is the default, but will beg, borrow, or steal whatever
280
+ * method should be the default on any particular platform (including
281
+ * DSO_METH_null() if necessary). */
282
+ DSO_METHOD *DSO_METHOD_openssl(void);
283
+
284
+ /* This method is defined for all platforms - if a platform has no
285
+ * DSO support then this will be the only method! */
286
+ DSO_METHOD *DSO_METHOD_null(void);
287
+
288
+ /* If DSO_DLFCN is defined, the standard dlfcn.h-style functions
289
+ * (dlopen, dlclose, dlsym, etc) will be used and incorporated into
290
+ * this method. If not, this method will return NULL. */
291
+ DSO_METHOD *DSO_METHOD_dlfcn(void);
292
+
293
+ /* If DSO_DL is defined, the standard dl.h-style functions (shl_load,
294
+ * shl_unload, shl_findsym, etc) will be used and incorporated into
295
+ * this method. If not, this method will return NULL. */
296
+ DSO_METHOD *DSO_METHOD_dl(void);
297
+
298
+ /* If WIN32 is defined, use DLLs. If not, return NULL. */
299
+ DSO_METHOD *DSO_METHOD_win32(void);
300
+
301
+ /* If VMS is defined, use shared images. If not, return NULL. */
302
+ DSO_METHOD *DSO_METHOD_vms(void);
303
+
304
+ /* This function writes null-terminated pathname of DSO module
305
+ * containing 'addr' into 'sz' large caller-provided 'path' and
306
+ * returns the number of characters [including trailing zero]
307
+ * written to it. If 'sz' is 0 or negative, 'path' is ignored and
308
+ * required amount of charachers [including trailing zero] to
309
+ * accomodate pathname is returned. If 'addr' is NULL, then
310
+ * pathname of cryptolib itself is returned. Negative or zero
311
+ * return value denotes error.
312
+ */
313
+ int DSO_pathbyaddr(void *addr,char *path,int sz);
314
+
315
+ /* This function should be used with caution! It looks up symbols in
316
+ * *all* loaded modules and if module gets unloaded by somebody else
317
+ * attempt to dereference the pointer is doomed to have fatal
318
+ * consequences. Primary usage for this function is to probe *core*
319
+ * system functionality, e.g. check if getnameinfo(3) is available
320
+ * at run-time without bothering about OS-specific details such as
321
+ * libc.so.versioning or where does it actually reside: in libc
322
+ * itself or libsocket. */
323
+ void *DSO_global_lookup(const char *name);
324
+
325
+ /* If BeOS is defined, use shared images. If not, return NULL. */
326
+ DSO_METHOD *DSO_METHOD_beos(void);
327
+
328
+ /* BEGIN ERROR CODES */
329
+ /* The following lines are auto generated by the script mkerr.pl. Any changes
330
+ * made after this point may be overwritten when the script is next run.
331
+ */
332
+ void ERR_load_DSO_strings(void);
333
+
334
+ /* Error codes for the DSO functions. */
335
+
336
+ /* Function codes. */
337
+ #define DSO_F_BEOS_BIND_FUNC 144
338
+ #define DSO_F_BEOS_BIND_VAR 145
339
+ #define DSO_F_BEOS_LOAD 146
340
+ #define DSO_F_BEOS_NAME_CONVERTER 147
341
+ #define DSO_F_BEOS_UNLOAD 148
342
+ #define DSO_F_DLFCN_BIND_FUNC 100
343
+ #define DSO_F_DLFCN_BIND_VAR 101
344
+ #define DSO_F_DLFCN_LOAD 102
345
+ #define DSO_F_DLFCN_MERGER 130
346
+ #define DSO_F_DLFCN_NAME_CONVERTER 123
347
+ #define DSO_F_DLFCN_UNLOAD 103
348
+ #define DSO_F_DL_BIND_FUNC 104
349
+ #define DSO_F_DL_BIND_VAR 105
350
+ #define DSO_F_DL_LOAD 106
351
+ #define DSO_F_DL_MERGER 131
352
+ #define DSO_F_DL_NAME_CONVERTER 124
353
+ #define DSO_F_DL_UNLOAD 107
354
+ #define DSO_F_DSO_BIND_FUNC 108
355
+ #define DSO_F_DSO_BIND_VAR 109
356
+ #define DSO_F_DSO_CONVERT_FILENAME 126
357
+ #define DSO_F_DSO_CTRL 110
358
+ #define DSO_F_DSO_FREE 111
359
+ #define DSO_F_DSO_GET_FILENAME 127
360
+ #define DSO_F_DSO_GET_LOADED_FILENAME 128
361
+ #define DSO_F_DSO_GLOBAL_LOOKUP 139
362
+ #define DSO_F_DSO_LOAD 112
363
+ #define DSO_F_DSO_MERGE 132
364
+ #define DSO_F_DSO_NEW_METHOD 113
365
+ #define DSO_F_DSO_PATHBYADDR 140
366
+ #define DSO_F_DSO_SET_FILENAME 129
367
+ #define DSO_F_DSO_SET_NAME_CONVERTER 122
368
+ #define DSO_F_DSO_UP_REF 114
369
+ #define DSO_F_GLOBAL_LOOKUP_FUNC 138
370
+ #define DSO_F_PATHBYADDR 137
371
+ #define DSO_F_VMS_BIND_SYM 115
372
+ #define DSO_F_VMS_LOAD 116
373
+ #define DSO_F_VMS_MERGER 133
374
+ #define DSO_F_VMS_UNLOAD 117
375
+ #define DSO_F_WIN32_BIND_FUNC 118
376
+ #define DSO_F_WIN32_BIND_VAR 119
377
+ #define DSO_F_WIN32_GLOBALLOOKUP 142
378
+ #define DSO_F_WIN32_GLOBALLOOKUP_FUNC 143
379
+ #define DSO_F_WIN32_JOINER 135
380
+ #define DSO_F_WIN32_LOAD 120
381
+ #define DSO_F_WIN32_MERGER 134
382
+ #define DSO_F_WIN32_NAME_CONVERTER 125
383
+ #define DSO_F_WIN32_PATHBYADDR 141
384
+ #define DSO_F_WIN32_SPLITTER 136
385
+ #define DSO_F_WIN32_UNLOAD 121
386
+
387
+ /* Reason codes. */
388
+ #define DSO_R_CTRL_FAILED 100
389
+ #define DSO_R_DSO_ALREADY_LOADED 110
390
+ #define DSO_R_EMPTY_FILE_STRUCTURE 113
391
+ #define DSO_R_FAILURE 114
392
+ #define DSO_R_FILENAME_TOO_BIG 101
393
+ #define DSO_R_FINISH_FAILED 102
394
+ #define DSO_R_INCORRECT_FILE_SYNTAX 115
395
+ #define DSO_R_LOAD_FAILED 103
396
+ #define DSO_R_NAME_TRANSLATION_FAILED 109
397
+ #define DSO_R_NO_FILENAME 111
398
+ #define DSO_R_NO_FILE_SPECIFICATION 116
399
+ #define DSO_R_NULL_HANDLE 104
400
+ #define DSO_R_SET_FILENAME_FAILED 112
401
+ #define DSO_R_STACK_ERROR 105
402
+ #define DSO_R_SYM_FAILURE 106
403
+ #define DSO_R_UNLOAD_FAILED 107
404
+ #define DSO_R_UNSUPPORTED 108
405
+
406
+ #ifdef __cplusplus
407
+ }
408
+ #endif
409
+ #endif
@@ -0,0 +1,287 @@
1
+ /* ssl/dtls1.h */
2
+ /*
3
+ * DTLS implementation written by Nagendra Modadugu
4
+ * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5
+ */
6
+ /* ====================================================================
7
+ * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
8
+ *
9
+ * Redistribution and use in source and binary forms, with or without
10
+ * modification, are permitted provided that the following conditions
11
+ * are met:
12
+ *
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ * notice, this list of conditions and the following disclaimer.
15
+ *
16
+ * 2. Redistributions in binary form must reproduce the above copyright
17
+ * notice, this list of conditions and the following disclaimer in
18
+ * the documentation and/or other materials provided with the
19
+ * distribution.
20
+ *
21
+ * 3. All advertising materials mentioning features or use of this
22
+ * software must display the following acknowledgment:
23
+ * "This product includes software developed by the OpenSSL Project
24
+ * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25
+ *
26
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27
+ * endorse or promote products derived from this software without
28
+ * prior written permission. For written permission, please contact
29
+ * openssl-core@OpenSSL.org.
30
+ *
31
+ * 5. Products derived from this software may not be called "OpenSSL"
32
+ * nor may "OpenSSL" appear in their names without prior written
33
+ * permission of the OpenSSL Project.
34
+ *
35
+ * 6. Redistributions of any form whatsoever must retain the following
36
+ * acknowledgment:
37
+ * "This product includes software developed by the OpenSSL Project
38
+ * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39
+ *
40
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
52
+ * ====================================================================
53
+ *
54
+ * This product includes cryptographic software written by Eric Young
55
+ * (eay@cryptsoft.com). This product includes software written by Tim
56
+ * Hudson (tjh@cryptsoft.com).
57
+ *
58
+ */
59
+
60
+ #ifndef HEADER_DTLS1_H
61
+ #define HEADER_DTLS1_H
62
+
63
+ #include <openssl/buffer.h>
64
+ #include <openssl/pqueue.h>
65
+ #ifdef OPENSSL_SYS_VMS
66
+ #include <resource.h>
67
+ #include <sys/timeb.h>
68
+ #endif
69
+ #ifdef OPENSSL_SYS_WIN32
70
+ /* Needed for struct timeval */
71
+ #include <winsock.h>
72
+ #elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)
73
+ #include <sys/timeval.h>
74
+ #else
75
+ #if defined(OPENSSL_SYS_VXWORKS)
76
+ #include <sys/times.h>
77
+ #else
78
+ #include <sys/time.h>
79
+ #endif
80
+ #endif
81
+
82
+ #ifdef __cplusplus
83
+ extern "C" {
84
+ #endif
85
+
86
+ #define DTLS1_VERSION 0xFEFF
87
+ #define DTLS1_BAD_VER 0x0100
88
+
89
+ #if 0
90
+ /* this alert description is not specified anywhere... */
91
+ #define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110
92
+ #endif
93
+
94
+ /* lengths of messages */
95
+ #define DTLS1_COOKIE_LENGTH 256
96
+
97
+ #define DTLS1_RT_HEADER_LENGTH 13
98
+
99
+ #define DTLS1_HM_HEADER_LENGTH 12
100
+
101
+ #define DTLS1_HM_BAD_FRAGMENT -2
102
+ #define DTLS1_HM_FRAGMENT_RETRY -3
103
+
104
+ #define DTLS1_CCS_HEADER_LENGTH 1
105
+
106
+ #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
107
+ #define DTLS1_AL_HEADER_LENGTH 7
108
+ #else
109
+ #define DTLS1_AL_HEADER_LENGTH 2
110
+ #endif
111
+
112
+ #ifndef OPENSSL_NO_SSL_INTERN
113
+
114
+ #ifndef OPENSSL_NO_SCTP
115
+ #define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP"
116
+ #endif
117
+
118
+ typedef struct dtls1_bitmap_st
119
+ {
120
+ unsigned long map; /* track 32 packets on 32-bit systems
121
+ and 64 - on 64-bit systems */
122
+ unsigned char max_seq_num[8]; /* max record number seen so far,
123
+ 64-bit value in big-endian
124
+ encoding */
125
+ } DTLS1_BITMAP;
126
+
127
+ struct dtls1_retransmit_state
128
+ {
129
+ EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */
130
+ EVP_MD_CTX *write_hash; /* used for mac generation */
131
+ #ifndef OPENSSL_NO_COMP
132
+ COMP_CTX *compress; /* compression */
133
+ #else
134
+ char *compress;
135
+ #endif
136
+ SSL_SESSION *session;
137
+ unsigned short epoch;
138
+ };
139
+
140
+ struct hm_header_st
141
+ {
142
+ unsigned char type;
143
+ unsigned long msg_len;
144
+ unsigned short seq;
145
+ unsigned long frag_off;
146
+ unsigned long frag_len;
147
+ unsigned int is_ccs;
148
+ struct dtls1_retransmit_state saved_retransmit_state;
149
+ };
150
+
151
+ struct ccs_header_st
152
+ {
153
+ unsigned char type;
154
+ unsigned short seq;
155
+ };
156
+
157
+ struct dtls1_timeout_st
158
+ {
159
+ /* Number of read timeouts so far */
160
+ unsigned int read_timeouts;
161
+
162
+ /* Number of write timeouts so far */
163
+ unsigned int write_timeouts;
164
+
165
+ /* Number of alerts received so far */
166
+ unsigned int num_alerts;
167
+ };
168
+
169
+ typedef struct record_pqueue_st
170
+ {
171
+ unsigned short epoch;
172
+ pqueue q;
173
+ } record_pqueue;
174
+
175
+ typedef struct hm_fragment_st
176
+ {
177
+ struct hm_header_st msg_header;
178
+ unsigned char *fragment;
179
+ unsigned char *reassembly;
180
+ } hm_fragment;
181
+
182
+ typedef struct dtls1_state_st
183
+ {
184
+ unsigned int send_cookie;
185
+ unsigned char cookie[DTLS1_COOKIE_LENGTH];
186
+ unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
187
+ unsigned int cookie_len;
188
+
189
+ /*
190
+ * The current data and handshake epoch. This is initially
191
+ * undefined, and starts at zero once the initial handshake is
192
+ * completed
193
+ */
194
+ unsigned short r_epoch;
195
+ unsigned short w_epoch;
196
+
197
+ /* records being received in the current epoch */
198
+ DTLS1_BITMAP bitmap;
199
+
200
+ /* renegotiation starts a new set of sequence numbers */
201
+ DTLS1_BITMAP next_bitmap;
202
+
203
+ /* handshake message numbers */
204
+ unsigned short handshake_write_seq;
205
+ unsigned short next_handshake_write_seq;
206
+
207
+ unsigned short handshake_read_seq;
208
+
209
+ /* save last sequence number for retransmissions */
210
+ unsigned char last_write_sequence[8];
211
+
212
+ /* Received handshake records (processed and unprocessed) */
213
+ record_pqueue unprocessed_rcds;
214
+ record_pqueue processed_rcds;
215
+
216
+ /* Buffered handshake messages */
217
+ pqueue buffered_messages;
218
+
219
+ /* Buffered (sent) handshake records */
220
+ pqueue sent_messages;
221
+
222
+ /* Buffered application records.
223
+ * Only for records between CCS and Finished
224
+ * to prevent either protocol violation or
225
+ * unnecessary message loss.
226
+ */
227
+ record_pqueue buffered_app_data;
228
+
229
+ /* Is set when listening for new connections with dtls1_listen() */
230
+ unsigned int listen;
231
+
232
+ unsigned int mtu; /* max DTLS packet size */
233
+
234
+ struct hm_header_st w_msg_hdr;
235
+ struct hm_header_st r_msg_hdr;
236
+
237
+ struct dtls1_timeout_st timeout;
238
+
239
+ /* Indicates when the last handshake msg or heartbeat sent will timeout */
240
+ struct timeval next_timeout;
241
+
242
+ /* Timeout duration */
243
+ unsigned short timeout_duration;
244
+
245
+ /* storage for Alert/Handshake protocol data received but not
246
+ * yet processed by ssl3_read_bytes: */
247
+ unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
248
+ unsigned int alert_fragment_len;
249
+ unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
250
+ unsigned int handshake_fragment_len;
251
+
252
+ unsigned int retransmitting;
253
+ unsigned int change_cipher_spec_ok;
254
+
255
+ #ifndef OPENSSL_NO_SCTP
256
+ /* used when SSL_ST_XX_FLUSH is entered */
257
+ int next_state;
258
+
259
+ int shutdown_received;
260
+ #endif
261
+
262
+ } DTLS1_STATE;
263
+
264
+ typedef struct dtls1_record_data_st
265
+ {
266
+ unsigned char *packet;
267
+ unsigned int packet_length;
268
+ SSL3_BUFFER rbuf;
269
+ SSL3_RECORD rrec;
270
+ #ifndef OPENSSL_NO_SCTP
271
+ struct bio_dgram_sctp_rcvinfo recordinfo;
272
+ #endif
273
+ } DTLS1_RECORD_DATA;
274
+
275
+ #endif
276
+
277
+ /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
278
+ #define DTLS1_TMO_READ_COUNT 2
279
+ #define DTLS1_TMO_WRITE_COUNT 2
280
+
281
+ #define DTLS1_TMO_ALERT_COUNT 12
282
+
283
+ #ifdef __cplusplus
284
+ }
285
+ #endif
286
+ #endif
287
+