Debian Codegraph @

ccast/axTLS/ssl.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2007-2016, Cameron Rich
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * * Neither the name of the axTLS project nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /**
32 * @mainpage axTLS API
33 *
34 * @image html axolotl.jpg
35 *
36 * The axTLS library has features such as:
37 * - The TLSv1 SSL client/server protocol
38 * - No requirement to use any openssl libraries.
39 * - A choice between AES block (128/256 bit) and RC4 (128 bit) stream ciphers.
40 * - RSA encryption/decryption with variable sized keys (up to 4096 bits).
41 * - Certificate chaining and peer authentication.
42 * - Session resumption, session renegotiation.
43 * - ASN.1, X.509, PKCS#8, PKCS#12 keys/certificates with DER/PEM encoding.
44 * - Highly configurable compile time options.
45 * - Portable across many platforms (written in ANSI C), and has language
46 * bindings in C, C#, VB.NET, Java, Perl and Lua.
47 * - Partial openssl API compatibility (via a wrapper).
48 * - A very small footprint (around 50-60kB for the library in 'server-only'
49 * mode).
50 * - No dependencies on sockets - can use serial connections for example.
51 * - A very simple API - ~ 20 functions/methods.
52 *
53 * A list of these functions/methods are described below.
54 *
55 * @ref c_api
56 *
57 * @ref bigint_api
58 *
59 * @ref csharp_api
60 *
61 * @ref java_api
62 */
63 #ifndef HEADER_SSL_H
64 #define HEADER_SSL_H
65
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69
70 #include <time.h>
71
72 /* need to predefine before ssl_lib.h gets to it */
73 #define SSL_SESSION_ID_SIZE 32
74
75 #include "tls1.h"
76
77 /* The optional parameters that can be given to the client/server SSL engine */
78 #define SSL_CLIENT_AUTHENTICATION 0x00010000
79 #define SSL_SERVER_VERIFY_LATER 0x00020000
80 #define SSL_NO_DEFAULT_KEY 0x00040000
81 #define SSL_DISPLAY_STATES 0x00080000
82 #define SSL_DISPLAY_BYTES 0x00100000
83 #define SSL_DISPLAY_CERTS 0x00200000
84 #define SSL_DISPLAY_RSA 0x00400000
85 #define SSL_CONNECT_IN_PARTS 0x00800000
86
87 /* errors that can be generated */
88 #define SSL_OK 0
89 #define SSL_NOT_OK -1
90 #define SSL_ERROR_DEAD -2
91 #define SSL_CLOSE_NOTIFY -3
92 #define SSL_TIMEDOUT -4 // GWG
93 #define SSL_ERROR_CONN_LOST -256
94 #define SSL_ERROR_RECORD_OVERFLOW -257
95 #define SSL_ERROR_SOCK_SETUP_FAILURE -258
96 #define SSL_ERROR_INVALID_HANDSHAKE -260
97 #define SSL_ERROR_INVALID_PROT_MSG -261
98 #define SSL_ERROR_INVALID_HMAC -262
99 #define SSL_ERROR_INVALID_VERSION -263
100 #define SSL_ERROR_UNSUPPORTED_EXTENSION -264
101 #define SSL_ERROR_INVALID_SESSION -265
102 #define SSL_ERROR_NO_CIPHER -266
103 #define SSL_ERROR_INVALID_CERT_HASH_ALG -267
104 #define SSL_ERROR_BAD_CERTIFICATE -268
105 #define SSL_ERROR_INVALID_KEY -269
106 #define SSL_ERROR_FINISHED_INVALID -271
107 #define SSL_ERROR_NO_CERT_DEFINED -272
108 #define SSL_ERROR_NO_CLIENT_RENOG -273
109 #define SSL_ERROR_NOT_SUPPORTED -274
110 #define SSL_X509_OFFSET -512
111 #define SSL_X509_ERROR(A) (SSL_X509_OFFSET+A)
112
113 /* alert types that are recognized */
114 #define SSL_ALERT_TYPE_WARNING 1
115 #define SLL_ALERT_TYPE_FATAL 2
116
117 /* these are all the alerts that are recognized */
118 #define SSL_ALERT_CLOSE_NOTIFY 0
119 #define SSL_ALERT_UNEXPECTED_MESSAGE 10
120 #define SSL_ALERT_BAD_RECORD_MAC 20
121 #define SSL_ALERT_RECORD_OVERFLOW 22
122 #define SSL_ALERT_HANDSHAKE_FAILURE 40
123 #define SSL_ALERT_BAD_CERTIFICATE 42
124 #define SSL_ALERT_UNSUPPORTED_CERTIFICATE 43
125 #define SSL_ALERT_CERTIFICATE_EXPIRED 45
126 #define SSL_ALERT_CERTIFICATE_UNKNOWN 46
127 #define SSL_ALERT_ILLEGAL_PARAMETER 47
128 #define SSL_ALERT_UNKNOWN_CA 48
129 #define SSL_ALERT_DECODE_ERROR 50
130 #define SSL_ALERT_DECRYPT_ERROR 51
131 #define SSL_ALERT_INVALID_VERSION 70
132 #define SSL_ALERT_NO_RENEGOTIATION 100
133 #define SSL_ALERT_UNSUPPORTED_EXTENSION 110
134
135 /* The ciphers that are supported */
136 #define SSL_AES128_SHA 0x2f
137 #define SSL_AES256_SHA 0x35
138 #define SSL_AES128_SHA256 0x3c
139 #define SSL_AES256_SHA256 0x3d
140
141 /* build mode ids' */
142 #define SSL_BUILD_SKELETON_MODE 0x01
143 #define SSL_BUILD_SERVER_ONLY 0x02
144 #define SSL_BUILD_ENABLE_VERIFICATION 0x03
145 #define SSL_BUILD_ENABLE_CLIENT 0x04
146 #define SSL_BUILD_FULL_MODE 0x05
147
148 /* offsets to retrieve configuration information */
149 #define SSL_BUILD_MODE 0
150 #define SSL_MAX_CERT_CFG_OFFSET 1
151 #define SSL_MAX_CA_CERT_CFG_OFFSET 2
152 #define SSL_HAS_PEM 3
153
154 /* default session sizes */
155 #define SSL_DEFAULT_SVR_SESS 5
156 #define SSL_DEFAULT_CLNT_SESS 1
157
158 /* X.509/X.520 distinguished name types */
159 #define SSL_X509_CERT_COMMON_NAME 0
160 #define SSL_X509_CERT_ORGANIZATION 1
161 #define SSL_X509_CERT_ORGANIZATIONAL_NAME 2
162 #define SSL_X509_CERT_LOCATION 3
163 #define SSL_X509_CERT_COUNTRY 4
164 #define SSL_X509_CERT_STATE 5
165 #define SSL_X509_CA_CERT_COMMON_NAME 6
166 #define SSL_X509_CA_CERT_ORGANIZATION 7
167 #define SSL_X509_CA_CERT_ORGANIZATIONAL_NAME 8
168 #define SSL_X509_CA_CERT_LOCATION 9
169 #define SSL_X509_CA_CERT_COUNTRY 10
170 #define SSL_X509_CA_CERT_STATE 11
171
172 /* SSL object loader types */
173 #define SSL_OBJ_X509_CERT 1
174 #define SSL_OBJ_X509_CACERT 2
175 #define SSL_OBJ_RSA_KEY 3
176 #define SSL_OBJ_PKCS8 4
177 #define SSL_OBJ_PKCS12 5
178
179 /**
180 * @defgroup c_api Standard C API
181 * @brief The standard interface in C.
182 * @{
183 */
184
185 /**
186 * @brief Establish a new client/server context.
187 *
188 * This function is called before any client/server SSL connections are made.
189 *
190 * Each new connection will use the this context's private key and
191 * certificate chain. If a different certificate chain is required, then a
192 * different context needs to be be used.
193 *
194 * There are two threading models supported - a single thread with one
195 * SSL_CTX can support any number of SSL connections - and multiple threads can
196 * support one SSL_CTX object each (the default). But if a single SSL_CTX
197 * object uses many SSL objects in individual threads, then the
198 * CONFIG_SSL_CTX_MUTEXING option needs to be configured.
199 *
200 * @param options [in] Any particular options. At present the options
201 * supported are:
202 * - SSL_SERVER_VERIFY_LATER (client only): Don't stop a handshake if the server
203 * authentication fails. The certificate can be authenticated later with a
204 * call to ssl_verify_cert().
205 * - SSL_CLIENT_AUTHENTICATION (server only): Enforce client authentication
206 * i.e. each handshake will include a "certificate request" message from the
207 * server. Only available if verification has been enabled.
208 * - SSL_DISPLAY_BYTES (full mode build only): Display the byte sequences
209 * during the handshake.
210 * - SSL_DISPLAY_STATES (full mode build only): Display the state changes
211 * during the handshake.
212 * - SSL_DISPLAY_CERTS (full mode build only): Display the certificates that
213 * are passed during a handshake.
214 * - SSL_DISPLAY_RSA (full mode build only): Display the RSA key details that
215 * are passed during a handshake.
216 * - SSL_CONNECT_IN_PARTS (client only): To use a non-blocking version of
217 * ssl_client_new().
218 * @param num_sessions [in] The number of sessions to be used for session
219 * caching. If this value is 0, then there is no session caching. This option
220 * is not used in skeleton mode.
221 * @return A client/server context.
222 */
223 EXP_FUNC SSL_CTX * STDCALL ssl_ctx_new(uint32_t options, int num_sessions);
224
225 /**
226 * @brief Remove a client/server context.
227 *
228 * Frees any used resources used by this context. Each connection will be
229 * sent a "Close Notify" alert (if possible).
230 * @param ssl_ctx [in] The client/server context.
231 */
232 EXP_FUNC void STDCALL ssl_ctx_free(SSL_CTX *ssl_ctx);
233
234 /**
235 * @brief Allocates new SSL extensions structure and returns pointer to it
236 *
237 * Needed for the SNI support.
238 * Needed for the Max Fragment Size Extension.
239 *
240 * @return ssl_ext Pointer to SSL_EXTENSIONS structure
241 *
242 */
243 EXP_FUNC SSL_EXTENSIONS * STDCALL ssl_ext_new(void);
244
245 /**
246 * @brief Frees SSL extensions structure
247 *
248 * @param ssl_ext [in] Pointer to SSL_EXTENSION structure
249 *
250 */
251 EXP_FUNC void STDCALL ssl_ext_free(SSL_EXTENSIONS *ssl_ext);
252
253 /**
254 * @brief (server only) Establish a new SSL connection to an SSL client.
255 *
256 * It is up to the application to establish the logical connection (whether it
257 * is a socket, serial connection etc).
258 * @param ssl_ctx [in] The server context.
259 * @param client_fd [in] The client's file descriptor.
260 * @return An SSL object reference.
261 */
262 EXP_FUNC SSL * STDCALL ssl_server_new(SSL_CTX *ssl_ctx, int client_fd);
263
264 /**
265 * @brief (client only) Establish a new SSL connection to an SSL server.
266 *
267 * It is up to the application to establish the initial logical connection
268 * (whether it is a socket, serial connection etc).
269 *
270 * This is a normally a blocking call - it will finish when the handshake is
271 * complete (or has failed). To use in non-blocking mode, set
272 * SSL_CONNECT_IN_PARTS in ssl_ctx_new().
273 * @param ssl_ctx [in] The client context.
274 * @param client_fd [in] The client's file descriptor.
275 * @param session_id [in] A 32 byte session id for session resumption. This
276 * can be null if no session resumption is being used or required. This option
277 * is not used in skeleton mode.
278 * @param sess_id_size The size of the session id (max 32)
279 * @param ssl_ext pointer to a structure with the activated SSL extensions
280 * and their values
281 * @return An SSL object reference. Use ssl_handshake_status() to check
282 * if a handshake succeeded.
283 */
284 EXP_FUNC SSL * STDCALL ssl_client_new(SSL_CTX *ssl_ctx, int client_fd, const uint8_t *session_id, uint8_t sess_id_size, SSL_EXTENSIONS* ssl_ext);
285
286 /**
287 * @brief Free any used resources on this connection.
288
289 * A "Close Notify" message is sent on this connection (if possible). It is up
290 * to the application to close the socket or file descriptor.
291 * @param ssl [in] The ssl object reference.
292 */
293 EXP_FUNC void STDCALL ssl_free(SSL *ssl);
294
295 /**
296 * @brief Read the SSL data stream.
297 * If the socket is non-blocking and data is blocked then SSO_OK will be
298 * returned.
299 * @param ssl [in] An SSL object reference.
300 * @param in_data [out] If the read was successful, a pointer to the read
301 * buffer will be here. Do NOT ever free this memory as this buffer is used in
302 * sucessive calls. If the call was unsuccessful, this value will be null.
303 * @return The number of decrypted bytes:
304 * - if > 0, then the handshaking is complete and we are returning the number
305 * of decrypted bytes.
306 * - SSL_OK if the handshaking stage is successful (but not yet complete).
307 * - < 0 if an error.
308 * @see ssl.h for the error code list.
309 * @note Use in_data before doing any successive ssl calls.
310 */
311 EXP_FUNC int STDCALL ssl_read(SSL *ssl, uint8_t **in_data);
312
313 /* Synchronous internal version of above used for protocol negotiation - GWG */
314 EXP_FUNC int STDCALL ssl_readi(SSL *ssl, uint8_t **in_data);
315
316 /**
317 * @brief Write to the SSL data stream.
318 * if the socket is non-blocking and data is blocked then a check is made
319 * to ensure that all data is sent (i.e. blocked mode is forced).
320 * @param ssl [in] An SSL obect reference.
321 * @param out_data [in] The data to be written
322 * @param out_len [in] The number of bytes to be written.
323 * @return The number of bytes sent, or if < 0 if an error.
324 * @see ssl.h for the error code list.
325 */
326 EXP_FUNC int STDCALL ssl_write(SSL *ssl, const uint8_t *out_data, int out_len);
327
328 /**
329 * @brief Find an ssl object based on a file descriptor.
330 *
331 * Goes through the list of SSL objects maintained in a client/server context
332 * to look for a file descriptor match.
333 * @param ssl_ctx [in] The client/server context.
334 * @param client_fd [in] The file descriptor.
335 * @return A reference to the SSL object. Returns null if the object could not
336 * be found.
337 */
338 EXP_FUNC SSL * STDCALL ssl_find(SSL_CTX *ssl_ctx, int client_fd);
339
340 /**
341 * @brief Get the session id for a handshake.
342 *
343 * This will be a 32 byte sequence and is available after the first
344 * handshaking messages are sent.
345 * @param ssl [in] An SSL object reference.
346 * @return The session id as a 32 byte sequence.
347 * @note A SSLv23 handshake may have only 16 valid bytes.
348 */
349 EXP_FUNC const uint8_t * STDCALL ssl_get_session_id(const SSL *ssl);
350
351 /**
352 * @brief Get the session id size for a handshake.
353 *
354 * This will normally be 32 but could be 0 (no session id) or something else.
355 * @param ssl [in] An SSL object reference.
356 * @return The size of the session id.
357 */
358 EXP_FUNC uint8_t STDCALL ssl_get_session_id_size(const SSL *ssl);
359
360 /**
361 * @brief Return the cipher id (in the SSL form).
362 * @param ssl [in] An SSL object reference.
363 * @return The cipher id. This will be one of the following:
364 * - SSL_AES128_SHA (0x2f)
365 * - SSL_AES256_SHA (0x35)
366 * - SSL_AES128_SHA256 (0x3c)
367 * - SSL_AES256_SHA256 (0x3d)
368 */
369 EXP_FUNC uint8_t STDCALL ssl_get_cipher_id(const SSL *ssl);
370
371 /**
372 * @brief Return the status of the handshake.
373 * @param ssl [in] An SSL object reference.
374 * @return SSL_OK if the handshake is complete and ok.
375 * @see ssl.h for the error code list.
376 */
377 EXP_FUNC int STDCALL ssl_handshake_status(const SSL *ssl);
378
379 /**
380 * @brief Retrieve various parameters about the axTLS engine.
381 * @param offset [in] The configuration offset. It will be one of the following:
382 * - SSL_BUILD_MODE The build mode. This will be one of the following:
383 * - SSL_BUILD_SERVER_ONLY (basic server mode)
384 * - SSL_BUILD_ENABLE_VERIFICATION (server can do client authentication)
385 * - SSL_BUILD_ENABLE_CLIENT (client/server capabilties)
386 * - SSL_BUILD_FULL_MODE (client/server with diagnostics)
387 * - SSL_BUILD_SKELETON_MODE (skeleton mode)
388 * - SSL_MAX_CERT_CFG_OFFSET The maximum number of certificates allowed.
389 * - SSL_MAX_CA_CERT_CFG_OFFSET The maximum number of CA certificates allowed.
390 * - SSL_HAS_PEM 1 if supported
391 * @return The value of the requested parameter.
392 */
393 EXP_FUNC int STDCALL ssl_get_config(int offset);
394
395 /**
396 * GWG
397 * @brief Return a string explaining why the handshake failed.
398 *
399 * This call is can be used by diagnostics elsewhere.
400 * @param error_code [in] An error code.
401 * @return The appropriate string, which may be static.
402 * @see ssl.h for the error code list.
403 */
404 EXP_FUNC const char * STDCALL ssl_error_string(int error_code);
405
406 /**
407 * @brief Display why the handshake failed.
408 *
409 * This call is only useful in a 'full mode' build. The output is to stdout.
410 * @param error_code [in] An error code.
411 * @see ssl.h for the error code list.
412 */
413 EXP_FUNC void STDCALL ssl_display_error(int error_code);
414
415 /**
416 * @brief Authenticate a received certificate.
417 *
418 * This call is usually made by a client after a handshake is complete and the
419 * context is in SSL_SERVER_VERIFY_LATER mode.
420 * @param ssl [in] An SSL object reference.
421 * @return SSL_OK if the certificate is verified.
422 */
423 EXP_FUNC int STDCALL ssl_verify_cert(const SSL *ssl);
424
425 /**
426 * @brief Retrieve an X.509 distinguished name component.
427 *
428 * When a handshake is complete and a certificate has been exchanged, then the
429 * details of the remote certificate can be retrieved.
430 *
431 * This will usually be used by a client to check that the server's common
432 * name matches the URL.
433 *
434 * @param ssl [in] An SSL object reference.
435 * @param component [in] one of:
436 * - SSL_X509_CERT_COMMON_NAME
437 * - SSL_X509_CERT_ORGANIZATION
438 * - SSL_X509_CERT_ORGANIZATIONAL_NAME
439 * - SSL_X509_CERT_LOCATION
440 * - SSL_X509_CERT_COUNTRY
441 * - SSL_X509_CERT_STATE
442 * - SSL_X509_CA_CERT_COMMON_NAME
443 * - SSL_X509_CA_CERT_ORGANIZATION
444 * - SSL_X509_CA_CERT_ORGANIZATIONAL_NAME
445 * - SSL_X509_CA_CERT_LOCATION
446 * - SSL_X509_CA_CERT_COUNTRY
447 * - SSL_X509_CA_CERT_STATE
448 * @return The appropriate string (or null if not defined)
449 * @note Verification build mode must be enabled.
450 */
451 EXP_FUNC const char * STDCALL ssl_get_cert_dn(const SSL *ssl, int component);
452
453 /**
454 * @brief Retrieve a Subject Alternative DNSName
455 *
456 * When a handshake is complete and a certificate has been exchanged, then the
457 * details of the remote certificate can be retrieved.
458 *
459 * This will usually be used by a client to check that the server's DNS
460 * name matches the URL.
461 *
462 * @param ssl [in] An SSL object reference.
463 * @param dnsindex [in] The index of the DNS name to retrieve.
464 * @return The appropriate string (or null if not defined)
465 * @note Verification build mode must be enabled.
466 */
467 EXP_FUNC const char * STDCALL ssl_get_cert_subject_alt_dnsname(const SSL *ssl, int dnsindex);
468
469 /**
470 * @brief Force the client to perform its handshake again.
471 *
472 * For a client this involves sending another "client hello" message.
473 * For the server is means sending a "hello request" message.
474 *
475 * This is a blocking call on the client (until the handshake completes).
476 *
477 * @param ssl [in] An SSL object reference.
478 * @return SSL_OK if renegotiation instantiation was ok
479 */
480 EXP_FUNC int STDCALL ssl_renegotiate(SSL *ssl);
481
482 /**
483 * @brief Process a file that is in binary DER or ASCII PEM format.
484 *
485 * These are temporary objects that are used to load private keys,
486 * certificates etc into memory.
487 * @param ssl_ctx [in] The client/server context.
488 * @param obj_type [in] The format of the file. Can be one of:
489 * - SSL_OBJ_X509_CERT (no password required)
490 * - SSL_OBJ_X509_CACERT (no password required)
491 * - SSL_OBJ_RSA_KEY (AES128/AES256 PEM encryption supported)
492 * - SSL_OBJ_PKCS8 (RC4-128 encrypted data supported)
493 * - SSL_OBJ_PKCS12 (RC4-128 encrypted data supported)
494 *
495 * PEM files are automatically detected (if supported). The object type is
496 * also detected, and so is not relevant for these types of files.
497 * @param filename [in] The location of a file in DER/PEM format.
498 * @param password [in] The password used. Can be null if not required.
499 * @return SSL_OK if all ok
500 * @note Not available in skeleton build mode.
501 */
502 EXP_FUNC int STDCALL ssl_obj_load(SSL_CTX *ssl_ctx, int obj_type, const char *filename, const char *password);
503
504 /**
505 * @brief Process binary data.
506 *
507 * These are temporary objects that are used to load private keys,
508 * certificates etc into memory.
509 * @param ssl_ctx [in] The client/server context.
510 * @param obj_type [in] The format of the memory data.
511 * @param data [in] The binary data to be loaded.
512 * @param len [in] The amount of data to be loaded.
513 * @param password [in] The password used. Can be null if not required.
514 * @return SSL_OK if all ok
515 * @see ssl_obj_load for more details on obj_type.
516 */
517 EXP_FUNC int STDCALL ssl_obj_memory_load(SSL_CTX *ssl_ctx, int obj_type, const uint8_t *data, int len, const char *password);
518
519 #ifdef CONFIG_SSL_GENERATE_X509_CERT
520 /**
521 * @brief Create an X.509 certificate.
522 *
523 * This certificate is a self-signed v1 cert with a fixed start/stop validity
524 * times. It is signed with an internal private key in ssl_ctx.
525 *
526 * @param ssl_ctx [in] The client/server context.
527 * @param options [in] Not used yet.
528 * @param dn [in] An array of distinguished name strings. The array is defined
529 * by:
530 * - SSL_X509_CERT_COMMON_NAME (0)
531 * - If SSL_X509_CERT_COMMON_NAME is empty or not defined, then the
532 * hostname will be used.
533 * - SSL_X509_CERT_ORGANIZATION (1)
534 * - If SSL_X509_CERT_ORGANIZATION is empty or not defined, then $USERNAME
535 * will be used.
536 * - SSL_X509_CERT_ORGANIZATIONAL_NAME (2)
537 * - SSL_X509_CERT_ORGANIZATIONAL_NAME is optional.
538 * @param cert_data [out] The certificate as a sequence of bytes.
539 * @return < 0 if an error, or the size of the certificate in bytes.
540 * @note cert_data must be freed when there is no more need for it.
541 */
542 EXP_FUNC int STDCALL ssl_x509_create(SSL_CTX *ssl_ctx, uint32_t options, const char * dn[], uint8_t **cert_data);
543 #endif
544
545 /**
546 * @brief Return the axTLS library version as a string.
547 */
548 EXP_FUNC const char * STDCALL ssl_version(void);
549
550 /** @} */
551
552 #ifdef __cplusplus
553 }
554 #endif
555
556 #endif