Skip to content

Commit

Permalink
Make LibCrypto::Bio an opaque type like in the C header
Browse files Browse the repository at this point in the history
The public headers don't disclose the data layout of `BIO`, so we should
not model it in the Crystal bindings either.

Doing that and having it wrong leads to issues such as crystal-lang#12647
  • Loading branch information
straight-shoota committed Nov 10, 2024
1 parent caf57c2 commit 794de9c
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/openssl/lib_crypto.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,7 @@ lib LibCrypto
type X509_STORE = Void*
type X509_STORE_CTX = Void*

struct Bio
method : Void*
callback : BIO_callback_fn
{% if compare_versions(LIBRESSL_VERSION, "3.5.0") >= 0 %}
callback_ex : BIO_callback_fn_ex
{% end %}
cb_arg : Char*
init : Int
shutdown : Int
flags : Int
retry_reason : Int
num : Int
ptr : Void*
next_bio : Void*
prev_bio : Void*
references : Int
num_read : ULong
num_write : ULong
end

alias BIO_callback_fn = (Bio*, Int, Char*, Int, Long, Long) -> Long
alias BIO_callback_fn_ex = (Bio*, Int, Char, SizeT, Int, Long, Int, SizeT*) -> Long
type Bio = Void

PKCS5_SALT_LEN = 8
EVP_MAX_KEY_LENGTH = 32
Expand Down

0 comments on commit 794de9c

Please sign in to comment.