History log of /openbsd-current/usr.bin/openssl/speed.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.34 27-Jul-2023 tb

Remove antiquated options output

This is uninteresting and rather meaningless except for the implementer.
No need to have several hundred lines of code backing half a dozen symbols
in the public API for this.

ok jsing


# 1.33 20-May-2023 tb

openssl speed: add an '-unaligned n' option

All hashes and ciphers covered by speed should be able to handle unaligned
input and output. The buffers used in openssl speed are well aligned since
they are large, so will never exercise the more problematic unaligned case.

I wished something like this was available on various occasions. It would
have been useful to point more easily at OpenSSL's broken T4 assembly.
Yesterday there were two independent reasons for wanting it, so I sat down
and did it. It's trivial: make the allocations a bit larger and use buffers
starting at an offset inside these allocations. Despite the trivality, I
managed to have a stupid bug. Thanks miod.

discussed with jsing
ok miod


# 1.32 20-May-2023 tb

openssl speed: minor style nits

This drops a bunch of unnecessary parentheses, makes the strcmp()
checks consistent and moves some "}\n\telse" to "} else".

Makes an upcoming commit smaller


# 1.31 20-May-2023 tb

openssl speed: remove binary curve remnants

This wasn't properly hidden under OPENSSL_NO_EC2M, and all it does now
is producing ugly errors and useless "statistics". While looking at this,
I found that much of speed "has been pilfered from [Eric A. Young's]
libdes speed.c program". Apparently this was an precursor and ingredient
of SSLeay. Unfortunately, it seems that this piece of the history is lost.

ok miod

PS: If anyone is bored, a rewrite from scratch of the speed 'app' would
be a welcome contribution and may be an instructive rainy day project.
The current code was written in about the most stupid way possible so as
to maximize fragility and unmaintainability.


Revision tags: OPENBSD_7_3_BASE
# 1.30 23-Feb-2023 tb

openssl speed: avoid bad plural

Remedy a case of twitching eyes caused by seeing "Doing ... rsa's for 10s".
If this breaks someone's script, so be it.

ok jsing sthen


# 1.29 11-Nov-2022 joshua

Remove the legacy interactive mode from openssl(1).

This removes the legacy interactive mode from openssl(1) since it is
rarely used, complicates the code, and has also been removed from
OpenSSL in version 3.x.x.

ok tb@ jsing@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.28 14-Jan-2022 tb

Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.33 20-May-2023 tb

openssl speed: add an '-unaligned n' option

All hashes and ciphers covered by speed should be able to handle unaligned
input and output. The buffers used in openssl speed are well aligned since
they are large, so will never exercise the more problematic unaligned case.

I wished something like this was available on various occasions. It would
have been useful to point more easily at OpenSSL's broken T4 assembly.
Yesterday there were two independent reasons for wanting it, so I sat down
and did it. It's trivial: make the allocations a bit larger and use buffers
starting at an offset inside these allocations. Despite the trivality, I
managed to have a stupid bug. Thanks miod.

discussed with jsing
ok miod


# 1.32 20-May-2023 tb

openssl speed: minor style nits

This drops a bunch of unnecessary parentheses, makes the strcmp()
checks consistent and moves some "}\n\telse" to "} else".

Makes an upcoming commit smaller


# 1.31 20-May-2023 tb

openssl speed: remove binary curve remnants

This wasn't properly hidden under OPENSSL_NO_EC2M, and all it does now
is producing ugly errors and useless "statistics". While looking at this,
I found that much of speed "has been pilfered from [Eric A. Young's]
libdes speed.c program". Apparently this was an precursor and ingredient
of SSLeay. Unfortunately, it seems that this piece of the history is lost.

ok miod

PS: If anyone is bored, a rewrite from scratch of the speed 'app' would
be a welcome contribution and may be an instructive rainy day project.
The current code was written in about the most stupid way possible so as
to maximize fragility and unmaintainability.


Revision tags: OPENBSD_7_3_BASE
# 1.30 23-Feb-2023 tb

openssl speed: avoid bad plural

Remedy a case of twitching eyes caused by seeing "Doing ... rsa's for 10s".
If this breaks someone's script, so be it.

ok jsing sthen


# 1.29 11-Nov-2022 joshua

Remove the legacy interactive mode from openssl(1).

This removes the legacy interactive mode from openssl(1) since it is
rarely used, complicates the code, and has also been removed from
OpenSSL in version 3.x.x.

ok tb@ jsing@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.28 14-Jan-2022 tb

Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.30 23-Feb-2023 tb

openssl speed: avoid bad plural

Remedy a case of twitching eyes caused by seeing "Doing ... rsa's for 10s".
If this breaks someone's script, so be it.

ok jsing sthen


# 1.29 11-Nov-2022 joshua

Remove the legacy interactive mode from openssl(1).

This removes the legacy interactive mode from openssl(1) since it is
rarely used, complicates the code, and has also been removed from
OpenSSL in version 3.x.x.

ok tb@ jsing@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.28 14-Jan-2022 tb

Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.29 11-Nov-2022 joshua

Remove the legacy interactive mode from openssl(1).

This removes the legacy interactive mode from openssl(1) since it is
rarely used, complicates the code, and has also been removed from
OpenSSL in version 3.x.x.

