EVP_MD_CTX “error: storage size of ‘ctx’ isn’t known”

前端 未结 2 1006
北荒
北荒 2021-01-04 20:42

My system is Ubuntu16.04 LTS. when I use the OpenSSL EVP_MD_CTX, this error appeared. Can anyone help me?


CODE:

相关标签:
2条回答
  • 2021-01-04 21:29

    I had a similar error but with EVP_CIPHER_CTX

    error: storage size of ‘ctx’ isn’t known
           EVP_CIPHER_CTX ctx;
    

    I solved with this:

    EVP_CIPHER_CTX *ctx;
    ctx = EVP_CIPHER_CTX_new();
    

    I hope this helps somebody with the same problem I had.

    0 讨论(0)
  • 2021-01-04 21:33

    You are using OpenSSL 1.1.0 which made this structure (and many others) opaque - which means you cannot stack allocate it. Instead do this:

    EVP_MD_CTX *md_ctx;
    
    md_ctx = EVP_MD_CTX_new();
    if (md_ctx == NULL)
        ...
    ...
    EVP_MD_CTX_free(md_ctx);
    
    0 讨论(0)
提交回复
热议问题