X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_lcl.h;h=bb25ce360c3a47612c776dc507cb752bcbd56158;hb=bd1b2c234ea8ef2bdfe8f303f6002525d6d69bc7;hp=08fe5ce66a39fcbd136bcf415ec2b1b3daf01218;hpb=fd12b88c3392a300d94421f62cf870be8d4ef430;p=openssl-gost%2Fengine.git diff --git a/gost_lcl.h b/gost_lcl.h index 08fe5ce..bb25ce3 100644 --- a/gost_lcl.h +++ b/gost_lcl.h @@ -21,7 +21,7 @@ # define GOST_PARAM_CRYPT_PARAMS 0 # define GOST_PARAM_PBE_PARAMS 1 # define GOST_PARAM_PK_FORMAT 2 -# define GOST_PARAM_MAX 2 +# define GOST_PARAM_MAX 3 # define GOST_CTRL_CRYPT_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_CRYPT_PARAMS) # define GOST_CTRL_PBE_PARAMS (ENGINE_CMD_BASE+GOST_PARAM_PBE_PARAMS) # define GOST_CTRL_PK_FORMAT (ENGINE_CMD_BASE+GOST_PARAM_PK_FORMAT) @@ -245,14 +245,13 @@ void inc_counter(unsigned char *buffer, size_t buf_len); # define EVP_MD_CTRL_KEY_LEN (EVP_MD_CTRL_ALG_CTRL+3) # define EVP_MD_CTRL_SET_KEY (EVP_MD_CTRL_ALG_CTRL+4) -# define EVP_MD_CTRL_MAC_LEN (EVP_MD_CTRL_ALG_CTRL+5) /* EVP_PKEY_METHOD key encryption callbacks */ /* From gost_ec_keyx.c */ -int pkey_GOST_ECcp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, +int pkey_gost_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *key, size_t key_len); -int pkey_GOST_ECcp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, +int pkey_gost_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t in_len); /* derive functions */ @@ -266,12 +265,32 @@ int gost_ec_verify(const unsigned char *dgst, int dgst_len, ECDSA_SIG *sig, EC_KEY *ec); int gost_ec_compute_public(EC_KEY *ec); +/* VKO */ +int VKO_compute_key(unsigned char *shared_key, + const EC_POINT *pub_key, const EC_KEY *priv_key, + const unsigned char *ukm, const size_t ukm_size, + const int vko_dgst_nid); + /* KDF TREE */ int gost_kdftree2012_256(unsigned char *keyout, size_t keyout_len, const unsigned char *key, size_t keylen, const unsigned char *label, size_t label_len, const unsigned char *seed, size_t seed_len, const size_t representation); + +int gost_tlstree(int cipher_nid, const unsigned char* inkey, + unsigned char *outkey, const unsigned char *tlsseq); +/* KExp/KImp */ +int gost_kexp15(const unsigned char *shared_key, const int shared_len, + int cipher_nid, const unsigned char *cipher_key, + int mac_nid, unsigned char *mac_key, + const unsigned char *iv, const size_t ivlen, + unsigned char *out, int *out_len); +int gost_kimp15(const unsigned char *expkey, const size_t expkeylen, + int cipher_nid, const unsigned char *cipher_key, + int mac_nid, unsigned char *mac_key, + const unsigned char *iv, const size_t ivlen, + unsigned char *shared_key); /*============== miscellaneous functions============================= */ /* from gost_sign.c */ /* Convert GOST R 34.11 hash sum to bignum according to standard */ @@ -287,5 +306,4 @@ int pack_sign_cp(ECDSA_SIG *s, int order, unsigned char *sig, size_t *siglen); /* Get private key as BIGNUM from both 34.10-2001 keys*/ /* Returns pointer into EVP_PKEY structure */ BIGNUM *gost_get0_priv_key(const EVP_PKEY *pkey); - #endif