diff --git a/scripts/ocsp-stapling.test b/scripts/ocsp-stapling.test index 787f7af66..075baea83 100755 --- a/scripts/ocsp-stapling.test +++ b/scripts/ocsp-stapling.test @@ -383,7 +383,18 @@ fi # need a unique port since may run the same time as testsuite generate_port() { - port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + #-------------------------------------------------------------------------# + # Generate a random port number + #-------------------------------------------------------------------------# + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) + elif [[ "$OSTYPE" == "darwin"* ]]; then + port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + else + echo "Unknown OS TYPE" + exit 1 + fi } # Start OpenSSL server that has no OCSP responses to return diff --git a/scripts/ocsp-stapling2.test b/scripts/ocsp-stapling2.test index 5fdc48bc6..7ede390df 100755 --- a/scripts/ocsp-stapling2.test +++ b/scripts/ocsp-stapling2.test @@ -448,7 +448,18 @@ printf '%s\n\n' "Test successfully REVOKED!" # need a unique port since may run the same time as testsuite generate_port() { - port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + #-------------------------------------------------------------------------# + # Generate a random port number + #-------------------------------------------------------------------------# + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) + elif [[ "$OSTYPE" == "darwin"* ]]; then + port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + else + echo "Unknown OS TYPE" + exit 1 + fi } # Start OpenSSL server that has no OCSP responses to return diff --git a/scripts/openssl.test b/scripts/openssl.test index 47d1cfc80..348b39d1a 100755 --- a/scripts/openssl.test +++ b/scripts/openssl.test @@ -32,9 +32,19 @@ echo "WOLFSSL_OPENSSL_TEST set, running test..." # need a unique port since may run the same time as testsuite generate_port() { - port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) -} + #-------------------------------------------------------------------------# + # Generate a random port number + #-------------------------------------------------------------------------# + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) + elif [[ "$OSTYPE" == "darwin"* ]]; then + port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + else + echo "Unknown OS TYPE" + exit 1 + fi +} no_pid=-1 servers="" diff --git a/scripts/openssl_srtp.test b/scripts/openssl_srtp.test index 145eb4c56..1e47da972 100755 --- a/scripts/openssl_srtp.test +++ b/scripts/openssl_srtp.test @@ -15,7 +15,18 @@ WOLFSSL_CLIENT=${WOLFSSL_CLIENT:="./examples/client/client"} # need a unique port since may run the same time as testsuite generate_port() { - port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + #-------------------------------------------------------------------------# + # Generate a random port number + #-------------------------------------------------------------------------# + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512)) + elif [[ "$OSTYPE" == "darwin"* ]]; then + port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512)) + else + echo "Unknown OS TYPE" + exit 1 + fi } # get size of key material based on the profile