History log of /openbsd-current/usr.bin/ssh/sshbuf.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.19 02-Dec-2022 djm

make struct sshbuf private and remove an unused field; ok dtucker


Revision tags: OPENBSD_7_2_BASE
# 1.18 25-May-2022 djm

revert previous; it was broken (spotted by Theo)


# 1.17 25-May-2022 djm

make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via
#define) dump to stderr rather than stdout


# 1.16 08-Apr-2022 djm

two defensive changes from Tobias Stoeckmann via GHPR287

enforce stricter invarient for sshbuf_set_parent() - never allow
a buffer to have a previously-set parent changed.

In sshbuf_reset(), if the reallocation fails, then zero the entire
buffer and not the (potentially smaller) default initial alloc size.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.15 26-Feb-2020 jsg

change explicit_bzero();free() to freezero()

While freezero() returns early if the pointer is NULL the tests for
NULL in callers are left to avoid warnings about passing an
uninitialised size argument across a function boundry.

ok deraadt@ djm@


# 1.14 23-Jan-2020 dtucker

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.18 25-May-2022 djm

revert previous; it was broken (spotted by Theo)


# 1.17 25-May-2022 djm

make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via
#define) dump to stderr rather than stdout


# 1.16 08-Apr-2022 djm

two defensive changes from Tobias Stoeckmann via GHPR287

enforce stricter invarient for sshbuf_set_parent() - never allow
a buffer to have a previously-set parent changed.

In sshbuf_reset(), if the reallocation fails, then zero the entire
buffer and not the (potentially smaller) default initial alloc size.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.15 26-Feb-2020 jsg

change explicit_bzero();free() to freezero()

While freezero() returns early if the pointer is NULL the tests for
NULL in callers are left to avoid warnings about passing an
uninitialised size argument across a function boundry.

ok deraadt@ djm@


# 1.14 23-Jan-2020 dtucker

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.16 08-Apr-2022 djm

two defensive changes from Tobias Stoeckmann via GHPR287

enforce stricter invarient for sshbuf_set_parent() - never allow
a buffer to have a previously-set parent changed.

In sshbuf_reset(), if the reallocation fails, then zero the entire
buffer and not the (potentially smaller) default initial alloc size.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.15 26-Feb-2020 jsg

change explicit_bzero();free() to freezero()

While freezero() returns early if the pointer is NULL the tests for
NULL in callers are left to avoid warnings about passing an
uninitialised size argument across a function boundry.

ok deraadt@ djm@


# 1.14 23-Jan-2020 dtucker

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.15 26-Feb-2020 jsg

change explicit_bzero();free() to freezero()

While freezero() returns early if the pointer is NULL the tests for
NULL in callers are left to avoid warnings about passing an
uninitialised size argument across a function boundry.

ok deraadt@ djm@


# 1.14 23-Jan-2020 dtucker

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.14 23-Jan-2020 dtucker

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.13 16-Nov-2018 djm

make grandparent-parent-child sshbuf chains robust to use-after-free
faults if the ancestors are freed before the descendents. Nothing in
OpenSSH uses this deallocation pattern. Reported by Jann Horn


Revision tags: OPENBSD_6_4_BASE
# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


# 1.12 09-Jul-2018 markus

remove legacy buffer API emulation layer; ok djm@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.


Revision tags: OPENBSD_6_2_BASE
# 1.11 01-Jun-2017 djm

unconditionally zero init size of buffer; ok markus@ deraadt@


# 1.10 31-May-2017 deraadt

Switch to recallocarray() for a few operations. Both growth and shrinkage
are handled safely, and there also is no need for preallocation dances.
Future changes in this area will be less error prone.
Review and one bug found by markus


# 1.9 26-May-2017 markus

sshbuf_consume: reset empty buffer; ok djm@


Revision tags: OPENBSD_6_1_BASE
# 1.8 25-Nov-2016 djm

split allocation out of sshbuf_reserve() into a separate
sshbuf_allocate() function; ok markus@


# 1.7 12-Sep-2016 deraadt

Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions
rather than pulling <sys/param.h> and unknown namespace pollution.
ok djm markus dtucker


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.6 12-Jan-2016 djm

use explicit_bzero() more liberally in the buffer code; ok deraadt


# 1.5 11-Dec-2015 mmcc

Remove NULL-checks before sshbuf_free().

ok djm@


# 1.4 05-Oct-2015 djm

some more bzero->explicit_bzero, from Michael McConville


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.3 20-Jan-2015 deraadt

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus


Revision tags: OPENBSD_5_6_BASE
# 1.2 25-Jun-2014 deraadt

unblock SIGSEGV before raising it
ok djm


# 1.1 30-Apr-2014 djm

New buffer API; the first installment of the conversion/replacement
of OpenSSH's internals to make them usable as a standalone library.

This includes a set of wrappers to make it compatible with the
existing buffer API so replacement can occur incrementally.

With and ok markus@

Thanks also to Ben Hawkes, David Tomaschik, Ivan Fratric, Matthew
Dempsky and Ron Bowes for a detailed review.