diff options
author | tb <> | 2025-01-18 13:07:47 +0000 |
---|---|---|
committer | tb <> | 2025-01-18 13:07:47 +0000 |
commit | 6e03331a19baa7a7151b89a73b6cf94ab645925f (patch) | |
tree | 490ca89c3ac052f144b114a555ce142acd4b813f /src | |
parent | 93077848f9412d72805b8b71490e11c81467b18c (diff) | |
download | openbsd-6e03331a19baa7a7151b89a73b6cf94ab645925f.tar.gz openbsd-6e03331a19baa7a7151b89a73b6cf94ab645925f.tar.bz2 openbsd-6e03331a19baa7a7151b89a73b6cf94ab645925f.zip |
Drop field determination dance
If we get here, we're in a server and have managed to load the cert.
The public key is therefore a point on a built-in curve, and we know
the group is defined over some prime field. Now it is just a matter of
figuring out whether we support the group in libssl.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/t1_lib.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/libssl/t1_lib.c b/src/lib/libssl/t1_lib.c index 6b0dd3b737..c889e04180 100644 --- a/src/lib/libssl/t1_lib.c +++ b/src/lib/libssl/t1_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t1_lib.c,v 1.199 2025/01/18 13:03:02 tb Exp $ */ | 1 | /* $OpenBSD: t1_lib.c,v 1.200 2025/01/18 13:07:47 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -629,8 +629,6 @@ static int | |||
629 | tls1_set_ec_id(uint16_t *group_id, uint8_t *comp_id, EC_KEY *ec) | 629 | tls1_set_ec_id(uint16_t *group_id, uint8_t *comp_id, EC_KEY *ec) |
630 | { | 630 | { |
631 | const EC_GROUP *grp; | 631 | const EC_GROUP *grp; |
632 | const EC_METHOD *meth; | ||
633 | int prime_field; | ||
634 | int nid; | 632 | int nid; |
635 | 633 | ||
636 | if (ec == NULL) | 634 | if (ec == NULL) |
@@ -639,9 +637,6 @@ tls1_set_ec_id(uint16_t *group_id, uint8_t *comp_id, EC_KEY *ec) | |||
639 | /* Determine whether the group is defined over a prime field. */ | 637 | /* Determine whether the group is defined over a prime field. */ |
640 | if ((grp = EC_KEY_get0_group(ec)) == NULL) | 638 | if ((grp = EC_KEY_get0_group(ec)) == NULL) |
641 | return (0); | 639 | return (0); |
642 | if ((meth = EC_GROUP_method_of(grp)) == NULL) | ||
643 | return (0); | ||
644 | prime_field = (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field); | ||
645 | 640 | ||
646 | /* Determine group ID. */ | 641 | /* Determine group ID. */ |
647 | nid = EC_GROUP_get_curve_name(grp); | 642 | nid = EC_GROUP_get_curve_name(grp); |
@@ -656,9 +651,7 @@ tls1_set_ec_id(uint16_t *group_id, uint8_t *comp_id, EC_KEY *ec) | |||
656 | return (0); | 651 | return (0); |
657 | *comp_id = TLSEXT_ECPOINTFORMAT_uncompressed; | 652 | *comp_id = TLSEXT_ECPOINTFORMAT_uncompressed; |
658 | if (EC_KEY_get_conv_form(ec) == POINT_CONVERSION_COMPRESSED) { | 653 | if (EC_KEY_get_conv_form(ec) == POINT_CONVERSION_COMPRESSED) { |
659 | *comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2; | 654 | *comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime; |
660 | if (prime_field) | ||
661 | *comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime; | ||
662 | } | 655 | } |
663 | 656 | ||
664 | return (1); | 657 | return (1); |