Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:mod:`ssl`: improve UWP build compatibility.
15 changes: 8 additions & 7 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4924,16 +4924,16 @@ static PyObject *
_ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath)
/*[clinic end generated code: output=dd74b3c524dd2723 input=832769a0734b8c4d]*/
{
FILE *f;
DH *dh;

#if defined(MS_WINDOWS) && defined(Py_DEBUG)
#if defined(MS_WINDOWS_APP) && !defined(MS_WINDOWS_DESKTOP)
PyErr_SetString(PyExc_NotImplementedError, "load_dh_params: unavailable on UWP build");
return NULL;
#elif defined(MS_WINDOWS) && defined(Py_DEBUG)
PyErr_SetString(PyExc_NotImplementedError,
"load_dh_params: unavailable on Windows debug build");
return NULL;
#endif

f = Py_fopen(filepath, "rb");
#else
FILE* f = Py_fopen(filepath, "rb");
DH* dh;
if (f == NULL)
return NULL;

Expand All @@ -4959,6 +4959,7 @@ _ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath)
}
DH_free(dh);
Py_RETURN_NONE;
#endif
}

/*[clinic input]
Expand Down
14 changes: 9 additions & 5 deletions Modules/_ssl/debughelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,17 @@ static int
_PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,
void *Py_UNUSED(closure))
{
PySSLContext *self = PySSLContext_CAST(op);
FILE *fp;

#if defined(MS_WINDOWS) && defined(Py_DEBUG)
#if defined(MS_WINDOWS_APP) && !defined(MS_WINDOWS_DESKTOP)
PyErr_SetString(PyExc_NotImplementedError,
"set_keylog_filename: unavailable on UWP build");
return -1;
#elif defined(MS_WINDOWS) && defined(Py_DEBUG)
PyErr_SetString(PyExc_NotImplementedError,
"set_keylog_filename: unavailable on Windows debug build");
return -1;
#endif
#else
PySSLContext* self = PySSLContext_CAST(op);
FILE* fp;

/* Reset variables and callback first */
SSL_CTX_set_keylog_callback(self->ctx, NULL);
Expand Down Expand Up @@ -231,4 +234,5 @@ _PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,
PySSL_END_ALLOW_THREADS(self)
SSL_CTX_set_keylog_callback(self->ctx, _PySSL_keylog_callback);
return 0;
#endif
}
Loading