diff options
| author | tb <> | 2022-06-30 16:05:07 +0000 |
|---|---|---|
| committer | tb <> | 2022-06-30 16:05:07 +0000 |
| commit | 6391ba921ad5c87d1a4783a438fb346672069664 (patch) | |
| tree | 5e132e3e23ccde65b520524d5b4a0c1eda124d9c /src/lib/libssl/ssl_seclevel.c | |
| parent | cc5a8fc86cf84c65abe310cec00f6d1501e38f0d (diff) | |
| download | openbsd-6391ba921ad5c87d1a4783a438fb346672069664.tar.gz openbsd-6391ba921ad5c87d1a4783a438fb346672069664.tar.bz2 openbsd-6391ba921ad5c87d1a4783a438fb346672069664.zip | |
Check security level for supported groups.
ok jsing
Diffstat (limited to 'src/lib/libssl/ssl_seclevel.c')
| -rw-r--r-- | src/lib/libssl/ssl_seclevel.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/libssl/ssl_seclevel.c b/src/lib/libssl/ssl_seclevel.c index 954f27b336..35f8b8891b 100644 --- a/src/lib/libssl/ssl_seclevel.c +++ b/src/lib/libssl/ssl_seclevel.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_seclevel.c,v 1.13 2022/06/30 11:25:52 tb Exp $ */ | 1 | /* $OpenBSD: ssl_seclevel.c,v 1.14 2022/06/30 16:05:07 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2020 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <openssl/x509.h> | 27 | #include <openssl/x509.h> |
| 28 | #include <openssl/x509v3.h> | 28 | #include <openssl/x509v3.h> |
| 29 | 29 | ||
| 30 | #include "bytestring.h" | ||
| 30 | #include "ssl_locl.h" | 31 | #include "ssl_locl.h" |
| 31 | 32 | ||
| 32 | static int | 33 | static int |
| @@ -398,3 +399,25 @@ ssl_security_cert_chain(const SSL *ssl, STACK_OF(X509) *sk, X509 *x509, | |||
| 398 | 399 | ||
| 399 | return 1; | 400 | return 1; |
| 400 | } | 401 | } |
| 402 | |||
| 403 | int | ||
| 404 | ssl_security_supported_group(const SSL *ssl, uint16_t curve_id) | ||
| 405 | { | ||
| 406 | CBB cbb; | ||
| 407 | int bits, nid; | ||
| 408 | uint8_t curve[2]; | ||
| 409 | |||
| 410 | if ((bits = tls1_ec_curve_id2bits(curve_id)) == 0) | ||
| 411 | return 0; | ||
| 412 | if ((nid = tls1_ec_curve_id2nid(curve_id)) == NID_undef) | ||
| 413 | return 0; | ||
| 414 | |||
| 415 | if (!CBB_init_fixed(&cbb, curve, sizeof(curve))) | ||
| 416 | return 0; | ||
| 417 | if (!CBB_add_u16(&cbb, curve_id)) | ||
| 418 | return 0; | ||
| 419 | if (!CBB_finish(&cbb, NULL, NULL)) | ||
| 420 | return 0; | ||
| 421 | |||
| 422 | return ssl_security(ssl, SSL_SECOP_CURVE_SUPPORTED, bits, nid, curve); | ||
| 423 | } | ||
