EVP_get_cipherbyname and “undefined struct/union evp_cipher_st” in OpenSSL 1.1.0

后端 未结 1 785
囚心锁ツ
囚心锁ツ 2021-01-23 15:02

I\'m trying to use openssl with visual studio c project.

I compiled openssl using visual studio nmake command then installed everything to a predefined folder (C:\\opens

1条回答
  •  囚心锁ツ
    2021-01-23 15:33

    You can get the key length using:

    *outputkey_size = EVP_CIPHER_key_length(cipher);
    

    Putting in the end of your code the next lines:

    printf("Key-size: %d\n", aes_keylen);
    printf("Key: "); for (int i = 0; i

    It prints the correct output, which is next:

    Key-size: 32
    Key: 51ae3ac4721439302cc5f90313f440bd9ca714c9a80b2213d034c87c00a700a0
    

    I'm not sure if key_len was available on previous versions but in the openssl-1.10 release notes you can read:

    • Most libcrypto and libssl public structures were made opaque, including: BIGNUM and associated types, EC_KEY and EC_KEY_METHOD, DH and DH_METHOD, DSA and DSA_METHOD, RSA and RSA_METHOD, BIO and BIO_METHOD, EVP_MD_CTX, EVP_MD, EVP_CIPHER_CTX, EVP_CIPHER, EVP_PKEY and associated types, HMAC_CTX, X509, X509_CRL, X509_OBJECT, X509_STORE_CTX, X509_STORE, X509_LOOKUP, X509_LOOKUP_METHOD
    • libssl internal structures made opaque

    which means that the applications are no longer allowed to look inside the variables of the structures. This is the reason that _key_len (and others) shows undefined.

    0 讨论(0)
提交回复
热议问题