X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=doc%2Feblob.texi;h=256e6d1e0dcc787677730f2a64c3bb91d80908ae;hb=0fad171c0d79ad583c0faf5427e22d1d62a0a52d;hp=ff637e4fd0f0854715be7ae12c7323a0447fc105;hpb=e3bc095b1863c3f5e105742ae30156d18e9c297a;p=nncp.git diff --git a/doc/eblob.texi b/doc/eblob.texi index ff637e4..256e6d1 100644 --- a/doc/eblob.texi +++ b/doc/eblob.texi @@ -32,16 +32,16 @@ winner). Eblob is an @url{https://tools.ietf.org/html/rfc4506, XDR}-encoded structure: @verbatim -+-------+------------------+------------+ -| MAGIC | S | T | P | SALT | BLOB | MAC | -+-------+------------------+------------+ ++-------+------------------+------+ +| MAGIC | S | T | P | SALT | BLOB | ++-------+------------------+------+ @end verbatim @multitable @columnfractions 0.2 0.3 0.5 @headitem @tab XDR type @tab Value @item Magic number @tab 8-byte, fixed length opaque data @tab - @verb{|N N C P B 0x00 0x00 0x02|} + @verb{|N N C P B 0x00 0x00 0x03|} @item S, T, P @tab unsigned integer @tab Space cost, time cost and parallel jobs number @@ -50,15 +50,19 @@ Eblob is an @url{https://tools.ietf.org/html/rfc4506, XDR}-encoded structure: Randomly generated salt @item Blob @tab variable length opaque data @tab - Encrypted data itself -@item MAC @tab - 32 bytes, fixed length opaque data @tab - BLAKE2b-256 MAC of encrypted blob + Authenticated and Encrypted data itself @end multitable -Blob's encryption is done using @url{https://cr.yp.to/chacha.html, -ChaCha20} algorithm. Data is splitted on 128 KiB blocks. Each block is -encrypted with increasing nonce counter. @code{balloon(BLAKE2b-256, S, -T, P, salt, password)} gives the main key, that is fed to -@url{https://blake2.net/, BLAKE2Xb} XOF Actual encryption key for -ChaCha20 and authentication key for MAC are derived from that XOF. +@enumerate +@item generate the main key using @code{balloon(BLAKE2b-256, S, T, P, +salt, password)} +@item initialize @url{https://blake2.net/, BLAKE2Xb} XOF with generated +main key and 32-byte output length +@item feed @verb{|N N C P B 0x00 0x00 0x03|} magic number to XOF +@item read 32-bytes of blob AEAD encryption key +@item encrypt and authenticate blob using + @url{https://cr.yp.to/chacha.html, ChaCha20}-@url{https://en.wikipedia.org/wiki/Poly1305, Poly1305}. + Blob is divided on 128 KiB blocks. Each block is encrypted with + increasing nonce counter. Eblob packet itself, with empty blob + field, is fed as an additional authenticated data +@end enumerate