scatterlist: Add const to sg_set_buf/sg_init_one pointer argument
Herbert Xu
maintainerPATCH 1/2 scatterlist: Add const to sg_set_buf/sg_init_one pointer argument
Hi:
I'm adding these two patches to cryptodev-2.6.
[PATCH] scatterlist: Add const to sg_set_buf/sg_init_one pointer argument
This patch adds a const modifier to the buf argument of sg_set_buf and sg_init_one. This lets people call it with pointers that are const.
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--include/linux/scatterlist.h +2 -2
@@ -5,7 +5,7 @@#include <linux/mm.h> #include <linux/string.h> -static inline void sg_set_buf (struct scatterlist *sg,void *buf, +static inline void sg_set_buf (struct scatterlist *sg,const void *buf,unsigned int buflen) { sg->page =virt_to_page (buf);
@@ -13,7 +13,7 @@ static inline void sg_set_buf(struct sca sg->length = buflen; } -static inline void sg_init_one (struct scatterlist *sg,void *buf, +static inline void sg_init_one (struct scatterlist *sg,const void *buf,unsigned int buflen) {memset (sg,0 ,sizeof (*sg));
Herbert Xu
maintainerPATCH 2/2 api: Mark parts of cipher interface as deprecated
Hi:
[CRYPTO] api: Mark parts of cipher interface as deprecated
Mark the parts of the cipher interface that have been replaced by block ciphers as deprecated. Thanks to Andrew Morton for suggesting doing this before removing them completely.
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--crypto/cipher.c +6 -6
@@ -280,7 +280,7 @@ static int ecb_encrypt(struct crypto_tfm desc.tfm = tfm; desc.crfn = cipher->cia_encrypt; - desc.prfn = cipher->cia_encrypt_ecb ?: ecb_process; + desc.prfn = cipher->__cia_encrypt_ecb ?: ecb_process;return crypt (&desc, dst, src, nbytes); }
@@ -295,7 +295,7 @@ static int ecb_decrypt(struct crypto_tfm desc.tfm = tfm; desc.crfn = cipher->cia_decrypt; - desc.prfn = cipher->cia_decrypt_ecb ?: ecb_process; + desc.prfn = cipher->__cia_decrypt_ecb ?: ecb_process;return crypt (&desc, dst, src, nbytes); }
@@ -310,7 +310,7 @@ static int cbc_encrypt(struct crypto_tfm desc.tfm = tfm; desc.crfn = cipher->cia_encrypt; - desc.prfn = cipher->cia_encrypt_cbc ?: cbc_process_encrypt; + desc.prfn = cipher->__cia_encrypt_cbc ?: cbc_process_encrypt; desc.info = tfm->crt_cipher.cit_iv;return crypt (&desc, dst, src, nbytes);
@@ -326,7 +326,7 @@ static int cbc_encrypt_iv(struct crypto_ desc.tfm = tfm; desc.crfn = cipher->cia_encrypt; - desc.prfn = cipher->cia_encrypt_cbc ?: cbc_process_encrypt; + desc.prfn = cipher->__cia_encrypt_cbc ?: cbc_process_encrypt; desc.info = iv;return crypt_iv_unaligned (&desc, dst, src, nbytes);
@@ -342,7 +342,7 @@ static int cbc_decrypt(struct crypto_tfm desc.tfm = tfm; desc.crfn = cipher->cia_decrypt; - desc.prfn = cipher->cia_decrypt_cbc ?: cbc_process_decrypt; + desc.prfn = cipher->__cia_decrypt_cbc ?: cbc_process_decrypt; desc.info = tfm->crt_cipher.cit_iv;return crypt (&desc, dst, src, nbytes);
@@ -358,7 +358,7 @@ static int cbc_decrypt_iv(struct crypto_ desc.tfm = tfm; desc.crfn = cipher->cia_decrypt; - desc.prfn = cipher->cia_decrypt_cbc ?: cbc_process_decrypt; + desc.prfn = cipher->__cia_decrypt_cbc ?: cbc_process_decrypt; desc.info = iv;return crypt_iv_unaligned (&desc, dst, src, nbytes);
include/linux/crypto.h +68 -20
160 lines not on this page · raw message
Herbert Xu
maintainerRe: [2/2] [CRYPTO] api: Mark parts of cipher interface as deprecated
Quoted 8 lines · herbert
[CRYPTO] api: Mark parts of cipher interface as deprecated
Mark the parts of the cipher interface that have been replaced by block ciphers as deprecated. Thanks to Andrew Morton for suggesting doing this before removing them completely.
Signed-off-by Herbert Xu <[email protected]>
I've replaced it with the following patch which should actually work with the geode aes patch.
Cheers,
Signature · 6 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
bf2ed06b30860493907cbdfd4da785f53d35acdfcrypto/cipher.c +28 -6
@@ -23,6 +23,28 @@ #include <asm/scatterlist.h>#include "internal.h" #include "scatterwalk.h" +struct cipher_alg_compat { +unsigned int cia_min_keysize; +unsigned int cia_max_keysize; +int (*cia_setkey)(struct crypto_tfm *tfm,const u8 *key, +unsigned int keylen); +void (*cia_encrypt)(struct crypto_tfm *tfm,u8 *dst,const u8 *src); +void (*cia_decrypt)(struct crypto_tfm *tfm,u8 *dst,const u8 *src); + +unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc, +u8 *dst,const u8 *src, +unsigned int nbytes); +unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc, +u8 *dst,const u8 *src, +unsigned int nbytes); +unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc, +u8 *dst,const u8 *src, +unsigned int nbytes); +unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc, +u8 *dst,const u8 *src, +unsigned int nbytes); +}; +static inline void xor_64 (u8 *a,const u8 *b) { ((u32 *)a)[0 ] ^= ((u32 *)b)[0 ];
@@ -276,7 +298,7 @@ static int ecb_encrypt(struct crypto_tfm struct scatterlist *src, unsigned int nbytes) {struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_encrypt;
@@ -291,7 +313,7 @@ static int ecb_decrypt(struct crypto_tfm unsigned int nbytes) {struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_decrypt;
@@ -306,7 +328,7 @@ static int cbc_encrypt(struct crypto_tfm unsigned int nbytes) {struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_encrypt;
@@ -322,7 +344,7 @@ static int cbc_encrypt_iv(struct crypto_ unsigned int nbytes, u8 *iv) { struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_encrypt;
@@ -338,7 +360,7 @@ static int cbc_decrypt(struct crypto_tfm unsigned int nbytes) {struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_decrypt;
@@ -354,7 +376,7 @@ static int cbc_decrypt_iv(struct crypto_ unsigned int nbytes, u8 *iv) { struct cipher_desc desc; -struct cipher_alg *cipher = &tfm->__crt_alg->cra_cipher; +struct cipher_alg_compat *cipher = (void *)&tfm->__crt_alg->cra_cipher; desc.tfm = tfm; desc.crfn = cipher->cia_decrypt;
include/linux/crypto.h +36 -12
126 lines not on this page · raw message