Skip to content

Commit

Permalink
Merge pull request #6022 from BOINC/vko_remove_openssl_builtin_engine…
Browse files Browse the repository at this point in the history
…s_and_add_tests

Remove OpenSSL built-in engines and add automation tests
  • Loading branch information
AenBleidd authored Jan 25, 2025
2 parents df43b3f + 0bf7992 commit b7a9977
Show file tree
Hide file tree
Showing 6 changed files with 755 additions and 322 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ jobs:
if: success() && matrix.type == 'unit-test'
run: ./tests/executeUnitTests.sh --report-coverage --report-xml

- name: Execute automation tests
if: success() && matrix.type == 'unit-test'
run: python ./tests/crypt_prog_tests.py ./lib/crypt_prog

- name: Execute integration-test
if: success() && matrix.type == 'integration-test'
run: ./integration_test/executeTestSuite.sh
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ jobs:
- name: Run unit tests
if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild'
working-directory: win_build\Build\${{matrix.platform}}\${{matrix.configuration}}
run: ${{github.workspace}}\temp\OpenCppCoverage\OpenCppCoverage-x64\OpenCppCoverage.exe --cover_children --optimized_build --sources ${{github.workspace}} --export_type=cobertura:cobertura.xml -- unittests.exe --gtest_output=xml:gtest.xml
run: |
${{github.workspace}}\temp\OpenCppCoverage\OpenCppCoverage-x64\OpenCppCoverage.exe --cover_children --optimized_build --sources ${{github.workspace}} --export_type=binary:gtest.cov -- unittests.exe --gtest_output=xml:gtest.xml
${{github.workspace}}\temp\OpenCppCoverage\OpenCppCoverage-x64\OpenCppCoverage.exe --cover_children --optimized_build --modules ${{github.workspace}} --sources ${{github.workspace}} --input_coverage=gtest.cov --export_type=cobertura:cobertura.xml -- python ${{github.workspace}}\tests\crypt_prog_tests.py ${{github.workspace}}\win_build\Build\x64\${{matrix.configuration}}\crypt_prog.exe
- name: Verify MSI file
if: success() && matrix.type == 'msbuild' && !startsWith(github.ref, 'refs/tags/')
Expand Down
33 changes: 21 additions & 12 deletions lib/crypt.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2023 University of California
// Copyright (C) 2025 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
Expand Down Expand Up @@ -34,7 +34,6 @@
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/conf.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/rsa.h>
#include <openssl/bn.h>
Expand Down Expand Up @@ -470,8 +469,10 @@ void openssl_to_keys(
RSA_get0_factors(rp, &p, &q);
RSA_get0_crt_params(rp, &dmp1, &dmq1, &iqmp);

bn_to_bin(n, pub.modulus, sizeof(pub.modulus));
bn_to_bin(e, pub.exponent, sizeof(pub.exponent));
if (n)
bn_to_bin(n, pub.modulus, sizeof(pub.modulus));
if (e)
bn_to_bin(e, pub.exponent, sizeof(pub.exponent));
#else
bn_to_bin(rp->n, pub.modulus, sizeof(pub.modulus));
bn_to_bin(rp->e, pub.exponent, sizeof(pub.exponent));
Expand All @@ -480,14 +481,22 @@ void openssl_to_keys(
memset(&priv, 0, sizeof(priv));
priv.bits = nbits;
#ifdef HAVE_OPAQUE_RSA_DSA_DH
bn_to_bin(n, priv.modulus, sizeof(priv.modulus));
bn_to_bin(e, priv.publicExponent, sizeof(priv.publicExponent));
bn_to_bin(d, priv.exponent, sizeof(priv.exponent));
bn_to_bin(p, priv.prime[0], sizeof(priv.prime[0]));
bn_to_bin(q, priv.prime[1], sizeof(priv.prime[1]));
bn_to_bin(dmp1, priv.primeExponent[0], sizeof(priv.primeExponent[0]));
bn_to_bin(dmq1, priv.primeExponent[1], sizeof(priv.primeExponent[1]));
bn_to_bin(iqmp, priv.coefficient, sizeof(priv.coefficient));
if (n)
bn_to_bin(n, priv.modulus, sizeof(priv.modulus));
if (e)
bn_to_bin(e, priv.publicExponent, sizeof(priv.publicExponent));
if (d)
bn_to_bin(d, priv.exponent, sizeof(priv.exponent));
if (p)
bn_to_bin(p, priv.prime[0], sizeof(priv.prime[0]));
if (q)
bn_to_bin(q, priv.prime[1], sizeof(priv.prime[1]));
if (dmp1)
bn_to_bin(dmp1, priv.primeExponent[0], sizeof(priv.primeExponent[0]));
if (dmq1)
bn_to_bin(dmq1, priv.primeExponent[1], sizeof(priv.primeExponent[1]));
if (iqmp)
bn_to_bin(iqmp, priv.coefficient, sizeof(priv.coefficient));
#else
bn_to_bin(rp->n, priv.modulus, sizeof(priv.modulus));
bn_to_bin(rp->e, priv.publicExponent, sizeof(priv.publicExponent));
Expand Down
Loading

0 comments on commit b7a9977

Please sign in to comment.