Signed-off-by: Tianjia Zhang <[email protected]>
---
nettle.texinfo | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/nettle.texinfo b/nettle.texinfo
index 45b06720..a291dc7e 100644
--- a/nettle.texinfo
+++ b/nettle.texinfo
@@ -297,6 +297,9 @@ Written by @value{AUTHOR}.
The C implementation of the SM3 message digest is written by Tianjia
Zhang, and the code is based on the implementation by Jia Zhang.
+@item SM4
+The implementation of the SM4 cipher is written by Tianjia Zhang.
+
@item TWOFISH
The implementation of the TWOFISH cipher is written by Ruud de Rooij.
@@ -2277,6 +2280,42 @@ in any other way.
Analogous to @code{twofish_encrypt}
@end deftypefun
+@node SM4
+@subsection SM4
+@cindex SM4
+
+SM4 is a block cipher standard adopted by the government of the People's
+Republic of China, and it was issued by the State Cryptography Administration
+on March 21, 2012. The standard is GM/T 0002-2012 "SM4 block cipher algorithm".
+Nettle defines it in @file{<nettle/sm4.h>}.
+
+@deftp {Context struct} {struct sm4_ctx}
+@end deftp
+
+@defvr Constant SM4_BLOCK_SIZE
+The SM4 block-size, 16.
+@end defvr
+
+@defvr Constant SM4_KEY_SIZE
+Default SM4 key size, 16.
+@end defvr
+
+@deftypefun void sm4_set_key (struct sm4_ctx *@var{ctx}, size_t @var{length},
const uint8_t *@var{key})
+Initialize the cipher. The same function is used for both encryption and
+decryption.
+@end deftypefun
+
+@deftypefun void sm4_encrypt (struct sm4_ctx *@var{ctx}, size_t @var{length},
uint8_t *@var{dst}, const uint8_t *@var{src})
+Encryption function. @var{length} must be an integral multiple of the
+block size. If it is more than one block, the data is processed in ECB
+mode. @code{src} and @code{dst} may be equal, but they must not overlap
+in any other way.
+@end deftypefun
+
+@deftypefun void sm4_decrypt (struct sm4_ctx *@var{ctx}, size_t @var{length},
uint8_t *@var{dst}, const uint8_t *@var{src})
+Analogous to @code{sm4_encrypt}
+@end deftypefun
+
@node nettle_cipher abstraction
@subsection The @code{struct nettle_cipher} abstraction
@cindex nettle_cipher
--
2.32.0
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs