History log of /openbsd-current/lib/libcrypto/x509/x509_trs.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.55 26-Mar-2024 tb

x509 trust: remove unneeded headers


# 1.54 25-Mar-2024 tb

Final tweaks in x509_trs.c for now

looked over by jsing


# 1.53 25-Mar-2024 tb

Kill X509_TRUST

After peeling off enough layers, the entire wacky abstraction turns out
to be nothing but dispatching from a trust_id to a trust handler and
passing the appropriate nid and the cert.

ok beck jsing


# 1.52 25-Mar-2024 tb

Add back trust member of X509_TRUST that I accidentally deleted


# 1.51 25-Mar-2024 tb

Const correct the trust handlers

The certificates no longer need to be modified since we cache the
extensions up front.

ok beck


# 1.50 25-Mar-2024 tb

Pass the nid instead of the entire trust structure

This code is so ridiculously overengineered that it is an achievement even
by early OpenSSL standards.

ok beck


# 1.49 25-Mar-2024 tb

Pull extension caching into X509_check_trust()

This way the trust handlers can stop modifying the certificates.

ok beck


# 1.48 24-Mar-2024 tb

Rename ax into aux


# 1.47 24-Mar-2024 tb

Drop redundant NULL checks around two for loops

ok beck


# 1.46 24-Mar-2024 tb

Rename arg1 to nid because that's what it is

"Yeah, arg1 is always such an imaginative name" ian
ok beck


# 1.45 24-Mar-2024 tb

Drop the unused 'name' member from X509_TRUST

This used to be exposed via an accessor, but this accessor is no longer
part of the library, so nuke it.

ok beck


# 1.44 23-Mar-2024 tb

Remove unused flags and arg2 members from X509_TRUST

ok jsing


# 1.43 23-Mar-2024 tb

Remove unused flags argument from the trust handlers

The public X509_check_trust() takes a flag parameter which we must leave
in place. However, we can stop passing the flag parameter around without
ever looking at it.

ok jsing


Revision tags: OPENBSD_7_5_BASE
# 1.42 02-Mar-2024 tb

Remove X509_TRUST from the public API

With API and other users internal, this struct can now go.

ok jsing


# 1.41 02-Mar-2024 tb

Remove unused public X509_TRUST API

Another thing that should never have leaked out of the library. It
will become internal entirely, where the code can be simplified greatly.

ok jsing


# 1.40 13-Jan-2024 tb

Prepare for removing most of the X509_TRUST API

X509_check_trust() is of course used by the verifier. Unfortunately
M2Crypto exposes it. The only other part of the X509_TRUST API that
are still needed are the X509_TRUST_* macros in x509.h, as they are
used via *_set_trust and indirectly via the purpose stuff. The rest
will be removed.

X509_TRUST_add() was defanged recently, in particular it no longer
hangs strdup()'ed strings off the global struct. Nothing ever cleaned
these up. TRUST_cleanup() attempted to do so, but since it checked
the dynamic/dynamic strings flags in the wrong order, that cleanup
call ended up doing nothing, so that code was removed at some point.

As a consequence, the struct can now be made const. Use a CTASSERT()
to ensure size assumptions on X509_TRUST_COUNT, X509_TRUST_MAX, and
X509_TRUST_MIN hold true.

Remove the global variable underlying X509_TRUST_set_default()'s
functionality and move its accessor down to all the other functions
that will be deleted.

Inline a few things in X509_check_trust(), so we can excise the
internals of X509_TRUST_get0(), X509_TRUST_get_by_id(). Since the
default trust function can no longer be changed, call obj_trust()
directly.

ok jsing


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.54 25-Mar-2024 tb

Final tweaks in x509_trs.c for now

looked over by jsing


# 1.53 25-Mar-2024 tb

Kill X509_TRUST

After peeling off enough layers, the entire wacky abstraction turns out
to be nothing but dispatching from a trust_id to a trust handler and
passing the appropriate nid and the cert.

