'\" t .\" Title: struct crypto_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 CRYPTO_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_crypto_alg \- definition of a cryptograpic cipher algorithm .SH "SYNOPSIS" .sp .nf struct crypto_alg { struct list_head cra_list; struct list_head cra_users; u32 cra_flags; unsigned int cra_blocksize; unsigned int cra_ctxsize; unsigned int cra_alignmask; int cra_priority; atomic_t cra_refcnt; char cra_name[CRYPTO_MAX_ALG_NAME]; char cra_driver_name[CRYPTO_MAX_ALG_NAME]; const struct crypto_type * cra_type; union cra_u; int (* cra_init) (struct crypto_tfm *tfm); void (* cra_exit) (struct crypto_tfm *tfm); void (* cra_destroy) (struct crypto_alg *alg); struct module * cra_module; }; .fi .SH "MEMBERS" .PP cra_list .RS 4 internally used .RE .PP cra_users .RS 4 internally used .RE .PP cra_flags .RS 4 Flags describing this transformation\&. See include/linux/crypto\&.h CRYPTO_ALG_* flags for the flags which go in here\&. Those are used for fine\-tuning the description of the transformation algorithm\&. .RE .PP cra_blocksize .RS 4 Minimum block size of this transformation\&. The size in bytes of the smallest possible unit which can be transformed with this algorithm\&. The users must respect this value\&. In case of HASH transformation, it is possible for a smaller block than \fIcra_blocksize\fR to be passed to the crypto API for transformation, in case of any other transformation type, an error will be returned upon any attempt to transform smaller than \fIcra_blocksize\fR chunks\&. .RE .PP cra_ctxsize .RS 4 Size of the operational context of the transformation\&. This value informs the kernel crypto API about the memory size needed to be allocated for the transformation context\&. .RE .PP cra_alignmask .RS 4 Alignment mask for the input and output data buffer\&. The data buffer containing the input data for the algorithm must be aligned to this alignment mask\&. The data buffer for the output data must be aligned to this alignment mask\&. Note that the Crypto API will do the re\-alignment in software, but only under special conditions and there is a performance hit\&. The re\-alignment happens at these occasions for different \fIcra_u\fR types: cipher \-\- For both input data and output data buffer; ahash \-\- For output hash destination buf; shash \-\- For output hash destination buf\&. This is needed on hardware which is flawed by design and cannot pick data from arbitrary addresses\&. .RE .PP cra_priority .RS 4 Priority of this transformation implementation\&. In case multiple transformations with same \fIcra_name\fR are available to the Crypto API, the kernel will use the one with highest \fIcra_priority\fR\&. .RE .PP cra_refcnt .RS 4 internally used .RE .PP cra_name[CRYPTO_MAX_ALG_NAME] .RS 4 Generic name (usable by multiple implementations) of the transformation algorithm\&. This is the name of the transformation itself\&. This field is used by the kernel when looking up the providers of particular transformation\&. .RE .PP cra_driver_name[CRYPTO_MAX_ALG_NAME] .RS 4 Unique name of the transformation provider\&. This is the name of the provider of the transformation\&. This can be any arbitrary value, but in the usual case, this contains the name of the chip or provider and the name of the transformation algorithm\&. .RE .PP cra_type .RS 4 Type of the cryptographic transformation\&. This is a pointer to struct crypto_type, which implements callbacks common for all transformation types\&. There are multiple options: crypto_blkcipher_type, crypto_ablkcipher_type, crypto_ahash_type, crypto_rng_type\&. This field might be empty\&. In that case, there are no common callbacks\&. This is the case for: cipher, compress, shash\&. .RE .PP cra_u .RS 4 Callbacks implementing the transformation\&. This is a union of multiple structures\&. Depending on the type of transformation selected by \fIcra_type\fR and \fIcra_flags\fR above, the associated structure must be filled with callbacks\&. This field might be empty\&. This is the case for ahash, shash\&. .RE .PP cra_init .RS 4 Initialize the cryptographic transformation object\&. This function is used to initialize the cryptographic transformation object\&. This function is called only once at the instantiation time, right after the transformation context was allocated\&. In case the cryptographic hardware has some special requirements which need to be handled by software, this function shall check for the precise requirement of the transformation and put any software fallbacks in place\&. .RE .PP cra_exit .RS 4 Deinitialize the cryptographic transformation object\&. This is a counterpart to \fIcra_init\fR, used to remove various changes set in \fIcra_init\fR\&. .RE .PP cra_destroy .RS 4 internally used .RE .PP cra_module .RS 4 Owner of this transformation implementation\&. Set to THIS_MODULE .RE .SH "DESCRIPTION" .PP The struct crypto_alg describes a generic Crypto API algorithm and is common for all of the transformations\&. Any variable not documented here shall not be used by a cipher implementation as it is internal to the Crypto API\&. .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