openssl: add a simple smoke test for the legacy provider
This change adds a simple smoke test for the legacy provider to ensure that the provider doesn't break in the future when performing updates. This is not a functional or system test; the OpenSSL test suite does a much better job at doing this than we can. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53045
This commit is contained in:
@@ -682,6 +682,9 @@ buildasm cleanasm:
|
||||
${.TARGET:S/build/all/:S/asm$//}
|
||||
.endfor
|
||||
|
||||
HAS_TESTS= yes
|
||||
SUBDIR.${MK_TESTS}= tests
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
.if ${MACHINE} == "powerpc"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PACKAGE= tests
|
||||
|
||||
ATF_TESTS_SH+= libcrypto_test
|
||||
|
||||
.include <bsd.test.mk>
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Copyright (c) 2025 Enji Cooper
|
||||
|
||||
atf_test_case legacy_provider
|
||||
legacy_provider_head() {
|
||||
atf_set "descr" "daemon should drop privileges"
|
||||
}
|
||||
legacy_provider_body() {
|
||||
local passphrase="test"
|
||||
local plaintext="test"
|
||||
|
||||
export OPENSSL_CONF="$PWD/openssl.conf"
|
||||
cat > "$OPENSSL_CONF" <<EOF
|
||||
HOME = .
|
||||
|
||||
openssl_conf = openssl_init
|
||||
|
||||
[openssl_init]
|
||||
providers = provider_sect
|
||||
|
||||
# List of providers to load
|
||||
[provider_sect]
|
||||
default = default_sect
|
||||
legacy = legacy_sect
|
||||
|
||||
[default_sect]
|
||||
activate = 1
|
||||
|
||||
[legacy_sect]
|
||||
activate = 1
|
||||
EOF
|
||||
|
||||
echo "$plaintext" | atf_check -s exit:0 -e empty -o not-empty \
|
||||
openssl rc4 -e -k "$passphrase" -a -pbkdf2
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case legacy_provider
|
||||
}
|
||||
Reference in New Issue
Block a user