Files
mars-nwe/include/openssl/ssl.h
2026-06-05 15:31:38 +02:00

93 lines
2.6 KiB
C

#ifndef MARS_MATRIXSSL_OPENSSL_SSL_H
#define MARS_MATRIXSSL_OPENSSL_SSL_H
#include <stdio.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct mars_ssl_ctx_st SSL_CTX;
typedef struct mars_ssl_st SSL;
typedef struct mars_ssl_method_st SSL_METHOD;
typedef struct mars_bio_st BIO;
typedef struct mars_bio_method_st BIO_METHOD;
typedef struct mars_x509_st X509;
typedef struct mars_x509_name_st X509_NAME;
typedef struct mars_evp_pkey_st EVP_PKEY;
#define SSL_FILETYPE_PEM 1
#define SSL_FILETYPE_ASN1 2
#define X509_FILETYPE_PEM SSL_FILETYPE_PEM
#define SSL_ERROR_NONE 0
#define SSL_ERROR_SSL 1
#define SSL_ERROR_WANT_READ 2
#define SSL_ERROR_WANT_WRITE 3
#define SSL_ERROR_WANT_X509_LOOKUP 4
#define SSL_ERROR_SYSCALL 5
#define SSL_ERROR_ZERO_RETURN 6
#define SSL_ERROR_WANT_CONNECT 7
#define SSL_ERROR_WANT_ACCEPT 8
#define SSL_VERIFY_NONE 0x00
#define SSL_VERIFY_PEER 0x01
#define X509_V_OK 0
#define SSL_MODE_AUTO_RETRY 0x00000004L
#define TLS1_2_VERSION 0x0303
#define TLS1_3_VERSION 0x0304
#define NID_commonName 13
#define EVP_PKEY_RSA 6
int SSL_library_init(void);
#define OpenSSL_add_ssl_algorithms() SSL_library_init()
#define SSLeay_add_ssl_algorithms() SSL_library_init()
#define OpenSSL_add_all_algorithms() SSL_library_init()
void SSL_load_error_strings(void);
void ERR_load_BIO_strings(void);
void ERR_print_errors_fp(FILE *fp);
void ERR_clear_error(void);
unsigned long ERR_peek_error(void);
const SSL_METHOD *TLS_server_method(void);
const SSL_METHOD *SSLv23_client_method(void);
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
void SSL_CTX_free(SSL_CTX *ctx);
int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);
int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);
int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);
int SSL_CTX_check_private_key(const SSL_CTX *ctx);
int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
SSL *SSL_new(SSL_CTX *ctx);
void SSL_free(SSL *ssl);
int SSL_set_fd(SSL *ssl, int fd);
int SSL_accept(SSL *ssl);
int SSL_connect(SSL *ssl);
int SSL_read(SSL *ssl, void *buf, int num);
int SSL_write(SSL *ssl, const void *buf, int num);
int SSL_shutdown(SSL *ssl);
int SSL_get_error(const SSL *ssl, int ret);
int SSL_pending(const SSL *ssl);
long SSL_set_mode(SSL *ssl, long mode);
long SSL_get_verify_result(const SSL *ssl);
X509 *SSL_get_peer_certificate(const SSL *ssl);
X509_NAME *X509_get_subject_name(X509 *cert);
int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len);
EVP_PKEY *X509_get_pubkey(X509 *cert);
void EVP_PKEY_free(EVP_PKEY *pkey);
void X509_free(X509 *cert);
struct mars_evp_pkey_st { int type; };
#ifdef __cplusplus
}
#endif
#endif