libcrypto: bind couple X509, X509_STORE and SSL_CTX helpers

This commit is contained in:
Halil Durak
2026-07-01 11:57:10 +03:00
parent 22fe4e993a
commit 6e75a0caa9

View File

@@ -343,6 +343,26 @@ pub extern fn EVP_MD_CTX_free(ctx: ?*EVP_MD_CTX) void;
pub const struct_evp_md_ctx_st = opaque {};
pub const EVP_MD_CTX = struct_evp_md_ctx_st;
pub extern fn X509_free(x509: ?*X509) void;
pub extern fn d2i_X509(out: [*c]?*X509, inp: *[*]const u8, len: c_long) ?*X509;
//pub const struct_x509_store_ctx_st = opaque {};
//pub const X509_STORE_CTX = struct_x509_store_ctx_st;
pub const struct_x509_store_st = opaque {};
pub const X509_STORE = struct_x509_store_st;
pub extern fn X509_STORE_new() ?*X509_STORE;
pub extern fn X509_STORE_free(store: *X509_STORE) void;
pub extern fn X509_STORE_add_cert(store: ?*X509_STORE, x: ?*X509) c_int;
pub extern fn X509_STORE_add_crl(store: ?*X509_STORE, x: ?*X509_CRL) c_int;
pub const struct_ssl_ctx_st = opaque {};
pub const SSL_CTX = struct_ssl_ctx_st;
/// SSL_CTX takes ownership.
pub extern fn SSL_CTX_set0_verify_cert_store(ctx: ?*SSL_CTX, store: ?*X509_STORE) c_int;
/// Ownership remains, ref count increments.
pub extern fn SSL_CTX_set1_verify_cert_store(ctx: ?*SSL_CTX, store: ?*X509_STORE) c_int;
/// Returns the desired digest by its name.
pub fn findDigest(name: []const u8) error{Invalid}!*const EVP_MD {
if (std.mem.eql(u8, "SHA-256", name)) {