1KCAPI_CIPHER_ENC_SM4(3)      Programming Interface     KCAPI_CIPHER_ENC_SM4(3)
2
3
4

NAME

6       kcapi_cipher_enc_sm4_ctr - Convenience function for SM4 CTR encryption
7

SYNOPSIS

9       ssize_t kcapi_cipher_enc_sm4_ctr(const uint8_t * key, uint32_t keylen,
10                                        const uint8_t * in, size_t inlen,
11                                        const uint8_t * ctr, uint8_t * out,
12                                        size_t outlen);
13

ARGUMENTS

15       key
16           [in] key buffer
17
18       keylen
19           [in] length of key buffer
20
21       in
22           [in] plaintext data buffer
23
24       inlen
25           [in] length of in buffer
26
27       ctr
28           [in] start counter value to be used for cipher operation
29
30       out
31           [out] ciphertext data buffer
32
33       outlen
34           [in] length of out buffer
35

DESCRIPTION

37       The convenience function performs an SM4 counter mode encryption
38       operation using the provided key, the given input buffer and the given
39       IV. The output is stored in the out buffer.
40
41       The input buffer can be of arbitrary length.
42
43       The output buffer must be at least as large as the input buffer.
44
45       The start counter can contain all zeros (not a NULL buffer!) and must
46       be exactly 16 bytes in size.
47
48       The SM4 key is fixed 16 bytes long.
49
50       return number of bytes generated upon success; a negative errno-style
51       error code if an error occurred
52

AUTHOR

54       Stephan Mueller <smueller@chronox.de>
55           Author.
56
58libkcapi Manual 1.4.0            January 2023          KCAPI_CIPHER_ENC_SM4(3)
Impressum