Stage 1 GOST ciphersuite support.
[openssl.git] / engines / ccgost / gost_eng.c
index df5d787c2e83c381c5e9df926d2eeb78cc948f4c..1c5a493df692abae8bd7fdcf02ecfcc27d96776b 100644 (file)
@@ -31,7 +31,7 @@ static int gost_pkey_asn1_meths (ENGINE *e, EVP_PKEY_ASN1_METHOD **ameth,
        const int **nids, int nid);
 
 static int gost_cipher_nids[] =
-    {NID_id_Gost28147_89, 0};
+    {NID_id_Gost28147_89, NID_gost89_cnt,0};
 
 static int gost_digest_nids[] =
        {NID_id_GostR3411_94, 0};
@@ -129,6 +129,7 @@ static int bind_gost (ENGINE *e,const char *id)
                || ! ENGINE_register_pkey_meths(e)
                /* These two actually should go in LIST_ADD command */
                || ! EVP_add_cipher(&cipher_gost)
+               || ! EVP_add_cipher(&cipher_gost_cpacnt)
                || ! EVP_add_digest(&digest_gost)
                )
                {
@@ -141,8 +142,10 @@ static int bind_gost (ENGINE *e,const char *id)
        return ret;
        }       
 
+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
 IMPLEMENT_DYNAMIC_BIND_FN(bind_gost)
 IMPLEMENT_DYNAMIC_CHECK_FN()
+#endif  /* ndef OPENSSL_NO_DYNAMIC_ENGINE */
 
 static int gost_digests(ENGINE *e, const EVP_MD **digest,
        const int **nids, int nid)
@@ -173,14 +176,18 @@ static int gost_ciphers (ENGINE *e,const EVP_CIPHER **cipher,
        if (!cipher) 
                {
                *nids = gost_cipher_nids;
-               return 1; /* Only one cipher supported */
+               return 2; /* two ciphers are supported */
                }
 
        if(nid == NID_id_Gost28147_89) 
                {
                *cipher = &cipher_gost;
                }
-       else 
+       else if  (nid == NID_gost89_cnt) 
+               {
+               *cipher = &cipher_gost_cpacnt;
+               }
+       else    
                {
                ok = 0;
                *cipher = NULL;