ok beck jsing


# 1.52 25-Mar-2024 tb

Add back trust member of X509_TRUST that I accidentally deleted


# 1.51 25-Mar-2024 tb

Const correct the trust handlers

The certificates no longer need to be modified since we cache the
extensions up front.

ok beck


# 1.50 25-Mar-2024 tb

Pass the nid instead of the entire trust structure

This code is so ridiculously overengineered that it is an achievement even
by early OpenSSL standards.

ok beck


# 1.49 25-Mar-2024 tb

Pull extension caching into X509_check_trust()

This way the trust handlers can stop modifying the certificates.

ok beck


# 1.48 24-Mar-2024 tb

Rename ax into aux


# 1.47 24-Mar-2024 tb

Drop redundant NULL checks around two for loops

ok beck


# 1.46 24-Mar-2024 tb

Rename arg1 to nid because that's what it is

"Yeah, arg1 is always such an imaginative name" ian
ok beck


# 1.45 24-Mar-2024 tb

Drop the unused 'name' member from X509_TRUST

This used to be exposed via an accessor, but this accessor is no longer
part of the library, so nuke it.

ok beck


# 1.44 23-Mar-2024 tb

Remove unused flags and arg2 members from X509_TRUST

ok jsing


# 1.43 23-Mar-2024 tb

Remove unused flags argument from the trust handlers

The public X509_check_trust() takes a flag parameter which we must leave
in place. However, we can stop passing the flag parameter around without
ever looking at it.

ok jsing


Revision tags: OPENBSD_7_5_BASE
# 1.42 02-Mar-2024 tb

Remove X509_TRUST from the public API

With API and other users internal, this struct can now go.

ok jsing


# 1.41 02-Mar-2024 tb

Remove unused public X509_TRUST API

Another thing that should never have leaked out of the library. It
will become internal entirely, where the code can be simplified greatly.

ok jsing


# 1.40 13-Jan-2024 tb

Prepare for removing most of the X509_TRUST API

X509_check_trust() is of course used by the verifier. Unfortunately
M2Crypto exposes it. The only other part of the X509_TRUST API that
are still needed are the X509_TRUST_* macros in x509.h, as they are
used via *_set_trust and indirectly via the purpose stuff. The rest
will be removed.

X509_TRUST_add() was defanged recently, in particular it no longer
hangs strdup()'ed strings off the global struct. Nothing ever cleaned
these up. TRUST_cleanup() attempted to do so, but since it checked
the dynamic/dynamic strings flags in the wrong order, that cleanup
call ended up doing nothing, so that code was removed at some point.

As a consequence, the struct can now be made const. Use a CTASSERT()
to ensure size assumptions on X509_TRUST_COUNT, X509_TRUST_MAX, and
X509_TRUST_MIN hold true.

Remove the global variable underlying X509_TRUST_set_default()'s
functionality and move its accessor down to all the other functions
that will be deleted.

Inline a few things in X509_check_trust(), so we can excise the
internals of X509_TRUST_get0(), X509_TRUST_get_by_id(). Since the
default trust function can no longer be changed, call obj_trust()
directly.

ok jsing


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.46 24-Mar-2024 tb

Rename arg1 to nid because that's what it is

"Yeah, arg1 is always such an imaginative name" ian
ok beck


# 1.45 24-Mar-2024 tb

Drop the unused 'name' member from X509_TRUST

This used to be exposed via an accessor, but this accessor is no longer
part of the library, so nuke it.

ok beck


# 1.44 23-Mar-2024 tb

Remove unused flags and arg2 members from X509_TRUST

ok jsing


# 1.43 23-Mar-2024 tb

Remove unused flags argument from the trust handlers

The public X509_check_trust() takes a flag parameter which we must leave
in place. However, we can stop passing the flag parameter around without
ever looking at it.

ok jsing


Revision tags: OPENBSD_7_5_BASE
# 1.42 02-Mar-2024 tb

