diff --git a/crypto/fipsmodule/bn/exponentiation.c b/crypto/fipsmodule/bn/exponentiation.c index 8713715b03..920d8c0053 100644 --- a/crypto/fipsmodule/bn/exponentiation.c +++ b/crypto/fipsmodule/bn/exponentiation.c @@ -121,7 +121,8 @@ #if !defined(OPENSSL_NO_ASM) && \ (defined(OPENSSL_LINUX) || defined(OPENSSL_APPLE) || \ - defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD)) && \ + defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD) || \ + defined(OPENSSL_NETBSD)) && \ defined(OPENSSL_AARCH64) #include "../../../third_party/s2n-bignum/s2n-bignum_aws-lc.h" @@ -1296,7 +1297,7 @@ int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1 if (!bn_wexpand(rr2, widthn)) { return ret; } - + /* Ensure that montgomery contexts are initialized */ if (in_mont1 == NULL) { return ret; diff --git a/crypto/fipsmodule/bn/montgomery.c b/crypto/fipsmodule/bn/montgomery.c index c7ac15c18d..27e70fbcdf 100644 --- a/crypto/fipsmodule/bn/montgomery.c +++ b/crypto/fipsmodule/bn/montgomery.c @@ -124,7 +124,8 @@ #if !defined(OPENSSL_NO_ASM) && \ (defined(OPENSSL_LINUX) || defined(OPENSSL_APPLE) || \ - defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD)) && \ + defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD) || \ + defined(OPENSS_NETBSD) ) && \ defined(OPENSSL_AARCH64) && defined(OPENSSL_BN_ASM_MONT) #include "../../../third_party/s2n-bignum/s2n-bignum_aws-lc.h" diff --git a/crypto/fipsmodule/curve25519/internal.h b/crypto/fipsmodule/curve25519/internal.h index 0a25754503..9b7bebecb4 100644 --- a/crypto/fipsmodule/curve25519/internal.h +++ b/crypto/fipsmodule/curve25519/internal.h @@ -109,7 +109,8 @@ int ED25519ph_verify_digest_no_self_test( #if ((defined(OPENSSL_X86_64) && !defined(MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX)) || \ defined(OPENSSL_AARCH64)) && \ (defined(OPENSSL_LINUX) || defined(OPENSSL_APPLE) || \ - defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD)) && \ + defined(OPENSSL_OPENBSD) || defined(OPENSSL_FREEBSD) || \ + defined(OPENSSL_NETBSD)) && \ !defined(OPENSSL_NO_ASM) #define CURVE25519_S2N_BIGNUM_CAPABLE #endif diff --git a/crypto/rand_extra/internal.h b/crypto/rand_extra/internal.h index 5b929744f8..60b3cb34ba 100644 --- a/crypto/rand_extra/internal.h +++ b/crypto/rand_extra/internal.h @@ -11,7 +11,8 @@ #elif defined(OPENSSL_WINDOWS) #define OPENSSL_RAND_WINDOWS #elif defined(OPENSSL_MACOS) || defined(OPENSSL_OPENBSD) || \ - defined(OPENSSL_FREEBSD) || defined(OPENSSL_SOLARIS) || \ + defined(OPENSSL_FREEBSD) || defined(OPENSS_NETBSD) || \ + defined(OPENSSL_SOLARIS) || \ (defined(OPENSSL_LINUX) && !defined(HAVE_LINUX_RANDOM_H)) #define OPENSSL_RAND_GETENTROPY #elif defined(OPENSSL_IOS) diff --git a/crypto/rand_extra/urandom.c b/crypto/rand_extra/urandom.c index 433acffb2c..2b1805c185 100644 --- a/crypto/rand_extra/urandom.c +++ b/crypto/rand_extra/urandom.c @@ -30,6 +30,11 @@ #include #include +#if defined(OPENSSL_NETBSD) +#include +#include +#endif + #if defined(OPENSSL_LINUX) #if defined(AWS_LC_URANDOM_NEEDS_U32) // On old Linux OS: unknown type name '__u32' when include . @@ -431,7 +436,7 @@ static int fill_with_entropy(uint8_t *out, size_t len, int block, int seed) { // Hard bail. abort(); } - } + } // Clear |errno| so it has defined value if |read| or |getrandom| // "successfully" returns zero. diff --git a/crypto/ube/fork_detect.c b/crypto/ube/fork_detect.c index 2d2aba8dde..91116fe2fc 100644 --- a/crypto/ube/fork_detect.c +++ b/crypto/ube/fork_detect.c @@ -30,7 +30,7 @@ #if !defined(_GNU_SOURCE) #define _GNU_SOURCE // Needed for madvise() and MAP_ANONYMOUS. #endif -#elif defined(OPENSSL_FREEBSD) || defined(OPENSSL_OPENBSD) +#elif defined(OPENSSL_FREEBSD) || defined(OPENSSL_OPENBSD) || defined(OPENSSL_NETBSD) #define AWSLC_FORK_DETECTION_SUPPORTED // FreeBSD requires POSIX compatibility off for its syscalls // (enables __BSD_VISIBLE). Without the below line, cannot be @@ -114,7 +114,7 @@ static int init_fork_detect_wipeonfork(void *addr, long page_size) { #endif // defined(OPENSSL_LINUX) -#if defined(OPENSSL_FREEBSD) || defined(OPENSSL_OPENBSD) +#if defined(OPENSSL_FREEBSD) || defined(OPENSSL_OPENBSD) || defined(OPENSSL_NETBSD) #include #include diff --git a/include/openssl/target.h b/include/openssl/target.h index 974cd9e412..85f1bcd78a 100644 --- a/include/openssl/target.h +++ b/include/openssl/target.h @@ -174,6 +174,10 @@ #define OPENSSL_OPENBSD #endif +#if defined(__NetBSD__) +#define OPENSSL_NETBSD +#endif + #if defined(__illumos__) || (defined(__sun) && defined(__SVR4)) #define OPENSSL_SOLARIS #endif