EC_KEY_METHOD init and finish support
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
5196641617
commit
0d6ff6d3d1
@ -107,6 +107,9 @@ void EC_KEY_free(EC_KEY *r)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (r->meth->finish)
|
||||||
|
r->meth->finish(r);
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_ENGINE
|
#ifndef OPENSSL_NO_ENGINE
|
||||||
if (r->engine)
|
if (r->engine)
|
||||||
ENGINE_finish(r->engine);
|
ENGINE_finish(r->engine);
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
static const EC_KEY_METHOD openssl_ec_key_method = {
|
static const EC_KEY_METHOD openssl_ec_key_method = {
|
||||||
"OpenSSL EC_KEY method",
|
"OpenSSL EC_KEY method",
|
||||||
0,
|
0,
|
||||||
|
0,0,
|
||||||
ossl_ec_key_gen,
|
ossl_ec_key_gen,
|
||||||
ossl_ecdh_compute_key
|
ossl_ecdh_compute_key
|
||||||
};
|
};
|
||||||
@ -120,7 +121,11 @@ EC_KEY *EC_KEY_new_method(ENGINE *engine)
|
|||||||
ret->version = 1;
|
ret->version = 1;
|
||||||
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
|
ret->conv_form = POINT_CONVERSION_UNCOMPRESSED;
|
||||||
ret->references = 1;
|
ret->references = 1;
|
||||||
return (ret);
|
if (ret->meth->init && ret->meth->init(ret) == 0) {
|
||||||
|
EC_KEY_free(ret);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
|
int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
|
||||||
|
@ -560,6 +560,8 @@ const EC_METHOD *EC_GFp_nistz256_method(void);
|
|||||||
struct ec_key_method_st {
|
struct ec_key_method_st {
|
||||||
const char *name;
|
const char *name;
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
|
int (*init)(EC_KEY *key);
|
||||||
|
void (*finish)(EC_KEY *key);
|
||||||
int (*keygen)(EC_KEY *key);
|
int (*keygen)(EC_KEY *key);
|
||||||
int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key,
|
int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key,
|
||||||
EC_KEY *ecdh,
|
EC_KEY *ecdh,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user