licentivo-launch 0.1.1

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.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/ext/launch_native/extconf.rb +28 -0
  5. data/lib/licentivo_launch/vendor/licentivo.rb +262 -0
  6. data/lib/licentivo_launch.rb +352 -0
  7. data/vendor/LICENSE +21 -0
  8. data/vendor/NOTICE +17 -0
  9. data/vendor/VERSION +1 -0
  10. data/vendor/c/app.c +33 -0
  11. data/vendor/c/demo.c +77 -0
  12. data/vendor/c/feature_tasks.h +72 -0
  13. data/vendor/c/licentivo.c +382 -0
  14. data/vendor/c/licentivo.h +67 -0
  15. data/vendor/c/quickstart.c +51 -0
  16. data/vendor/c/test_vectors.c +4 -0
  17. data/vendor/c/vendor/Monocypher-LICENCE.md +173 -0
  18. data/vendor/c/vendor/cJSON-LICENSE +20 -0
  19. data/vendor/c/vendor/cJSON.c +3191 -0
  20. data/vendor/c/vendor/cJSON.h +306 -0
  21. data/vendor/c/vendor/monocypher-ed25519.c +500 -0
  22. data/vendor/c/vendor/monocypher-ed25519.h +140 -0
  23. data/vendor/c/vendor/monocypher.c +2956 -0
  24. data/vendor/c/vendor/monocypher.h +321 -0
  25. data/vendor/curl/COPYING.txt +22 -0
  26. data/vendor/curl/bin/libcurl-x64.dll +0 -0
  27. data/vendor/curl/include/brotli/decode.h +409 -0
  28. data/vendor/curl/include/brotli/encode.h +505 -0
  29. data/vendor/curl/include/brotli/port.h +302 -0
  30. data/vendor/curl/include/brotli/shared_dictionary.h +100 -0
  31. data/vendor/curl/include/brotli/types.h +83 -0
  32. data/vendor/curl/include/curl/curl.h +3374 -0
  33. data/vendor/curl/include/curl/curlver.h +77 -0
  34. data/vendor/curl/include/curl/easy.h +123 -0
  35. data/vendor/curl/include/curl/header.h +74 -0
  36. data/vendor/curl/include/curl/mprintf.h +85 -0
  37. data/vendor/curl/include/curl/multi.h +561 -0
  38. data/vendor/curl/include/curl/options.h +70 -0
  39. data/vendor/curl/include/curl/stdcheaders.h +35 -0
  40. data/vendor/curl/include/curl/system.h +399 -0
  41. data/vendor/curl/include/curl/typecheck-gcc.h +964 -0
  42. data/vendor/curl/include/curl/urlapi.h +156 -0
  43. data/vendor/curl/include/curl/websockets.h +98 -0
  44. data/vendor/curl/include/libpsl.h +207 -0
  45. data/vendor/curl/include/libssh2.h +1516 -0
  46. data/vendor/curl/include/libssh2_publickey.h +128 -0
  47. data/vendor/curl/include/libssh2_sftp.h +382 -0
  48. data/vendor/curl/include/nghttp2/nghttp2.h +6878 -0
  49. data/vendor/curl/include/nghttp2/nghttp2ver.h +42 -0
  50. data/vendor/curl/include/nghttp3/nghttp3.h +3704 -0
  51. data/vendor/curl/include/nghttp3/version.h +46 -0
  52. data/vendor/curl/include/ngtcp2/ngtcp2.h +7485 -0
  53. data/vendor/curl/include/ngtcp2/ngtcp2_crypto.h +1071 -0
  54. data/vendor/curl/include/ngtcp2/ngtcp2_crypto_quictls.h +147 -0
  55. data/vendor/curl/include/ngtcp2/version.h +51 -0
  56. data/vendor/curl/include/openssl/aes.h +120 -0
  57. data/vendor/curl/include/openssl/asn1.h +1121 -0
  58. data/vendor/curl/include/openssl/asn1t.h +996 -0
  59. data/vendor/curl/include/openssl/bio.h +716 -0
  60. data/vendor/curl/include/openssl/blowfish.h +106 -0
  61. data/vendor/curl/include/openssl/bn.h +480 -0
  62. data/vendor/curl/include/openssl/buffer.h +102 -0
  63. data/vendor/curl/include/openssl/camellia.h +121 -0
  64. data/vendor/curl/include/openssl/cast.h +99 -0
  65. data/vendor/curl/include/openssl/chacha.h +54 -0
  66. data/vendor/curl/include/openssl/cmac.h +81 -0
  67. data/vendor/curl/include/openssl/cms.h +541 -0
  68. data/vendor/curl/include/openssl/comp.h +7 -0
  69. data/vendor/curl/include/openssl/conf.h +189 -0
  70. data/vendor/curl/include/openssl/crypto.h +458 -0
  71. data/vendor/curl/include/openssl/ct.h +567 -0
  72. data/vendor/curl/include/openssl/curve25519.h +104 -0
  73. data/vendor/curl/include/openssl/des.h +215 -0
  74. data/vendor/curl/include/openssl/dh.h +245 -0
  75. data/vendor/curl/include/openssl/dsa.h +263 -0
  76. data/vendor/curl/include/openssl/dtls1.h +107 -0
  77. data/vendor/curl/include/openssl/ec.h +675 -0
  78. data/vendor/curl/include/openssl/ecdh.h +6 -0
  79. data/vendor/curl/include/openssl/ecdsa.h +6 -0
  80. data/vendor/curl/include/openssl/engine.h +215 -0
  81. data/vendor/curl/include/openssl/err.h +325 -0
  82. data/vendor/curl/include/openssl/evp.h +1288 -0
  83. data/vendor/curl/include/openssl/hkdf.h +65 -0
  84. data/vendor/curl/include/openssl/hmac.h +101 -0
  85. data/vendor/curl/include/openssl/idea.h +99 -0
  86. data/vendor/curl/include/openssl/kdf.h +137 -0
  87. data/vendor/curl/include/openssl/lhash.h +179 -0
  88. data/vendor/curl/include/openssl/md4.h +105 -0
  89. data/vendor/curl/include/openssl/md5.h +99 -0
  90. data/vendor/curl/include/openssl/mlkem.h +236 -0
  91. data/vendor/curl/include/openssl/modes.h +118 -0
  92. data/vendor/curl/include/openssl/obj_mac.h +4646 -0
  93. data/vendor/curl/include/openssl/objects.h +137 -0
  94. data/vendor/curl/include/openssl/ocsp.h +484 -0
  95. data/vendor/curl/include/openssl/opensslconf.h +16 -0
  96. data/vendor/curl/include/openssl/opensslfeatures.h +153 -0
  97. data/vendor/curl/include/openssl/opensslv.h +18 -0
  98. data/vendor/curl/include/openssl/ossl_typ.h +196 -0
  99. data/vendor/curl/include/openssl/pem.h +542 -0
  100. data/vendor/curl/include/openssl/pkcs12.h +284 -0
  101. data/vendor/curl/include/openssl/pkcs7.h +523 -0
  102. data/vendor/curl/include/openssl/poly1305.h +45 -0
  103. data/vendor/curl/include/openssl/posix_time.h +54 -0
  104. data/vendor/curl/include/openssl/rand.h +118 -0
  105. data/vendor/curl/include/openssl/rc2.h +101 -0
  106. data/vendor/curl/include/openssl/rc4.h +88 -0
  107. data/vendor/curl/include/openssl/ripemd.h +107 -0
  108. data/vendor/curl/include/openssl/rsa.h +603 -0
  109. data/vendor/curl/include/openssl/safestack.h +1739 -0
  110. data/vendor/curl/include/openssl/sha.h +190 -0
  111. data/vendor/curl/include/openssl/sm3.h +49 -0
  112. data/vendor/curl/include/openssl/sm4.h +47 -0
  113. data/vendor/curl/include/openssl/srtp.h +148 -0
  114. data/vendor/curl/include/openssl/ssl.h +2336 -0
  115. data/vendor/curl/include/openssl/ssl3.h +441 -0
  116. data/vendor/curl/include/openssl/stack.h +99 -0
  117. data/vendor/curl/include/openssl/tls1.h +764 -0
  118. data/vendor/curl/include/openssl/ts.h +660 -0
  119. data/vendor/curl/include/openssl/txt_db.h +112 -0
  120. data/vendor/curl/include/openssl/ui.h +397 -0
  121. data/vendor/curl/include/openssl/x509.h +1037 -0
  122. data/vendor/curl/include/openssl/x509_vfy.h +464 -0
  123. data/vendor/curl/include/openssl/x509v3.h +1039 -0
  124. data/vendor/curl/include/zconf.h +206 -0
  125. data/vendor/curl/include/zdict.h +481 -0
  126. data/vendor/curl/include/zlib.h +1859 -0
  127. data/vendor/curl/include/zlib_name_mangling.h +8 -0
  128. data/vendor/curl/include/zstd.h +3198 -0
  129. data/vendor/curl/include/zstd_errors.h +107 -0
  130. data/vendor/curl/lib/libcurl.dll.a +0 -0
  131. data/vendor/curl/licenses/brotli/LICENSE.txt +19 -0
  132. data/vendor/curl/licenses/certdata/LICENSE.url +2 -0
  133. data/vendor/curl/licenses/libpsl/COPYING.txt +20 -0
  134. data/vendor/curl/licenses/libressl/COPYING.txt +133 -0
  135. data/vendor/curl/licenses/libssh2/COPYING.txt +43 -0
  136. data/vendor/curl/licenses/nghttp2/COPYING.txt +23 -0
  137. data/vendor/curl/licenses/nghttp3/COPYING.txt +22 -0
  138. data/vendor/curl/licenses/ngtcp2/COPYING.txt +22 -0
  139. data/vendor/curl/licenses/psl/LICENSE.txt +373 -0
  140. data/vendor/curl/licenses/trurl/COPYING.txt +22 -0
  141. data/vendor/curl/licenses/zlibng/LICENSE.md +19 -0
  142. data/vendor/curl/licenses/zstd/LICENSE.txt +30 -0
  143. metadata +205 -0
