<div dir="ltr"><div class="gmail_default" style="font-size:small">Thank you for your answer.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I made all the changes and the code isn't compiling.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm using cmake in order to build the code.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">my CMakeLists.txt contains this line in order to include openssl headers:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small">INCLUDE_DIRECTORIES(/usr/<wbr>include/openssl/ /usr/local/include/openssl/)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The constructor of my code is :</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default">HashEncrypt::HashEncrypt(const unsigned char *key, const unsigned char *iv, size_t ivSizeBytes)</div><div class="gmail_default">{</div><div class="gmail_default">    // copy the 128-bit key</div><div class="gmail_default">    memcpy(_key, key, 16);</div><div class="gmail_default"><br></div><div class="gmail_default">    //copy the iv:</div><div class="gmail_default">    EVP_CIPHER_CTX *_ctx;<br></div><div class="gmail_default">    _iv = new unsigned char[ivSizeBytes];</div><div class="gmail_default">    memcpy(_iv, iv, ivSizeBytes);</div><div class="gmail_default"><br></div><div class="gmail_default">    //EVP_CIPHER_CTX_init(&_ctx);</div><div class="gmail_default">    _ctx = EVP_CIPHER_CTX_new();</div><div class="gmail_default"><br></div><div class="gmail_default">    EVP_EncryptInit_ex(_ctx, EVP_aes_128_gcm(), NULL, NULL, NULL);</div><div class="gmail_default"><br></div><div class="gmail_default">    EVP_CIPHER_CTX_ctrl(_ctx, EVP_CTRL_GCM_SET_IVLEN, ivSizeBytes, NULL);</div><div class="gmail_default"><br></div><div class="gmail_default">    EVP_EncryptInit_ex(_ctx, NULL, NULL, _key, _iv);</div><div class="gmail_default"><br></div><div class="gmail_default">}</div><div class="gmail_default"><br></div><div class="gmail_default">What I'm missing?</div><div style="font-size:small"><br></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 May 2017 at 12:57, Matt Caswell <span dir="ltr"><<a href="mailto:matt@openssl.org" target="_blank">matt@openssl.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 03/05/17 10:33, Lior Koskas wrote:<br>
>  I viewed the file and the definition exists.<br>
> I also checked that I'm picking the correct version.<br>
><br>
> My problem is this line : EVP_EncryptInit_ex(&_ctx, EVP_aes_128_gcm(),<br>
> NULL, NULL, NULL);<br>
><br>
> I also tried to change the code to this two lines :<br>
> EVP_CIPHER *EVP evp_gcm = EVP_aes_128_gcm();<br>
<br>
</span>You have one too many "EVP"'s in there. It should be:<br>
<br>
const EVP_CIPHER *evp_gcm = EVP_aes_128_gcm();<br>
<br>
Although, that really shouldn't be necessary and your original version<br>
looks ok. What doesn't look quite right is the "&_ctx" bit. In 1.1.0 an<br>
EVP_CIPHER_CTX is an opaque type. You cannot allocate concrete instances<br>
of it directly.<br>
<br>
Where previously you might have had:<br>
<br>
EVP_CIPHER_CTX _ctx;<br>
<br>
EVP_CIPHER_CTX_init(&_ctx);<br>
<span class="">EVP_EncryptInit_ex(&_ctx, EVP_aes_128_gcm(), NULL, NULL, NULL);<br>
<br>
<br>
</span>You now need to do:<br>
<br>
EVP_CIPHER_CTX *_ctx;<br>
<br>
_ctx = EVP_CIPHER_CTX_new();<br>
EVP_EncryptInit_ex(_ctx, EVP_aes_128_gcm(), NULL, NULL, NULL);<br>
<br>
...<br>
EVP_CIPHER_CTX_free(_ctx);<br>
<br>
<br>
I have omitted error checking code for brevity.<br>
<span class="HOEnZb"><font color="#888888"><br>
Matt<br>
</font></span><span class="im HOEnZb"><br>
<br>
> EVP_EncryptInit_ex(&_ctx, evp_gcm, NULL, NULL, NULL);<br>
><br>
> After the change I got this error : expected initializer before ‘evp_gcm’<br>
><br>
> What am I doing wrong?<br>
><br>
> On 3 May 2017 at 12:07, Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a><br>
</span><div class="HOEnZb"><div class="h5">> <mailto:<a href="mailto:matt@openssl.org">matt@openssl.org</a>>> wrote:<br>
><br>
><br>
><br>
>     On 03/05/17 09:43, Lior Koskas wrote:<br>
>     > Hi,<br>
>     ><br>
>     > I'm using EVP_aes_128_gcm and have problem with compiling it with<br>
>     > OpenSSL 1.1.0 (earlier versions are compiling).<br>
>     > Although I included <openssl/evp.h> I got this error : error:<br>
>     > ‘EVP_aes_128_gcm’ was not declared in this scope.<br>
>     ><br>
>     > I'm using CentOS 7.3.<br>
>     ><br>
>     > Which file I need to include in order to compile EVP_aes_128_gcm ?<br>
><br>
>     It's still declared in evp.h:<br>
><br>
>     const EVP_CIPHER *EVP_aes_128_gcm(void);<br>
><br>
>     Perhaps you are not picking up the version of evp.h that you think<br>
>     you are?<br>
><br>
>     Matt<br>
><br>
>     --<br>
>     openssl-users mailing list<br>
>     To unsubscribe:<br>
>     <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><br>
>     <<a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><wbr>><br>
><br>
><br>
><br>
><br>
> --<br>
> Lior           Koskas<br>
> Software Engineer<br>
><br>
><br>
--<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Lior           Koskas</div><div>Software Engineer</div></div></div></div></div></div>
</div>