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,106 @@
1
+ /* $OpenBSD: blowfish.h,v 1.18 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_BLOWFISH_H
60
+ #define HEADER_BLOWFISH_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #ifdef __cplusplus
65
+ extern "C" {
66
+ #endif
67
+
68
+ #define BF_ENCRYPT 1
69
+ #define BF_DECRYPT 0
70
+
71
+ /*
72
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
73
+ * ! BF_LONG has to be at least 32 bits wide. If it's wider, then !
74
+ * ! BF_LONG_LOG2 has to be defined along. !
75
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
76
+ */
77
+
78
+ #define BF_LONG unsigned int
79
+
80
+ #define BF_ROUNDS 16
81
+ #define BF_BLOCK 8
82
+
83
+ typedef struct bf_key_st {
84
+ BF_LONG P[BF_ROUNDS + 2];
85
+ BF_LONG S[4*256];
86
+ } BF_KEY;
87
+
88
+ void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
89
+
90
+ void BF_encrypt(BF_LONG *data, const BF_KEY *key);
91
+ void BF_decrypt(BF_LONG *data, const BF_KEY *key);
92
+
93
+ void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
94
+ const BF_KEY *key, int enc);
95
+ void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
96
+ const BF_KEY *schedule, unsigned char *ivec, int enc);
97
+ void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,
98
+ const BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
99
+ void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,
100
+ const BF_KEY *schedule, unsigned char *ivec, int *num);
101
+
102
+ #ifdef __cplusplus
103
+ }
104
+ #endif
105
+
106
+ #endif
@@ -0,0 +1,480 @@
1
+ /* $OpenBSD: bn.h,v 1.85 2025/12/05 17:25:55 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
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
60
+ *
61
+ * Redistribution and use in source and binary forms, with or without
62
+ * modification, are permitted provided that the following conditions
63
+ * are met:
64
+ *
65
+ * 1. Redistributions of source code must retain the above copyright
66
+ * notice, this list of conditions and the following disclaimer.
67
+ *
68
+ * 2. Redistributions in binary form must reproduce the above copyright
69
+ * notice, this list of conditions and the following disclaimer in
70
+ * the documentation and/or other materials provided with the
71
+ * distribution.
72
+ *
73
+ * 3. All advertising materials mentioning features or use of this
74
+ * software must display the following acknowledgment:
75
+ * "This product includes software developed by the OpenSSL Project
76
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77
+ *
78
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79
+ * endorse or promote products derived from this software without
80
+ * prior written permission. For written permission, please contact
81
+ * openssl-core@openssl.org.
82
+ *
83
+ * 5. Products derived from this software may not be called "OpenSSL"
84
+ * nor may "OpenSSL" appear in their names without prior written
85
+ * permission of the OpenSSL Project.
86
+ *
87
+ * 6. Redistributions of any form whatsoever must retain the following
88
+ * acknowledgment:
89
+ * "This product includes software developed by the OpenSSL Project
90
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91
+ *
92
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
104
+ * ====================================================================
105
+ *
106
+ * This product includes cryptographic software written by Eric Young
107
+ * (eay@cryptsoft.com). This product includes software written by Tim
108
+ * Hudson (tjh@cryptsoft.com).
109
+ *
110
+ */
111
+ /* ====================================================================
112
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
113
+ *
114
+ * Portions of the attached software ("Contribution") are developed by
115
+ * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
116
+ *
117
+ * The Contribution is licensed pursuant to the Eric Young open source
118
+ * license provided above.
119
+ *
120
+ * The binary polynomial arithmetic software is originally written by
121
+ * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
122
+ *
123
+ */
124
+
125
+ #ifndef HEADER_BN_H
126
+ #define HEADER_BN_H
127
+
128
+ #include <inttypes.h>
129
+ #include <stdint.h>
130
+ #include <stdio.h>
131
+ #include <stdlib.h>
132
+
133
+ #include <openssl/opensslconf.h>
134
+
135
+ #include <openssl/ossl_typ.h>
136
+ #include <openssl/crypto.h>
137
+ #include <openssl/bio.h>
138
+
139
+ #ifdef __cplusplus
140
+ extern "C" {
141
+ #endif
142
+
143
+ #if defined(_LP64) || defined(_WIN64)
144
+ #undef BN_LLONG
145
+ #define BN_ULONG uint64_t
146
+ #define BN_BYTES 8
147
+ #define BN_BITS2 64
148
+ #else
149
+ #define BN_ULLONG uint64_t
150
+ #define BN_LLONG
151
+ #define BN_ULONG uint32_t
152
+ #define BN_BYTES 4
153
+ #define BN_BITS2 32
154
+ #endif
155
+
156
+ #define BN_FLG_MALLOCED 0x01
157
+ #define BN_FLG_STATIC_DATA 0x02
158
+ #define BN_FLG_CONSTTIME 0x04 /* avoid leaking exponent information through timing,
159
+ * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
160
+ * BN_div() will call BN_div_no_branch,
161
+ * BN_mod_inverse() will call BN_mod_inverse_no_branch.
162
+ */
163
+
164
+ void BN_set_flags(BIGNUM *b, int n);
165
+ int BN_get_flags(const BIGNUM *b, int n);
166
+ void BN_with_flags(BIGNUM *dest, const BIGNUM *src, int flags);
167
+
168
+ /* Values for |top| in BN_rand() */
169
+ #define BN_RAND_TOP_ANY -1
170
+ #define BN_RAND_TOP_ONE 0
171
+ #define BN_RAND_TOP_TWO 1
172
+
173
+ /* Values for |bottom| in BN_rand() */
174
+ #define BN_RAND_BOTTOM_ANY 0
175
+ #define BN_RAND_BOTTOM_ODD 1
176
+
177
+ BN_GENCB *BN_GENCB_new(void);
178
+ void BN_GENCB_free(BN_GENCB *cb);
179
+
180
+ /* Wrapper function to make using BN_GENCB easier, */
181
+ int BN_GENCB_call(BN_GENCB *cb, int a, int b);
182
+
183
+ /* Populate a BN_GENCB structure with an "old"-style callback */
184
+ void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback)(int, int, void *),
185
+ void *cb_arg);
186
+
187
+ /* Populate a BN_GENCB structure with a "new"-style callback */
188
+ void BN_GENCB_set(BN_GENCB *gencb, int (*callback)(int, int, BN_GENCB *),
189
+ void *cb_arg);
190
+
191
+ void *BN_GENCB_get_arg(BN_GENCB *cb);
192
+
193
+ #define BN_prime_checks 0 /* default: select number of iterations
194
+ based on the size of the number */
195
+
196
+ /*
197
+ * BN_prime_checks_for_size() returns the number of Miller-Rabin
198
+ * iterations that will be done for checking that a random number
199
+ * is probably prime. The error rate for accepting a composite
200
+ * number as prime depends on the size of the prime |b|. The error
201
+ * rates used are for calculating an RSA key with 2 primes, and so
202
+ * the level is what you would expect for a key of double the size
203
+ * of the prime.
204
+ *
205
+ * This table is generated using the algorithm of FIPS PUB 186-4
206
+ * Digital Signature Standard (DSS), section F.1, page 117.
207
+ * (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
208
+ *
209
+ * The following magma script was used to generate the output:
210
+ * securitybits:=125;
211
+ * k:=1024;
212
+ * for t:=1 to 65 do
213
+ * for M:=3 to Floor(2*Sqrt(k-1)-1) do
214
+ * S:=0;
215
+ * // Sum over m
216
+ * for m:=3 to M do
217
+ * s:=0;
218
+ * // Sum over j
219
+ * for j:=2 to m do
220
+ * s+:=(RealField(32)!2)^-(j+(k-1)/j);
221
+ * end for;
222
+ * S+:=2^(m-(m-1)*t)*s;
223
+ * end for;
224
+ * A:=2^(k-2-M*t);
225
+ * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
226
+ * pkt:=2.00743*Log(2)*k*2^-k*(A+B);
227
+ * seclevel:=Floor(-Log(2,pkt));
228
+ * if seclevel ge securitybits then
229
+ * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
230
+ * break;
231
+ * end if;
232
+ * end for;
233
+ * if seclevel ge securitybits then break; end if;
234
+ * end for;
235
+ *
236
+ * It can be run online at:
237
+ * http://magma.maths.usyd.edu.au/calc
238
+ *
239
+ * And will output:
240
+ * k: 1024, security: 129 bits (t: 6, M: 23)
241
+ *
242
+ * k is the number of bits of the prime, securitybits is the level
243
+ * we want to reach.
244
+ *
245
+ * prime length | RSA key size | # MR tests | security level
246
+ * -------------+--------------|------------+---------------
247
+ * (b) >= 6394 | >= 12788 | 3 | 256 bit
248
+ * (b) >= 3747 | >= 7494 | 3 | 192 bit
249
+ * (b) >= 1345 | >= 2690 | 4 | 128 bit
250
+ * (b) >= 1080 | >= 2160 | 5 | 128 bit
251
+ * (b) >= 852 | >= 1704 | 5 | 112 bit
252
+ * (b) >= 476 | >= 952 | 5 | 80 bit
253
+ * (b) >= 400 | >= 800 | 6 | 80 bit
254
+ * (b) >= 347 | >= 694 | 7 | 80 bit
255
+ * (b) >= 308 | >= 616 | 8 | 80 bit
256
+ * (b) >= 55 | >= 110 | 27 | 64 bit
257
+ * (b) >= 6 | >= 12 | 34 | 64 bit
258
+ */
259
+
260
+ #define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
261
+ (b) >= 1345 ? 4 : \
262
+ (b) >= 476 ? 5 : \
263
+ (b) >= 400 ? 6 : \
264
+ (b) >= 347 ? 7 : \
265
+ (b) >= 308 ? 8 : \
266
+ (b) >= 55 ? 27 : \
267
+ /* b >= 6 */ 34)
268
+
269
+ #define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
270
+
271
+ int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
272
+ int BN_is_zero(const BIGNUM *a);
273
+ int BN_is_one(const BIGNUM *a);
274
+ int BN_is_word(const BIGNUM *a, const BN_ULONG w);
275
+ int BN_is_odd(const BIGNUM *a);
276
+
277
+ void BN_zero(BIGNUM *a);
278
+ int BN_one(BIGNUM *a);
279
+
280
+ const BIGNUM *BN_value_one(void);
281
+ BN_CTX *BN_CTX_new(void);
282
+ void BN_CTX_free(BN_CTX *c);
283
+ void BN_CTX_start(BN_CTX *ctx);
284
+ BIGNUM *BN_CTX_get(BN_CTX *ctx);
285
+ void BN_CTX_end(BN_CTX *ctx);
286
+ int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
287
+ int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
288
+ int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
289
+ int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
290
+ int BN_num_bits(const BIGNUM *a);
291
+ int BN_num_bits_word(BN_ULONG);
292
+ BIGNUM *BN_new(void);
293
+ void BN_clear_free(BIGNUM *a);
294
+ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
295
+ void BN_swap(BIGNUM *a, BIGNUM *b);
296
+ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
297
+ int BN_bn2bin(const BIGNUM *a, unsigned char *to);
298
+ int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
299
+ BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
300
+ int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
301
+ BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
302
+ int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
303
+ int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
304
+ int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
305
+ int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
306
+ int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
307
+ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
308
+ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
309
+ void BN_set_negative(BIGNUM *b, int n);
310
+
311
+ int BN_is_negative(const BIGNUM *b);
312
+
313
+ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
314
+ BN_CTX *ctx);
315
+ #define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
316
+
317
+ int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
318
+ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
319
+ int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
320
+ int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
321
+ int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
322
+ int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
323
+ const BIGNUM *m, BN_CTX *ctx);
324
+ int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
325
+ int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
326
+ int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
327
+ int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);
328
+ int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
329
+
330
+ BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
331
+ BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
332
+ int BN_mul_word(BIGNUM *a, BN_ULONG w);
333
+ int BN_add_word(BIGNUM *a, BN_ULONG w);
334
+ int BN_sub_word(BIGNUM *a, BN_ULONG w);
335
+ int BN_set_word(BIGNUM *a, BN_ULONG w);
336
+ BN_ULONG BN_get_word(const BIGNUM *a);
337
+
338
+ int BN_cmp(const BIGNUM *a, const BIGNUM *b);
339
+ void BN_free(BIGNUM *a);
340
+ int BN_is_bit_set(const BIGNUM *a, int n);
341
+ int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
342
+ int BN_lshift1(BIGNUM *r, const BIGNUM *a);
343
+ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
344
+
345
+ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
346
+ const BIGNUM *m, BN_CTX *ctx);
347
+ int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
348
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
349
+ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
350
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
351
+
352
+ int BN_mask_bits(BIGNUM *a, int n);
353
+ int BN_print_fp(FILE *fp, const BIGNUM *a);
354
+ int BN_print(BIO *fp, const BIGNUM *a);
355
+ int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
356
+ int BN_rshift1(BIGNUM *r, const BIGNUM *a);
357
+ void BN_clear(BIGNUM *a);
358
+ BIGNUM *BN_dup(const BIGNUM *a);
359
+ int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
360
+ int BN_set_bit(BIGNUM *a, int n);
361
+ int BN_clear_bit(BIGNUM *a, int n);
362
+ char * BN_bn2hex(const BIGNUM *a);
363
+ char * BN_bn2dec(const BIGNUM *a);
364
+ int BN_hex2bn(BIGNUM **a, const char *str);
365
+ int BN_dec2bn(BIGNUM **a, const char *str);
366
+ int BN_asc2bn(BIGNUM **a, const char *str);
367
+ int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
368
+ int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */
369
+ BIGNUM *BN_mod_inverse(BIGNUM *ret,
370
+ const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
371
+ BIGNUM *BN_mod_sqrt(BIGNUM *ret,
372
+ const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
373
+
374
+ void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
375
+
376
+ int BN_security_bits(int L, int N);
377
+
378
+ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
379
+ const BIGNUM *rem, BN_GENCB *cb);
380
+ int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
381
+ int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
382
+ int do_trial_division, BN_GENCB *cb);
383
+
384
+ BN_MONT_CTX *BN_MONT_CTX_new(void);
385
+ int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
386
+ BN_MONT_CTX *mont, BN_CTX *ctx);
387
+ int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
388
+ BN_CTX *ctx);
389
+ int BN_from_montgomery(BIGNUM *r, const BIGNUM *a,
390
+ BN_MONT_CTX *mont, BN_CTX *ctx);
391
+ void BN_MONT_CTX_free(BN_MONT_CTX *mont);
392
+ int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
393
+ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, const BN_MONT_CTX *from);
394
+ BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
395
+ const BIGNUM *mod, BN_CTX *ctx);
396
+
397
+ /* Primes from RFC 2409 */
398
+ BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
399
+ BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
400
+
401
+ /* Primes from RFC 3526 */
402
+ BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
403
+ BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
404
+ BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
405
+ BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
406
+ BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
407
+ BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
408
+
409
+ void ERR_load_BN_strings(void);
410
+
411
+ /* Error codes for the BN functions. */
412
+
413
+ /* Function codes. */
414
+ #define BN_F_BNRAND 127
415
+ #define BN_F_BN_BLINDING_CONVERT_EX 100
416
+ #define BN_F_BN_BLINDING_CREATE_PARAM 128
417
+ #define BN_F_BN_BLINDING_INVERT_EX 101
418
+ #define BN_F_BN_BLINDING_NEW 102
419
+ #define BN_F_BN_BLINDING_UPDATE 103
420
+ #define BN_F_BN_BN2DEC 104
421
+ #define BN_F_BN_BN2HEX 105
422
+ #define BN_F_BN_CTX_GET 116
423
+ #define BN_F_BN_CTX_NEW 106
424
+ #define BN_F_BN_CTX_START 129
425
+ #define BN_F_BN_DIV 107
426
+ #define BN_F_BN_DIV_NO_BRANCH 138
427
+ #define BN_F_BN_DIV_RECP 130
428
+ #define BN_F_BN_EXP 123
429
+ #define BN_F_BN_EXPAND2 108
430
+ #define BN_F_BN_GENERATE_PRIME_EX 140
431
+ #define BN_F_BN_EXPAND_INTERNAL 120
432
+ #define BN_F_BN_GF2M_MOD 131
433
+ #define BN_F_BN_GF2M_MOD_EXP 132
434
+ #define BN_F_BN_GF2M_MOD_MUL 133
435
+ #define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
436
+ #define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
437
+ #define BN_F_BN_GF2M_MOD_SQR 136
438
+ #define BN_F_BN_GF2M_MOD_SQRT 137
439
+ #define BN_F_BN_MOD_EXP2_MONT 118
440
+ #define BN_F_BN_MOD_EXP_MONT 109
441
+ #define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
442
+ #define BN_F_BN_MOD_EXP_MONT_WORD 117
443
+ #define BN_F_BN_MOD_EXP_RECP 125
444
+ #define BN_F_BN_MOD_EXP_SIMPLE 126
445
+ #define BN_F_BN_MOD_INVERSE 110
446
+ #define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
447
+ #define BN_F_BN_MOD_LSHIFT_QUICK 119
448
+ #define BN_F_BN_MOD_MUL_RECIPROCAL 111
449
+ #define BN_F_BN_MOD_SQRT 121
450
+ #define BN_F_BN_MPI2BN 112
451
+ #define BN_F_BN_NEW 113
452
+ #define BN_F_BN_RAND 114
453
+ #define BN_F_BN_RAND_RANGE 122
454
+ #define BN_F_BN_USUB 115
455
+
456
+ /* Reason codes. */
457
+ #define BN_R_ARG2_LT_ARG3 100
458
+ #define BN_R_BAD_RECIPROCAL 101
459
+ #define BN_R_BIGNUM_TOO_LONG 114
460
+ #define BN_R_BITS_TOO_SMALL 117
461
+ #define BN_R_CALLED_WITH_EVEN_MODULUS 102
462
+ #define BN_R_DIV_BY_ZERO 103
463
+ #define BN_R_ENCODING_ERROR 104
464
+ #define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
465
+ #define BN_R_INPUT_NOT_REDUCED 110
466
+ #define BN_R_INVALID_ARGUMENT 118
467
+ #define BN_R_INVALID_LENGTH 106
468
+ #define BN_R_INVALID_RANGE 115
469
+ #define BN_R_NOT_A_SQUARE 111
470
+ #define BN_R_NOT_INITIALIZED 107
471
+ #define BN_R_NO_INVERSE 108
472
+ #define BN_R_NO_SOLUTION 116
473
+ #define BN_R_P_IS_NOT_PRIME 112
474
+ #define BN_R_TOO_MANY_ITERATIONS 113
475
+ #define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
476
+
477
+ #ifdef __cplusplus
478
+ }
479
+ #endif
480
+ #endif
@@ -0,0 +1,102 @@
1
+ /* $OpenBSD: buffer.h,v 1.17 2023/07/28 10:17:21 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_BUFFER_H
60
+ #define HEADER_BUFFER_H
61
+
62
+ #include <openssl/ossl_typ.h>
63
+
64
+ #ifdef __cplusplus
65
+ extern "C" {
66
+ #endif
67
+
68
+ #include <stddef.h>
69
+ #include <sys/types.h>
70
+
71
+ /* Already declared in ossl_typ.h */
72
+ /* typedef struct buf_mem_st BUF_MEM; */
73
+
74
+ struct buf_mem_st {
75
+ size_t length; /* current number of bytes */
76
+ char *data;
77
+ size_t max; /* size of buffer */
78
+ };
79
+
80
+ BUF_MEM *BUF_MEM_new(void);
81
+ void BUF_MEM_free(BUF_MEM *a);
82
+ int BUF_MEM_grow(BUF_MEM *str, size_t len);
83
+ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
84
+
85
+ void ERR_load_BUF_strings(void);
86
+
87
+ /* Error codes for the BUF functions. */
88
+
89
+ /* Function codes. */
90
+ #define BUF_F_BUF_MEMDUP 103
91
+ #define BUF_F_BUF_MEM_GROW 100
92
+ #define BUF_F_BUF_MEM_GROW_CLEAN 105
93
+ #define BUF_F_BUF_MEM_NEW 101
94
+ #define BUF_F_BUF_STRDUP 102
95
+ #define BUF_F_BUF_STRNDUP 104
96
+
97
+ /* Reason codes. */
98
+
99
+ #ifdef __cplusplus
100
+ }
101
+ #endif
102
+ #endif