'\" t .\" Title: struct cipher_alg .\" Author: .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Programming Interface .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "STRUCT CIPHER_ALG" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Programming Interface" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" struct_cipher_alg \- single\-block symmetric ciphers definition .SH "SYNOPSIS" .sp .nf struct cipher_alg { unsigned int cia_min_keysize; unsigned int cia_max_keysize; int (* cia_setkey) (struct crypto_tfm *tfm, const u8 *key,unsigned int keylen); void (* cia_encrypt) (struct crypto_tfm *tfm, u8 *dst, const u8 *src); void (* cia_decrypt) (struct crypto_tfm *tfm, u8 *dst, const u8 *src); }; .fi .SH "MEMBERS" .PP cia_min_keysize .RS 4 Minimum key size supported by the transformation\&. This is the smallest key length supported by this transformation algorithm\&. This must be set to one of the pre\-defined values as this is not hardware specific\&. Possible values for this field can be found via git grep \(lq_MIN_KEY_SIZE\(rq include/crypto/ .RE .PP cia_max_keysize .RS 4 Maximum key size supported by the transformation\&. This is the largest key length supported by this transformation algorithm\&. This must be set to one of the pre\-defined values as this is not hardware specific\&. Possible values for this field can be found via git grep \(lq_MAX_KEY_SIZE\(rq include/crypto/ .RE .PP cia_setkey .RS 4 Set key for the transformation\&. This function is used to either program a supplied key into the hardware or store the key in the transformation context for programming it later\&. Note that this function does modify the transformation context\&. This function can be called multiple times during the existence of the transformation object, so one must make sure the key is properly reprogrammed into the hardware\&. This function is also responsible for checking the key length for validity\&. .RE .PP cia_encrypt .RS 4 Encrypt a single block\&. This function is used to encrypt a single block of data, which must be \fIcra_blocksize\fR big\&. This always operates on a full \fIcra_blocksize\fR and it is not possible to encrypt a block of smaller size\&. The supplied buffers must therefore also be at least of \fIcra_blocksize\fR size\&. Both the input and output buffers are always aligned to \fIcra_alignmask\fR\&. In case either of the input or output buffer supplied by user of the crypto API is not aligned to \fIcra_alignmask\fR, the crypto API will re\-align the buffers\&. The re\-alignment means that a new buffer will be allocated, the data will be copied into the new buffer, then the processing will happen on the new buffer, then the data will be copied back into the original buffer and finally the new buffer will be freed\&. In case a software fallback was put in place in the \fIcra_init\fR call, this function might need to use the fallback if the algorithm doesn\*(Aqt support all of the key sizes\&. In case the key was stored in transformation context, the key might need to be re\-programmed into the hardware in this function\&. This function shall not modify the transformation context, as this function may be called in parallel with the same transformation object\&. .RE .PP cia_decrypt .RS 4 Decrypt a single block\&. This is a reverse counterpart to \fIcia_encrypt\fR, and the conditions are exactly the same\&. .RE .SH "DESCRIPTION" .PP All fields are mandatory and must be filled\&. .SH "AUTHORS" .PP \fBStephan Mueller\fR <\&smueller@chronox.de\&> .RS 4 Author. .RE .PP \fBMarek Vasut\fR <\&marek@denx.de\&> .RS 4 Author. .RE .SH "COPYRIGHT" .br