spot-the-bug/stream-ciphers/monocypher-3.1.1/doc/html/crypto_ietf_chacha20.html

97 lines
4.7 KiB
HTML
Raw Normal View History

2020-09-25 05:58:08 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<style>
table.head, table.foot { width: 100%; }
td.head-rtitle, td.foot-os { text-align: right; }
td.head-vol { text-align: center; }
div.Pp { margin: 1ex 0ex; }
</style>
<link rel="stylesheet" href="style.css" type="text/css" media="all"/>
<title>CRYPTO_IETF_CHACHA20(3MONOCYPHER)</title>
</head>
<body>
<table class="head">
<tr>
<td class="head-ltitle">CRYPTO_IETF_CHACHA20(3MONOCYPHER)</td>
<td class="head-vol">3MONOCYPHER</td>
<td class="head-rtitle">CRYPTO_IETF_CHACHA20(3MONOCYPHER)</td>
</tr>
</table>
<div class="manual-text">
<h1 class="Sh" title="Sh" id="NAME"><a class="selflink" href="#NAME">NAME</a></h1>
<b class="Nm" title="Nm">crypto_ietf_chacha20</b>,
<b class="Nm" title="Nm">crypto_ietf_chacha20_ctr</b> &#x2014;
<span class="Nd" title="Nd">IETF Chacha20 encryption functions</span>
<h1 class="Sh" title="Sh" id="SYNOPSIS"><a class="selflink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<b class="In" title="In">#include
&lt;<a class="In" title="In">monocypher.h</a>&gt;</b>
<div class="Pp"></div>
<var class="Ft" title="Ft">void</var>
<br/>
<b class="Fn" title="Fn">crypto_ietf_chacha20</b>(<var class="Fa" title="Fa">uint8_t
*cipher_text</var>, <var class="Fa" title="Fa">const uint8_t
*plain_text</var>, <var class="Fa" title="Fa">size_t text_size</var>,
<var class="Fa" title="Fa">const uint8_t key[32]</var>,
<var class="Fa" title="Fa">const uint8_t nonce[12]</var>);
<div class="Pp"></div>
<var class="Ft" title="Ft">void</var>
<br/>
<b class="Fn" title="Fn">crypto_ietf_chacha20_ctr</b>(<var class="Fa" title="Fa">uint8_t
*cipher_text</var>, <var class="Fa" title="Fa">const uint8_t
*plain_text</var>, <var class="Fa" title="Fa">size_t text_size</var>,
<var class="Fa" title="Fa">const uint8_t key[32]</var>,
<var class="Fa" title="Fa">const uint8_t nonce[12]</var>,
<var class="Fa" title="Fa">const uint32_t ctr</var>);
<h1 class="Sh" title="Sh" id="DESCRIPTION"><a class="selflink" href="#DESCRIPTION">DESCRIPTION</a></h1>
These functions provide an interface for the Chacha20 encryption primitive as
specified by the IETF in RFC 8439. They are provided strictly for
compatibility with existing systems or strict standards compliance. New
programs are strongly encouraged to use
<a class="Xr" title="Xr" href="crypto_xchacha20.html">crypto_xchacha20(3monocypher)</a>
instead.
<div class="Pp"></div>
Chacha20 is a low-level primitive. Consider using authenticated encryption,
implemented by
<a class="Xr" title="Xr" href="crypto_lock.html">crypto_lock(3monocypher)</a>.
<div class="Pp"></div>
The <b class="Fn" title="Fn">crypto_ietf_chacha20</b>() and
<b class="Fn" title="Fn">crypto_ietf_chacha20_ctr</b>() functions behave the
same as
<a class="Xr" title="Xr" href="crypto_chacha20.html">crypto_chacha20</a> and
<a class="Xr" title="Xr" href="crypto_chacha20_ctr.html">crypto_chacha20_ctr</a>,
respectively, but use differently-sized nonce and counter values. The nonce
encompasses 12 bytes and the counter is correspondingly reduced to 4 bytes.
The short counter limits a single pair of key and nonce to 256 GiB of data. A
nonce of 12 bytes is <i class="Em" title="Em">just barely too short</i> to be
safely chosen at random; use a message counter instead. RFC 8439 also permits
linear feedback shift registers to generate nonces.
<h1 class="Sh" title="Sh" id="RETURN_VALUES"><a class="selflink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<b class="Fn" title="Fn">crypto_ietf_chacha20</b>() returns nothing.
<b class="Fn" title="Fn">crypto_ietf_chacha20_ctr</b>() functions return the
next <var class="Fa" title="Fa">ctr</var> to use with the same key and nonce
values; this is always <var class="Fa" title="Fa">text_size</var> divided by
64; plus one if there was a remainder.
<h1 class="Sh" title="Sh" id="SEE_ALSO"><a class="selflink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<a class="Xr" title="Xr" href="crypto_chacha20.html">crypto_chacha20(3monocypher)</a>,
<a class="Xr" title="Xr" href="crypto_lock.html">crypto_lock(3monocypher)</a>,
<a class="Xr" title="Xr" href="crypto_wipe.html">crypto_wipe(3monocypher)</a>,
<a class="Xr" title="Xr" href="intro.html">intro(3monocypher)</a>
<h1 class="Sh" title="Sh" id="STANDARDS"><a class="selflink" href="#STANDARDS">STANDARDS</a></h1>
These functions implement Chacha20 as described in RFC 8439.
<h1 class="Sh" title="Sh" id="HISTORY"><a class="selflink" href="#HISTORY">HISTORY</a></h1>
<b class="Fn" title="Fn">crypto_ietf_chacha20</b>() and
<b class="Fn" title="Fn">crypto_ietf_chacha20_ctr</b>() were added in
Monocypher 3.0.0.</div>
<table class="foot">
<tr>
<td class="foot-date">March 31, 2020</td>
<td class="foot-os">Linux 4.15.0-106-generic</td>
</tr>
</table>
</body>
</html>