diff options
author | Vitaly Chikunov <vt@altlinux.org> | 2019-01-30 16:02:53 +0300 |
---|---|---|
committer | Vitaly Chikunov <vt@altlinux.org> | 2019-01-30 16:02:53 +0300 |
commit | 1b374532c2d494710c39371e83c197d08c65e8bc (patch) | |
tree | 0c06d35a5f28caf3bd637b92f88346a44c08c058 | |
parent | 3652da53812f398d0b1db39c425d9136a15eb968 (diff) | |
download | gost-engine-1b374532c2d494710c39371e83c197d08c65e8bc.zip gost-engine-1b374532c2d494710c39371e83c197d08c65e8bc.tar.gz gost-engine-1b374532c2d494710c39371e83c197d08c65e8bc.tar.bz2 |
Implement EVP_PKEY_{,public_}check
Very simple redirect to EC_KEY_check_key() which is doing all basic
checks (see crypto/ec/ec_key.c:ec_key_simple_check_key()).
-rw-r--r-- | gost_pmeth.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gost_pmeth.c b/gost_pmeth.c index 41bda94..d4364e4 100644 --- a/gost_pmeth.c +++ b/gost_pmeth.c @@ -966,6 +966,14 @@ static int pkey_gost_mac_signctx(EVP_PKEY_CTX *ctx, unsigned char *sig, return ret; } +/* ----------- misc callbacks -------------------------------------*/ + +/* Callback for both EVP_PKEY_check() and EVP_PKEY_public_check. */ +static int pkey_gost_check(EVP_PKEY *pkey) +{ + return EC_KEY_check_key(EVP_PKEY_get0(pkey)); +} + /* ----------------------------------------------------------------*/ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth, int flags) { @@ -990,6 +998,8 @@ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth, int flags) pkey_gost_derive_init, pkey_gost_ec_derive); EVP_PKEY_meth_set_paramgen(*pmeth, pkey_gost_paramgen_init, pkey_gost2001_paramgen); + EVP_PKEY_meth_set_check(*pmeth, pkey_gost_check); + EVP_PKEY_meth_set_public_check(*pmeth, pkey_gost_check); break; case NID_id_GostR3410_2012_256: EVP_PKEY_meth_set_ctrl(*pmeth, @@ -1008,6 +1018,8 @@ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth, int flags) EVP_PKEY_meth_set_paramgen(*pmeth, pkey_gost_paramgen_init, pkey_gost2012_paramgen); + EVP_PKEY_meth_set_check(*pmeth, pkey_gost_check); + EVP_PKEY_meth_set_public_check(*pmeth, pkey_gost_check); break; case NID_id_GostR3410_2012_512: EVP_PKEY_meth_set_ctrl(*pmeth, @@ -1026,6 +1038,8 @@ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth, int flags) EVP_PKEY_meth_set_paramgen(*pmeth, pkey_gost_paramgen_init, pkey_gost2012_paramgen); + EVP_PKEY_meth_set_check(*pmeth, pkey_gost_check); + EVP_PKEY_meth_set_public_check(*pmeth, pkey_gost_check); break; case NID_id_Gost28147_89_MAC: EVP_PKEY_meth_set_ctrl(*pmeth, pkey_gost_mac_ctrl, |