Browse Source

Fix no-threads

Make OPENSSL_fork_prepare() et al always available even in a no-threads
build. These functions are no-ops anyway so this shouldn't make any
difference.

This fixes an issue where the symbol_presence test fails in a no-threads
build. This is because these functions have not been marked in
libcrypto.num as being dependent on thread support. Enclosing the
declarations of the functions in the header with an appropriate guard
does not help because we never define OPENSSL_NO_THREADS (we define the
opposite OPENSSL_THREADS). This confuses the scripts which only consider
OPENSSL_NO_* guards. The simplest solution is to just make them always
available.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13647)
master
Matt Caswell 1 year ago
committed by Pauli
parent
commit
c739222b5a
3 changed files with 26 additions and 16 deletions
  1. +1
    -1
      crypto/build.info
  2. +25
    -0
      crypto/threads_lib.c
  3. +0
    -15
      crypto/threads_pthread.c

+ 1
- 1
crypto/build.info View File

@ -71,7 +71,7 @@ $UTIL_COMMON=\
cryptlib.c params.c params_from_text.c bsearch.c ex_data.c o_str.c \
ctype.c threads_pthread.c threads_win.c threads_none.c initthread.c \
context.c sparse_array.c asn1_dsa.c packet.c param_build.c $CPUIDASM \
param_build_set.c der_writer.c passphrase.c
param_build_set.c der_writer.c passphrase.c threads_lib.c
$UTIL_DEFINE=$CPUIDDEF
SOURCE[../libcrypto]=$UTIL_COMMON \


+ 25
- 0
crypto/threads_lib.c View File

@ -0,0 +1,25 @@
/*
* Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <openssl/crypto.h>
#ifndef OPENSSL_NO_DEPRECATED_3_0
void OPENSSL_fork_prepare(void)
{
}
void OPENSSL_fork_parent(void)
{
}
void OPENSSL_fork_child(void)
{
}
#endif

+ 0
- 15
crypto/threads_pthread.c View File

@ -200,21 +200,6 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
# ifndef FIPS_MODULE
# ifdef OPENSSL_SYS_UNIX
# ifndef OPENSSL_NO_DEPRECATED_3_0
void OPENSSL_fork_prepare(void)
{
}
void OPENSSL_fork_parent(void)
{
}
void OPENSSL_fork_child(void)
{
}
# endif
static pthread_once_t fork_once_control = PTHREAD_ONCE_INIT;
static void fork_once_func(void)


Loading…
Cancel
Save