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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/ext/launch_native/extconf.rb +28 -0
- data/lib/licentivo_launch/vendor/licentivo.rb +262 -0
- data/lib/licentivo_launch.rb +352 -0
- data/vendor/LICENSE +21 -0
- data/vendor/NOTICE +17 -0
- data/vendor/VERSION +1 -0
- data/vendor/c/app.c +33 -0
- data/vendor/c/demo.c +77 -0
- data/vendor/c/feature_tasks.h +72 -0
- data/vendor/c/licentivo.c +382 -0
- data/vendor/c/licentivo.h +67 -0
- data/vendor/c/quickstart.c +51 -0
- data/vendor/c/test_vectors.c +4 -0
- data/vendor/c/vendor/Monocypher-LICENCE.md +173 -0
- data/vendor/c/vendor/cJSON-LICENSE +20 -0
- data/vendor/c/vendor/cJSON.c +3191 -0
- data/vendor/c/vendor/cJSON.h +306 -0
- data/vendor/c/vendor/monocypher-ed25519.c +500 -0
- data/vendor/c/vendor/monocypher-ed25519.h +140 -0
- data/vendor/c/vendor/monocypher.c +2956 -0
- data/vendor/c/vendor/monocypher.h +321 -0
- data/vendor/curl/COPYING.txt +22 -0
- data/vendor/curl/bin/libcurl-x64.dll +0 -0
- data/vendor/curl/include/brotli/decode.h +409 -0
- data/vendor/curl/include/brotli/encode.h +505 -0
- data/vendor/curl/include/brotli/port.h +302 -0
- data/vendor/curl/include/brotli/shared_dictionary.h +100 -0
- data/vendor/curl/include/brotli/types.h +83 -0
- data/vendor/curl/include/curl/curl.h +3374 -0
- data/vendor/curl/include/curl/curlver.h +77 -0
- data/vendor/curl/include/curl/easy.h +123 -0
- data/vendor/curl/include/curl/header.h +74 -0
- data/vendor/curl/include/curl/mprintf.h +85 -0
- data/vendor/curl/include/curl/multi.h +561 -0
- data/vendor/curl/include/curl/options.h +70 -0
- data/vendor/curl/include/curl/stdcheaders.h +35 -0
- data/vendor/curl/include/curl/system.h +399 -0
- data/vendor/curl/include/curl/typecheck-gcc.h +964 -0
- data/vendor/curl/include/curl/urlapi.h +156 -0
- data/vendor/curl/include/curl/websockets.h +98 -0
- data/vendor/curl/include/libpsl.h +207 -0
- data/vendor/curl/include/libssh2.h +1516 -0
- data/vendor/curl/include/libssh2_publickey.h +128 -0
- data/vendor/curl/include/libssh2_sftp.h +382 -0
- data/vendor/curl/include/nghttp2/nghttp2.h +6878 -0
- data/vendor/curl/include/nghttp2/nghttp2ver.h +42 -0
- data/vendor/curl/include/nghttp3/nghttp3.h +3704 -0
- data/vendor/curl/include/nghttp3/version.h +46 -0
- data/vendor/curl/include/ngtcp2/ngtcp2.h +7485 -0
- data/vendor/curl/include/ngtcp2/ngtcp2_crypto.h +1071 -0
- data/vendor/curl/include/ngtcp2/ngtcp2_crypto_quictls.h +147 -0
- data/vendor/curl/include/ngtcp2/version.h +51 -0
- data/vendor/curl/include/openssl/aes.h +120 -0
- data/vendor/curl/include/openssl/asn1.h +1121 -0
- data/vendor/curl/include/openssl/asn1t.h +996 -0
- data/vendor/curl/include/openssl/bio.h +716 -0
- data/vendor/curl/include/openssl/blowfish.h +106 -0
- data/vendor/curl/include/openssl/bn.h +480 -0
- data/vendor/curl/include/openssl/buffer.h +102 -0
- data/vendor/curl/include/openssl/camellia.h +121 -0
- data/vendor/curl/include/openssl/cast.h +99 -0
- data/vendor/curl/include/openssl/chacha.h +54 -0
- data/vendor/curl/include/openssl/cmac.h +81 -0
- data/vendor/curl/include/openssl/cms.h +541 -0
- data/vendor/curl/include/openssl/comp.h +7 -0
- data/vendor/curl/include/openssl/conf.h +189 -0
- data/vendor/curl/include/openssl/crypto.h +458 -0
- data/vendor/curl/include/openssl/ct.h +567 -0
- data/vendor/curl/include/openssl/curve25519.h +104 -0
- data/vendor/curl/include/openssl/des.h +215 -0
- data/vendor/curl/include/openssl/dh.h +245 -0
- data/vendor/curl/include/openssl/dsa.h +263 -0
- data/vendor/curl/include/openssl/dtls1.h +107 -0
- data/vendor/curl/include/openssl/ec.h +675 -0
- data/vendor/curl/include/openssl/ecdh.h +6 -0
- data/vendor/curl/include/openssl/ecdsa.h +6 -0
- data/vendor/curl/include/openssl/engine.h +215 -0
- data/vendor/curl/include/openssl/err.h +325 -0
- data/vendor/curl/include/openssl/evp.h +1288 -0
- data/vendor/curl/include/openssl/hkdf.h +65 -0
- data/vendor/curl/include/openssl/hmac.h +101 -0
- data/vendor/curl/include/openssl/idea.h +99 -0
- data/vendor/curl/include/openssl/kdf.h +137 -0
- data/vendor/curl/include/openssl/lhash.h +179 -0
- data/vendor/curl/include/openssl/md4.h +105 -0
- data/vendor/curl/include/openssl/md5.h +99 -0
- data/vendor/curl/include/openssl/mlkem.h +236 -0
- data/vendor/curl/include/openssl/modes.h +118 -0
- data/vendor/curl/include/openssl/obj_mac.h +4646 -0
- data/vendor/curl/include/openssl/objects.h +137 -0
- data/vendor/curl/include/openssl/ocsp.h +484 -0
- data/vendor/curl/include/openssl/opensslconf.h +16 -0
- data/vendor/curl/include/openssl/opensslfeatures.h +153 -0
- data/vendor/curl/include/openssl/opensslv.h +18 -0
- data/vendor/curl/include/openssl/ossl_typ.h +196 -0
- data/vendor/curl/include/openssl/pem.h +542 -0
- data/vendor/curl/include/openssl/pkcs12.h +284 -0
- data/vendor/curl/include/openssl/pkcs7.h +523 -0
- data/vendor/curl/include/openssl/poly1305.h +45 -0
- data/vendor/curl/include/openssl/posix_time.h +54 -0
- data/vendor/curl/include/openssl/rand.h +118 -0
- data/vendor/curl/include/openssl/rc2.h +101 -0
- data/vendor/curl/include/openssl/rc4.h +88 -0
- data/vendor/curl/include/openssl/ripemd.h +107 -0
- data/vendor/curl/include/openssl/rsa.h +603 -0
- data/vendor/curl/include/openssl/safestack.h +1739 -0
- data/vendor/curl/include/openssl/sha.h +190 -0
- data/vendor/curl/include/openssl/sm3.h +49 -0
- data/vendor/curl/include/openssl/sm4.h +47 -0
- data/vendor/curl/include/openssl/srtp.h +148 -0
- data/vendor/curl/include/openssl/ssl.h +2336 -0
- data/vendor/curl/include/openssl/ssl3.h +441 -0
- data/vendor/curl/include/openssl/stack.h +99 -0
- data/vendor/curl/include/openssl/tls1.h +764 -0
- data/vendor/curl/include/openssl/ts.h +660 -0
- data/vendor/curl/include/openssl/txt_db.h +112 -0
- data/vendor/curl/include/openssl/ui.h +397 -0
- data/vendor/curl/include/openssl/x509.h +1037 -0
- data/vendor/curl/include/openssl/x509_vfy.h +464 -0
- data/vendor/curl/include/openssl/x509v3.h +1039 -0
- data/vendor/curl/include/zconf.h +206 -0
- data/vendor/curl/include/zdict.h +481 -0
- data/vendor/curl/include/zlib.h +1859 -0
- data/vendor/curl/include/zlib_name_mangling.h +8 -0
- data/vendor/curl/include/zstd.h +3198 -0
- data/vendor/curl/include/zstd_errors.h +107 -0
- data/vendor/curl/lib/libcurl.dll.a +0 -0
- data/vendor/curl/licenses/brotli/LICENSE.txt +19 -0
- data/vendor/curl/licenses/certdata/LICENSE.url +2 -0
- data/vendor/curl/licenses/libpsl/COPYING.txt +20 -0
- data/vendor/curl/licenses/libressl/COPYING.txt +133 -0
- data/vendor/curl/licenses/libssh2/COPYING.txt +43 -0
- data/vendor/curl/licenses/nghttp2/COPYING.txt +23 -0
- data/vendor/curl/licenses/nghttp3/COPYING.txt +22 -0
- data/vendor/curl/licenses/ngtcp2/COPYING.txt +22 -0
- data/vendor/curl/licenses/psl/LICENSE.txt +373 -0
- data/vendor/curl/licenses/trurl/COPYING.txt +22 -0
- data/vendor/curl/licenses/zlibng/LICENSE.md +19 -0
- data/vendor/curl/licenses/zstd/LICENSE.txt +30 -0
- metadata +205 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
/* $OpenBSD: ct.h,v 1.8 2024/08/08 23:50:29 tb Exp $ */
|
|
2
|
+
/*
|
|
3
|
+
* Public API for Certificate Transparency (CT).
|
|
4
|
+
* Written by Rob Percival (robpercival@google.com) for the OpenSSL project.
|
|
5
|
+
*/
|
|
6
|
+
/* ====================================================================
|
|
7
|
+
* Copyright (c) 2016 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
|
+
* licensing@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
|
+
|
|
55
|
+
#ifndef HEADER_CT_H
|
|
56
|
+
#define HEADER_CT_H
|
|
57
|
+
|
|
58
|
+
#include <openssl/opensslconf.h>
|
|
59
|
+
|
|
60
|
+
#ifndef OPENSSL_NO_CT
|
|
61
|
+
#include <openssl/ossl_typ.h>
|
|
62
|
+
#include <openssl/safestack.h>
|
|
63
|
+
#include <openssl/x509.h>
|
|
64
|
+
#ifdef __cplusplus
|
|
65
|
+
extern "C" {
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
/* Minimum RSA key size, from RFC6962 */
|
|
69
|
+
#define SCT_MIN_RSA_BITS 2048
|
|
70
|
+
|
|
71
|
+
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
|
72
|
+
#define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
|
73
|
+
|
|
74
|
+
typedef enum {
|
|
75
|
+
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
|
76
|
+
CT_LOG_ENTRY_TYPE_X509 = 0,
|
|
77
|
+
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
|
78
|
+
} ct_log_entry_type_t;
|
|
79
|
+
|
|
80
|
+
typedef enum {
|
|
81
|
+
SCT_VERSION_NOT_SET = -1,
|
|
82
|
+
SCT_VERSION_V1 = 0
|
|
83
|
+
} sct_version_t;
|
|
84
|
+
|
|
85
|
+
typedef enum {
|
|
86
|
+
SCT_SOURCE_UNKNOWN,
|
|
87
|
+
SCT_SOURCE_TLS_EXTENSION,
|
|
88
|
+
SCT_SOURCE_X509V3_EXTENSION,
|
|
89
|
+
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
|
90
|
+
} sct_source_t;
|
|
91
|
+
|
|
92
|
+
typedef enum {
|
|
93
|
+
SCT_VALIDATION_STATUS_NOT_SET,
|
|
94
|
+
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
|
95
|
+
SCT_VALIDATION_STATUS_VALID,
|
|
96
|
+
SCT_VALIDATION_STATUS_INVALID,
|
|
97
|
+
SCT_VALIDATION_STATUS_UNVERIFIED,
|
|
98
|
+
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
|
99
|
+
} sct_validation_status_t;
|
|
100
|
+
|
|
101
|
+
DECLARE_STACK_OF(SCT)
|
|
102
|
+
DECLARE_STACK_OF(CTLOG)
|
|
103
|
+
|
|
104
|
+
/******************************************
|
|
105
|
+
* CT policy evaluation context functions *
|
|
106
|
+
******************************************/
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Creates a new, empty policy evaluation context.
|
|
110
|
+
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
|
111
|
+
* with the CT_POLICY_EVAL_CTX.
|
|
112
|
+
*/
|
|
113
|
+
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
|
114
|
+
|
|
115
|
+
/* Deletes a policy evaluation context and anything it owns. */
|
|
116
|
+
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
|
117
|
+
|
|
118
|
+
/* Gets the peer certificate that the SCTs are for */
|
|
119
|
+
X509 *CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
|
120
|
+
|
|
121
|
+
/*
|
|
122
|
+
* Sets the certificate associated with the received SCTs.
|
|
123
|
+
* Increments the reference count of cert.
|
|
124
|
+
* Returns 1 on success, 0 otherwise.
|
|
125
|
+
*/
|
|
126
|
+
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
|
127
|
+
|
|
128
|
+
/* Gets the issuer of the aforementioned certificate */
|
|
129
|
+
X509 *CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* Sets the issuer of the certificate associated with the received SCTs.
|
|
133
|
+
* Increments the reference count of issuer.
|
|
134
|
+
* Returns 1 on success, 0 otherwise.
|
|
135
|
+
*/
|
|
136
|
+
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
|
137
|
+
|
|
138
|
+
/* Gets the CT logs that are trusted sources of SCTs */
|
|
139
|
+
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
|
140
|
+
|
|
141
|
+
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
|
142
|
+
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
|
143
|
+
CTLOG_STORE *log_store);
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
|
147
|
+
* current time when checking whether an SCT was issued in the future.
|
|
148
|
+
* Such SCTs will fail validation, as required by RFC6962.
|
|
149
|
+
*/
|
|
150
|
+
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
|
151
|
+
|
|
152
|
+
/*
|
|
153
|
+
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
|
154
|
+
* If an SCT's timestamp is after this time, it will be interpreted as having
|
|
155
|
+
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
|
156
|
+
* whose timestamp is in the future", so an SCT will not validate in this case.
|
|
157
|
+
*/
|
|
158
|
+
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
|
159
|
+
|
|
160
|
+
/*****************
|
|
161
|
+
* SCT functions *
|
|
162
|
+
*****************/
|
|
163
|
+
|
|
164
|
+
/*
|
|
165
|
+
* Creates a new, blank SCT.
|
|
166
|
+
* The caller is responsible for calling SCT_free when finished with the SCT.
|
|
167
|
+
*/
|
|
168
|
+
SCT *SCT_new(void);
|
|
169
|
+
|
|
170
|
+
/*
|
|
171
|
+
* Creates a new SCT from some base64-encoded strings.
|
|
172
|
+
* The caller is responsible for calling SCT_free when finished with the SCT.
|
|
173
|
+
*/
|
|
174
|
+
SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64,
|
|
175
|
+
ct_log_entry_type_t entry_type, uint64_t timestamp,
|
|
176
|
+
const char *extensions_base64, const char *signature_base64);
|
|
177
|
+
|
|
178
|
+
/*
|
|
179
|
+
* Frees the SCT and the underlying data structures.
|
|
180
|
+
*/
|
|
181
|
+
void SCT_free(SCT *sct);
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* Free a stack of SCTs, and the underlying SCTs themselves.
|
|
185
|
+
* Intended to be compatible with X509V3_EXT_FREE.
|
|
186
|
+
*/
|
|
187
|
+
void SCT_LIST_free(STACK_OF(SCT) *a);
|
|
188
|
+
|
|
189
|
+
/*
|
|
190
|
+
* Returns the version of the SCT.
|
|
191
|
+
*/
|
|
192
|
+
sct_version_t SCT_get_version(const SCT *sct);
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* Set the version of an SCT.
|
|
196
|
+
* Returns 1 on success, 0 if the version is unrecognized.
|
|
197
|
+
*/
|
|
198
|
+
int SCT_set_version(SCT *sct, sct_version_t version);
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* Returns the log entry type of the SCT.
|
|
202
|
+
*/
|
|
203
|
+
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
|
204
|
+
|
|
205
|
+
/*
|
|
206
|
+
* Set the log entry type of an SCT.
|
|
207
|
+
* Returns 1 on success, 0 otherwise.
|
|
208
|
+
*/
|
|
209
|
+
int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
|
210
|
+
|
|
211
|
+
/*
|
|
212
|
+
* Gets the ID of the log that an SCT came from.
|
|
213
|
+
* Ownership of the log ID remains with the SCT.
|
|
214
|
+
* Returns the length of the log ID.
|
|
215
|
+
*/
|
|
216
|
+
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
|
217
|
+
|
|
218
|
+
/*
|
|
219
|
+
* Set the log ID of an SCT to point directly to the *log_id specified.
|
|
220
|
+
* The SCT takes ownership of the specified pointer.
|
|
221
|
+
* Returns 1 on success, 0 otherwise.
|
|
222
|
+
*/
|
|
223
|
+
int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
|
224
|
+
|
|
225
|
+
/*
|
|
226
|
+
* Set the log ID of an SCT.
|
|
227
|
+
* This makes a copy of the log_id.
|
|
228
|
+
* Returns 1 on success, 0 otherwise.
|
|
229
|
+
*/
|
|
230
|
+
int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
|
231
|
+
size_t log_id_len);
|
|
232
|
+
|
|
233
|
+
/*
|
|
234
|
+
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
|
235
|
+
*/
|
|
236
|
+
uint64_t SCT_get_timestamp(const SCT *sct);
|
|
237
|
+
|
|
238
|
+
/*
|
|
239
|
+
* Set the timestamp of an SCT (epoch time in milliseconds).
|
|
240
|
+
*/
|
|
241
|
+
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
* Return the NID for the signature used by the SCT.
|
|
245
|
+
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
|
246
|
+
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
|
247
|
+
*/
|
|
248
|
+
int SCT_get_signature_nid(const SCT *sct);
|
|
249
|
+
|
|
250
|
+
/*
|
|
251
|
+
* Set the signature type of an SCT
|
|
252
|
+
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
|
253
|
+
* NID_ecdsa_with_SHA256.
|
|
254
|
+
* Returns 1 on success, 0 otherwise.
|
|
255
|
+
*/
|
|
256
|
+
int SCT_set_signature_nid(SCT *sct, int nid);
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
|
260
|
+
* The SCT retains ownership of this pointer.
|
|
261
|
+
* Returns length of the data pointed to.
|
|
262
|
+
*/
|
|
263
|
+
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
* Set the extensions of an SCT to point directly to the *ext specified.
|
|
267
|
+
* The SCT takes ownership of the specified pointer.
|
|
268
|
+
*/
|
|
269
|
+
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
|
270
|
+
|
|
271
|
+
/*
|
|
272
|
+
* Set the extensions of an SCT.
|
|
273
|
+
* This takes a copy of the ext.
|
|
274
|
+
* Returns 1 on success, 0 otherwise.
|
|
275
|
+
*/
|
|
276
|
+
int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
|
277
|
+
size_t ext_len);
|
|
278
|
+
|
|
279
|
+
/*
|
|
280
|
+
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
|
281
|
+
* The SCT retains ownership of this pointer.
|
|
282
|
+
* Returns length of the data pointed to.
|
|
283
|
+
*/
|
|
284
|
+
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
|
285
|
+
|
|
286
|
+
/*
|
|
287
|
+
* Set the signature of an SCT to point directly to the *sig specified.
|
|
288
|
+
* The SCT takes ownership of the specified pointer.
|
|
289
|
+
*/
|
|
290
|
+
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
|
291
|
+
|
|
292
|
+
/*
|
|
293
|
+
* Set the signature of an SCT to be a copy of the *sig specified.
|
|
294
|
+
* Returns 1 on success, 0 otherwise.
|
|
295
|
+
*/
|
|
296
|
+
int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
|
297
|
+
size_t sig_len);
|
|
298
|
+
|
|
299
|
+
/*
|
|
300
|
+
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
|
301
|
+
*/
|
|
302
|
+
sct_source_t SCT_get_source(const SCT *sct);
|
|
303
|
+
|
|
304
|
+
/*
|
|
305
|
+
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
|
306
|
+
* Returns 1 on success, 0 otherwise.
|
|
307
|
+
*/
|
|
308
|
+
int SCT_set_source(SCT *sct, sct_source_t source);
|
|
309
|
+
|
|
310
|
+
/*
|
|
311
|
+
* Returns a text string describing the validation status of |sct|.
|
|
312
|
+
*/
|
|
313
|
+
const char *SCT_validation_status_string(const SCT *sct);
|
|
314
|
+
|
|
315
|
+
/*
|
|
316
|
+
* Pretty-prints an |sct| to |out|.
|
|
317
|
+
* It will be indented by the number of spaces specified by |indent|.
|
|
318
|
+
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
|
319
|
+
* from, so that the log name can be printed.
|
|
320
|
+
*/
|
|
321
|
+
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
|
322
|
+
|
|
323
|
+
/*
|
|
324
|
+
* Pretty-prints an |sct_list| to |out|.
|
|
325
|
+
* It will be indented by the number of spaces specified by |indent|.
|
|
326
|
+
* SCTs will be delimited by |separator|.
|
|
327
|
+
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
|
328
|
+
* came from, so that the log names can be printed.
|
|
329
|
+
*/
|
|
330
|
+
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
|
331
|
+
const char *separator, const CTLOG_STORE *logs);
|
|
332
|
+
|
|
333
|
+
/*
|
|
334
|
+
* Gets the last result of validating this SCT.
|
|
335
|
+
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
|
336
|
+
*/
|
|
337
|
+
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
|
338
|
+
|
|
339
|
+
/*
|
|
340
|
+
* Validates the given SCT with the provided context.
|
|
341
|
+
* Sets the "validation_status" field of the SCT.
|
|
342
|
+
* Returns 1 if the SCT is valid and the signature verifies.
|
|
343
|
+
* Returns 0 if the SCT is invalid or could not be verified.
|
|
344
|
+
* Returns -1 if an error occurs.
|
|
345
|
+
*/
|
|
346
|
+
int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
|
347
|
+
|
|
348
|
+
/*
|
|
349
|
+
* Validates the given list of SCTs with the provided context.
|
|
350
|
+
* Sets the "validation_status" field of each SCT.
|
|
351
|
+
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
|
352
|
+
* Returns 0 if at least one SCT is invalid or could not be verified.
|
|
353
|
+
* Returns a negative integer if an error occurs.
|
|
354
|
+
*/
|
|
355
|
+
int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
|
356
|
+
CT_POLICY_EVAL_CTX *ctx);
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
/*********************************
|
|
360
|
+
* SCT parsing and serialisation *
|
|
361
|
+
*********************************/
|
|
362
|
+
|
|
363
|
+
/*
|
|
364
|
+
* Serialize (to TLS format) a stack of SCTs and return the length.
|
|
365
|
+
* "a" must not be NULL.
|
|
366
|
+
* If "pp" is NULL, just return the length of what would have been serialized.
|
|
367
|
+
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
|
368
|
+
* for data that caller is responsible for freeing (only if function returns
|
|
369
|
+
* successfully).
|
|
370
|
+
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
|
371
|
+
* that "*pp" is large enough to accept all of the serialized data.
|
|
372
|
+
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
|
373
|
+
* on success.
|
|
374
|
+
*/
|
|
375
|
+
int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
|
376
|
+
|
|
377
|
+
/*
|
|
378
|
+
* Convert TLS format SCT list to a stack of SCTs.
|
|
379
|
+
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
|
380
|
+
* responsible for freeing (by calling SCT_LIST_free).
|
|
381
|
+
* "**pp" and "*pp" must not be NULL.
|
|
382
|
+
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
|
383
|
+
* will be returned.
|
|
384
|
+
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
|
385
|
+
* not defined.
|
|
386
|
+
*/
|
|
387
|
+
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
|
388
|
+
size_t len);
|
|
389
|
+
|
|
390
|
+
/*
|
|
391
|
+
* Serialize (to DER format) a stack of SCTs and return the length.
|
|
392
|
+
* "a" must not be NULL.
|
|
393
|
+
* If "pp" is NULL, just returns the length of what would have been serialized.
|
|
394
|
+
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
|
395
|
+
* for data that caller is responsible for freeing (only if function returns
|
|
396
|
+
* successfully).
|
|
397
|
+
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
|
398
|
+
* that "*pp" is large enough to accept all of the serialized data.
|
|
399
|
+
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
|
400
|
+
* on success.
|
|
401
|
+
*/
|
|
402
|
+
int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
|
403
|
+
|
|
404
|
+
/*
|
|
405
|
+
* Parses an SCT list in DER format and returns it.
|
|
406
|
+
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
|
407
|
+
* responsible for freeing (by calling SCT_LIST_free).
|
|
408
|
+
* "**pp" and "*pp" must not be NULL.
|
|
409
|
+
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
|
410
|
+
* will be returned.
|
|
411
|
+
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
|
412
|
+
* not defined.
|
|
413
|
+
*/
|
|
414
|
+
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
|
415
|
+
long len);
|
|
416
|
+
|
|
417
|
+
/*
|
|
418
|
+
* Serialize (to TLS format) an |sct| and write it to |out|.
|
|
419
|
+
* If |out| is null, no SCT will be output but the length will still be returned.
|
|
420
|
+
* If |out| points to a null pointer, a string will be allocated to hold the
|
|
421
|
+
* TLS-format SCT. It is the responsibility of the caller to free it.
|
|
422
|
+
* If |out| points to an allocated string, the TLS-format SCT will be written
|
|
423
|
+
* to it.
|
|
424
|
+
* The length of the SCT in TLS format will be returned.
|
|
425
|
+
*/
|
|
426
|
+
int i2o_SCT(const SCT *sct, unsigned char **out);
|
|
427
|
+
|
|
428
|
+
/*
|
|
429
|
+
* Parses an SCT in TLS format and returns it.
|
|
430
|
+
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
|
431
|
+
* already points to a non-null pointer, the pointer will be free'd.
|
|
432
|
+
* |in| should be a pointer to a string containing the TLS-format SCT.
|
|
433
|
+
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
|
434
|
+
* |len| should be the length of the SCT in |in|.
|
|
435
|
+
* Returns NULL if an error occurs.
|
|
436
|
+
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
|
437
|
+
* fields will be populated (with |in| and |len| respectively).
|
|
438
|
+
*/
|
|
439
|
+
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
|
440
|
+
|
|
441
|
+
/********************
|
|
442
|
+
* CT log functions *
|
|
443
|
+
********************/
|
|
444
|
+
|
|
445
|
+
/*
|
|
446
|
+
* Creates a new CT log instance with the given |public_key| and |name|.
|
|
447
|
+
* Takes ownership of |public_key| but copies |name|.
|
|
448
|
+
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
|
449
|
+
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
|
450
|
+
*/
|
|
451
|
+
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
|
452
|
+
|
|
453
|
+
/*
|
|
454
|
+
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
|
455
|
+
* in |pkey_base64|. The |name| is a string to help users identify this log.
|
|
456
|
+
* Returns 1 on success, 0 on failure.
|
|
457
|
+
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
|
458
|
+
*/
|
|
459
|
+
int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64,
|
|
460
|
+
const char *name);
|
|
461
|
+
|
|
462
|
+
/*
|
|
463
|
+
* Deletes a CT log instance and its fields.
|
|
464
|
+
*/
|
|
465
|
+
void CTLOG_free(CTLOG *log);
|
|
466
|
+
|
|
467
|
+
/* Gets the name of the CT log */
|
|
468
|
+
const char *CTLOG_get0_name(const CTLOG *log);
|
|
469
|
+
/* Gets the ID of the CT log */
|
|
470
|
+
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
|
471
|
+
size_t *log_id_len);
|
|
472
|
+
/* Gets the public key of the CT log */
|
|
473
|
+
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
|
474
|
+
|
|
475
|
+
/**************************
|
|
476
|
+
* CT log store functions *
|
|
477
|
+
**************************/
|
|
478
|
+
|
|
479
|
+
/*
|
|
480
|
+
* Creates a new CT log store.
|
|
481
|
+
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
|
482
|
+
*/
|
|
483
|
+
CTLOG_STORE *CTLOG_STORE_new(void);
|
|
484
|
+
|
|
485
|
+
/*
|
|
486
|
+
* Deletes a CT log store and all of the CT log instances held within.
|
|
487
|
+
*/
|
|
488
|
+
void CTLOG_STORE_free(CTLOG_STORE *store);
|
|
489
|
+
|
|
490
|
+
/*
|
|
491
|
+
* Finds a CT log in the store based on its log ID.
|
|
492
|
+
* Returns the CT log, or NULL if no match is found.
|
|
493
|
+
*/
|
|
494
|
+
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
|
495
|
+
const uint8_t *log_id, size_t log_id_len);
|
|
496
|
+
|
|
497
|
+
/*
|
|
498
|
+
* Loads a CT log list into a |store| from a |file|.
|
|
499
|
+
* Returns 1 if loading is successful, or 0 otherwise.
|
|
500
|
+
*/
|
|
501
|
+
int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
|
502
|
+
|
|
503
|
+
/*
|
|
504
|
+
* Loads the default CT log list into a |store|.
|
|
505
|
+
* Returns 1 if loading is successful, or 0 otherwise.
|
|
506
|
+
*/
|
|
507
|
+
int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
|
508
|
+
|
|
509
|
+
int ERR_load_CT_strings(void);
|
|
510
|
+
|
|
511
|
+
/*
|
|
512
|
+
* CT function codes.
|
|
513
|
+
*/
|
|
514
|
+
# define CT_F_CTLOG_NEW 117
|
|
515
|
+
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
|
516
|
+
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
|
517
|
+
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
|
518
|
+
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
|
519
|
+
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
|
520
|
+
# define CT_F_CTLOG_STORE_NEW 131
|
|
521
|
+
# define CT_F_CT_BASE64_DECODE 124
|
|
522
|
+
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
|
523
|
+
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
|
524
|
+
# define CT_F_I2O_SCT 107
|
|
525
|
+
# define CT_F_I2O_SCT_LIST 108
|
|
526
|
+
# define CT_F_I2O_SCT_SIGNATURE 109
|
|
527
|
+
# define CT_F_O2I_SCT 110
|
|
528
|
+
# define CT_F_O2I_SCT_LIST 111
|
|
529
|
+
# define CT_F_O2I_SCT_SIGNATURE 112
|
|
530
|
+
# define CT_F_SCT_CTX_NEW 126
|
|
531
|
+
# define CT_F_SCT_CTX_VERIFY 128
|
|
532
|
+
# define CT_F_SCT_NEW 100
|
|
533
|
+
# define CT_F_SCT_NEW_FROM_BASE64 127
|
|
534
|
+
# define CT_F_SCT_SET0_LOG_ID 101
|
|
535
|
+
# define CT_F_SCT_SET1_EXTENSIONS 114
|
|
536
|
+
# define CT_F_SCT_SET1_LOG_ID 115
|
|
537
|
+
# define CT_F_SCT_SET1_SIGNATURE 116
|
|
538
|
+
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
|
539
|
+
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
|
540
|
+
# define CT_F_SCT_SET_VERSION 104
|
|
541
|
+
|
|
542
|
+
/*
|
|
543
|
+
* CT reason codes.
|
|
544
|
+
*/
|
|
545
|
+
# define CT_R_BASE64_DECODE_ERROR 108
|
|
546
|
+
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
|
547
|
+
# define CT_R_LOG_CONF_INVALID 109
|
|
548
|
+
# define CT_R_LOG_CONF_INVALID_KEY 110
|
|
549
|
+
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
|
550
|
+
# define CT_R_LOG_CONF_MISSING_KEY 112
|
|
551
|
+
# define CT_R_LOG_KEY_INVALID 113
|
|
552
|
+
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
|
553
|
+
# define CT_R_SCT_INVALID 104
|
|
554
|
+
# define CT_R_SCT_INVALID_SIGNATURE 107
|
|
555
|
+
# define CT_R_SCT_LIST_INVALID 105
|
|
556
|
+
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
|
557
|
+
# define CT_R_SCT_NOT_SET 106
|
|
558
|
+
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
|
559
|
+
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
|
560
|
+
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
|
561
|
+
# define CT_R_UNSUPPORTED_VERSION 103
|
|
562
|
+
|
|
563
|
+
#ifdef __cplusplus
|
|
564
|
+
}
|
|
565
|
+
#endif
|
|
566
|
+
#endif
|
|
567
|
+
#endif
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/* $OpenBSD: curve25519.h,v 1.7 2022/11/13 14:05:04 tb Exp $ */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2015, Google Inc.
|
|
4
|
+
*
|
|
5
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
* copyright notice and this permission notice appear in all copies.
|
|
8
|
+
*
|
|
9
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
12
|
+
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
14
|
+
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
15
|
+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#ifndef HEADER_CURVE25519_H
|
|
19
|
+
#define HEADER_CURVE25519_H
|
|
20
|
+
|
|
21
|
+
#include <stdint.h>
|
|
22
|
+
|
|
23
|
+
#include <openssl/opensslconf.h>
|
|
24
|
+
|
|
25
|
+
#if defined(__cplusplus)
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Curve25519.
|
|
31
|
+
*
|
|
32
|
+
* Curve25519 is an elliptic curve. See https://tools.ietf.org/html/rfc7748.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* X25519.
|
|
37
|
+
*
|
|
38
|
+
* X25519 is the Diffie-Hellman primitive built from curve25519. It is
|
|
39
|
+
* sometimes referred to as curve25519, but X25519 is a more precise name.
|
|
40
|
+
* See http://cr.yp.to/ecdh.html and https://tools.ietf.org/html/rfc7748.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
#define X25519_KEY_LENGTH 32
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* X25519_keypair sets |out_public_value| and |out_private_key| to a freshly
|
|
47
|
+
* generated, public/private key pair.
|
|
48
|
+
*/
|
|
49
|
+
void X25519_keypair(uint8_t out_public_value[X25519_KEY_LENGTH],
|
|
50
|
+
uint8_t out_private_key[X25519_KEY_LENGTH]);
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* X25519 writes a shared key to |out_shared_key| that is calculated from the
|
|
54
|
+
* given private key and the peer's public value. It returns one on success and
|
|
55
|
+
* zero on error.
|
|
56
|
+
*
|
|
57
|
+
* Don't use the shared key directly, rather use a KDF and also include the two
|
|
58
|
+
* public values as inputs.
|
|
59
|
+
*/
|
|
60
|
+
int X25519(uint8_t out_shared_key[X25519_KEY_LENGTH],
|
|
61
|
+
const uint8_t private_key[X25519_KEY_LENGTH],
|
|
62
|
+
const uint8_t peers_public_value[X25519_KEY_LENGTH]);
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* ED25519
|
|
66
|
+
*
|
|
67
|
+
* Ed25519 is a signature scheme using a twisted Edwards curve that is
|
|
68
|
+
* birationally equivalent to curve25519.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
#define ED25519_PRIVATE_KEY_LENGTH 32
|
|
72
|
+
#define ED25519_PUBLIC_KEY_LENGTH 32
|
|
73
|
+
#define ED25519_SIGNATURE_LENGTH 64
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* ED25519_keypair sets |out_public_key| and |out_private_key| to a freshly
|
|
77
|
+
* generated, public/private key pair.
|
|
78
|
+
*/
|
|
79
|
+
void ED25519_keypair(uint8_t out_public_key[ED25519_PUBLIC_KEY_LENGTH],
|
|
80
|
+
uint8_t out_private_key[ED25519_PRIVATE_KEY_LENGTH]);
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* ED25519_sign sets |out_sig| to be a signature of |message_len| bytes from
|
|
84
|
+
* |message| using |public_key| and |private_key|. It returns one on success
|
|
85
|
+
* or zero on allocation failure.
|
|
86
|
+
*/
|
|
87
|
+
int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
|
|
88
|
+
const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH],
|
|
89
|
+
const uint8_t private_key_seed[ED25519_PRIVATE_KEY_LENGTH]);
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* ED25519_verify returns one iff |signature| is a valid signature by
|
|
93
|
+
* |public_key| of |message_len| bytes from |message|. It returns zero
|
|
94
|
+
* otherwise.
|
|
95
|
+
*/
|
|
96
|
+
int ED25519_verify(const uint8_t *message, size_t message_len,
|
|
97
|
+
const uint8_t signature[ED25519_SIGNATURE_LENGTH],
|
|
98
|
+
const uint8_t public_key[ED25519_PUBLIC_KEY_LENGTH]);
|
|
99
|
+
|
|
100
|
+
#if defined(__cplusplus)
|
|
101
|
+
} /* extern C */
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
#endif /* HEADER_CURVE25519_H */
|