android_kernel_xiaomi_sm8350/crypto
Joy Latten 23e353c8a6 [CRYPTO] ctr: Add CTR (Counter) block cipher mode
This patch implements CTR mode for IPsec.
It is based off of RFC 3686.

Please note:
1. CTR turns a block cipher into a stream cipher.
Encryption is done in blocks, however the last block
may be a partial block.

A "counter block" is encrypted, creating a keystream
that is xor'ed with the plaintext. The counter portion
of the counter block is incremented after each block
of plaintext is encrypted.
Decryption is performed in same manner.

2. The CTR counterblock is composed of,
        nonce + IV + counter

The size of the counterblock is equivalent to the
blocksize of the cipher.
        sizeof(nonce) + sizeof(IV) + sizeof(counter) = blocksize

The CTR template requires the name of the cipher
algorithm, the sizeof the nonce, and the sizeof the iv.
        ctr(cipher,sizeof_nonce,sizeof_iv)

So for example,
        ctr(aes,4,8)
specifies the counterblock will be composed of 4 bytes
from a nonce, 8 bytes from the iv, and 4 bytes for counter
since aes has a blocksize of 16 bytes.

3. The counter portion of the counter block is stored
in big endian for conformance to rfc 3686.

Signed-off-by: Joy Latten <latten@austin.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2008-01-11 08:16:01 +11:00
..
async_tx async_tx: fix dma_wait_for_async_tx 2007-09-24 10:26:26 -07:00
ablkcipher.c [CRYPTO] ablkcipher: Remove queue pointer from common alg object 2007-10-10 16:55:41 -07:00
aead.c [CRYPTO] api: Add aead crypto type 2007-10-10 16:55:39 -07:00
aes_generic.c [CRYPTO] aes: Rename aes to aes-generic 2007-10-10 16:55:49 -07:00
algapi.c [CRYPTO] api: Fix potential race in crypto_remove_spawn 2007-11-23 19:32:09 +08:00
anubis.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
api.c crypto: convert "crypto" subdirectory to UTF-8 2007-10-19 23:06:17 +02:00
arc4.c
authenc.c [CRYPTO] authenc: Move initialisations up to shut up gcc 2007-11-23 19:32:09 +08:00
blkcipher.c [CRYPTO] blkcipher: Added blkcipher_walk_virt_block 2007-10-10 16:55:48 -07:00
blowfish.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
camellia.c
cast5.c
cast6.c
cbc.c
cipher.c [CRYPTO] api: Add missing headers for setkey_unaligned 2007-10-10 16:55:40 -07:00
compress.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
crc32c.c
cryptd.c [CRYPTO] ablkcipher: Remove queue pointer from common alg object 2007-10-10 16:55:41 -07:00
crypto_null.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
cryptomgr.c [CRYPTO] cryptomgr: Fix parsing of recursive algorithms 2007-10-10 16:55:45 -07:00
ctr.c [CRYPTO] ctr: Add CTR (Counter) block cipher mode 2008-01-11 08:16:01 +11:00
deflate.c
des_generic.c [CRYPTO] des: Rename des to des-generic 2007-10-10 16:55:49 -07:00
digest.c [SG] Update crypto/ to sg helpers 2007-10-22 19:40:16 +02:00
ecb.c
fcrypt.c crypto: convert "crypto" subdirectory to UTF-8 2007-10-19 23:06:17 +02:00
gf128mul.c [CRYPTO] xts: XTS blockcipher mode implementation without partial blocks 2007-10-10 16:55:45 -07:00
hash.c [CRYPTO] api: Add missing headers for setkey_unaligned 2007-10-10 16:55:40 -07:00
hmac.c [CRYPTO]: HMAC needs some more scatterlist fixups. 2007-10-26 00:37:12 -07:00
internal.h [CRYPTO] api: Kill crypto_km_types 2007-10-10 16:55:44 -07:00
Kconfig [CRYPTO] ctr: Add CTR (Counter) block cipher mode 2008-01-11 08:16:01 +11:00
khazad.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
lrw.c
Makefile [CRYPTO] ctr: Add CTR (Counter) block cipher mode 2008-01-11 08:16:01 +11:00
md4.c
md5.c
michael_mic.c
pcbc.c
proc.c
scatterwalk.c [SG] Update crypto/ to sg helpers 2007-10-22 19:40:16 +02:00
scatterwalk.h [SG] Update crypto/ to sg helpers 2007-10-22 19:40:16 +02:00
seed.c [CRYPTO] seed: New cipher algorithm 2007-10-10 16:55:38 -07:00
serpent.c
sha1_generic.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
sha256_generic.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
sha512.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
tcrypt.c [CRYPTO] ctr: Add CTR (Counter) block cipher mode 2008-01-11 08:16:01 +11:00
tcrypt.h [CRYPTO] ctr: Add CTR (Counter) block cipher mode 2008-01-11 08:16:01 +11:00
tea.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
tgr192.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
twofish_common.c
twofish.c
wp512.c cleanup asm/scatterlist.h includes 2007-11-02 08:47:06 +01:00
xcbc.c [SG] Update crypto/ to sg helpers 2007-10-22 19:40:16 +02:00
xor.c
xts.c [CRYPTO] xts: XTS blockcipher mode implementation without partial blocks 2007-10-10 16:55:45 -07:00