summaryrefslogtreecommitdiff
path: root/nettle.texinfo
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2019-07-11 21:43:12 +0300
committerNiels Möller <nisse@lysator.liu.se>2019-09-15 10:09:16 +0200
commit9826eed6b23296eac9e496232ba1b74c1d205694 (patch)
treea98cc76853465cf6abd9f49843985c076b8d6156 /nettle.texinfo
parent1d7bce28f88b493854810ce21468a996b4d857f1 (diff)
downloadnettle-9826eed6b23296eac9e496232ba1b74c1d205694.tar.gz
Add support for GOSTHASH94CP: GOST R 34.11-94 hash with CryptoPro S-box
Hash gosthash94 implements GOST R 34.11-94 standard using S-Box defined in the standard 'for testing purposes only'. RFC 4357 defines S-Box (CryptoPro one) for GOST R 34.11-94 hash function that is widely used in applications. Add separate hash function algorithm (gosthash94cp) implementing GOST R 34.11-94 hashing using that S-Box. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'nettle.texinfo')
-rw-r--r--nettle.texinfo41
1 files changed, 38 insertions, 3 deletions
diff --git a/nettle.texinfo b/nettle.texinfo
index 5e29018e..9a3ca04e 100644
--- a/nettle.texinfo
+++ b/nettle.texinfo
@@ -1039,12 +1039,17 @@ This function also resets the context in the same way as
@end deftypefun
-@subsubsection @acronym{GOSTHASH94}
+@subsubsection @acronym{GOSTHASH94 and GOSTHASH94CP}
The GOST94 or GOST R 34.11-94 hash algorithm is a Soviet-era algorithm
used in Russian government standards (see @cite{RFC 4357}).
-It outputs message digests of 256 bits, or 32 octets.
-Nettle defines GOSTHASH94 in @file{<nettle/gosthash94.h>}.
+It outputs message digests of 256 bits, or 32 octets. The standard itself
+does not fix the S-box used by the hash algorith, so there are two popular
+variants (the testing S-box from the standard itself and the S-box defined
+by CryptoPro company, see RFC 4357). Nettle provides support for the former
+S-box in the form of GOSTHASH94 hash algorithm and for the latter in the
+form of GOSTHASH94CP hash algorithm.
+Nettle defines GOSTHASH94 and GOSTHASH94CP in @file{<nettle/gosthash94.h>}.
@deftp {Context struct} {struct gosthash94_ctx}
@end deftp
@@ -1075,6 +1080,35 @@ This function also resets the context in the same way as
@code{gosthash94_init}.
@end deftypefun
+@deftp {Context struct} {struct gosthash94cp_ctx}
+@end deftp
+
+@defvr Constant GOSTHASH94CP_DIGEST_SIZE
+The size of a GOSTHASH94CP digest, i.e. 32.
+@end defvr
+
+@defvr Constant GOSTHASH94CP_BLOCK_SIZE
+The internal block size of GOSTHASH94CP, i.e., 32.
+@end defvr
+
+@deftypefun void gosthash94cp_init (struct gosthash94cp_ctx *@var{ctx})
+Initialize the GOSTHASH94CP state.
+@end deftypefun
+
+@deftypefun void gosthash94cp_update (struct gosthash94cp_ctx *@var{ctx}, size_t @var{length}, const uint8_t *@var{data})
+Hash some more data.
+@end deftypefun
+
+@deftypefun void gosthash94cp_digest (struct gosthash94cp_ctx *@var{ctx}, size_t @var{length}, uint8_t *@var{digest})
+Performs final processing and extracts the message digest, writing it
+to @var{digest}. @var{length} may be smaller than
+@code{GOSTHASH94CP_DIGEST_SIZE}, in which case only the first @var{length}
+octets of the digest are written.
+
+This function also resets the context in the same way as
+@code{gosthash94cp_init}.
+@end deftypefun
+
@node nettle_hash abstraction,, Legacy hash functions, Hash functions
@comment node-name, next, previous, up
@subsection The @code{struct nettle_hash} abstraction
@@ -1104,6 +1138,7 @@ The last three attributes are function pointers, of types
@deftypevrx {Constant Struct} {struct nettle_hash} nettle_sha512
@deftypevrx {Constant Struct} {struct nettle_hash} nettle_sha3_256
@deftypevrx {Constant Struct} {struct nettle_hash} nettle_gosthash94
+@deftypevrx {Constant Struct} {struct nettle_hash} nettle_gosthash94cp
These are all the hash functions that Nettle implements.
@end deftypevr