<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
PRs on GitHub to fix documentation are always welcome.<br class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">--</div>
<div class="">-Todd Short</div>
<div class="">// <a href="mailto:tshort@akamai.com" class="">tshort@akamai.com</a></div>
<div class="">// "One if by land, two if by sea, three if by the Internet."</div>
</div>
</div>
</div>
<div style=""><br class="">
<blockquote type="cite" class="">
<div class="">On Sep 5, 2018, at 10:18 AM, Sam Habiel <<a href="mailto:sam.habiel@gmail.com" class="">sam.habiel@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">I had to double check something--I was wrong about something--&outlen<br class="">
is not incremented inside of openssl--so you have to keep another<br class="">
variable to which you add outlen and use that to set the read/write<br class="">
pointer in outbuf.<br class="">
<br class="">
--Sam<br class="">
On Wed, Sep 5, 2018 at 10:04 AM Sam Habiel <<a href="mailto:sam.habiel@gmail.com" class="">sam.habiel@gmail.com</a>> wrote:<br class="">
<blockquote type="cite" class=""><br class="">
First time poster. I hope I am writing to the right place.<br class="">
<br class="">
Example for "General encryption and decryption function example using<br class="">
FILE I/O and AES128 with a 128-bit key" has two errors. I spent a lot<br class="">
of time trying to figure out what I did wrong for a while...<br class="">
<br class="">
1. ctx is already a pointer; it does not need to be indirected to get<br class="">
the pointer.<br class="">
<br class="">
       EVP_CipherInit_ex(&ctx, EVP_aes_128_cbc(), NULL, NULL, NULL,<br class="">
do_encrypt);<br class="">
<br class="">
should say:<br class="">
<br class="">
       EVP_CipherInit_ex(ctx, EVP_aes_128_cbc(), NULL, NULL, NULL, do_encrypt);<br class="">
<br class="">
2. ciphertext length is not used to update write position:<br class="">
<br class="">
               if(!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen))<br class="">
and<br class="">
<br class="">
       if(!EVP_CipherFinal_ex(ctx, outbuf, &outlen))<br class="">
<br class="">
should say (what worked for me):<br class="">
<br class="">
               if(!EVP_CipherUpdate(ctx, outbuf + outlen, &outlen,<br class="">
inbuf, inlen))<br class="">
<br class="">
and<br class="">
       if(!EVP_CipherFinal_ex(ctx, outbuf + outlen, &outlen))<br class="">
<br class="">
It would be nice if there is a complete example that compiles and has<br class="">
a main() to run it.<br class="">
<br class="">
--Sam<br class="">
</blockquote>
-- <br class="">
openssl-users mailing list<br class="">
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" class="">
https://mta.openssl.org/mailman/listinfo/openssl-users</a><br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>