Remove X509_TRUST from the public API

With API and other users internal, this struct can now go.

ok jsing


# 1.41 02-Mar-2024 tb

Remove unused public X509_TRUST API

Another thing that should never have leaked out of the library. It
will become internal entirely, where the code can be simplified greatly.

ok jsing


# 1.40 13-Jan-2024 tb

Prepare for removing most of the X509_TRUST API

X509_check_trust() is of course used by the verifier. Unfortunately
M2Crypto exposes it. The only other part of the X509_TRUST API that
are still needed are the X509_TRUST_* macros in x509.h, as they are
used via *_set_trust and indirectly via the purpose stuff. The rest
will be removed.

X509_TRUST_add() was defanged recently, in particular it no longer
hangs strdup()'ed strings off the global struct. Nothing ever cleaned
these up. TRUST_cleanup() attempted to do so, but since it checked
the dynamic/dynamic strings flags in the wrong order, that cleanup
call ended up doing nothing, so that code was removed at some point.

As a consequence, the struct can now be made const. Use a CTASSERT()
to ensure size assumptions on X509_TRUST_COUNT, X509_TRUST_MAX, and
X509_TRUST_MIN hold true.

Remove the global variable underlying X509_TRUST_set_default()'s
functionality and move its accessor down to all the other functions
that will be deleted.

Inline a few things in X509_check_trust(), so we can excise the
internals of X509_TRUST_get0(), X509_TRUST_get_by_id(). Since the
default trust function can no longer be changed, call obj_trust()
directly.

ok jsing


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.42 02-Mar-2024 tb

Remove X509_TRUST from the public API

With API and other users internal, this struct can now go.

ok jsing


# 1.41 02-Mar-2024 tb

Remove unused public X509_TRUST API

Another thing that should never have leaked out of the library. It
will become internal entirely, where the code can be simplified greatly.

ok jsing


# 1.40 13-Jan-2024 tb

Prepare for removing most of the X509_TRUST API

X509_check_trust() is of course used by the verifier. Unfortunately
M2Crypto exposes it. The only other part of the X509_TRUST API that
are still needed are the X509_TRUST_* macros in x509.h, as they are
used via *_set_trust and indirectly via the purpose stuff. The rest
will be removed.

X509_TRUST_add() was defanged recently, in particular it no longer
hangs strdup()'ed strings off the global struct. Nothing ever cleaned
these up. TRUST_cleanup() attempted to do so, but since it checked
the dynamic/dynamic strings flags in the wrong order, that cleanup
call ended up doing nothing, so that code was removed at some point.

As a consequence, the struct can now be made const. Use a CTASSERT()
to ensure size assumptions on X509_TRUST_COUNT, X509_TRUST_MAX, and
X509_TRUST_MIN hold true.

Remove the global variable underlying X509_TRUST_set_default()'s
functionality and move its accessor down to all the other functions
that will be deleted.

Inline a few things in X509_check_trust(), so we can excise the
internals of X509_TRUST_get0(), X509_TRUST_get_by_id(). Since the
default trust function can no longer be changed, call obj_trust()
directly.

ok jsing


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.40 13-Jan-2024 tb

Prepare for removing most of the X509_TRUST API

X509_check_trust() is of course used by the verifier. Unfortunately
M2Crypto exposes it. The only other part of the X509_TRUST API that
are still needed are the X509_TRUST_* macros in x509.h, as they are
used via *_set_trust and indirectly via the purpose stuff. The rest
will be removed.

X509_TRUST_add() was defanged recently, in particular it no longer
hangs strdup()'ed strings off the global struct. Nothing ever cleaned
these up. TRUST_cleanup() attempted to do so, but since it checked
the dynamic/dynamic strings flags in the wrong order, that cleanup
call ended up doing nothing, so that code was removed at some point.

As a consequence, the struct can now be made const. Use a CTASSERT()
to ensure size assumptions on X509_TRUST_COUNT, X509_TRUST_MAX, and
X509_TRUST_MIN hold true.

