Skip to content

Commit 61d4e16

Browse files
author
Test User
committed
Dont test unit test with replace default
1 parent 955d0c1 commit 61d4e16

File tree

4 files changed

+21
-50
lines changed

4 files changed

+21
-50
lines changed

configure.ac

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,6 @@ if test "x$have_openssl" = "xyes"; then
4040
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
4141
fi
4242

43-
# Check if OpenSSL is built with replace-default mode
44-
AC_MSG_CHECKING([if OpenSSL is built with replace-default mode])
45-
AC_RUN_IFELSE(
46-
[AC_LANG_PROGRAM(
47-
[[#include <openssl/opensslv.h>
48-
#include <string.h>
49-
#include <stdio.h>]],
50-
[[const char *version = OPENSSL_VERSION_TEXT;
51-
if (strstr(version, "replace-default") != NULL) {
52-
return 0;
53-
}
54-
return 1;]])],
55-
[replace_default=yes],
56-
[replace_default=no],
57-
[replace_default=no])
58-
AC_MSG_RESULT([$replace_default])
59-
60-
if test "$replace_default" = "yes"; then
61-
AM_CFLAGS="$AM_CFLAGS -DREPLACE_DEFAULT"
62-
fi
63-
6443
# wolfSSL
6544
AX_CHECK_WOLFSSL(
6645
[have_wolfssl=yes],

debian/rules

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,28 @@ override_dh_auto_clean:
9898
rm -rf test/standalone/tests/.libs
9999

100100
override_dh_auto_test:
101-
@if [ -n "$(DEB_LDFLAGS_APPEND)" ]; then \
102-
# If DEB_LDFLAGS_APPEND is set, it usually means the \
103-
# build system is using a custom library path, rather \
104-
# than the system path. So let's set up LD_LIBRARY_PATH \
105-
# to use it when running `make test`. \
106-
echo "Setting up LD_LIBRARY_PATH from DEB_LDFLAGS_APPEND"; \
107-
LD_LIBRARY_PATH="$$(echo $(DEB_LDFLAGS_APPEND) | \
108-
grep -oE -- '-L[^ ]+' | sed 's/^-L//' | awk '!seen[$$0]++' | paste -sd: -)" \
109-
$(MAKE) test; \
101+
@REPLACE_DEFAULT=0; \
102+
if command -v openssl >/dev/null 2>&1; then \
103+
OPENSSL_VERSION=$$(openssl version 2>/dev/null || echo ""); \
104+
if echo "$$OPENSSL_VERSION" | grep -qi "wolfProvider"; then \
105+
REPLACE_DEFAULT=1; \
106+
fi; \
107+
fi; \
108+
if [ $$REPLACE_DEFAULT -eq 1 ]; then \
109+
echo "Skipping unit tests (OpenSSL built with replace-default mode)"; \
110110
else \
111-
$(MAKE) test; \
111+
if [ -n "$(DEB_LDFLAGS_APPEND)" ]; then \
112+
# If DEB_LDFLAGS_APPEND is set, it usually means the \
113+
# build system is using a custom library path, rather \
114+
# than the system path. So let's set up LD_LIBRARY_PATH \
115+
# to use it when running `make test`. \
116+
echo "Setting up LD_LIBRARY_PATH from DEB_LDFLAGS_APPEND"; \
117+
LD_LIBRARY_PATH="$$(echo $(DEB_LDFLAGS_APPEND) | \
118+
grep -oE -- '-L[^ ]+' | sed 's/^-L//' | awk '!seen[$$0]++' | paste -sd: -)" \
119+
$(MAKE) test; \
120+
else \
121+
$(MAKE) test; \
122+
fi; \
112123
fi
113124

114125
override_dh_shlibdeps:

test/test_ecc.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -944,9 +944,7 @@ static int test_pkey_verify_ecc(EVP_PKEY *pkey, OSSL_LIB_CTX* libCtx,
944944
int test_ecdsa_p192_pkey(void *data)
945945
{
946946
int err;
947-
#ifndef REPLACE_DEFAULT
948947
int res;
949-
#endif
950948
EVP_PKEY *pkey = NULL;
951949
unsigned char ecdsaSig[64];
952950
size_t ecdsaSigLen;
@@ -960,9 +958,6 @@ int test_ecdsa_p192_pkey(void *data)
960958
pkey = d2i_PrivateKey(EVP_PKEY_EC, NULL, &p, sizeof(ecc_key_der_192));
961959
err = pkey == NULL;
962960
}
963-
#ifndef REPLACE_DEFAULT
964-
/* With replace default, OpenSSL inherits wolfProvider, so we can't test
965-
* cross-provider behavior with P-192. */
966961
if (err == 0) {
967962
PRINT_MSG("Sign with OpenSSL");
968963
ecdsaSigLen = sizeof(ecdsaSig);
@@ -982,7 +977,6 @@ int test_ecdsa_p192_pkey(void *data)
982977
if (res != 1)
983978
err = 1;
984979
}
985-
#endif
986980
if (err == 0) {
987981
PRINT_MSG("Sign with wolfprovider");
988982
ecdsaSigLen = sizeof(ecdsaSig);
@@ -1237,9 +1231,7 @@ int test_ecdsa_p521_pkey(void *data)
12371231
int test_ecdsa_p192(void *data)
12381232
{
12391233
int err;
1240-
#ifndef REPLACE_DEFAULT
12411234
int res;
1242-
#endif
12431235
EVP_PKEY *pkey = NULL;
12441236
unsigned char ecdsaSig[64];
12451237
size_t ecdsaSigLen;
@@ -1258,9 +1250,6 @@ int test_ecdsa_p192(void *data)
12581250
pkey = d2i_PrivateKey(EVP_PKEY_EC, NULL, &p, sizeof(ecc_key_der_192));
12591251
err = pkey == NULL;
12601252
}
1261-
#ifndef REPLACE_DEFAULT
1262-
/* With replace default, OpenSSL inherits wolfProvider, so we can't test
1263-
* cross-provider behavior with P-192. */
12641253
if (err == 0) {
12651254
PRINT_MSG("Sign with OpenSSL");
12661255
ecdsaSigLen = sizeof(ecdsaSig);
@@ -1280,7 +1269,6 @@ int test_ecdsa_p192(void *data)
12801269
if (res != 1)
12811270
err = 1;
12821271
}
1283-
#endif
12841272

12851273
if (err == 0) {
12861274
PRINT_MSG("Sign with wolfprovider");

test/test_rsa.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121
#include "unit.h"
22-
#include <wolfprovider/wp_fips.h>
2322
#include <wolfssl/wolfcrypt/asn.h>
2423

2524
#include <openssl/store.h>
@@ -597,9 +596,6 @@ int test_rsa_sign_sha1(void *data)
597596
err = RAND_bytes(buf, sizeof(buf)) == 0;
598597
}
599598

600-
#ifndef REPLACE_DEFAULT
601-
/* With replace default, OpenSSL inherits wolfProvider, so we can't test
602-
* cross-provider behavior with SHA-1. */
603599
if (err == 0) {
604600
PRINT_MSG("Sign with OpenSSL");
605601
err = test_digest_sign(pkey, osslLibCtx, buf, sizeof(buf), "SHA-1",
@@ -616,7 +612,6 @@ int test_rsa_sign_sha1(void *data)
616612
err = test_digest_sign(pkey, wpLibCtx, buf, sizeof(buf), "SHA-1",
617613
NULL, rsaSig, &rsaSigLen, 0, 0) != 1;
618614
}
619-
#endif /* REPLACE_DEFAULT */
620615
EVP_PKEY_free(pkey);
621616

622617
if (rsaSig)
@@ -1262,7 +1257,6 @@ int test_rsa_pkey_invalid_key_size(void *data) {
12621257
}
12631258

12641259
#if defined(HAVE_FIPS) || defined(HAVE_FIPS_VERSION)
1265-
#ifndef REPLACE_DEFAULT
12661260
if (err == 0) {
12671261
PRINT_MSG("Check that signing with OpenSSL and verifying with "
12681262
"wolfProvider using a 1024-bit key works.");
@@ -1273,7 +1267,6 @@ int test_rsa_pkey_invalid_key_size(void *data) {
12731267
err = test_pkey_verify(pkey, wpLibCtx, buf, sizeof(buf), rsaSig,
12741268
rsaSigLen, 0, NULL, NULL);
12751269
}
1276-
#endif
12771270
#endif /* HAVE_FIPS || HAVE_FIPS_VERSION */
12781271

12791272
EVP_PKEY_free(pkey);

0 commit comments

Comments
 (0)