summaryrefslogtreecommitdiffstats
path: root/include/internal/refcount.h
AgeCommit message (Collapse)Author
2023-07-27Include <openssl/err.h> in include/refcount.hJohn Kohl
Fixes #21555 CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> (Merged from https://github.com/openssl/openssl/pull/21561)
2023-07-05fix memory allocation and reference counting issuesPauli
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/21341)
2023-07-01refcnt: convert references counts to a structurePauli
The structure includes the count and optionally a lock. The count has the appropriate qualifiers. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21260)
2023-05-24QUIC: Fix bugs where threading is disabledHugo Landau
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20856)
2023-05-12QUIC: Fix CRYPTO_GET_REFHugo Landau
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
2023-05-12REFCOUNT: Add support for querying refcountHugo Landau
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
2022-11-25Disable atomic refcounts with no-threadsJ.W. Jagersma
This is needed for building with '-march=i386 no-threads', on platforms where libatomic is not available (djgpp, specifically). The implementation now falls back to 'CRYPTO_atomic_add()', which performs plain lock-free addition in a 'no-threads' build. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19751)
2021-05-28Rework and make DEBUG macros consistent.Rich Salz
Remove unused -DCONF_DEBUG and -DBN_CTX_DEBUG. Rename REF_PRINT to REF_DEBUG for consistency, and add a new tracing category and use it for printing reference counts. Rename -DDEBUG_UNUSED to -DUNUSED_RESULT_DEBUG Fix BN_DEBUG_RAND so it compiles and, when set, force DEBUG_RAND to be set also. Rename engine_debug_ref to be ENGINE_REF_PRINT also for consistency. Fixes #15357 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15353)
2021-02-18Update copyright yearMatt Caswell
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14235)
2021-02-10include/internal: add a few missing #pragma once directivesFdaSilvaYY
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/14096)
2020-12-03tag unused function arguments as ossl_unusedPauli
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13577)
2020-11-16REF_PRINT: cast pointer to void to avoid warningsDaniel Bevenius
Currently, when configuring OpenSSL and specifying the --strict-warnings option there are failures like the following one: crypto/bio/bio_lib.c: In function 'BIO_up_ref': include/internal/refcount.h:169:25: error: format '%p' expects argument of type 'void *', but argument 3 has type 'BIO *' {aka 'struct bio_st *'} [-Werror=format=] 169 | fprintf(stderr, "%p:%4d:%s\n", b, b->references, a) | ^~~~~~~~~~~~~ crypto/bio/bio_lib.c:185:5: note: in expansion of macro'REF_PRINT_COUNT' 185 | REF_PRINT_COUNT("BIO", a); | ^~~~~~~~~~~~~~~ include/internal/refcount.h:169:27: note: format string is defined here 169 | fprintf(stderr, "%p:%4d:%s\n", b, b->references, a) | ~^ | | | void * cc1: all warnings being treated as errors This commit adds casts to avoid the warnings. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13389)
2020-06-21Fix one typo in a comment.FdaSilvaYY
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12209)
2019-09-28Fix header file include guard namesDr. Matthias St. Pierre
Make the include guards consistent by renaming them systematically according to the naming conventions below For the public header files (in the 'include/openssl' directory), the guard names try to match the path specified in the include directives, with all letters converted to upper case and '/' and '.' replaced by '_'. For the private header files files, an extra 'OSSL_' is added as prefix. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
2019-09-18Fix Compiler error/warning for windows icl buildShane Lontis
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9907)
2019-04-07fix --strict-warnings buildPatrick Steuer
C++ style comments are not allowed in ISO C90 Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8693)
2019-03-29Avoid linking error on WCE700 for _InterlockedExchangeAdd().Soujyu Tanaka
This implementation is referenced to https://www.boost.org/doc/libs/1_69_0/boost/detail/interlocked.hpp Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8596)
2019-03-14internal/refcount.h: allow non-atomic buildRichard Levitte
Configure with -DOPENSSL_DEV_NO_ATOMICS and you get refcount without atomics. This is intended for internal development only, to check the refcounting is properly coded. It should never become a configuration option, hence the name of the macro. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/8479)
2018-12-06Following the license change, modify the boilerplates in include/ and ↵Richard Levitte
crypto/include/ Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7770)
2018-08-16internal/refcount.h: overhaul fencing and add _MSC_VER section.Andy Polyakov
Relax memory_order on counter decrement itself, because mutable members of the reference-counted structure should be visible on all processors independently on counter. [Even re-format and minimize dependency on other headers.] Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/6900)
2017-08-30Move the REF_PRINT support from e_os.h to internal/refcount.h.Pauli
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4188)
2017-05-28Revert "Add internal functions to fetch a refcount"Richard Levitte
It turned out to be a bad idea. This reverts commits 6891a79da67ccd621b67e49b60ddc188d7864291 and c27bc74698ed043b7549d5637ec0a8cf65b39e59. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3576)
2017-05-28Correct small typo in CRYPTO_GET_REFRichard Levitte
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3574)
2017-05-27Add internal functions to fetch a refcountRichard Levitte
Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3573)
2017-02-24Add -Wundef to --strict-warnings options.Bernd Edlinger
Avoid a -Wundef warning in refcount.h Avoid a -Wundef warning in o_str.c Avoid a -Wundef warning in testutil.h Include internal/cryptlib.h before openssl/stack.h to avoid use of undefined symbol OPENSSL_API_COMPAT. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2712)
2016-11-17Add support for reference counting using C11 atomicsKurt Roeckx
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1500