Remove the global variable underlying X509_TRUST_set_default()'s
functionality and move its accessor down to all the other functions
that will be deleted.

Inline a few things in X509_check_trust(), so we can excise the
internals of X509_TRUST_get0(), X509_TRUST_get_by_id(). Since the
default trust function can no longer be changed, call obj_trust()
directly.

ok jsing


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.39 10-Jan-2024 tb

X509_TRUST: tidy up includes


# 1.38 10-Jan-2024 tb

X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.


# 1.37 10-Jan-2024 tb

X509_TRUST: hoist trust_compat() to the other end of the file


# 1.36 10-Jan-2024 tb

X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.35 08-Jan-2024 tb

Fix logic error (&& -> ||)

CID 477172


# 1.34 07-Jan-2024 tb

purpose/trust: Improve comments about COUNT/MAX confusion


# 1.33 07-Jan-2024 tb

Remove X509_TRUST extensibility

This is pretty much identical to the X509_PURPOSE case: remove the stack
used for extending and overriding the trust table and make X509_TRUST_add()
always fail. Simplify some other bits accordingly.

ok jsing


Revision tags: OPENBSD_7_4_BASE
# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.32 02-Jul-2023 tb

Convert some tables to C99 initializers

ok & "happy pirate day" beck


Revision tags: OPENBSD_7_3_BASE
# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.31 16-Feb-2023 tb

libressl *_namespace.h: adjust *_ALIAS() to require a semicolon

LCRYPTO_ALIAS() and LSSL_ALIAS() contained a trailing semicolon.
This does not conform to style(9), breaks editors and ctags and
(most importantly) my workflow. Fix this by neutering them with
asm("") so that -Wpedantic doesn't complain. There's precedent
in libc's namespace.h

fix suggested by & ok jsing


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.30 26-Nov-2022 tb

Make internal header file names consistent

Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names
used for internal headers. Move all these headers we inherited from
OpenSSL to *_local.h, reserving the name *_internal.h for our own code.
Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.
constant_time_locl.h is moved to constant_time.h since it's special.

Adjust all .c files in libcrypto, libssl and regress.

The diff is mechanical with the exception of tls13_quic.c, where
#include <ssl_locl.h> was fixed manually.

discussed with jsing,
no objection bcook


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.29 17-Nov-2022 beck

Revert "Check certificate extensions in trusted certificates"

There are some possible strange side effects noticed by the
openssl cms regress tests that I missed. Backing this out
until I untangle it

ok tb@


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.28 14-Nov-2022 beck

Hide public symbols in libcrypto/x509 .c files

ok tb@


# 1.27 13-Nov-2022 beck

Check certificate extensions in trusted certificates.

Historically the standards let the implementation decide to
either check or ignore the certificate properties of trust anchors.
You could either use them simply as a source of a public key which
was trusted for everything, or you were also permitted to check the
certificate properties and fully enforce them. Hooray for freedumb.

OpenSSL changed to checking these with :
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Author: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu Jan 28 03:01:45 2016 -0500

