2 Star 6 Fork 5

赵建辉/ssl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ssl.h 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
赵建辉 提交于 2023-07-01 18:32 . Add a new error code SSL_INSECURE
/* SPDX-License-Identifier: MIT */
/*
* Author: Jianhui Zhao <zhaojh329@gmail.com>
*/
#ifndef __SSL_H
#define __SSL_H
#include <stdbool.h>
enum {
SSL_OK = 0,
SSL_ERROR = -1,
SSL_WANT_READ = -2,
SSL_WANT_WRITE = -3,
SSL_INSECURE = -4
};
struct ssl {
int err;
};
struct ssl_context;
const char *ssl_last_error_string(struct ssl *ssl, char *buf, int len);
struct ssl_context *ssl_context_new(bool server);
void ssl_context_free(struct ssl_context *ctx);
struct ssl *ssl_session_new(struct ssl_context *ctx, int sock);
void ssl_session_free(struct ssl *ssl);
int ssl_load_ca_cert_file(struct ssl_context *ctx, const char *file);
int ssl_load_cert_file(struct ssl_context *ctx, const char *file);
int ssl_load_key_file(struct ssl_context *ctx, const char *file);
int ssl_set_ciphers(struct ssl_context *ctx, const char *ciphers);
int ssl_set_require_validation(struct ssl_context *ctx, bool require);
void ssl_set_server_name(struct ssl *ssl, const char *name);
int ssl_read(struct ssl *ssl, void *buf, int len);
int ssl_write(struct ssl *ssl, const void *buf, int len);
int ssl_accept(struct ssl *ssl, void (*on_verify_error)(int error, const char *str, void *arg), void *arg);
int ssl_connect(struct ssl *ssl, void (*on_verify_error)(int error, const char *str, void *arg), void *arg);
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/zhaojh329/ssl.git
git@gitee.com:zhaojh329/ssl.git
zhaojh329
ssl
ssl
master

搜索帮助