You need to initiualie engine first:

static ENGINE *e = NULL;

    e = ENGINE_by_id("gost");
    if (!e){
        printf("Can't find engine \n");
        return 1;
    }
    if (!ENGINE_init(e)){
        printf("Engine initialization failed!\n");
        ENGINE_free(e);
        return 1;
    }
     /* ENGINE_init() returned a functional reference, so free the structural
      * reference from ENGINE_by_id(). */
     ENGINE_free(e);

    if (ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
        printf("Engine %s(%s): Activated.\n", ENGINE_get_name(e),
ENGINE_get_id(e));
    } else {
        printf("Engine %s(%s): Initialized but not usable.\n",
ENGINE_get_name(e), ENGINE_get_id(e));
        return 1;
    }

// Optional?
    OpenSSL_add_all_algorithms();
    OpenSSL_add_ssl_algorithms();


Then do whatever you want.

On 19 September 2011 15:30, Dmitrij K <kdi...@live.ru> wrote:
> Hi guys!
>
> I need help, please.
>
> I don't know, how do it. Maybe anyone has experience with signing/verify a
> docs/strings with GOST, and he will help me with...
>
> I have little code, which has can't load `md_gost94'... And I don't know how
> to use API for the GOST... :(
>
> My code are:
>
> [CODE=cpp]
>
> #include <openssl/conf.h>
> #include <openssl/err.h>
> #include <openssl/rsa.h>
> #include <openssl/sha.h>
> #include <openssl/md5.h>
> #include <openssl/pem.h>
> #include <openssl/x509.h>
> #include <openssl/x509v3.h>
> #include <openssl/crypto.h>
> #include <openssl/ssl.h>
> #include <openssl/ssl2.h>
> #include <openssl/ssl3.h>
> #include <openssl/ssl23.h>
> #include <openssl/evp.h>
> #include <openssl/engine.h>
> #include <stdio.h>
>
> // g++ gost.cxx -o gost -lssl
> int main(){
>
> int ret = -1;
>
> SSL_library_init();
>
> const EVP_MD *md = NULL;
>
> if((md = EVP_get_digestbyname("md_gost94")) == NULL){
>  printf("cannot load the `md_gost94'!\n");
>  goto ENDFUNC;
> }
>
> else { printf("Ok!\n"); }
>
>
> ret = 0;
>
> ENDFUNC:
>
> md = NULL;
>
> return ret;
>
> }
>
> [/CODE]
>
> PS:
>
> Platform: Linux
> Version of OpenSSL: 1.0.0e
>
> --
> Regards.
>
> --
> Regards.
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to