@@ -0,0 +1,215 @@
1
+ /* $OpenBSD: des.h,v 1.26 2025/06/09 17:49:45 tb Exp $ */
2
+ /* Copyright (C) 1995-1997 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_DES_H
60
+ #define HEADER_DES_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #ifndef DES_LONG
65
+ /* XXX - typedef to unsigned int everywhere. */
66
+ #ifdef __i386__
67
+ #define DES_LONG unsigned long
68
+ #else
69
+ #define DES_LONG unsigned int
70
+ #endif
71
+ #endif
72
+
73
+ #ifdef __cplusplus
74
+ extern "C" {
75
+ #endif
76
+
77
+ typedef unsigned char DES_cblock[8];
78
+ typedef /* const */ unsigned char const_DES_cblock[8];
79
+ /* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock *
80
+ * and const_DES_cblock * are incompatible pointer types. */
81
+
82
+ typedef struct DES_ks {
83
+ union {
84
+ DES_cblock cblock;
85
+ /* make sure things are correct size on machines with
86
+ * 8 byte longs */
87
+ DES_LONG deslong[2];
88
+ } ks[16];
89
+ } DES_key_schedule;
90
+
91
+ #define DES_KEY_SZ (sizeof(DES_cblock))
92
+ #define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
93
+
94
+ #define DES_ENCRYPT 1
95
+ #define DES_DECRYPT 0
96
+
97
+ #define DES_CBC_MODE 0
98
+ #define DES_PCBC_MODE 1
99
+
100
+ #define DES_ecb2_encrypt(i,o,k1,k2,e) \
101
+ DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
102
+
103
+ #define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
104
+ DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
105
+
106
+ #define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
107
+ DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
108
+
109
+ #define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
110
+ DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
111
+
112
+ extern int DES_check_key; /* defaults to false */
113
+
114
+ void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
115
+ DES_key_schedule *ks1, DES_key_schedule *ks2,
116
+ DES_key_schedule *ks3, int enc);
117
+ DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
118
+ long length, DES_key_schedule *schedule,
119
+ const_DES_cblock *ivec);
120
+ /* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */
121
+ void DES_cbc_encrypt(const unsigned char *input, unsigned char *output,
122
+ long length, DES_key_schedule *schedule, DES_cblock *ivec,
123
+ int enc);
124
+ void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
125
+ long length, DES_key_schedule *schedule, DES_cblock *ivec,
126
+ int enc);
127
+ void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
128
+ long length, DES_key_schedule *schedule, DES_cblock *ivec,
129
+ const_DES_cblock *inw, const_DES_cblock *outw, int enc);
130
+ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
131
+ long length, DES_key_schedule *schedule, DES_cblock *ivec,
132
+ int enc);
133
+ void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
134
+ DES_key_schedule *ks, int enc);
135
+
136
+ /* This is the DES encryption function that gets called by just about
137
+ every other DES routine in the library. You should not use this
138
+ function except to implement 'modes' of DES. I say this because the
139
+ functions that call this routine do the conversion from 'char *' to
140
+ long, and this needs to be done to make sure 'non-aligned' memory
141
+ access do not occur. The characters are loaded 'little endian'.
142
+ Data is a pointer to 2 unsigned long's and ks is the
143
+ DES_key_schedule to use. enc, is non zero specifies encryption,
144
+ zero if decryption. */
145
+ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc);
146
+
147
+ /* This functions is the same as DES_encrypt1() except that the DES
148
+ initial permutation (IP) and final permutation (FP) have been left
149
+ out. As for DES_encrypt1(), you should not use this function.
150
+ It is used by the routines in the library that implement triple DES.
151
+ IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same
152
+ as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */
153
+ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc);
154
+
155
+ void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
156
+ DES_key_schedule *ks2, DES_key_schedule *ks3);
157
+ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
158
+ DES_key_schedule *ks2, DES_key_schedule *ks3);
159
+ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
160
+ long length,
161
+ DES_key_schedule *ks1, DES_key_schedule *ks2,
162
+ DES_key_schedule *ks3, DES_cblock *ivec, int enc);
163
+ void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,
164
+ long length,
165
+ DES_key_schedule *ks1, DES_key_schedule *ks2,
166
+ DES_key_schedule *ks3,
167
+ DES_cblock *ivec1, DES_cblock *ivec2,
168
+ int enc);
169
+ void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
170
+ long length, DES_key_schedule *ks1,
171
+ DES_key_schedule *ks2, DES_key_schedule *ks3,
172
+ DES_cblock *ivec, int *num, int enc);
173
+ void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
174
+ int numbits, long length, DES_key_schedule *ks1,
175
+ DES_key_schedule *ks2, DES_key_schedule *ks3,
176
+ DES_cblock *ivec, int enc);
177
+ void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
178
+ long length, DES_key_schedule *ks1,
179
+ DES_key_schedule *ks2, DES_key_schedule *ks3,
180
+ DES_cblock *ivec, int *num);
181
+ char *DES_fcrypt(const char *buf, const char *salt, char *ret);
182
+ char *DES_crypt(const char *buf, const char *salt);
183
+ void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
184
+ long length, DES_key_schedule *schedule, DES_cblock *ivec);
185
+ void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
186
+ long length, DES_key_schedule *schedule, DES_cblock *ivec,
187
+ int enc);
188
+ DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
189
+ long length, int out_count, DES_cblock *seed);
190
+ int DES_random_key(DES_cblock *ret);
191
+ void DES_set_odd_parity(DES_cblock *key);
192
+ int DES_check_key_parity(const_DES_cblock *key);
193
+ int DES_is_weak_key(const_DES_cblock *key);
194
+ /* DES_set_key (= set_key = DES_key_sched = key_sched) calls
195
+ * DES_set_key_checked if global variable DES_check_key is set,
196
+ * DES_set_key_unchecked otherwise. */
197
+ int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
198
+ int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
199
+ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
200
+ void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
201
+ void DES_string_to_key(const char *str, DES_cblock *key);
202
+ void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
203
+ void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,
204
+ DES_key_schedule *schedule, DES_cblock *ivec, int *num,
205
+ int enc);
206
+ void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,
207
+ DES_key_schedule *schedule, DES_cblock *ivec, int *num);
208
+
209
+ #define DES_fixup_key_parity DES_set_odd_parity
210
+
211
+ #ifdef __cplusplus
212
+ }
213
+ #endif
214
+
215
+ #endif
@@ -0,0 +1,245 @@
1
+ /* $OpenBSD: dh.h,v 1.38 2025/01/25 17:59:44 tb Exp $ */
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_DH_H
60
+ #define HEADER_DH_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #ifndef OPENSSL_NO_BIO
65
+ #include <openssl/bio.h>
66
+ #endif
67
+ #include <openssl/ossl_typ.h>
68
+ #include <openssl/bn.h>
69
+
70
+ #ifndef OPENSSL_DH_MAX_MODULUS_BITS
71
+ # define OPENSSL_DH_MAX_MODULUS_BITS 10000
72
+ #endif
73
+
74
+ #define DH_FLAG_CACHE_MONT_P 0x01
75
+
76
+ /* If this flag is set the DH method is FIPS compliant and can be used
77
+ * in FIPS mode. This is set in the validated module method. If an
78
+ * application sets this flag in its own methods it is its reposibility
79
+ * to ensure the result is compliant.
80
+ */
81
+
82
+ #define DH_FLAG_FIPS_METHOD 0x0400
83
+
84
+ /* If this flag is set the operations normally disabled in FIPS mode are
85
+ * permitted it is then the applications responsibility to ensure that the
86
+ * usage is compliant.
87
+ */
88
+
89
+ #define DH_FLAG_NON_FIPS_ALLOW 0x0400
90
+
91
+ #ifdef __cplusplus
92
+ extern "C" {
93
+ #endif
94
+
95
+ #define DH_GENERATOR_2 2
96
+ /* #define DH_GENERATOR_3 3 */
97
+ #define DH_GENERATOR_5 5
98
+
99
+ /* DH_check error codes */
100
+ #define DH_CHECK_P_NOT_PRIME 0x01
101
+ #define DH_CHECK_P_NOT_SAFE_PRIME 0x02
102
+ #define DH_UNABLE_TO_CHECK_GENERATOR 0x04
103
+ #define DH_NOT_SUITABLE_GENERATOR 0x08
104
+ #define DH_CHECK_Q_NOT_PRIME 0x10
105
+ #define DH_CHECK_INVALID_Q_VALUE 0x20
106
+ #define DH_CHECK_INVALID_J_VALUE 0x40
107
+
108
+ /* DH_check_pub_key error codes */
109
+ #define DH_CHECK_PUBKEY_TOO_SMALL 0x01
110
+ #define DH_CHECK_PUBKEY_TOO_LARGE 0x02
111
+ #define DH_CHECK_PUBKEY_INVALID 0x04
112
+
113
+ /* primes p where (p-1)/2 is prime too are called "safe"; we define
114
+ this for backward compatibility: */
115
+ #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
116
+
117
+ DH *d2i_DHparams_bio(BIO *bp, DH **a);
118
+ int i2d_DHparams_bio(BIO *bp, DH *a);
119
+ DH *d2i_DHparams_fp(FILE *fp, DH **a);
120
+ int i2d_DHparams_fp(FILE *fp, DH *a);
121
+
122
+ DH *DHparams_dup(DH *);
123
+
124
+ const DH_METHOD *DH_OpenSSL(void);
125
+
126
+ void DH_set_default_method(const DH_METHOD *meth);
127
+ const DH_METHOD *DH_get_default_method(void);
128
+ int DH_set_method(DH *dh, const DH_METHOD *meth);
129
+ DH *DH_new_method(ENGINE *engine);
130
+
131
+ DH * DH_new(void);
132
+ void DH_free(DH *dh);
133
+ int DH_up_ref(DH *dh);
134
+ int DH_size(const DH *dh);
135
+ int DH_bits(const DH *dh);
136
+ int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
137
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
138
+ int DH_set_ex_data(DH *d, int idx, void *arg);
139
+ void *DH_get_ex_data(DH *d, int idx);
140
+ int DH_security_bits(const DH *dh);
141
+
142
+ ENGINE *DH_get0_engine(DH *d);
143
+ void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
144
+ const BIGNUM **g);
145
+ int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
146
+ void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
147
+ int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
148
+ const BIGNUM *DH_get0_p(const DH *dh);
149
+ const BIGNUM *DH_get0_q(const DH *dh);
150
+ const BIGNUM *DH_get0_g(const DH *dh);
151
+ const BIGNUM *DH_get0_priv_key(const DH *dh);
152
+ const BIGNUM *DH_get0_pub_key(const DH *dh);
153
+ void DH_clear_flags(DH *dh, int flags);
154
+ int DH_test_flags(const DH *dh, int flags);
155
+ void DH_set_flags(DH *dh, int flags);
156
+ long DH_get_length(const DH *dh);
157
+ int DH_set_length(DH *dh, long length);
158
+
159
+ /*
160
+ * Wrapped in OPENSSL_NO_DEPRECATED in 0.9.8, added to rust-openssl in 2020,
161
+ * for "advanced DH support".
162
+ */
163
+ DH * DH_generate_parameters(int prime_len,int generator,
164
+ void (*callback)(int,int,void *),void *cb_arg);
165
+
166
+ /* New version */
167
+ int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
168
+
169
+ int DH_check(const DH *dh,int *codes);
170
+ int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
171
+ int DH_generate_key(DH *dh);
172
+ int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
173
+ DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
174
+ int i2d_DHparams(const DH *a,unsigned char **pp);
175
+ int DHparams_print_fp(FILE *fp, const DH *x);
176
+ #ifndef OPENSSL_NO_BIO
177
+ int DHparams_print(BIO *bp, const DH *x);
178
+ #else
179
+ int DHparams_print(char *bp, const DH *x);
180
+ #endif
181
+
182
+ #define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
183
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
184
+ EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)
185
+
186
+ #define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \
187
+ EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
188
+ EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)
189
+
190
+ #define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
191
+ #define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
192
+
193
+
194
+ void ERR_load_DH_strings(void);
195
+
196
+ /* Error codes for the DH functions. */
197
+
198
+ /* Function codes. */
199
+ #define DH_F_COMPUTE_KEY 102
200
+ #define DH_F_DHPARAMS_PRINT_FP 101
201
+ #define DH_F_DH_BUILTIN_GENPARAMS 106
202
+ #define DH_F_DH_COMPUTE_KEY 114
203
+ #define DH_F_DH_GENERATE_KEY 115
204
+ #define DH_F_DH_GENERATE_PARAMETERS_EX 116
205
+ #define DH_F_DH_NEW_METHOD 105
206
+ #define DH_F_DH_PARAM_DECODE 107
207
+ #define DH_F_DH_PRIV_DECODE 110
208
+ #define DH_F_DH_PRIV_ENCODE 111
209
+ #define DH_F_DH_PUB_DECODE 108
210
+ #define DH_F_DH_PUB_ENCODE 109
211
+ #define DH_F_DO_DH_PRINT 100
212
+ #define DH_F_GENERATE_KEY 103
213
+ #define DH_F_GENERATE_PARAMETERS 104
214
+ #define DH_F_PKEY_DH_DERIVE 112
215
+ #define DH_F_PKEY_DH_KEYGEN 113
216
+
217
+ /* Reason codes. */
218
+ #define DH_R_BAD_GENERATOR 101
219
+ #define DH_R_BN_DECODE_ERROR 109
220
+ #define DH_R_BN_ERROR 106
221
+ #define DH_R_DECODE_ERROR 104
222
+ #define DH_R_INVALID_PUBKEY 102
223
+ #define DH_R_KEYS_NOT_SET 108
224
+ #define DH_R_KEY_SIZE_TOO_SMALL 110
225
+ #define DH_R_MODULUS_TOO_LARGE 103
226
+ #define DH_R_NON_FIPS_METHOD 111
227
+ #define DH_R_NO_PARAMETERS_SET 107
228
+ #define DH_R_NO_PRIVATE_VALUE 100
229
+ #define DH_R_PARAMETER_ENCODING_ERROR 105
230
+ #define DH_R_CHECK_INVALID_J_VALUE 115
231
+ #define DH_R_CHECK_INVALID_Q_VALUE 116
232
+ #define DH_R_CHECK_PUBKEY_INVALID 122
233
+ #define DH_R_CHECK_PUBKEY_TOO_LARGE 123
234
+ #define DH_R_CHECK_PUBKEY_TOO_SMALL 124
235
+ #define DH_R_CHECK_P_NOT_PRIME 117
236
+ #define DH_R_CHECK_P_NOT_SAFE_PRIME 118
237
+ #define DH_R_CHECK_Q_NOT_PRIME 119
238
+ #define DH_R_MISSING_PUBKEY 125
239
+ #define DH_R_NOT_SUITABLE_GENERATOR 120
240
+ #define DH_R_UNABLE_TO_CHECK_GENERATOR 121
241
+
242
+ #ifdef __cplusplus
243
+ }
244
+ #endif
245
+ #endif