zig_example 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/mkmf.rb +2734 -0
- data/ext/openssl/openssl_missing.c +40 -0
- data/ext/openssl/openssl_missing.h +238 -0
- data/ext/openssl/ossl.c +1295 -0
- data/ext/openssl/ossl.h +201 -0
- data/ext/openssl/ossl_asn1.c +1891 -0
- data/ext/openssl/ossl_asn1.h +62 -0
- data/ext/openssl/ossl_bio.c +42 -0
- data/ext/openssl/ossl_bio.h +16 -0
- data/ext/openssl/ossl_bn.c +1344 -0
- data/ext/openssl/ossl_bn.h +26 -0
- data/ext/openssl/ossl_cipher.c +1074 -0
- data/ext/openssl/ossl_cipher.h +20 -0
- data/ext/openssl/ossl_config.c +460 -0
- data/ext/openssl/ossl_config.h +16 -0
- data/ext/openssl/ossl_digest.c +425 -0
- data/ext/openssl/ossl_digest.h +20 -0
- data/ext/openssl/ossl_engine.c +568 -0
- data/ext/openssl/ossl_engine.h +19 -0
- data/ext/openssl/ossl_hmac.c +310 -0
- data/ext/openssl/ossl_hmac.h +18 -0
- data/ext/openssl/ossl_kdf.c +311 -0
- data/ext/openssl/ossl_kdf.h +6 -0
- data/ext/openssl/ossl_ns_spki.c +405 -0
- data/ext/openssl/ossl_ns_spki.h +19 -0
- data/ext/openssl/ossl_ocsp.c +1965 -0
- data/ext/openssl/ossl_ocsp.h +23 -0
- data/ext/openssl/ossl_pkcs12.c +275 -0
- data/ext/openssl/ossl_pkcs12.h +13 -0
- data/ext/openssl/ossl_pkcs7.c +1081 -0
- data/ext/openssl/ossl_pkcs7.h +36 -0
- data/ext/openssl/ossl_pkey.c +1624 -0
- data/ext/openssl/ossl_pkey.h +204 -0
- data/ext/openssl/ossl_pkey_dh.c +440 -0
- data/ext/openssl/ossl_pkey_dsa.c +359 -0
- data/ext/openssl/ossl_pkey_ec.c +1655 -0
- data/ext/openssl/ossl_pkey_rsa.c +579 -0
- data/ext/openssl/ossl_rand.c +200 -0
- data/ext/openssl/ossl_rand.h +18 -0
- data/ext/openssl/ossl_ssl.c +3142 -0
- data/ext/openssl/ossl_ssl.h +36 -0
- data/ext/openssl/ossl_ssl_session.c +331 -0
- data/ext/openssl/ossl_ts.c +1539 -0
- data/ext/openssl/ossl_ts.h +16 -0
- data/ext/openssl/ossl_x509.c +256 -0
- data/ext/openssl/ossl_x509.h +115 -0
- data/ext/openssl/ossl_x509attr.c +324 -0
- data/ext/openssl/ossl_x509cert.c +1002 -0
- data/ext/openssl/ossl_x509crl.c +545 -0
- data/ext/openssl/ossl_x509ext.c +490 -0
- data/ext/openssl/ossl_x509name.c +597 -0
- data/ext/openssl/ossl_x509req.c +444 -0
- data/ext/openssl/ossl_x509revoked.c +300 -0
- data/ext/openssl/ossl_x509store.c +986 -0
- data/ext/zigrb_100doors/build.zig +0 -12
- data/ext/zigrb_100doors/extconf.rb +2 -19
- data/ext/zigrb_ackermann/build.zig +0 -12
- data/ext/zigrb_ackermann/extconf.rb +2 -19
- data/ext/zigrb_lucas_lehmer/build.zig +53 -0
- data/ext/zigrb_lucas_lehmer/extconf.rb +3 -0
- data/ext/zigrb_lucas_lehmer/src/lucas_lehmer.c +60 -0
- data/ext/zigrb_lucas_lehmer/src/lucas_lehmer.h +1 -0
- data/ext/zigrb_lucas_lehmer/src/wrapper.zig +42 -0
- data/lib/zig_example/version.rb +1 -1
- data/lib/zig_example.rb +1 -0
- metadata +63 -3
@@ -0,0 +1,40 @@
|
|
1
|
+
/*
|
2
|
+
* 'OpenSSL for Ruby' project
|
3
|
+
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
4
|
+
* All rights reserved.
|
5
|
+
*/
|
6
|
+
/*
|
7
|
+
* This program is licensed under the same licence as Ruby.
|
8
|
+
* (See the file 'LICENCE'.)
|
9
|
+
*/
|
10
|
+
#include RUBY_EXTCONF_H
|
11
|
+
|
12
|
+
#include <string.h> /* memcpy() */
|
13
|
+
#include <openssl/x509_vfy.h>
|
14
|
+
|
15
|
+
#include "openssl_missing.h"
|
16
|
+
|
17
|
+
/*** added in 1.1.0 ***/
|
18
|
+
#if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
|
19
|
+
void
|
20
|
+
ossl_X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,
|
21
|
+
const X509_ALGOR **palg)
|
22
|
+
{
|
23
|
+
if (psig != NULL)
|
24
|
+
*psig = crl->signature;
|
25
|
+
if (palg != NULL)
|
26
|
+
*palg = crl->sig_alg;
|
27
|
+
}
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#if !defined(HAVE_X509_REQ_GET0_SIGNATURE)
|
31
|
+
void
|
32
|
+
ossl_X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig,
|
33
|
+
const X509_ALGOR **palg)
|
34
|
+
{
|
35
|
+
if (psig != NULL)
|
36
|
+
*psig = req->signature;
|
37
|
+
if (palg != NULL)
|
38
|
+
*palg = req->sig_alg;
|
39
|
+
}
|
40
|
+
#endif
|
@@ -0,0 +1,238 @@
|
|
1
|
+
/*
|
2
|
+
* 'OpenSSL for Ruby' project
|
3
|
+
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
4
|
+
* All rights reserved.
|
5
|
+
*/
|
6
|
+
/*
|
7
|
+
* This program is licensed under the same licence as Ruby.
|
8
|
+
* (See the file 'LICENCE'.)
|
9
|
+
*/
|
10
|
+
#if !defined(_OSSL_OPENSSL_MISSING_H_)
|
11
|
+
#define _OSSL_OPENSSL_MISSING_H_
|
12
|
+
|
13
|
+
#include "ruby/config.h"
|
14
|
+
|
15
|
+
/* added in 1.1.0 */
|
16
|
+
#if !defined(HAVE_EVP_MD_CTX_NEW)
|
17
|
+
# define EVP_MD_CTX_new EVP_MD_CTX_create
|
18
|
+
#endif
|
19
|
+
|
20
|
+
#if !defined(HAVE_EVP_MD_CTX_FREE)
|
21
|
+
# define EVP_MD_CTX_free EVP_MD_CTX_destroy
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
|
25
|
+
# define X509_STORE_get_ex_data(x, idx) \
|
26
|
+
CRYPTO_get_ex_data(&(x)->ex_data, (idx))
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
|
30
|
+
# define X509_STORE_set_ex_data(x, idx, data) \
|
31
|
+
CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data))
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#if !defined(HAVE_X509_STORE_GET_EX_NEW_INDEX) && !defined(X509_STORE_get_ex_new_index)
|
35
|
+
# define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
|
36
|
+
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \
|
37
|
+
(newf), (dupf), (freef))
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
|
41
|
+
void ossl_X509_CRL_get0_signature(const X509_CRL *, const ASN1_BIT_STRING **, const X509_ALGOR **);
|
42
|
+
# define X509_CRL_get0_signature ossl_X509_CRL_get0_signature
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#if !defined(HAVE_X509_REQ_GET0_SIGNATURE)
|
46
|
+
void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, const X509_ALGOR **);
|
47
|
+
# define X509_REQ_get0_signature ossl_X509_REQ_get0_signature
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#if !defined(HAVE_X509_REVOKED_GET0_SERIALNUMBER)
|
51
|
+
# define X509_REVOKED_get0_serialNumber(x) ((x)->serialNumber)
|
52
|
+
#endif
|
53
|
+
|
54
|
+
#if !defined(HAVE_X509_REVOKED_GET0_REVOCATIONDATE)
|
55
|
+
# define X509_REVOKED_get0_revocationDate(x) ((x)->revocationDate)
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#if !defined(HAVE_X509_GET0_TBS_SIGALG)
|
59
|
+
# define X509_get0_tbs_sigalg(x) ((x)->cert_info->signature)
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#if !defined(HAVE_X509_STORE_CTX_GET0_UNTRUSTED)
|
63
|
+
# define X509_STORE_CTX_get0_untrusted(x) ((x)->untrusted)
|
64
|
+
#endif
|
65
|
+
|
66
|
+
#if !defined(HAVE_X509_STORE_CTX_GET0_CERT)
|
67
|
+
# define X509_STORE_CTX_get0_cert(x) ((x)->cert)
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if !defined(HAVE_X509_STORE_CTX_GET0_CHAIN)
|
71
|
+
# define X509_STORE_CTX_get0_chain(ctx) X509_STORE_CTX_get_chain(ctx)
|
72
|
+
#endif
|
73
|
+
|
74
|
+
#if !defined(HAVE_OCSP_SINGLERESP_GET0_ID)
|
75
|
+
# define OCSP_SINGLERESP_get0_id(s) ((s)->certId)
|
76
|
+
#endif
|
77
|
+
|
78
|
+
#if !defined(HAVE_SSL_CTX_GET_CIPHERS)
|
79
|
+
# define SSL_CTX_get_ciphers(ctx) ((ctx)->cipher_list)
|
80
|
+
#endif
|
81
|
+
|
82
|
+
#if !defined(HAVE_X509_UP_REF)
|
83
|
+
# define X509_up_ref(x) \
|
84
|
+
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509)
|
85
|
+
#endif
|
86
|
+
|
87
|
+
#if !defined(HAVE_X509_CRL_UP_REF)
|
88
|
+
# define X509_CRL_up_ref(x) \
|
89
|
+
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_CRL);
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#if !defined(HAVE_X509_STORE_UP_REF)
|
93
|
+
# define X509_STORE_up_ref(x) \
|
94
|
+
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_STORE);
|
95
|
+
#endif
|
96
|
+
|
97
|
+
#if !defined(HAVE_SSL_SESSION_UP_REF)
|
98
|
+
# define SSL_SESSION_up_ref(x) \
|
99
|
+
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
|
100
|
+
#endif
|
101
|
+
|
102
|
+
#if !defined(HAVE_EVP_PKEY_UP_REF)
|
103
|
+
# define EVP_PKEY_up_ref(x) \
|
104
|
+
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_EVP_PKEY);
|
105
|
+
#endif
|
106
|
+
|
107
|
+
#if !defined(HAVE_OPAQUE_OPENSSL)
|
108
|
+
#define IMPL_PKEY_GETTER(_type, _name) \
|
109
|
+
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
|
110
|
+
return pkey->pkey._name; }
|
111
|
+
#define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \
|
112
|
+
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
|
113
|
+
if (a1) *a1 = obj->a1; \
|
114
|
+
if (a2) *a2 = obj->a2; } \
|
115
|
+
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
|
116
|
+
if (_fail_cond) return 0; \
|
117
|
+
BN_clear_free(obj->a1); obj->a1 = a1; \
|
118
|
+
BN_clear_free(obj->a2); obj->a2 = a2; \
|
119
|
+
return 1; }
|
120
|
+
#define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \
|
121
|
+
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
|
122
|
+
if (a1) *a1 = obj->a1; \
|
123
|
+
if (a2) *a2 = obj->a2; \
|
124
|
+
if (a3) *a3 = obj->a3; } \
|
125
|
+
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
|
126
|
+
if (_fail_cond) return 0; \
|
127
|
+
BN_clear_free(obj->a1); obj->a1 = a1; \
|
128
|
+
BN_clear_free(obj->a2); obj->a2 = a2; \
|
129
|
+
BN_clear_free(obj->a3); obj->a3 = a3; \
|
130
|
+
return 1; }
|
131
|
+
|
132
|
+
#if !defined(OPENSSL_NO_RSA)
|
133
|
+
IMPL_PKEY_GETTER(RSA, rsa)
|
134
|
+
IMPL_KEY_ACCESSOR3(RSA, key, n, e, d, (n == obj->n || e == obj->e || (obj->d && d == obj->d)))
|
135
|
+
IMPL_KEY_ACCESSOR2(RSA, factors, p, q, (p == obj->p || q == obj->q))
|
136
|
+
IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
|
137
|
+
#endif
|
138
|
+
|
139
|
+
#if !defined(OPENSSL_NO_DSA)
|
140
|
+
IMPL_PKEY_GETTER(DSA, dsa)
|
141
|
+
IMPL_KEY_ACCESSOR2(DSA, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
|
142
|
+
IMPL_KEY_ACCESSOR3(DSA, pqg, p, q, g, (p == obj->p || q == obj->q || g == obj->g))
|
143
|
+
#endif
|
144
|
+
|
145
|
+
#if !defined(OPENSSL_NO_DH)
|
146
|
+
IMPL_PKEY_GETTER(DH, dh)
|
147
|
+
IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
|
148
|
+
IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || (obj->q && q == obj->q) || g == obj->g))
|
149
|
+
static inline ENGINE *DH_get0_engine(DH *dh) { return dh->engine; }
|
150
|
+
#endif
|
151
|
+
|
152
|
+
#if !defined(OPENSSL_NO_EC)
|
153
|
+
IMPL_PKEY_GETTER(EC_KEY, ec)
|
154
|
+
#endif
|
155
|
+
|
156
|
+
#undef IMPL_PKEY_GETTER
|
157
|
+
#undef IMPL_KEY_ACCESSOR2
|
158
|
+
#undef IMPL_KEY_ACCESSOR3
|
159
|
+
#endif /* HAVE_OPAQUE_OPENSSL */
|
160
|
+
|
161
|
+
#if !defined(EVP_CTRL_AEAD_GET_TAG)
|
162
|
+
# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
|
163
|
+
# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
|
164
|
+
# define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN
|
165
|
+
#endif
|
166
|
+
|
167
|
+
#if !defined(HAVE_X509_GET0_NOTBEFORE)
|
168
|
+
# define X509_get0_notBefore(x) X509_get_notBefore(x)
|
169
|
+
# define X509_get0_notAfter(x) X509_get_notAfter(x)
|
170
|
+
# define X509_CRL_get0_lastUpdate(x) X509_CRL_get_lastUpdate(x)
|
171
|
+
# define X509_CRL_get0_nextUpdate(x) X509_CRL_get_nextUpdate(x)
|
172
|
+
# define X509_set1_notBefore(x, t) X509_set_notBefore(x, t)
|
173
|
+
# define X509_set1_notAfter(x, t) X509_set_notAfter(x, t)
|
174
|
+
# define X509_CRL_set1_lastUpdate(x, t) X509_CRL_set_lastUpdate(x, t)
|
175
|
+
# define X509_CRL_set1_nextUpdate(x, t) X509_CRL_set_nextUpdate(x, t)
|
176
|
+
#endif
|
177
|
+
|
178
|
+
#if !defined(HAVE_SSL_SESSION_GET_PROTOCOL_VERSION)
|
179
|
+
# define SSL_SESSION_get_protocol_version(s) ((s)->ssl_version)
|
180
|
+
#endif
|
181
|
+
|
182
|
+
#if !defined(HAVE_TS_STATUS_INFO_GET0_STATUS)
|
183
|
+
# define TS_STATUS_INFO_get0_status(a) ((a)->status)
|
184
|
+
#endif
|
185
|
+
|
186
|
+
#if !defined(HAVE_TS_STATUS_INFO_GET0_TEXT)
|
187
|
+
# define TS_STATUS_INFO_get0_text(a) ((a)->text)
|
188
|
+
#endif
|
189
|
+
|
190
|
+
#if !defined(HAVE_TS_STATUS_INFO_GET0_FAILURE_INFO)
|
191
|
+
# define TS_STATUS_INFO_get0_failure_info(a) ((a)->failure_info)
|
192
|
+
#endif
|
193
|
+
|
194
|
+
#if !defined(HAVE_TS_VERIFY_CTS_SET_CERTS)
|
195
|
+
# define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
|
196
|
+
#endif
|
197
|
+
|
198
|
+
#if !defined(HAVE_TS_VERIFY_CTX_SET_STORE)
|
199
|
+
# define TS_VERIFY_CTX_set_store(ctx, str) ((ctx)->store=(str))
|
200
|
+
#endif
|
201
|
+
|
202
|
+
#if !defined(HAVE_TS_VERIFY_CTX_ADD_FLAGS)
|
203
|
+
# define TS_VERIFY_CTX_add_flags(ctx, f) ((ctx)->flags |= (f))
|
204
|
+
#endif
|
205
|
+
|
206
|
+
#if !defined(HAVE_TS_RESP_CTX_SET_TIME_CB)
|
207
|
+
# define TS_RESP_CTX_set_time_cb(ctx, callback, dta) do { \
|
208
|
+
(ctx)->time_cb = (callback); \
|
209
|
+
(ctx)->time_cb_data = (dta); \
|
210
|
+
} while (0)
|
211
|
+
#endif
|
212
|
+
|
213
|
+
/* added in 3.0.0 */
|
214
|
+
#if !defined(HAVE_TS_VERIFY_CTX_SET_CERTS)
|
215
|
+
# define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
|
216
|
+
#endif
|
217
|
+
|
218
|
+
#ifndef HAVE_EVP_MD_CTX_GET0_MD
|
219
|
+
# define EVP_MD_CTX_get0_md(ctx) EVP_MD_CTX_md(ctx)
|
220
|
+
#endif
|
221
|
+
|
222
|
+
/*
|
223
|
+
* OpenSSL 1.1.0 added EVP_MD_CTX_pkey_ctx(), and then it was renamed to
|
224
|
+
* EVP_MD_CTX_get_pkey_ctx(x) in OpenSSL 3.0.
|
225
|
+
*/
|
226
|
+
#ifndef HAVE_EVP_MD_CTX_GET_PKEY_CTX
|
227
|
+
# ifdef HAVE_EVP_MD_CTX_PKEY_CTX
|
228
|
+
# define EVP_MD_CTX_get_pkey_ctx(x) EVP_MD_CTX_pkey_ctx(x)
|
229
|
+
# else
|
230
|
+
# define EVP_MD_CTX_get_pkey_ctx(x) (x)->pctx
|
231
|
+
# endif
|
232
|
+
#endif
|
233
|
+
|
234
|
+
#ifndef HAVE_EVP_PKEY_EQ
|
235
|
+
# define EVP_PKEY_eq(a, b) EVP_PKEY_cmp(a, b)
|
236
|
+
#endif
|
237
|
+
|
238
|
+
#endif /* _OSSL_OPENSSL_MISSING_H_ */
|