1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef _SSL_PM_H_
16 #define _SSL_PM_H_
17 
18 #ifdef __cplusplus
19  extern "C" {
20 #endif
21 
22 #include <string.h>
23 #include "ssl_types.h"
24 #include "ssl_port.h"
25 
26 #define LOCAL_ATRR
27 
28 int ssl_pm_new(SSL *ssl);
29 void ssl_pm_free(SSL *ssl);
30 
31 int ssl_pm_handshake(SSL *ssl);
32 int ssl_pm_shutdown(SSL *ssl);
33 int ssl_pm_clear(SSL *ssl);
34 
35 int ssl_pm_read(SSL *ssl, void *buffer, int len);
36 int ssl_pm_send(SSL *ssl, const void *buffer, int len);
37 int ssl_pm_pending(const SSL *ssl);
38 
39 void ssl_pm_set_fd(SSL *ssl, int fd, int mode);
40 int ssl_pm_get_fd(const SSL *ssl, int mode);
41 
42 void ssl_pm_set_hostname(SSL *ssl, const char *hostname);
43 
44 OSSL_HANDSHAKE_STATE ssl_pm_get_state(const SSL *ssl);
45 
46 void ssl_pm_set_bufflen(SSL *ssl, int len);
47 
48 int x509_pm_show_info(X509 *x);
49 int x509_pm_new(X509 *x, X509 *m_x);
50 void x509_pm_free(X509 *x);
51 int x509_pm_load(X509 *x, const unsigned char *buffer, int len);
52 
53 int pkey_pm_new(EVP_PKEY *pk, EVP_PKEY *m_pk);
54 void pkey_pm_free(EVP_PKEY *pk);
55 int pkey_pm_load(EVP_PKEY *pk, const unsigned char *buffer, int len);
56 
57 long ssl_pm_get_verify_result(const SSL *ssl);
58 
59 #ifdef __cplusplus
60  }
61 #endif
62 
63 #endif
64