'\" t .\" Title: struct ahash_alg .\" Author: .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Programming Interface .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "STRUCT AHASH_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_ahash_alg \- asynchronous message digest definition .SH "SYNOPSIS" .sp .nf struct ahash_alg { int (* init) (struct ahash_request *req); int (* update) (struct ahash_request *req); int (* final) (struct ahash_request *req); int (* finup) (struct ahash_request *req); int (* digest) (struct ahash_request *req); int (* export) (struct ahash_request *req, void *out); int (* import) (struct ahash_request *req, const void *in); int (* setkey) (struct crypto_ahash *tfm, const u8 *key,unsigned int keylen); struct hash_alg_common halg; }; .fi .SH "MEMBERS" .PP init .RS 4 Initialize the transformation context\&. Intended only to initialize the state of the HASH transformation at the beginning\&. This shall fill in the internal structures used during the entire duration of the whole transformation\&. No data processing happens at this point\&. .RE .PP update .RS 4 Push a chunk of data into the driver for transformation\&. This function actually pushes blocks of data from upper layers into the driver, which then passes those to the hardware as seen fit\&. This function must not finalize the HASH transformation by calculating the final message digest as this only adds more data into the transformation\&. This function shall not modify the transformation context, as this function may be called in parallel with the same transformation object\&. Data processing can happen synchronously [SHASH] or asynchronously [AHASH] at this point\&. .RE .PP final .RS 4 Retrieve result from the driver\&. This function finalizes the transformation and retrieves the resulting hash from the driver and pushes it back to upper layers\&. No data processing happens at this point\&. .RE .PP finup .RS 4 Combination of \fIupdate\fR and \fIfinal\fR\&. This function is effectively a combination of \fIupdate\fR and \fIfinal\fR calls issued in sequence\&. As some hardware cannot do \fIupdate\fR and \fIfinal\fR separately, this callback was added to allow such hardware to be used at least by IPsec\&. Data processing can happen synchronously [SHASH] or asynchronously [AHASH] at this point\&. .RE .PP digest .RS 4 Combination of \fIinit\fR and \fIupdate\fR and \fIfinal\fR\&. This function effectively behaves as the entire chain of operations, \fIinit\fR, \fIupdate\fR and \fIfinal\fR issued in sequence\&. Just like \fIfinup\fR, this was added for hardware which cannot do even the \fIfinup\fR, but can only do the whole transformation in one run\&. Data processing can happen synchronously [SHASH] or asynchronously [AHASH] at this point\&. .RE .PP export .RS 4 Export partial state of the transformation\&. This function dumps the entire state of the ongoing transformation into a provided block of data so it can be \fIimport\fR \*(Aqed back later on\&. This is useful in case you want to save partial result of the transformation after processing certain amount of data and reload this partial result multiple times later on for multiple re\-use\&. No data processing happens at this point\&. .RE .PP import .RS 4 Import partial state of the transformation\&. This function loads the entire state of the ongoing transformation from a provided block of data so the transformation can continue from this point onward\&. No data processing happens at this point\&. .RE .PP setkey .RS 4 Set optional key used by the hashing algorithm\&. Intended to push optional key used by the hashing algorithm from upper layers into the driver\&. This function can store the key in the transformation context or can outright program it into the hardware\&. In the former case, one must be careful to program the key into the hardware at appropriate time and one must be careful that \&.\fBsetkey\fR can be called multiple times during the existence of the transformation object\&. Not all hashing algorithms do implement this function as it is only needed for keyed message digests\&. SHAx/MDx/CRCx do NOT implement this function\&. HMAC(MDx)/HMAC(SHAx)/CMAC(AES) do implement this function\&. This function must be called before any other of the \fIinit\fR, \fIupdate\fR, \fIfinal\fR, \fIfinup\fR, \fIdigest\fR is called\&. No data processing happens at this point\&. .RE .PP halg .RS 4 see struct hash_alg_common .RE .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