Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wolfSSL/wolfssl into ED25…
Browse files Browse the repository at this point in the history
…519_SHA2_fix
  • Loading branch information
gojimmypi committed Jan 26, 2025
2 parents de5b3c8 + 3379328 commit 3aae0d9
Show file tree
Hide file tree
Showing 41 changed files with 2,199 additions and 553 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/bind.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: bind9 Tests

# START OF COMMON SECTION
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# END OF COMMON SECTION

jobs:
build_wolfssl:
name: Build wolfSSL
if: github.repository_owner == 'wolfssl'
# Just to keep it the same as the testing target
runs-on: ubuntu-22.04
# This should be a safe limit for the tests to run.
timeout-minutes: 4
steps:
- name: Build wolfSSL
uses: wolfSSL/actions-build-autotools-project@v1
with:
path: wolfssl
configure: --enable-all
install: true
check: false

- name: tar build-dir
run: tar -zcf build-dir.tgz build-dir

- name: Upload built lib
uses: actions/upload-artifact@v4
with:
name: wolf-install-bind
path: build-dir.tgz
retention-days: 5

bind_check:
strategy:
fail-fast: false
matrix:
# List of releases to test
ref: [ 9.18.0, 9.18.28 ]
name: ${{ matrix.ref }}
if: github.repository_owner == 'wolfssl'
runs-on: ubuntu-22.04
# This should be a safe limit for the tests to run.
timeout-minutes: 10
needs: build_wolfssl
steps:
- name: Download lib
uses: actions/download-artifact@v4
with:
name: wolf-install-bind

- name: untar build-dir
run: tar -xf build-dir.tgz

- name: Install dependencies
run: |
# Don't prompt for anything
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
# hostap dependencies
sudo apt-get install -y libuv1-dev libnghttp2-dev libcap-dev libcmocka-dev
- name: Checkout OSP
uses: actions/checkout@v4
with:
repository: wolfssl/osp
path: osp

- name: Checkout bind9
uses: actions/checkout@v4
with:
repository: isc-projects/bind9
path: bind
ref: v${{ matrix.ref }}

- name: Build and test bind9
working-directory: bind
run: |
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build-dir/lib/pkgconfig
patch -p1 < $GITHUB_WORKSPACE/osp/bind9/${{ matrix.ref }}.patch
autoreconf -ivf
./configure --with-wolfssl
sed -i 's/SUBDIRS = system//g' bin/tests/Makefile # remove failing tests
make -j V=1
make -j V=1 check
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5951,7 +5951,7 @@ then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE128"
if test "$ENABLED_SHA3" = "no"
then
AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
AC_MSG_ERROR([shake128 requires SHA-3: --enable-sha3])
fi
else
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE128"
Expand All @@ -5967,7 +5967,7 @@ then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE256"
if test "$ENABLED_SHA3" = "no"
then
AC_MSG_ERROR([Must have SHA-3 enabled: --enable-sha3])
AC_MSG_ERROR([shake256 requires SHA-3: --enable-sha3])
fi
else
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_NO_SHAKE256"
Expand Down
57 changes: 32 additions & 25 deletions linuxkm/module_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,38 @@ static int wolfssl_init(void)
}
return -ECANCELED;
}
#endif /* HAVE_FIPS */

#ifdef WC_RNG_SEED_CB
ret = wc_SetSeed_Cb(wc_GenerateSeed);
if (ret < 0) {
pr_err("wc_SetSeed_Cb() failed with return code %d.\n", ret);
(void)libwolfssl_cleanup();
msleep(10);
return -ECANCELED;
}
#endif

#ifdef WOLFCRYPT_ONLY
ret = wolfCrypt_Init();
if (ret != 0) {
pr_err("wolfCrypt_Init() failed: %s\n", wc_GetErrorString(ret));
return -ECANCELED;
}
#else
ret = wolfSSL_Init();
if (ret != WOLFSSL_SUCCESS) {
pr_err("wolfSSL_Init() failed: %s\n", wc_GetErrorString(ret));
return -ECANCELED;
}
#endif

#ifdef HAVE_FIPS
ret = wc_RunAllCast_fips();
if (ret != 0) {
pr_err("wc_RunAllCast_fips() failed with return value %d\n", ret);
return -ECANCELED;
}

pr_info("FIPS 140-3 wolfCrypt-fips v%d.%d.%d%s%s startup "
"self-test succeeded.\n",
Expand All @@ -270,33 +302,8 @@ static int wolfssl_init(void)
""
#endif
);

#endif /* HAVE_FIPS */

#ifdef WC_RNG_SEED_CB
ret = wc_SetSeed_Cb(wc_GenerateSeed);
if (ret < 0) {
pr_err("wc_SetSeed_Cb() failed with return code %d.\n", ret);
(void)libwolfssl_cleanup();
msleep(10);
return -ECANCELED;
}
#endif

#ifdef WOLFCRYPT_ONLY
ret = wolfCrypt_Init();
if (ret != 0) {
pr_err("wolfCrypt_Init() failed: %s\n", wc_GetErrorString(ret));
return -ECANCELED;
}
#else
ret = wolfSSL_Init();
if (ret != WOLFSSL_SUCCESS) {
pr_err("wolfSSL_Init() failed: %s\n", wc_GetErrorString(ret));
return -ECANCELED;
}
#endif

#ifndef NO_CRYPT_TEST
ret = wolfcrypt_test(NULL);
if (ret < 0) {
Expand Down
14 changes: 14 additions & 0 deletions src/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2770,9 +2770,23 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
}
else {
size_t currLen = XSTRLEN(b->ip);
#ifdef WOLFSSL_NO_REALLOC
char* tmp = NULL;
#endif

if (currLen != newLen) {
#ifdef WOLFSSL_NO_REALLOC
tmp = b->ip;
b->ip = (char*)XMALLOC(newLen+1, b->heap, DYNAMIC_TYPE_OPENSSL);
if (b->ip != NULL && tmp != NULL) {
XMEMCPY(b->ip, tmp, newLen);
XFREE(tmp, b->heap, DYNAMIC_TYPE_OPENSSL);
tmp = NULL;
}
#else
b->ip = (char*)XREALLOC(b->ip, newLen + 1, b->heap,
DYNAMIC_TYPE_OPENSSL);
#endif
if (b->ip == NULL) {
WOLFSSL_MSG("Hostname realloc failed.");
return WOLFSSL_FAILURE;
Expand Down
10 changes: 10 additions & 0 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,18 @@ static char* expandValue(WOLFSSL_CONF *conf, const char* section,
/* This will allocate slightly more memory than necessary
* but better be safe */
strLen += valueLen;
#ifdef WOLFSSL_NO_REALLOC
newRet = (char*)XMALLOC(strLen + 1, NULL,
DYNAMIC_TYPE_OPENSSL);
if (newRet != NULL && ret != NULL) {
XMEMCPY(newRet, ret, (strLen - valueLen) + 1);
XFREE(ret, NULL, DYNAMIC_TYPE_OPENSSL);
ret = NULL;
}
#else
newRet = (char*)XREALLOC(ret, strLen + 1, NULL,
DYNAMIC_TYPE_OPENSSL);
#endif
if (!newRet) {
WOLFSSL_MSG("realloc error");
goto expand_cleanup;
Expand Down
Loading

0 comments on commit 3aae0d9

Please sign in to comment.