]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_lcl.h
Export bind_gost to allow local engine init
[openssl-gost/engine.git] / gost_lcl.h
index 52984a00336ed96a0aebe595a92780aff586fee6..512d94746d6c1ce87195a4890733240f207e7efd 100644 (file)
@@ -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)
@@ -114,6 +114,24 @@ typedef struct {                /* FIXME incomplete */
     GOST_KEY_TRANSPORT *gkt;
 } GOST_CLIENT_KEY_EXCHANGE_PARAMS;
 
+/*   PSKeyTransport ::= SEQUENCE {
+       PSEXP OCTET STRING,
+       ephemeralPublicKey SubjectPublicKeyInfo
+   }
+   SubjectPublicKeyInfo ::= SEQUENCE {
+       algorithm AlgorithmIdentifier,
+       subjectPublicKey BITSTRING
+   }
+   AlgorithmIdentifier ::= SEQUENCE {
+       algorithm OBJECT IDENTIFIER,
+       parameters ANY OPTIONAL
+   }*/
+typedef struct PSKeyTransport_st {
+    ASN1_OCTET_STRING *psexp;
+    X509_PUBKEY       *ephem_key;
+} PSKeyTransport_gost;
+
+DECLARE_ASN1_FUNCTIONS(PSKeyTransport_gost)
 /*
  * Hacks to shorten symbols to 31 characters or less, or OpenVMS. This mimics
  * what's done in symhacks.h, but since this is a very local header file, I
@@ -230,11 +248,11 @@ void inc_counter(unsigned char *buffer, size_t buf_len);
 # 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 */
@@ -254,6 +272,20 @@ int gost_kdftree2012_256(unsigned char *keyout, size_t keyout_len,
                          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 */
@@ -270,4 +302,6 @@ int pack_sign_cp(ECDSA_SIG *s, int order, unsigned char *sig, size_t *siglen);
 /* Returns pointer into EVP_PKEY structure */
 BIGNUM *gost_get0_priv_key(const EVP_PKEY *pkey);
 
+int bind_gost(ENGINE* e, const char* id);
+
 #endif