diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2022-07-03 08:13:46 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2022-07-03 08:13:46 +0000 |
commit | 3a567c22b58d3036497a498dbef6a17d167c741e (patch) | |
tree | 0cf7b8cde4ac3b77f2f25b02d6fc43b432429e2b /lib/libssl/t1_lib.c | |
parent | 556859cd6b942e67dbf67408de3b25b8f760de4d (diff) |
Simplify tls1_ec_group_id2{bits,nid}()
Instead of a nonsensical NULL check, check nid_list[group_id].{bits,nid}
is not 0. This way we can drop the group_id < 1 check.
ok jsing
Diffstat (limited to 'lib/libssl/t1_lib.c')
-rw-r--r-- | lib/libssl/t1_lib.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c index beaaae1eb0c..638e81ae82d 100644 --- a/lib/libssl/t1_lib.c +++ b/lib/libssl/t1_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t1_lib.c,v 1.191 2022/07/02 16:00:12 tb Exp $ */ +/* $OpenBSD: t1_lib.c,v 1.192 2022/07/03 08:13:45 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -342,15 +342,15 @@ static const uint16_t ecgroups_server_default[] = { int tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) { - const struct supported_group *group; + int nid; - if (group_id < 1 || group_id >= NID_LIST_LEN) + if (group_id >= NID_LIST_LEN) return 0; - if ((group = &nid_list[group_id]) == NULL) + if ((nid = nid_list[group_id].nid) == 0) return 0; - *out_nid = group->nid; + *out_nid = nid; return 1; } @@ -358,15 +358,15 @@ tls1_ec_group_id2nid(uint16_t group_id, int *out_nid) int tls1_ec_group_id2bits(uint16_t group_id, int *out_bits) { - const struct supported_group *group; + int bits; - if (group_id < 1 || group_id >= NID_LIST_LEN) + if (group_id >= NID_LIST_LEN) return 0; - if ((group = &nid_list[group_id]) == NULL) + if ((bits = nid_list[group_id].bits) == 0) return 0; - *out_bits = group->bits; + *out_bits = bits; return 1; } |