<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — wc_AesGcmEncrypt / wc_AesGcmDecrypt questions]]></title>
		<link>https://www.wolfssl.com/forums/topic762-wcaesgcmencrypt-wcaesgcmdecrypt-questions.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic762.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in wc_AesGcmEncrypt / wc_AesGcmDecrypt questions.]]></description>
		<lastBuildDate>Wed, 02 Mar 2016 10:54:27 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: wc_AesGcmEncrypt / wc_AesGcmDecrypt questions]]></title>
			<link>https://www.wolfssl.com/forums/post2438.html#p2438</link>
			<description><![CDATA[<p>Hi, i was able to find an example under wolfcrypt/test/test.c so it&#039;s ok! if it can help you to understand the mechanism an.schall.<br />There are more explanations here:<br /><a href="http://www.yassl.com/forums/topic616-solved-how-to-use-the-aesgcm-mode-of-operation.html">http://www.yassl.com/forums/topic616-so … ation.html</a><br />If i have well understood, plaintext size must be equal to cipher text size...</p>]]></description>
			<author><![CDATA[null@example.com (rskkya)]]></author>
			<pubDate>Wed, 02 Mar 2016 10:54:27 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2438.html#p2438</guid>
		</item>
		<item>
			<title><![CDATA[Re: wc_AesGcmEncrypt / wc_AesGcmDecrypt questions]]></title>
			<link>https://www.wolfssl.com/forums/post2386.html#p2386</link>
			<description><![CDATA[<p>1. It is calling AesGcmDecrypt_fips only when FIPS mode is enabled. We do not provide the implementation of any of the _fips() functions in the open source download.</p><p>2. You are encrypting 24 bytes of plaintext and storing the 24 bytes of cipher text into a 32 byte array and then are decrypting the 32 byte array. The first thing the decrypt function does is calculate and checks the authTag, which is failing with error -180.</p>]]></description>
			<author><![CDATA[null@example.com (john)]]></author>
			<pubDate>Thu, 14 Jan 2016 23:33:16 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2386.html#p2386</guid>
		</item>
		<item>
			<title><![CDATA[wc_AesGcmEncrypt / wc_AesGcmDecrypt questions]]></title>
			<link>https://www.wolfssl.com/forums/post2381.html#p2381</link>
			<description><![CDATA[<p>Hi,</p><p>I want to implement AES-GCM and have the following questions:</p><p>1. looking at the implementation of </p><div class="codebox"><pre><code>wc_AesGcmDecrypt</code></pre></div><p> in <strong>wolfcrypt/src/aes.c</strong> the code calls </p><div class="codebox"><pre><code>AesGcmDecrypt_fips</code></pre></div><p>. However, if I grep for </p><div class="codebox"><pre><code>AesGcmDecrypt_fips</code></pre></div><p> in the wolfSSL folder, I get no other result beside the </p><div class="codebox"><pre><code>wc_AesGcmDecrypt</code></pre></div><p> implementation. Where is </p><div class="codebox"><pre><code>AesGcmDecrypt_fips</code></pre></div><p> implemented?</p><p>2. In the code below, </p><div class="codebox"><pre><code>wc_AesGcmDecrypt</code></pre></div><p> returns -180. What does this mean?</p><div class="codebox"><pre><code>#include &lt;wolfssl/wolfcrypt/aes.h&gt;
#include &quot;stdio.h&quot;
#include &quot;string.h&quot;
#include &quot;stdlib.h&quot;
#include &quot;inttypes.h&quot;

void printhex(unsigned char myarray[], unsigned int size);

//__aead(byte plaintext[], byte iv[], byte addAuthData[])
unsigned long main()
{

      int  result;
    Aes enc;

    printf(&quot;Entering aead() function...\n&quot;);

    // additional plaintext that is to be authenticated
    // with the plaintext being encrypted
    const byte addAuthData[] =
    {
        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
        0xab, 0xad, 0xda, 0xd2
    };

    const byte key[] =
    {
        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c
    };

    const byte iv[] =
    {
        0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
        0xde, 0xca, 0xf8, 0x88
    };

    const byte plaintext[] =
    {
        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c
    };

    byte plaintextresult[sizeof(plaintext)];
    byte authTag[32];
    byte ciphertext[32];

    //    set key for AES-GCM
    //    wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len);
    wc_AesGcmSetKey(&amp;enc, key, sizeof(key));

    printf(&quot;\nSetting key for aead() operation:\n&quot;);
    printhex(key, sizeof(key));
    //    perform encryption
    /*
    wc_AesGcmEncrypt(Aes* aes, byte* out,
                     const byte* in, word32 sz,
                     const byte* iv, word32 ivSz,
                     byte* authTag, word32 authTagSz,
                     const byte* authIn, word32 authInSz);
    */
    wc_AesGcmEncrypt(&amp;enc, ciphertext,
                    plaintext, sizeof(plaintext),
                    iv, sizeof(iv), 
                    authTag, sizeof(authTag),
                    addAuthData, sizeof(addAuthData));
    printf(&quot;\nEncrypting plaintext:\n&quot;);
    printhex(plaintext, sizeof(plaintext));
    printf(&quot;\nCipher:\n&quot;);
    printhex(ciphertext, sizeof(ciphertext));

    //    perform decryption
    /*
    wc_AesGcmDecrypt(Aes* aes, byte* out,
                    const byte* in, word32 sz,
                    const byte* iv, word32 ivSz,
                    const byte* authTag, word32 authTagSz,
                    const byte* authIn, word32 authInSz);
    */
    result = wc_AesGcmDecrypt(&amp;enc, plaintextresult,
                    ciphertext, sizeof(ciphertext),
                    iv, sizeof(iv),
                    authTag, sizeof(authTag),
                    addAuthData, sizeof(addAuthData));

    printf(&quot;\nDecrypting ciphertext (result: %d)\n&quot;, result);
    printhex(plaintextresult, sizeof(plaintextresult));
    //printf();


      return (0);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (an.schall)]]></author>
			<pubDate>Wed, 13 Jan 2016 09:23:03 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2381.html#p2381</guid>
		</item>
	</channel>
</rss>
