KCAPI_CIPHER_ENC_SM4(3) | Programming Interface | KCAPI_CIPHER_ENC_SM4(3) |
NAME¶
kcapi_cipher_enc_sm4_ctr - Convenience function for SM4 CTR encryption
SYNOPSIS¶
ssize_t kcapi_cipher_enc_sm4_ctr(const uint8_t * key, uint32_t keylen, const uint8_t * in, size_t inlen, const uint8_t * ctr, uint8_t * out, size_t outlen);
ARGUMENTS¶
key
keylen
in
inlen
ctr
out
outlen
DESCRIPTION¶
The convenience function performs an SM4 counter mode encryption operation using the provided key, the given input buffer and the given IV. The output is stored in the out buffer.
The input buffer can be of arbitrary length.
The output buffer must be at least as large as the input buffer.
The start counter can contain all zeros (not a NULL buffer!) and must be exactly 16 bytes in size.
The SM4 key is fixed 16 bytes long.
return number of bytes generated upon success; a negative errno-style error code if an error occurred
AUTHOR¶
Stephan Mueller <smueller@chronox.de>
COPYRIGHT¶
March 2023 | libkcapi Manual 1.4.0 |