Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LibCrypto bindings for LibreSSL 3.5+ #14872

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/openssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,33 @@ jobs:
run: bin/crystal eval 'require "openssl"; p! LibSSL::OPENSSL_VERSION, LibSSL::LIBRESSL_VERSION'
- name: Run OpenSSL specs
run: bin/crystal spec --order=random spec/std/openssl/
libressl35:
runs-on: ubuntu-latest
name: "LibreSSL 3.5"
container: crystallang/crystal:1.13.1-alpine
steps:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Uninstall openssl
run: apk del openssl-dev openssl-libs-static
- name: Install libressl 3.5
run: apk add "libressl-dev=~3.5" --repository=http://dl-cdn.alpinelinux.org/alpine/v3.16/community
- name: Check LibSSL version
run: bin/crystal eval 'require "openssl"; p! LibSSL::OPENSSL_VERSION, LibSSL::LIBRESSL_VERSION'
- name: Run OpenSSL specs
run: bin/crystal spec --order=random spec/std/openssl/
libressl38:
runs-on: ubuntu-latest
name: "LibreSSL 3.5"
container: crystallang/crystal:1.13.1-alpine
steps:
- name: Download Crystal source
uses: actions/checkout@v2
- name: Uninstall openssl
run: apk del openssl-dev openssl-libs-static
- name: Install libressl 3.8
run: apk add "libressl-dev=~3.8" --repository=http://dl-cdn.alpinelinux.org/alpine/v3.20/community
- name: Check LibSSL version
run: bin/crystal eval 'require "openssl"; p! LibSSL::OPENSSL_VERSION, LibSSL::LIBRESSL_VERSION'
- name: Run OpenSSL specs
run: bin/crystal spec --order=random spec/std/openssl/
8 changes: 7 additions & 1 deletion src/openssl/lib_crypto.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ lib LibCrypto

struct Bio
method : Void*
callback : (Void*, Int, Char*, Int, Long, Long) -> Long
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
Expand All @@ -72,6 +75,9 @@ lib LibCrypto
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

PKCS5_SALT_LEN = 8
EVP_MAX_KEY_LENGTH = 32
EVP_MAX_IV_LENGTH = 16
Expand Down
Loading