Skip to content

Commit

Permalink
fix: Segfault when OpenSSL queries signature length. (#46)
Browse files Browse the repository at this point in the history
fix: Segfault when OpenSSL queries signature length.
Fix macos ci.
  • Loading branch information
clundin25 authored Nov 28, 2023
1 parent ef1406c commit 8859280
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew update && brew install cmake openssl@3
run: brew update && brew install cmake openssl@3.0
- name: Build Library
run: OPENSSL_ROOT_DIR="$(brew --prefix openssl@3)" cmake -S . -B build -DENABLE_UNIT_TESTS=TRUE && cmake --build build
run: OPENSSL_ROOT_DIR="$(brew --prefix openssl@3.0)" cmake -S . -B build -DENABLE_UNIT_TESTS=TRUE && cmake --build build
- name: Set up Signer Proxy Binaries
run: ./scripts/setup_signer_proxy.sh
- name: Integration Test
Expand Down
8 changes: 8 additions & 0 deletions src/offload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ int CustomDigestSign(EVP_MD_CTX *ctx, unsigned char *sig, size_t *sig_len,
LogInfo("Unsupported ECDSA hash");
return 0;
}
if (sig == NULL) {
*sig_len = 72;
return 1;
}
} else if (EVP_PKEY_id(pkey) == EVP_PKEY_RSA) {
const EVP_MD *md;
if (EVP_PKEY_CTX_get_signature_md(pctx, &md) != 1 ||
Expand All @@ -214,6 +218,10 @@ int CustomDigestSign(EVP_MD_CTX *ctx, unsigned char *sig, size_t *sig_len,
LogInfo("Unsupported RSA-PSS salt length");
return 0;
}
if (sig == NULL) {
*sig_len = 256;
return 1;
}
} else {
LogInfo("Unsupported key");
return 0;
Expand Down

0 comments on commit 8859280

Please sign in to comment.