[CRYPTO] api: Add crypto_inc and crypto_xor
With the addition of more stream ciphers we need to curb the proliferation of ad-hoc xor functions. This patch creates a generic pair of functions, crypto_inc and crypto_xor which does big-endian increment and exclusive or, respectively. For optimum performance, they both use u32 operations so alignment must be as that of u32 even though the arguments are of type u8 *. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@ -124,6 +124,10 @@ int crypto_enqueue_request(struct crypto_queue *queue,
|
||||
struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue);
|
||||
int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm);
|
||||
|
||||
/* These functions require the input/output to be aligned as u32. */
|
||||
void crypto_inc(u8 *a, unsigned int size);
|
||||
void crypto_xor(u8 *dst, const u8 *src, unsigned int size);
|
||||
|
||||
int blkcipher_walk_done(struct blkcipher_desc *desc,
|
||||
struct blkcipher_walk *walk, int err);
|
||||
int blkcipher_walk_virt(struct blkcipher_desc *desc,
|
||||
|
Reference in New Issue
Block a user