diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-10-18 18:03:46 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-10-18 18:03:46 +0000 |
commit | 004e0f600266d411435a18565a49d38e4bb49291 (patch) | |
tree | d2bd6a2bcaf5444d0893533bf9fe6389af145722 /lib | |
parent | e143f86e050ebddfcd1cda254a9d0605418b1dc6 (diff) |
Simplify EC_get_builtin_curves().
When determining the minimum of nitems and EC_CURVE_LIST_LENGTH
we need neither an extra variable nor a ternary operator.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/ec/ec_curve.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libcrypto/ec/ec_curve.c b/lib/libcrypto/ec/ec_curve.c index 4c1611f1af0..6d7eea81cf8 100644 --- a/lib/libcrypto/ec/ec_curve.c +++ b/lib/libcrypto/ec/ec_curve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_curve.c,v 1.45 2024/10/18 17:56:45 tb Exp $ */ +/* $OpenBSD: ec_curve.c,v 1.46 2024/10/18 18:03:45 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -2680,14 +2680,15 @@ ec_group_is_builtin_curve(const EC_GROUP *group) size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems) { - size_t i, min; + size_t i; if (r == NULL || nitems == 0) return EC_CURVE_LIST_LENGTH; - min = nitems < EC_CURVE_LIST_LENGTH ? nitems : EC_CURVE_LIST_LENGTH; + if (nitems > EC_CURVE_LIST_LENGTH) + nitems = EC_CURVE_LIST_LENGTH; - for (i = 0; i < min; i++) { + for (i = 0; i < nitems; i++) { r[i].nid = ec_curve_list[i].nid; r[i].comment = ec_curve_list[i].comment; } |