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:24:39 +0000 (10:24 +0000)
commitf5c9916742655f872018426838cff4ff04da5321
treea1dbe39ade90627cc0cabb5443692d3cfdc1c521
parentd61f489b5a8d8369e75ee1e4991b3d4db95d7c7c
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)
apps/speed.c