Commit dc7042cc authored by Sam Rushing's avatar Sam Rushing

allow curves params to come from private key (where openssl DER-encodes them).

parent 0ac2c550
...@@ -157,6 +157,7 @@ cdef extern from "openssl/evp.h": ...@@ -157,6 +157,7 @@ cdef extern from "openssl/evp.h":
cdef extern from "openssl/ec.h": cdef extern from "openssl/ec.h":
ctypedef struct EC_KEY ctypedef struct EC_KEY
ctypedef struct EC_POINT ctypedef struct EC_POINT
EC_KEY * EC_KEY_new ()
EC_KEY * EC_KEY_new_by_curve_name (int) EC_KEY * EC_KEY_new_by_curve_name (int)
int EC_KEY_generate_key (EC_KEY *) int EC_KEY_generate_key (EC_KEY *)
void EC_KEY_free (EC_KEY *) void EC_KEY_free (EC_KEY *)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
# -*- Mode: Pyrex -*- # -*- Mode: Cython; indent-tabs-mode: nil -*-
from libc.errno cimport errno from libc.errno cimport errno
...@@ -1283,6 +1283,10 @@ cdef class ecdsa: ...@@ -1283,6 +1283,10 @@ cdef class ecdsa:
def __init__ (self, object curve): def __init__ (self, object curve):
cdef int nid cdef int nid
if curve is None:
# no curve specified
self.key = EC_KEY_new()
else:
if type(curve) is int: if type(curve) is int:
nid = curve nid = curve
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment