Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfea40c6

Browse files
committed
gh-109945 Enable spec of multiple curves/groups for TLS
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
1 parent7e57640 commitfea40c6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎Modules/_ssl.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4373,18 +4373,19 @@ _ssl__SSLContext_set_ecdh_curve(PySSLContext *self, PyObject *name)
43734373
/*[clinic end generated code: output=23022c196e40d7d2 input=c2bafb6f6e34726b]*/
43744374
{
43754375
PyObject*name_bytes;
4376-
intnid;
4376+
43774377
if (!PyUnicode_FSConverter(name,&name_bytes))
43784378
returnNULL;
43794379
assert(PyBytes_Check(name_bytes));
4380+
#ifOPENSSL_VERSION_MAJOR<3
4381+
intnid;
43804382
nid=OBJ_sn2nid(PyBytes_AS_STRING(name_bytes));
43814383
Py_DECREF(name_bytes);
43824384
if (nid==0) {
43834385
PyErr_Format(PyExc_ValueError,
43844386
"unknown elliptic curve name %R",name);
43854387
returnNULL;
43864388
}
4387-
#ifOPENSSL_VERSION_MAJOR<3
43884389
EC_KEY*key=EC_KEY_new_by_curve_name(nid);
43894390
if (key==NULL) {
43904391
_setSSLError(get_state_ctx(self),NULL,0,__FILE__,__LINE__);
@@ -4393,7 +4394,9 @@ _ssl__SSLContext_set_ecdh_curve(PySSLContext *self, PyObject *name)
43934394
SSL_CTX_set_tmp_ecdh(self->ctx,key);
43944395
EC_KEY_free(key);
43954396
#else
4396-
if (!SSL_CTX_set1_groups(self->ctx,&nid,1)) {
4397+
intres=SSL_CTX_set1_groups_list(self->ctx,PyBytes_AS_STRING(name_bytes));
4398+
Py_DECREF(name_bytes);
4399+
if (!res) {
43974400
_setSSLError(get_state_ctx(self),NULL,0,__FILE__,__LINE__);
43984401
returnNULL;
43994402
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp