coco coco wrote:
Sorry if this is a dumb question, I'm not sure why EVP_SignInit_ext() is giving me unhandled exception error. My code is a very simple testing code:

    char * clearText = "testing openssl";
    char cryptText[MAX_LEN];
    char buf[MAX_LEN];
    unsigned char ubuf[MAX_LEN];
    unsigned char sig[MAX_LEN];
    unsigned int sigLen;

    EVP_PKEY key;
    EVP_MD_CTX sctx, vctx;

int ret = EVP_PKEY_assign_RSA(&key, RSA_generate_key(1024, RSA_3, 0, 0));
    if (ret != 1)
        std::cout << "Generate rsa key failed..." << std::endl;

    EVP_SignInit_ex(&sctx, EVP_sha1(), NULL);
    EVP_SignUpdate(&sctx, clearText, strlen(clearText));
    memset(sig, 0, MAX_LEN);
    ret = EVP_SignFinal(&sctx, sig, &sigLen, &key);
    if (ret != 1)
        std::cout << "Signing failed..." << std::endl;
...
Everytime I get to EVP_SignInit_ex(), I get the error:

Unhandled exception at 0x1003dee6 in test.exe: 0xC0000005: Access violation reading location 0xcccccccc.

try a EVP_MD_CTX_init() before using the EVP_MD_CTX objects

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to