diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-20 04:26:06 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:17 -0500 |
commit | 7613636def82092a5c7b6322078a2af832410417 (patch) | |
tree | a05fec8d522e78d21b7b45f9ac330bcd1372e1af /include/crypto | |
parent | fcd06755936d2209b69650d2a7cc99cbcd3ccc67 (diff) |
[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>
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/algapi.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 88619f902c10..2cdb227fc39d 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -124,6 +124,10 @@ int crypto_enqueue_request(struct crypto_queue *queue, | |||
124 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); | 124 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); |
125 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); | 125 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); |
126 | 126 | ||
127 | /* These functions require the input/output to be aligned as u32. */ | ||
128 | void crypto_inc(u8 *a, unsigned int size); | ||
129 | void crypto_xor(u8 *dst, const u8 *src, unsigned int size); | ||
130 | |||
127 | int blkcipher_walk_done(struct blkcipher_desc *desc, | 131 | int blkcipher_walk_done(struct blkcipher_desc *desc, |
128 | struct blkcipher_walk *walk, int err); | 132 | struct blkcipher_walk *walk, int err); |
129 | int blkcipher_walk_virt(struct blkcipher_desc *desc, | 133 | int blkcipher_walk_virt(struct blkcipher_desc *desc, |