apps/speed.c: properly address NO_EC2M on systems without SIGALRM
authorVitezslav Cizek <vcizek@suse.com>
Tue, 5 Mar 2019 21:52:33 +0000 (22:52 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 19 Mar 2019 10:30:27 +0000 (10:30 +0000)
commita7e1cb8cbbefda0f31489566ad08055239ee216e
tree460489899eb36114b3fe14db294ca60c92097230
parent958beb89b34aafe16b62416099e099ce0eb3e5e4
apps/speed.c: properly address NO_EC2M on systems without SIGALRM

The ecdh_c array is allocated of the same size as ecdh_choices,
whose size depends on whether the support for binary curves is enabled
or not.  (The same goes for ecdsa_c).
On systems without SIGALRM, ecdh_c is indexed by predefined constants
intended for representing the index of the ciphers in the ecdh_choices
array.
However, in case of NO_EC2M some of the #defined constants won't match
and would actually access the ecdh_c out-of-bounds.

Use enum instead of a macro to define the curve indexes so they're
within the bounds of the ecdh_c array.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8422)

(cherry picked from commit f5c9916742655f872018426838cff4ff04da5321)
apps/speed.c