BoringSSL currently does not check them, as it also inherited
the previous OpenSSL behaviour. It will change to check them in
the future.
(https://bugs.chromium.org/p/boringssl/issues/detail?id=533)


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.26 10-Nov-2022 beck

Allow explicit cert trusts or distrusts for EKU any

This matches the current OpenSSL behaviour introduced
in their commit:
commit 0daccd4dc1f1ac62181738a91714f35472e50f3c
Date: Thu Jan 28 03:01:45 2016 -0500

ok jsing@ tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.25 01-Nov-2021 tb

Move the now internal X.509-related structs into x509_lcl.h.
Garbage collect the now unused LIBRESSL_CRYPTO_INTERNAL and
LIBRESSL_OPAQUE_X509. Include "x509_lcl.h" where needed and
fix a couple of unnecessary reacharounds.

ok jsing


Revision tags: OPENBSD_7_0_BASE
# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.24 23-Jul-2021 schwarze

Similar to x509/x509_purp.c rev. 1.5:
Delete some code from X509_TRUST_cleanup(3) that had no effect:
it called a function on static objects that returns right away
unless the argument is dynamically allocated.
Pointed out by tb@.

This commit is identical to:

OpenSSL commit 5e6e650d62af09f47d63bfdd6c92e3b16e9da644
Author: Kurt Cancemi <kurt at x64architecture dot com>
Date: Thu Jun 9 21:57:36 2016 -0400


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


# 1.23 18-May-2018 tb

Add const qualifiers to the name and xp arguments of X509_TRUST_add(3),
X509_TRUST_get0_name(3), X509_TRUST_get_flags(3), and X509_TRUST_get_trust(3).

tested in a bulk build by sthen
ok jsing


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.22 29-Jan-2017 beck

Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@


# 1.21 06-Nov-2016 beck

The upcoming x509 alt chains diff tightens the trust requirements
for certificates. This (from OpenSSL) ensures that the current
"default" behaviour remains the same. We should revisit this
later
ok jsing@


# 1.20 10-Feb-2015 jsing

Remove more IMPLEMENT_STACK_OF noops that have been hiding for the last
15 years.


# 1.19 06-Dec-2014 doug

Avoid modifying input on failure in X509_(TRUST|PURPOSE)_add.

If X509_TRUST_add() or X509_PURPOSE_add() fail, they will leave the
object in an inconsistent state since the name is already freed.
This commit avoids changing the original name unless the *_add() call
will succeed.

Based on BoringSSL's commit: ab2815eaff6219ef57aedca2f7b1b72333c27fd0

ok miod@


# 1.18 18-Nov-2014 tedu

further BUF_strdup conversion: these places should be safe to rely on
the function argument not being NULL


# 1.17 16-Oct-2014 beck

Get rid of the last remaining BUF_strdup and BUF_strlcpy and friends, use
intrinsic functions everywhere, and wrap these functions in an
#ifndef LIBRESSL_INTERNAL to make sure we don't bring their use back.


# 1.16 28-Sep-2014 miod

X509_TRUST_add(): check X509_TRUST_get0() return value before dereferencing it,
for it may be NULL. Do not leak memory upon error.

ok bcook@


# 1.15 11-Jul-2014 jsing

Only import cryptlib.h in the four source files that actually need it.
Remove the openssl public includes from cryptlib.h and add a small number
of includes into the source files that actually need them. While here,
also sort/group/tidy the includes.

ok beck@ miod@


# 1.14 12-Jun-2014 deraadt

tags as requested by miod and tedu


# 1.13 20-Apr-2014 jsing

More KNF.


# 1.12 20-Apr-2014 jsing

KNF.


# 1.11 18-Apr-2014 tedu

blunt force knf


# 1.10 17-Apr-2014 beck

Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free


# 1.9 01-Oct-2010 djm

resolve conflicts, fix local changes


# 1.8 09-Jan-2009 djm

resolve conflicts


# 1.7 06-Sep-2008 djm

resolve conflicts


# 1.6 11-Nov-2003 markus

merge 0.9.7c; minor bugsfixes;
API addition: ERR_release_err_state_table
[make includes before you build libssl/libcrypto]


# 1.5 15-May-2002 beck

OpenSSL 0.9.7 stable 2002 05 08 merge


# 1.4 01-Aug-2001 beck

merge openssl 0.9.6b-engine

Note that this is a maintenence release, API's appear *not* to have changed.
As such, I have only increased the minor number on these libraries


# 1.3 15-Dec-2000 beck

openssl-engine-0.9.6 merge


# 1.2 15-Apr-2000 beck

OpenSSL 0.9.5a merge


# 1.1 19-Mar-2000 beck

branches: 1.1.1;
OpenSSL 0.9.5 merge

*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs