xref: /aosp_15_r20/external/libwebsockets/lib/tls/openssl/private-lib-tls-openssl.h (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1  /*
2  * libwebsockets - small server side websockets and web server implementation
3  *
4  * Copyright (C) 2010 - 2019 Andy Green <[email protected]>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  *
24  *  gencrypto openssl-specific helper declarations
25  */
26 
27 #if !defined(__LWS_PRIVATE_LIB_TLS_OPENSSL_H__)
28 #define __LWS_PRIVATE_LIB_TLS_OPENSSL_H__
29 
30 /*
31  * one of these per different client context
32  * cc_owner is in lws_context.lws_context_tls
33  */
34 
35 struct lws_tls_client_reuse {
36 	lws_tls_ctx *ssl_client_ctx;
37 	uint8_t hash[32];
38 	struct lws_dll2 cc_list;
39 	int refcount;
40 	int index;
41 };
42 
43 typedef int (*next_proto_cb)(SSL *, const unsigned char **out,
44                              unsigned char *outlen, const unsigned char *in,
45                              unsigned int inlen, void *arg);
46 
47 struct lws_x509_cert {
48 	X509 *cert; /* X509 is opaque, this has to be a pointer */
49 };
50 
51 int
52 lws_gencrypto_openssl_hash_to_NID(enum lws_genhash_types hash_type);
53 
54 const EVP_MD *
55 lws_gencrypto_openssl_hash_to_EVP_MD(enum lws_genhash_types hash_type);
56 
57 #if !defined(LWS_HAVE_BN_bn2binpad)
58 int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
59 #endif
60 
61 #endif
62 
63