mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 03:12:37 +03:00
Private raw key should be returned as a secret
This commit is contained in:
parent
89854cca8b
commit
a1c4ffec20
@ -178,11 +178,11 @@ static PyObject*
|
||||
elliptic_curve_key_get_private(EllipticCurveKey *self, void UNUSED *closure) {
|
||||
size_t len = 0;
|
||||
if (1 != EVP_PKEY_get_raw_private_key(self->key, NULL, &len)) return set_error_from_openssl("Could not get public key from EVP_PKEY");
|
||||
PyObject *ans = PyBytes_FromStringAndSize(NULL, len);
|
||||
Secret *ans = alloc_secret(len);
|
||||
if (!ans) return NULL;
|
||||
if (mlock(PyBytes_AS_STRING(ans), len) != 0) { Py_CLEAR(ans); return PyErr_SetFromErrno(PyExc_OSError); }
|
||||
if (1 != EVP_PKEY_get_raw_private_key(self->key, (unsigned char*)PyBytes_AS_STRING(ans), &len)) { Py_CLEAR(ans); return set_error_from_openssl("Could not get public key from EVP_PKEY"); }
|
||||
return ans;
|
||||
if (1 != EVP_PKEY_get_raw_private_key(self->key, (unsigned char*)ans->secret, &len)) { Py_CLEAR(ans); return set_error_from_openssl("Could not get public key from EVP_PKEY"); }
|
||||
return (PyObject*)ans;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user