ok tb@ jsing@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.28 14-Jan-2022 tb

Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.28 14-Jan-2022 tb

Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.27 26-Dec-2021 tb

Check error returns for HMAC_* to appease coverity.

CID 345114


# 1.26 26-Dec-2021 tb

One more leak similar to previous.


# 1.25 26-Dec-2021 tb

Plug leaks

CID 345111


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.24 12-Dec-2021 tb

Make speed.c compile with opaque EVP_CIPHER, EVP_MD and HMAC_CTX.

ok inoguchi


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 OPENBSD_7_0_BASE
# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.23 13-Jul-2018 cheloha

openssl app timers: TM_START -> TM_RESET, TM_STOP -> TM_GET

Much more apt than the current operation names.

Names suggested by jca@ ages ago.

ok jca, jsing


Revision tags: OPENBSD_6_3_BASE
# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.22 07-Feb-2018 jsing

Indent labels with a single space so that diff prototypes are more useful.


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@


# 1.21 05-Dec-2017 jca

Seperate real and user timer interfaces

Use more descriptive names, and make it clearer that real and user
timers work on different static storage. The end goal is to be able to
reuse those timer functions, instead of inlining other timer
implementations subject to clock jumps.

Discussed with Scott Cheloha


# 1.20 07-Oct-2017 guenther

Fix cast-pasto's in comments


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 22-Aug-2016 deraadt

Sorry Andrew and Luke, I'm pretty sure we deleted your IRIX and VMS code.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.18 17-Oct-2015 doug

Exit if a pledge call fails in non-interactive mode.

ok semarie@


# 1.17 10-Oct-2015 doug

Initial support for pledges in openssl(1) commands.

openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.

We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.

This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.

deraadt@ and beck@ are roughly fine with this approach.


# 1.16 20-Sep-2015 miod

Pack the algorithm numbers, to avoid printing a useless (null) 0 0 0 0
line in the summary.


# 1.15 14-Sep-2015 doug

Temporarily revive MD4 for MS CHAP support.


# 1.14 13-Sep-2015 doug

Remove MD4 support from LibreSSL.

MD4 should have been removed a long time ago. Also, RFC 6150 moved it to
historic in 2011. Rides the major crank from removing SHA-0.

Discussed with many including beck@, millert@, djm@, sthen@
ok jsing@, input + ok bcook@


# 1.13 12-Sep-2015 bcook

Add openssl(1) speed support for AEAD algorithms.

This adds aes-128-gcm aes-256-gcm chacha20-poly1305
from Adam Langley's original patch for OpenSSL

ok beck@ jsing@


# 1.12 11-Sep-2015 jsing

unifdef -DOPENSSL_NO_RC5


# 1.11 11-Sep-2015 bcook

Remove engine command and parameters from openssl(1).

We do not have any builtin or dynamic engines, meaning openssl(1) has
no way to use the engine command or parameters at all.

ok jsing@


# 1.10 11-Sep-2015 deraadt

remove stupid casts


# 1.9 22-Aug-2015 jsing

Remove all duplicate prototypes for *_main functions (these are already
provided by progs.h). Also, move the FUNCTION type (and flags) into
openssl.c since that is the only place of use. Lastly, remove pointless
'extern' from the prototypes and use char **argv instead of char *argv[]
(the former is used elsewhere).

ok deraadt@ doug@


Revision tags: OPENBSD_5_8_BASE
# 1.8 20-Jul-2015 doug

Don't try to run ECDH if ecdh_checks fails in openssl(1) speed.

Coverity 72744 noticed that rsa_count was overwitten. The underlying
issue is that this code is supposed to be in an else block.

ok bcook@


# 1.7 03-Jul-2015 miod

Repair algorithm name array after 1.6.


# 1.6 20-Jun-2015 doug

Remove obsolete MDC-2DES from libcrypto.

ok deraadt@ jsing@ miod@


Revision tags: OPENBSD_5_7_BASE
# 1.5 08-Feb-2015 doug

Delete commented out code from openssl(1) apps.

From OpenSSL commits:

6f91b017bbb7140f816721141ac156d1b828a6b3
75d0ebef2aef7a2c77b27575b8da898e22f3ccd5
a2b18e657ea1a932d125154f4e13ab2258796d90

ok miod@, jsing@


# 1.4 03-Jan-2015 lteo

Check the return values of several reallocarray() calls. While here,
also check the return value of an adjacent malloc() call.

ok jsing@


# 1.3 02-Jan-2015 lteo

Remove ifdef statements for TIMES and USE_TOD; they don't do anything,
apart from introducing a bug where the -elapsed option is not listed in
the usage output when it should be.

feedback/ok bcook@ jsing@


# 1.2 22-Oct-2014 jsing

Use arc4random_buf() instead of RAND(_pseudo)?_bytes().

ok bcook@


# 1.1 26-Aug-2014 jsing

Move openssl(1) from /usr/sbin/openssl to /usr/bin/openssl, since it is not
a system/superuser binary. At the same time, move the source code from its
current lib/libssl/src/apps location to a more appropriate home under
usr.bin/openssl.

ok deraadt@ miod@