diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-05-02 19:30:00 +0200 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-05-03 13:53:08 +0200 |
commit | b6eb9827a6866981c08cc9613ca8b4a648894fb1 (patch) | |
tree | c5a6351461d8be964bc1f31fa2e34c4ebb7cfafd /crypto/ec/ec_curve.c | |
parent | Remove obsolete make variables (diff) | |
download | openssl-b6eb9827a6866981c08cc9613ca8b4a648894fb1.tar.xz openssl-b6eb9827a6866981c08cc9613ca8b4a648894fb1.zip |
Add OSSL_NELEM macro.
Add OSSL_NELEM macro to e_os.h to determine the number of elements in an
array.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/ec/ec_curve.c')
-rw-r--r-- | crypto/ec/ec_curve.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c index 8bba3bcb83..d0f1fcb2fd 100644 --- a/crypto/ec/ec_curve.c +++ b/crypto/ec/ec_curve.c @@ -74,6 +74,7 @@ #include <openssl/err.h> #include <openssl/obj_mac.h> #include <openssl/opensslconf.h> +#include "e_os.h" typedef struct { int field_type, /* either NID_X9_62_prime_field or @@ -3022,7 +3023,7 @@ static const ec_list_element curve_list[] = { "RFC 5639 curve over a 512 bit prime field"}, }; -#define curve_list_length (sizeof(curve_list)/sizeof(ec_list_element)) +#define curve_list_length OSSL_NELEM(curve_list) static EC_GROUP *ec_group_new_from_data(const ec_list_element curve) { @@ -3194,7 +3195,7 @@ static EC_NIST_NAME nist_curves[] = { const char *EC_curve_nid2nist(int nid) { size_t i; - for (i = 0; i < sizeof(nist_curves) / sizeof(EC_NIST_NAME); i++) { + for (i = 0; i < OSSL_NELEM(nist_curves); i++) { if (nist_curves[i].nid == nid) return nist_curves[i].name; } @@ -3204,7 +3205,7 @@ const char *EC_curve_nid2nist(int nid) int EC_curve_nist2nid(const char *name) { size_t i; - for (i = 0; i < sizeof(nist_curves) / sizeof(EC_NIST_NAME); i++) { + for (i = 0; i < OSSL_NELEM(nist_curves); i++) { if (!strcmp(nist_curves[i].name, name)) return nist_curves[i].nid; } |