diff options
author | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
---|---|---|
committer | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
commit | 871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch) | |
tree | 8718f573808810c2a1e8cb8fb6ac469093ca2784 /ANDROID_3.4.5/include/crypto | |
parent | 9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff) | |
download | FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2 FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip |
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized.
Changes are basically to make it look like kernel structure.
Diffstat (limited to 'ANDROID_3.4.5/include/crypto')
31 files changed, 0 insertions, 2711 deletions
diff --git a/ANDROID_3.4.5/include/crypto/aead.h b/ANDROID_3.4.5/include/crypto/aead.h deleted file mode 100644 index 0edf949f..00000000 --- a/ANDROID_3.4.5/include/crypto/aead.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * AEAD: Authenticated Encryption with Associated Data - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_AEAD_H -#define _CRYPTO_AEAD_H - -#include <linux/crypto.h> -#include <linux/kernel.h> -#include <linux/slab.h> - -/** - * struct aead_givcrypt_request - AEAD request with IV generation - * @seq: Sequence number for IV generation - * @giv: Space for generated IV - * @areq: The AEAD request itself - */ -struct aead_givcrypt_request { - u64 seq; - u8 *giv; - - struct aead_request areq; -}; - -static inline struct crypto_aead *aead_givcrypt_reqtfm( - struct aead_givcrypt_request *req) -{ - return crypto_aead_reqtfm(&req->areq); -} - -static inline int crypto_aead_givencrypt(struct aead_givcrypt_request *req) -{ - struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); - return crt->givencrypt(req); -}; - -static inline int crypto_aead_givdecrypt(struct aead_givcrypt_request *req) -{ - struct aead_tfm *crt = crypto_aead_crt(aead_givcrypt_reqtfm(req)); - return crt->givdecrypt(req); -}; - -static inline void aead_givcrypt_set_tfm(struct aead_givcrypt_request *req, - struct crypto_aead *tfm) -{ - req->areq.base.tfm = crypto_aead_tfm(tfm); -} - -static inline struct aead_givcrypt_request *aead_givcrypt_alloc( - struct crypto_aead *tfm, gfp_t gfp) -{ - struct aead_givcrypt_request *req; - - req = kmalloc(sizeof(struct aead_givcrypt_request) + - crypto_aead_reqsize(tfm), gfp); - - if (likely(req)) - aead_givcrypt_set_tfm(req, tfm); - - return req; -} - -static inline void aead_givcrypt_free(struct aead_givcrypt_request *req) -{ - kfree(req); -} - -static inline void aead_givcrypt_set_callback( - struct aead_givcrypt_request *req, u32 flags, - crypto_completion_t complete, void *data) -{ - aead_request_set_callback(&req->areq, flags, complete, data); -} - -static inline void aead_givcrypt_set_crypt(struct aead_givcrypt_request *req, - struct scatterlist *src, - struct scatterlist *dst, - unsigned int nbytes, void *iv) -{ - aead_request_set_crypt(&req->areq, src, dst, nbytes, iv); -} - -static inline void aead_givcrypt_set_assoc(struct aead_givcrypt_request *req, - struct scatterlist *assoc, - unsigned int assoclen) -{ - aead_request_set_assoc(&req->areq, assoc, assoclen); -} - -static inline void aead_givcrypt_set_giv(struct aead_givcrypt_request *req, - u8 *giv, u64 seq) -{ - req->giv = giv; - req->seq = seq; -} - -#endif /* _CRYPTO_AEAD_H */ diff --git a/ANDROID_3.4.5/include/crypto/aes.h b/ANDROID_3.4.5/include/crypto/aes.h deleted file mode 100644 index 7524ba3b..00000000 --- a/ANDROID_3.4.5/include/crypto/aes.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Common values for AES algorithms - */ - -#ifndef _CRYPTO_AES_H -#define _CRYPTO_AES_H - -#include <linux/types.h> -#include <linux/crypto.h> - -#define AES_MIN_KEY_SIZE 16 -#define AES_MAX_KEY_SIZE 32 -#define AES_KEYSIZE_128 16 -#define AES_KEYSIZE_192 24 -#define AES_KEYSIZE_256 32 -#define AES_BLOCK_SIZE 16 -#define AES_MAX_KEYLENGTH (15 * 16) -#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32)) - -/* - * Please ensure that the first two fields are 16-byte aligned - * relative to the start of the structure, i.e., don't move them! - */ -struct crypto_aes_ctx { - u32 key_enc[AES_MAX_KEYLENGTH_U32]; - u32 key_dec[AES_MAX_KEYLENGTH_U32]; - u32 key_length; -}; - -extern const u32 crypto_ft_tab[4][256]; -extern const u32 crypto_fl_tab[4][256]; -extern const u32 crypto_it_tab[4][256]; -extern const u32 crypto_il_tab[4][256]; - -int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, - unsigned int key_len); -int crypto_aes_expand_key(struct crypto_aes_ctx *ctx, const u8 *in_key, - unsigned int key_len); -#endif diff --git a/ANDROID_3.4.5/include/crypto/algapi.h b/ANDROID_3.4.5/include/crypto/algapi.h deleted file mode 100644 index 418d270e..00000000 --- a/ANDROID_3.4.5/include/crypto/algapi.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Cryptographic API for algorithms (i.e., low-level API). - * - * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ -#ifndef _CRYPTO_ALGAPI_H -#define _CRYPTO_ALGAPI_H - -#include <linux/crypto.h> -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/skbuff.h> - -struct module; -struct rtattr; -struct seq_file; - -struct crypto_type { - unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); - unsigned int (*extsize)(struct crypto_alg *alg); - int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); - int (*init_tfm)(struct crypto_tfm *tfm); - void (*show)(struct seq_file *m, struct crypto_alg *alg); - int (*report)(struct sk_buff *skb, struct crypto_alg *alg); - struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask); - - unsigned int type; - unsigned int maskclear; - unsigned int maskset; - unsigned int tfmsize; -}; - -struct crypto_instance { - struct crypto_alg alg; - - struct crypto_template *tmpl; - struct hlist_node list; - - void *__ctx[] CRYPTO_MINALIGN_ATTR; -}; - -struct crypto_template { - struct list_head list; - struct hlist_head instances; - struct module *module; - - struct crypto_instance *(*alloc)(struct rtattr **tb); - void (*free)(struct crypto_instance *inst); - int (*create)(struct crypto_template *tmpl, struct rtattr **tb); - - char name[CRYPTO_MAX_ALG_NAME]; -}; - -struct crypto_spawn { - struct list_head list; - struct crypto_alg *alg; - struct crypto_instance *inst; - const struct crypto_type *frontend; - u32 mask; -}; - -struct crypto_queue { - struct list_head list; - struct list_head *backlog; - - unsigned int qlen; - unsigned int max_qlen; -}; - -struct scatter_walk { - struct scatterlist *sg; - unsigned int offset; -}; - -struct blkcipher_walk { - union { - struct { - struct page *page; - unsigned long offset; - } phys; - - struct { - u8 *page; - u8 *addr; - } virt; - } src, dst; - - struct scatter_walk in; - unsigned int nbytes; - - struct scatter_walk out; - unsigned int total; - - void *page; - u8 *buffer; - u8 *iv; - - int flags; - unsigned int blocksize; -}; - -struct ablkcipher_walk { - struct { - struct page *page; - unsigned int offset; - } src, dst; - - struct scatter_walk in; - unsigned int nbytes; - struct scatter_walk out; - unsigned int total; - struct list_head buffers; - u8 *iv_buffer; - u8 *iv; - int flags; - unsigned int blocksize; -}; - -extern const struct crypto_type crypto_ablkcipher_type; -extern const struct crypto_type crypto_aead_type; -extern const struct crypto_type crypto_blkcipher_type; - -void crypto_mod_put(struct crypto_alg *alg); - -int crypto_register_template(struct crypto_template *tmpl); -void crypto_unregister_template(struct crypto_template *tmpl); -struct crypto_template *crypto_lookup_template(const char *name); - -int crypto_register_instance(struct crypto_template *tmpl, - struct crypto_instance *inst); -int crypto_unregister_instance(struct crypto_alg *alg); - -int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, - struct crypto_instance *inst, u32 mask); -int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg, - struct crypto_instance *inst, - const struct crypto_type *frontend); - -void crypto_drop_spawn(struct crypto_spawn *spawn); -struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, - u32 mask); -void *crypto_spawn_tfm2(struct crypto_spawn *spawn); - -static inline void crypto_set_spawn(struct crypto_spawn *spawn, - struct crypto_instance *inst) -{ - spawn->inst = inst; -} - -struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); -int crypto_check_attr_type(struct rtattr **tb, u32 type); -const char *crypto_attr_alg_name(struct rtattr *rta); -struct crypto_alg *crypto_attr_alg2(struct rtattr *rta, - const struct crypto_type *frontend, - u32 type, u32 mask); - -static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta, - u32 type, u32 mask) -{ - return crypto_attr_alg2(rta, NULL, type, mask); -} - -int crypto_attr_u32(struct rtattr *rta, u32 *num); -void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg, - unsigned int head); -struct crypto_instance *crypto_alloc_instance(const char *name, - struct crypto_alg *alg); - -void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); -int crypto_enqueue_request(struct crypto_queue *queue, - struct crypto_async_request *request); -void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset); -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, - struct blkcipher_walk *walk); -int blkcipher_walk_phys(struct blkcipher_desc *desc, - struct blkcipher_walk *walk); -int blkcipher_walk_virt_block(struct blkcipher_desc *desc, - struct blkcipher_walk *walk, - unsigned int blocksize); - -int ablkcipher_walk_done(struct ablkcipher_request *req, - struct ablkcipher_walk *walk, int err); -int ablkcipher_walk_phys(struct ablkcipher_request *req, - struct ablkcipher_walk *walk); -void __ablkcipher_walk_complete(struct ablkcipher_walk *walk); - -static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) -{ - return PTR_ALIGN(crypto_tfm_ctx(tfm), - crypto_tfm_alg_alignmask(tfm) + 1); -} - -static inline struct crypto_instance *crypto_tfm_alg_instance( - struct crypto_tfm *tfm) -{ - return container_of(tfm->__crt_alg, struct crypto_instance, alg); -} - -static inline void *crypto_instance_ctx(struct crypto_instance *inst) -{ - return inst->__ctx; -} - -static inline struct ablkcipher_alg *crypto_ablkcipher_alg( - struct crypto_ablkcipher *tfm) -{ - return &crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_ablkcipher; -} - -static inline void *crypto_ablkcipher_ctx(struct crypto_ablkcipher *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -static inline void *crypto_ablkcipher_ctx_aligned(struct crypto_ablkcipher *tfm) -{ - return crypto_tfm_ctx_aligned(&tfm->base); -} - -static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm) -{ - return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead; -} - -static inline void *crypto_aead_ctx(struct crypto_aead *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -static inline struct crypto_instance *crypto_aead_alg_instance( - struct crypto_aead *aead) -{ - return crypto_tfm_alg_instance(&aead->base); -} - -static inline struct crypto_blkcipher *crypto_spawn_blkcipher( - struct crypto_spawn *spawn) -{ - u32 type = CRYPTO_ALG_TYPE_BLKCIPHER; - u32 mask = CRYPTO_ALG_TYPE_MASK; - - return __crypto_blkcipher_cast(crypto_spawn_tfm(spawn, type, mask)); -} - -static inline void *crypto_blkcipher_ctx(struct crypto_blkcipher *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -static inline void *crypto_blkcipher_ctx_aligned(struct crypto_blkcipher *tfm) -{ - return crypto_tfm_ctx_aligned(&tfm->base); -} - -static inline struct crypto_cipher *crypto_spawn_cipher( - struct crypto_spawn *spawn) -{ - u32 type = CRYPTO_ALG_TYPE_CIPHER; - u32 mask = CRYPTO_ALG_TYPE_MASK; - - return __crypto_cipher_cast(crypto_spawn_tfm(spawn, type, mask)); -} - -static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm) -{ - return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher; -} - -static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn) -{ - u32 type = CRYPTO_ALG_TYPE_HASH; - u32 mask = CRYPTO_ALG_TYPE_HASH_MASK; - - return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask)); -} - -static inline void *crypto_hash_ctx(struct crypto_hash *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) -{ - return crypto_tfm_ctx_aligned(&tfm->base); -} - -static inline void blkcipher_walk_init(struct blkcipher_walk *walk, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) -{ - walk->in.sg = src; - walk->out.sg = dst; - walk->total = nbytes; -} - -static inline void ablkcipher_walk_init(struct ablkcipher_walk *walk, - struct scatterlist *dst, - struct scatterlist *src, - unsigned int nbytes) -{ - walk->in.sg = src; - walk->out.sg = dst; - walk->total = nbytes; - INIT_LIST_HEAD(&walk->buffers); -} - -static inline void ablkcipher_walk_complete(struct ablkcipher_walk *walk) -{ - if (unlikely(!list_empty(&walk->buffers))) - __ablkcipher_walk_complete(walk); -} - -static inline struct crypto_async_request *crypto_get_backlog( - struct crypto_queue *queue) -{ - return queue->backlog == &queue->list ? NULL : - container_of(queue->backlog, struct crypto_async_request, list); -} - -static inline int ablkcipher_enqueue_request(struct crypto_queue *queue, - struct ablkcipher_request *request) -{ - return crypto_enqueue_request(queue, &request->base); -} - -static inline struct ablkcipher_request *ablkcipher_dequeue_request( - struct crypto_queue *queue) -{ - return ablkcipher_request_cast(crypto_dequeue_request(queue)); -} - -static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) -{ - return req->__ctx; -} - -static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue, - struct crypto_ablkcipher *tfm) -{ - return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); -} - -static inline void *aead_request_ctx(struct aead_request *req) -{ - return req->__ctx; -} - -static inline void aead_request_complete(struct aead_request *req, int err) -{ - req->base.complete(&req->base, err); -} - -static inline u32 aead_request_flags(struct aead_request *req) -{ - return req->base.flags; -} - -static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, - u32 type, u32 mask) -{ - return crypto_attr_alg(tb[1], type, mask); -} - -/* - * Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms. - * Otherwise returns zero. - */ -static inline int crypto_requires_sync(u32 type, u32 mask) -{ - return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC; -} - -#endif /* _CRYPTO_ALGAPI_H */ - diff --git a/ANDROID_3.4.5/include/crypto/authenc.h b/ANDROID_3.4.5/include/crypto/authenc.h deleted file mode 100644 index e47b0449..00000000 --- a/ANDROID_3.4.5/include/crypto/authenc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Authenc: Simple AEAD wrapper for IPsec - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ -#ifndef _CRYPTO_AUTHENC_H -#define _CRYPTO_AUTHENC_H - -#include <linux/types.h> - -enum { - CRYPTO_AUTHENC_KEYA_UNSPEC, - CRYPTO_AUTHENC_KEYA_PARAM, -}; - -struct crypto_authenc_key_param { - __be32 enckeylen; -}; - -#endif /* _CRYPTO_AUTHENC_H */ - diff --git a/ANDROID_3.4.5/include/crypto/b128ops.h b/ANDROID_3.4.5/include/crypto/b128ops.h deleted file mode 100644 index 0b8e6bc5..00000000 --- a/ANDROID_3.4.5/include/crypto/b128ops.h +++ /dev/null @@ -1,80 +0,0 @@ -/* b128ops.h - common 128-bit block operations - * - * Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. - * Copyright (c) 2006, Rik Snel <rsnel@cube.dyndns.org> - * - * Based on Dr Brian Gladman's (GPL'd) work published at - * http://fp.gladman.plus.com/cryptography_technology/index.htm - * See the original copyright notice below. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - */ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 13/06/2006 -*/ - -#ifndef _CRYPTO_B128OPS_H -#define _CRYPTO_B128OPS_H - -#include <linux/types.h> - -typedef struct { - u64 a, b; -} u128; - -typedef struct { - __be64 a, b; -} be128; - -typedef struct { - __le64 b, a; -} le128; - -static inline void u128_xor(u128 *r, const u128 *p, const u128 *q) -{ - r->a = p->a ^ q->a; - r->b = p->b ^ q->b; -} - -static inline void be128_xor(be128 *r, const be128 *p, const be128 *q) -{ - u128_xor((u128 *)r, (u128 *)p, (u128 *)q); -} - -static inline void le128_xor(le128 *r, const le128 *p, const le128 *q) -{ - u128_xor((u128 *)r, (u128 *)p, (u128 *)q); -} - -#endif /* _CRYPTO_B128OPS_H */ diff --git a/ANDROID_3.4.5/include/crypto/blowfish.h b/ANDROID_3.4.5/include/crypto/blowfish.h deleted file mode 100644 index 1450d4a2..00000000 --- a/ANDROID_3.4.5/include/crypto/blowfish.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Common values for blowfish algorithms - */ - -#ifndef _CRYPTO_BLOWFISH_H -#define _CRYPTO_BLOWFISH_H - -#include <linux/types.h> -#include <linux/crypto.h> - -#define BF_BLOCK_SIZE 8 -#define BF_MIN_KEY_SIZE 4 -#define BF_MAX_KEY_SIZE 56 - -struct bf_ctx { - u32 p[18]; - u32 s[1024]; -}; - -int blowfish_setkey(struct crypto_tfm *tfm, const u8 *key, - unsigned int key_len); - -#endif diff --git a/ANDROID_3.4.5/include/crypto/compress.h b/ANDROID_3.4.5/include/crypto/compress.h deleted file mode 100644 index 86163ef2..00000000 --- a/ANDROID_3.4.5/include/crypto/compress.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Compress: Compression algorithms under the cryptographic API. - * - * Copyright 2008 Sony Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. - * If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _CRYPTO_COMPRESS_H -#define _CRYPTO_COMPRESS_H - -#include <linux/crypto.h> - - -struct comp_request { - const void *next_in; /* next input byte */ - void *next_out; /* next output byte */ - unsigned int avail_in; /* bytes available at next_in */ - unsigned int avail_out; /* bytes available at next_out */ -}; - -enum zlib_comp_params { - ZLIB_COMP_LEVEL = 1, /* e.g. Z_DEFAULT_COMPRESSION */ - ZLIB_COMP_METHOD, /* e.g. Z_DEFLATED */ - ZLIB_COMP_WINDOWBITS, /* e.g. MAX_WBITS */ - ZLIB_COMP_MEMLEVEL, /* e.g. DEF_MEM_LEVEL */ - ZLIB_COMP_STRATEGY, /* e.g. Z_DEFAULT_STRATEGY */ - __ZLIB_COMP_MAX, -}; - -#define ZLIB_COMP_MAX (__ZLIB_COMP_MAX - 1) - - -enum zlib_decomp_params { - ZLIB_DECOMP_WINDOWBITS = 1, /* e.g. DEF_WBITS */ - __ZLIB_DECOMP_MAX, -}; - -#define ZLIB_DECOMP_MAX (__ZLIB_DECOMP_MAX - 1) - - -struct crypto_pcomp { - struct crypto_tfm base; -}; - -struct pcomp_alg { - int (*compress_setup)(struct crypto_pcomp *tfm, void *params, - unsigned int len); - int (*compress_init)(struct crypto_pcomp *tfm); - int (*compress_update)(struct crypto_pcomp *tfm, - struct comp_request *req); - int (*compress_final)(struct crypto_pcomp *tfm, - struct comp_request *req); - int (*decompress_setup)(struct crypto_pcomp *tfm, void *params, - unsigned int len); - int (*decompress_init)(struct crypto_pcomp *tfm); - int (*decompress_update)(struct crypto_pcomp *tfm, - struct comp_request *req); - int (*decompress_final)(struct crypto_pcomp *tfm, - struct comp_request *req); - - struct crypto_alg base; -}; - -extern struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type, - u32 mask); - -static inline struct crypto_tfm *crypto_pcomp_tfm(struct crypto_pcomp *tfm) -{ - return &tfm->base; -} - -static inline void crypto_free_pcomp(struct crypto_pcomp *tfm) -{ - crypto_destroy_tfm(tfm, crypto_pcomp_tfm(tfm)); -} - -static inline struct pcomp_alg *__crypto_pcomp_alg(struct crypto_alg *alg) -{ - return container_of(alg, struct pcomp_alg, base); -} - -static inline struct pcomp_alg *crypto_pcomp_alg(struct crypto_pcomp *tfm) -{ - return __crypto_pcomp_alg(crypto_pcomp_tfm(tfm)->__crt_alg); -} - -static inline int crypto_compress_setup(struct crypto_pcomp *tfm, - void *params, unsigned int len) -{ - return crypto_pcomp_alg(tfm)->compress_setup(tfm, params, len); -} - -static inline int crypto_compress_init(struct crypto_pcomp *tfm) -{ - return crypto_pcomp_alg(tfm)->compress_init(tfm); -} - -static inline int crypto_compress_update(struct crypto_pcomp *tfm, - struct comp_request *req) -{ - return crypto_pcomp_alg(tfm)->compress_update(tfm, req); -} - -static inline int crypto_compress_final(struct crypto_pcomp *tfm, - struct comp_request *req) -{ - return crypto_pcomp_alg(tfm)->compress_final(tfm, req); -} - -static inline int crypto_decompress_setup(struct crypto_pcomp *tfm, - void *params, unsigned int len) -{ - return crypto_pcomp_alg(tfm)->decompress_setup(tfm, params, len); -} - -static inline int crypto_decompress_init(struct crypto_pcomp *tfm) -{ - return crypto_pcomp_alg(tfm)->decompress_init(tfm); -} - -static inline int crypto_decompress_update(struct crypto_pcomp *tfm, - struct comp_request *req) -{ - return crypto_pcomp_alg(tfm)->decompress_update(tfm, req); -} - -static inline int crypto_decompress_final(struct crypto_pcomp *tfm, - struct comp_request *req) -{ - return crypto_pcomp_alg(tfm)->decompress_final(tfm, req); -} - -#endif /* _CRYPTO_COMPRESS_H */ diff --git a/ANDROID_3.4.5/include/crypto/cryptd.h b/ANDROID_3.4.5/include/crypto/cryptd.h deleted file mode 100644 index ba98918b..00000000 --- a/ANDROID_3.4.5/include/crypto/cryptd.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Software async crypto daemon - * - * Added AEAD support to cryptd. - * Authors: Tadeusz Struk (tadeusz.struk@intel.com) - * Adrian Hoban <adrian.hoban@intel.com> - * Gabriele Paoloni <gabriele.paoloni@intel.com> - * Aidan O'Mahony (aidan.o.mahony@intel.com) - * Copyright (c) 2010, Intel Corporation. - */ - -#ifndef _CRYPTO_CRYPT_H -#define _CRYPTO_CRYPT_H - -#include <linux/crypto.h> -#include <linux/kernel.h> -#include <crypto/hash.h> - -struct cryptd_ablkcipher { - struct crypto_ablkcipher base; -}; - -static inline struct cryptd_ablkcipher *__cryptd_ablkcipher_cast( - struct crypto_ablkcipher *tfm) -{ - return (struct cryptd_ablkcipher *)tfm; -} - -/* alg_name should be algorithm to be cryptd-ed */ -struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name, - u32 type, u32 mask); -struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm); -void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm); - -struct cryptd_ahash { - struct crypto_ahash base; -}; - -static inline struct cryptd_ahash *__cryptd_ahash_cast( - struct crypto_ahash *tfm) -{ - return (struct cryptd_ahash *)tfm; -} - -/* alg_name should be algorithm to be cryptd-ed */ -struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, - u32 type, u32 mask); -struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); -struct shash_desc *cryptd_shash_desc(struct ahash_request *req); -void cryptd_free_ahash(struct cryptd_ahash *tfm); - -struct cryptd_aead { - struct crypto_aead base; -}; - -static inline struct cryptd_aead *__cryptd_aead_cast( - struct crypto_aead *tfm) -{ - return (struct cryptd_aead *)tfm; -} - -struct cryptd_aead *cryptd_alloc_aead(const char *alg_name, - u32 type, u32 mask); - -struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm); - -void cryptd_free_aead(struct cryptd_aead *tfm); - -#endif diff --git a/ANDROID_3.4.5/include/crypto/crypto_wq.h b/ANDROID_3.4.5/include/crypto/crypto_wq.h deleted file mode 100644 index a7d252da..00000000 --- a/ANDROID_3.4.5/include/crypto/crypto_wq.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CRYPTO_WQ_H -#define CRYPTO_WQ_H - -#include <linux/workqueue.h> - -extern struct workqueue_struct *kcrypto_wq; -#endif diff --git a/ANDROID_3.4.5/include/crypto/ctr.h b/ANDROID_3.4.5/include/crypto/ctr.h deleted file mode 100644 index 4180fc08..00000000 --- a/ANDROID_3.4.5/include/crypto/ctr.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * CTR: Counter mode - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_CTR_H -#define _CRYPTO_CTR_H - -#define CTR_RFC3686_NONCE_SIZE 4 -#define CTR_RFC3686_IV_SIZE 8 -#define CTR_RFC3686_BLOCK_SIZE 16 - -#endif /* _CRYPTO_CTR_H */ diff --git a/ANDROID_3.4.5/include/crypto/des.h b/ANDROID_3.4.5/include/crypto/des.h deleted file mode 100644 index 2971c630..00000000 --- a/ANDROID_3.4.5/include/crypto/des.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * DES & Triple DES EDE Cipher Algorithms. - */ - -#ifndef __CRYPTO_DES_H -#define __CRYPTO_DES_H - -#define DES_KEY_SIZE 8 -#define DES_EXPKEY_WORDS 32 -#define DES_BLOCK_SIZE 8 - -#define DES3_EDE_KEY_SIZE (3 * DES_KEY_SIZE) -#define DES3_EDE_EXPKEY_WORDS (3 * DES_EXPKEY_WORDS) -#define DES3_EDE_BLOCK_SIZE DES_BLOCK_SIZE - - -extern unsigned long des_ekey(u32 *pe, const u8 *k); - -#endif /* __CRYPTO_DES_H */ diff --git a/ANDROID_3.4.5/include/crypto/gf128mul.h b/ANDROID_3.4.5/include/crypto/gf128mul.h deleted file mode 100644 index da2530e3..00000000 --- a/ANDROID_3.4.5/include/crypto/gf128mul.h +++ /dev/null @@ -1,200 +0,0 @@ -/* gf128mul.h - GF(2^128) multiplication functions - * - * Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. - * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org> - * - * Based on Dr Brian Gladman's (GPL'd) work published at - * http://fp.gladman.plus.com/cryptography_technology/index.htm - * See the original copyright notice below. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - */ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 31/01/2006 - - An implementation of field multiplication in Galois Field GF(128) -*/ - -#ifndef _CRYPTO_GF128MUL_H -#define _CRYPTO_GF128MUL_H - -#include <crypto/b128ops.h> -#include <linux/slab.h> - -/* Comment by Rik: - * - * For some background on GF(2^128) see for example: - * http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf - * - * The elements of GF(2^128) := GF(2)[X]/(X^128-X^7-X^2-X^1-1) can - * be mapped to computer memory in a variety of ways. Let's examine - * three common cases. - * - * Take a look at the 16 binary octets below in memory order. The msb's - * are left and the lsb's are right. char b[16] is an array and b[0] is - * the first octet. - * - * 80000000 00000000 00000000 00000000 .... 00000000 00000000 00000000 - * b[0] b[1] b[2] b[3] b[13] b[14] b[15] - * - * Every bit is a coefficient of some power of X. We can store the bits - * in every byte in little-endian order and the bytes themselves also in - * little endian order. I will call this lle (little-little-endian). - * The above buffer represents the polynomial 1, and X^7+X^2+X^1+1 looks - * like 11100001 00000000 .... 00000000 = { 0xE1, 0x00, }. - * This format was originally implemented in gf128mul and is used - * in GCM (Galois/Counter mode) and in ABL (Arbitrary Block Length). - * - * Another convention says: store the bits in bigendian order and the - * bytes also. This is bbe (big-big-endian). Now the buffer above - * represents X^127. X^7+X^2+X^1+1 looks like 00000000 .... 10000111, - * b[15] = 0x87 and the rest is 0. LRW uses this convention and bbe - * is partly implemented. - * - * Both of the above formats are easy to implement on big-endian - * machines. - * - * EME (which is patent encumbered) uses the ble format (bits are stored - * in big endian order and the bytes in little endian). The above buffer - * represents X^7 in this case and the primitive polynomial is b[0] = 0x87. - * - * The common machine word-size is smaller than 128 bits, so to make - * an efficient implementation we must split into machine word sizes. - * This file uses one 32bit for the moment. Machine endianness comes into - * play. The lle format in relation to machine endianness is discussed - * below by the original author of gf128mul Dr Brian Gladman. - * - * Let's look at the bbe and ble format on a little endian machine. - * - * bbe on a little endian machine u32 x[4]: - * - * MS x[0] LS MS x[1] LS - * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - * 103..96 111.104 119.112 127.120 71...64 79...72 87...80 95...88 - * - * MS x[2] LS MS x[3] LS - * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - * 39...32 47...40 55...48 63...56 07...00 15...08 23...16 31...24 - * - * ble on a little endian machine - * - * MS x[0] LS MS x[1] LS - * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - * 31...24 23...16 15...08 07...00 63...56 55...48 47...40 39...32 - * - * MS x[2] LS MS x[3] LS - * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - * 95...88 87...80 79...72 71...64 127.120 199.112 111.104 103..96 - * - * Multiplications in GF(2^128) are mostly bit-shifts, so you see why - * ble (and lbe also) are easier to implement on a little-endian - * machine than on a big-endian machine. The converse holds for bbe - * and lle. - * - * Note: to have good alignment, it seems to me that it is sufficient - * to keep elements of GF(2^128) in type u64[2]. On 32-bit wordsize - * machines this will automatically aligned to wordsize and on a 64-bit - * machine also. - */ -/* Multiply a GF128 field element by x. Field elements are held in arrays - of bytes in which field bits 8n..8n + 7 are held in byte[n], with lower - indexed bits placed in the more numerically significant bit positions - within bytes. - - On little endian machines the bit indexes translate into the bit - positions within four 32-bit words in the following way - - MS x[0] LS MS x[1] LS - ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - 24...31 16...23 08...15 00...07 56...63 48...55 40...47 32...39 - - MS x[2] LS MS x[3] LS - ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - 88...95 80...87 72...79 64...71 120.127 112.119 104.111 96..103 - - On big endian machines the bit indexes translate into the bit - positions within four 32-bit words in the following way - - MS x[0] LS MS x[1] LS - ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - 00...07 08...15 16...23 24...31 32...39 40...47 48...55 56...63 - - MS x[2] LS MS x[3] LS - ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls - 64...71 72...79 80...87 88...95 96..103 104.111 112.119 120.127 -*/ - -/* A slow generic version of gf_mul, implemented for lle and bbe - * It multiplies a and b and puts the result in a */ -void gf128mul_lle(be128 *a, const be128 *b); - -void gf128mul_bbe(be128 *a, const be128 *b); - -/* multiply by x in ble format, needed by XTS */ -void gf128mul_x_ble(be128 *a, const be128 *b); - -/* 4k table optimization */ - -struct gf128mul_4k { - be128 t[256]; -}; - -struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g); -struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g); -void gf128mul_4k_lle(be128 *a, struct gf128mul_4k *t); -void gf128mul_4k_bbe(be128 *a, struct gf128mul_4k *t); - -static inline void gf128mul_free_4k(struct gf128mul_4k *t) -{ - kfree(t); -} - - -/* 64k table optimization, implemented for lle and bbe */ - -struct gf128mul_64k { - struct gf128mul_4k *t[16]; -}; - -/* first initialize with the constant factor with which you - * want to multiply and then call gf128_64k_lle with the other - * factor in the first argument, the table in the second and a - * scratch register in the third. Afterwards *a = *r. */ -struct gf128mul_64k *gf128mul_init_64k_lle(const be128 *g); -struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g); -void gf128mul_free_64k(struct gf128mul_64k *t); -void gf128mul_64k_lle(be128 *a, struct gf128mul_64k *t); -void gf128mul_64k_bbe(be128 *a, struct gf128mul_64k *t); - -#endif /* _CRYPTO_GF128MUL_H */ diff --git a/ANDROID_3.4.5/include/crypto/hash.h b/ANDROID_3.4.5/include/crypto/hash.h deleted file mode 100644 index 26cb1eb1..00000000 --- a/ANDROID_3.4.5/include/crypto/hash.h +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Hash: Hash algorithms under the crypto API - * - * Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_HASH_H -#define _CRYPTO_HASH_H - -#include <linux/crypto.h> - -struct crypto_ahash; - -struct hash_alg_common { - unsigned int digestsize; - unsigned int statesize; - - struct crypto_alg base; -}; - -struct ahash_request { - struct crypto_async_request base; - - unsigned int nbytes; - struct scatterlist *src; - u8 *result; - - /* This field may only be used by the ahash API code. */ - void *priv; - - void *__ctx[] CRYPTO_MINALIGN_ATTR; -}; - -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; -}; - -struct shash_desc { - struct crypto_shash *tfm; - u32 flags; - - void *__ctx[] CRYPTO_MINALIGN_ATTR; -}; - -struct shash_alg { - int (*init)(struct shash_desc *desc); - int (*update)(struct shash_desc *desc, const u8 *data, - unsigned int len); - int (*final)(struct shash_desc *desc, u8 *out); - int (*finup)(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out); - int (*digest)(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out); - int (*export)(struct shash_desc *desc, void *out); - int (*import)(struct shash_desc *desc, const void *in); - int (*setkey)(struct crypto_shash *tfm, const u8 *key, - unsigned int keylen); - - unsigned int descsize; - - /* These fields must match hash_alg_common. */ - unsigned int digestsize - __attribute__ ((aligned(__alignof__(struct hash_alg_common)))); - unsigned int statesize; - - struct crypto_alg base; -}; - -struct crypto_ahash { - 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); - - unsigned int reqsize; - struct crypto_tfm base; -}; - -struct crypto_shash { - unsigned int descsize; - struct crypto_tfm base; -}; - -static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) -{ - return container_of(tfm, struct crypto_ahash, base); -} - -struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type, - u32 mask); - -static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) -{ - return &tfm->base; -} - -static inline void crypto_free_ahash(struct crypto_ahash *tfm) -{ - crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm)); -} - -static inline unsigned int crypto_ahash_alignmask( - struct crypto_ahash *tfm) -{ - return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm)); -} - -static inline struct hash_alg_common *__crypto_hash_alg_common( - struct crypto_alg *alg) -{ - return container_of(alg, struct hash_alg_common, base); -} - -static inline struct hash_alg_common *crypto_hash_alg_common( - struct crypto_ahash *tfm) -{ - return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg); -} - -static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) -{ - return crypto_hash_alg_common(tfm)->digestsize; -} - -static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm) -{ - return crypto_hash_alg_common(tfm)->statesize; -} - -static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm) -{ - return crypto_tfm_get_flags(crypto_ahash_tfm(tfm)); -} - -static inline void crypto_ahash_set_flags(struct crypto_ahash *tfm, u32 flags) -{ - crypto_tfm_set_flags(crypto_ahash_tfm(tfm), flags); -} - -static inline void crypto_ahash_clear_flags(struct crypto_ahash *tfm, u32 flags) -{ - crypto_tfm_clear_flags(crypto_ahash_tfm(tfm), flags); -} - -static inline struct crypto_ahash *crypto_ahash_reqtfm( - struct ahash_request *req) -{ - return __crypto_ahash_cast(req->base.tfm); -} - -static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) -{ - return tfm->reqsize; -} - -static inline void *ahash_request_ctx(struct ahash_request *req) -{ - return req->__ctx; -} - -int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, - unsigned int keylen); -int crypto_ahash_finup(struct ahash_request *req); -int crypto_ahash_final(struct ahash_request *req); -int crypto_ahash_digest(struct ahash_request *req); - -static inline int crypto_ahash_export(struct ahash_request *req, void *out) -{ - return crypto_ahash_reqtfm(req)->export(req, out); -} - -static inline int crypto_ahash_import(struct ahash_request *req, const void *in) -{ - return crypto_ahash_reqtfm(req)->import(req, in); -} - -static inline int crypto_ahash_init(struct ahash_request *req) -{ - return crypto_ahash_reqtfm(req)->init(req); -} - -static inline int crypto_ahash_update(struct ahash_request *req) -{ - return crypto_ahash_reqtfm(req)->update(req); -} - -static inline void ahash_request_set_tfm(struct ahash_request *req, - struct crypto_ahash *tfm) -{ - req->base.tfm = crypto_ahash_tfm(tfm); -} - -static inline struct ahash_request *ahash_request_alloc( - struct crypto_ahash *tfm, gfp_t gfp) -{ - struct ahash_request *req; - - req = kmalloc(sizeof(struct ahash_request) + - crypto_ahash_reqsize(tfm), gfp); - - if (likely(req)) - ahash_request_set_tfm(req, tfm); - - return req; -} - -static inline void ahash_request_free(struct ahash_request *req) -{ - kzfree(req); -} - -static inline struct ahash_request *ahash_request_cast( - struct crypto_async_request *req) -{ - return container_of(req, struct ahash_request, base); -} - -static inline void ahash_request_set_callback(struct ahash_request *req, - u32 flags, - crypto_completion_t complete, - void *data) -{ - req->base.complete = complete; - req->base.data = data; - req->base.flags = flags; -} - -static inline void ahash_request_set_crypt(struct ahash_request *req, - struct scatterlist *src, u8 *result, - unsigned int nbytes) -{ - req->src = src; - req->nbytes = nbytes; - req->result = result; -} - -struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, - u32 mask); - -static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm) -{ - return &tfm->base; -} - -static inline void crypto_free_shash(struct crypto_shash *tfm) -{ - crypto_destroy_tfm(tfm, crypto_shash_tfm(tfm)); -} - -static inline unsigned int crypto_shash_alignmask( - struct crypto_shash *tfm) -{ - return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm)); -} - -static inline unsigned int crypto_shash_blocksize(struct crypto_shash *tfm) -{ - return crypto_tfm_alg_blocksize(crypto_shash_tfm(tfm)); -} - -static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg) -{ - return container_of(alg, struct shash_alg, base); -} - -static inline struct shash_alg *crypto_shash_alg(struct crypto_shash *tfm) -{ - return __crypto_shash_alg(crypto_shash_tfm(tfm)->__crt_alg); -} - -static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm) -{ - return crypto_shash_alg(tfm)->digestsize; -} - -static inline unsigned int crypto_shash_statesize(struct crypto_shash *tfm) -{ - return crypto_shash_alg(tfm)->statesize; -} - -static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm) -{ - return crypto_tfm_get_flags(crypto_shash_tfm(tfm)); -} - -static inline void crypto_shash_set_flags(struct crypto_shash *tfm, u32 flags) -{ - crypto_tfm_set_flags(crypto_shash_tfm(tfm), flags); -} - -static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags) -{ - crypto_tfm_clear_flags(crypto_shash_tfm(tfm), flags); -} - -static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) -{ - return tfm->descsize; -} - -static inline void *shash_desc_ctx(struct shash_desc *desc) -{ - return desc->__ctx; -} - -int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, - unsigned int keylen); -int crypto_shash_digest(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out); - -static inline int crypto_shash_export(struct shash_desc *desc, void *out) -{ - return crypto_shash_alg(desc->tfm)->export(desc, out); -} - -static inline int crypto_shash_import(struct shash_desc *desc, const void *in) -{ - return crypto_shash_alg(desc->tfm)->import(desc, in); -} - -static inline int crypto_shash_init(struct shash_desc *desc) -{ - return crypto_shash_alg(desc->tfm)->init(desc); -} - -int crypto_shash_update(struct shash_desc *desc, const u8 *data, - unsigned int len); -int crypto_shash_final(struct shash_desc *desc, u8 *out); -int crypto_shash_finup(struct shash_desc *desc, const u8 *data, - unsigned int len, u8 *out); - -#endif /* _CRYPTO_HASH_H */ diff --git a/ANDROID_3.4.5/include/crypto/if_alg.h b/ANDROID_3.4.5/include/crypto/if_alg.h deleted file mode 100644 index d61c1117..00000000 --- a/ANDROID_3.4.5/include/crypto/if_alg.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * if_alg: User-space algorithm interface - * - * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_IF_ALG_H -#define _CRYPTO_IF_ALG_H - -#include <linux/compiler.h> -#include <linux/completion.h> -#include <linux/if_alg.h> -#include <linux/scatterlist.h> -#include <linux/types.h> -#include <net/sock.h> - -#define ALG_MAX_PAGES 16 - -struct crypto_async_request; - -struct alg_sock { - /* struct sock must be the first member of struct alg_sock */ - struct sock sk; - - struct sock *parent; - - const struct af_alg_type *type; - void *private; -}; - -struct af_alg_completion { - struct completion completion; - int err; -}; - -struct af_alg_control { - struct af_alg_iv *iv; - int op; -}; - -struct af_alg_type { - void *(*bind)(const char *name, u32 type, u32 mask); - void (*release)(void *private); - int (*setkey)(void *private, const u8 *key, unsigned int keylen); - int (*accept)(void *private, struct sock *sk); - - struct proto_ops *ops; - struct module *owner; - char name[14]; -}; - -struct af_alg_sgl { - struct scatterlist sg[ALG_MAX_PAGES]; - struct page *pages[ALG_MAX_PAGES]; -}; - -int af_alg_register_type(const struct af_alg_type *type); -int af_alg_unregister_type(const struct af_alg_type *type); - -int af_alg_release(struct socket *sock); -int af_alg_accept(struct sock *sk, struct socket *newsock); - -int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, - int write); -void af_alg_free_sg(struct af_alg_sgl *sgl); - -int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con); - -int af_alg_wait_for_completion(int err, struct af_alg_completion *completion); -void af_alg_complete(struct crypto_async_request *req, int err); - -static inline struct alg_sock *alg_sk(struct sock *sk) -{ - return (struct alg_sock *)sk; -} - -static inline void af_alg_release_parent(struct sock *sk) -{ - sock_put(alg_sk(sk)->parent); -} - -static inline void af_alg_init_completion(struct af_alg_completion *completion) -{ - init_completion(&completion->completion); -} - -#endif /* _CRYPTO_IF_ALG_H */ diff --git a/ANDROID_3.4.5/include/crypto/internal/aead.h b/ANDROID_3.4.5/include/crypto/internal/aead.h deleted file mode 100644 index 2eba3402..00000000 --- a/ANDROID_3.4.5/include/crypto/internal/aead.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * AEAD: Authenticated Encryption with Associated Data - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_INTERNAL_AEAD_H -#define _CRYPTO_INTERNAL_AEAD_H - -#include <crypto/aead.h> -#include <crypto/algapi.h> -#include <linux/types.h> - -struct rtattr; - -struct crypto_aead_spawn { - struct crypto_spawn base; -}; - -extern const struct crypto_type crypto_nivaead_type; - -static inline void crypto_set_aead_spawn( - struct crypto_aead_spawn *spawn, struct crypto_instance *inst) -{ - crypto_set_spawn(&spawn->base, inst); -} - -struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask); - -int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, - u32 type, u32 mask); - -static inline void crypto_drop_aead(struct crypto_aead_spawn *spawn) -{ - crypto_drop_spawn(&spawn->base); -} - -static inline struct crypto_alg *crypto_aead_spawn_alg( - struct crypto_aead_spawn *spawn) -{ - return spawn->base.alg; -} - -static inline struct crypto_aead *crypto_spawn_aead( - struct crypto_aead_spawn *spawn) -{ - return __crypto_aead_cast( - crypto_spawn_tfm(&spawn->base, CRYPTO_ALG_TYPE_AEAD, - CRYPTO_ALG_TYPE_MASK)); -} - -struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl, - struct rtattr **tb, u32 type, - u32 mask); -void aead_geniv_free(struct crypto_instance *inst); -int aead_geniv_init(struct crypto_tfm *tfm); -void aead_geniv_exit(struct crypto_tfm *tfm); - -static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv) -{ - return crypto_aead_crt(geniv)->base; -} - -static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req) -{ - return aead_request_ctx(&req->areq); -} - -static inline void aead_givcrypt_complete(struct aead_givcrypt_request *req, - int err) -{ - aead_request_complete(&req->areq, err); -} - -#endif /* _CRYPTO_INTERNAL_AEAD_H */ - diff --git a/ANDROID_3.4.5/include/crypto/internal/compress.h b/ANDROID_3.4.5/include/crypto/internal/compress.h deleted file mode 100644 index 178a888d..00000000 --- a/ANDROID_3.4.5/include/crypto/internal/compress.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Compress: Compression algorithms under the cryptographic API. - * - * Copyright 2008 Sony Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. - * If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _CRYPTO_INTERNAL_COMPRESS_H -#define _CRYPTO_INTERNAL_COMPRESS_H - -#include <crypto/compress.h> - -extern int crypto_register_pcomp(struct pcomp_alg *alg); -extern int crypto_unregister_pcomp(struct pcomp_alg *alg); - -#endif /* _CRYPTO_INTERNAL_COMPRESS_H */ diff --git a/ANDROID_3.4.5/include/crypto/internal/hash.h b/ANDROID_3.4.5/include/crypto/internal/hash.h deleted file mode 100644 index 5bfad8c8..00000000 --- a/ANDROID_3.4.5/include/crypto/internal/hash.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Hash algorithms. - * - * Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_INTERNAL_HASH_H -#define _CRYPTO_INTERNAL_HASH_H - -#include <crypto/algapi.h> -#include <crypto/hash.h> - -struct ahash_request; -struct scatterlist; - -struct crypto_hash_walk { - char *data; - - unsigned int offset; - unsigned int alignmask; - - struct page *pg; - unsigned int entrylen; - - unsigned int total; - struct scatterlist *sg; - - unsigned int flags; -}; - -struct ahash_instance { - struct ahash_alg alg; -}; - -struct shash_instance { - struct shash_alg alg; -}; - -struct crypto_ahash_spawn { - struct crypto_spawn base; -}; - -struct crypto_shash_spawn { - struct crypto_spawn base; -}; - -extern const struct crypto_type crypto_ahash_type; - -int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); -int crypto_hash_walk_first(struct ahash_request *req, - struct crypto_hash_walk *walk); -int crypto_hash_walk_first_compat(struct hash_desc *hdesc, - struct crypto_hash_walk *walk, - struct scatterlist *sg, unsigned int len); - -static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk) -{ - return !(walk->entrylen | walk->total); -} - -int crypto_register_ahash(struct ahash_alg *alg); -int crypto_unregister_ahash(struct ahash_alg *alg); -int ahash_register_instance(struct crypto_template *tmpl, - struct ahash_instance *inst); -void ahash_free_instance(struct crypto_instance *inst); - -int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn, - struct hash_alg_common *alg, - struct crypto_instance *inst); - -static inline void crypto_drop_ahash(struct crypto_ahash_spawn *spawn) -{ - crypto_drop_spawn(&spawn->base); -} - -struct hash_alg_common *ahash_attr_alg(struct rtattr *rta, u32 type, u32 mask); - -int crypto_register_shash(struct shash_alg *alg); -int crypto_unregister_shash(struct shash_alg *alg); -int shash_register_instance(struct crypto_template *tmpl, - struct shash_instance *inst); -void shash_free_instance(struct crypto_instance *inst); - -int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn, - struct shash_alg *alg, - struct crypto_instance *inst); - -static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn) -{ - crypto_drop_spawn(&spawn->base); -} - -struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask); - -int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc); -int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc); -int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); - -int crypto_init_shash_ops_async(struct crypto_tfm *tfm); - -static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) -{ - return crypto_tfm_ctx(crypto_ahash_tfm(tfm)); -} - -static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg) -{ - return container_of(__crypto_hash_alg_common(alg), struct ahash_alg, - halg); -} - -static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm, - unsigned int reqsize) -{ - tfm->reqsize = reqsize; -} - -static inline struct crypto_instance *ahash_crypto_instance( - struct ahash_instance *inst) -{ - return container_of(&inst->alg.halg.base, struct crypto_instance, alg); -} - -static inline struct ahash_instance *ahash_instance( - struct crypto_instance *inst) -{ - return container_of(&inst->alg, struct ahash_instance, alg.halg.base); -} - -static inline void *ahash_instance_ctx(struct ahash_instance *inst) -{ - return crypto_instance_ctx(ahash_crypto_instance(inst)); -} - -static inline unsigned int ahash_instance_headroom(void) -{ - return sizeof(struct ahash_alg) - sizeof(struct crypto_alg); -} - -static inline struct ahash_instance *ahash_alloc_instance( - const char *name, struct crypto_alg *alg) -{ - return crypto_alloc_instance2(name, alg, ahash_instance_headroom()); -} - -static inline struct crypto_ahash *crypto_spawn_ahash( - struct crypto_ahash_spawn *spawn) -{ - return crypto_spawn_tfm2(&spawn->base); -} - -static inline int ahash_enqueue_request(struct crypto_queue *queue, - struct ahash_request *request) -{ - return crypto_enqueue_request(queue, &request->base); -} - -static inline struct ahash_request *ahash_dequeue_request( - struct crypto_queue *queue) -{ - return ahash_request_cast(crypto_dequeue_request(queue)); -} - -static inline int ahash_tfm_in_queue(struct crypto_queue *queue, - struct crypto_ahash *tfm) -{ - return crypto_tfm_in_queue(queue, crypto_ahash_tfm(tfm)); -} - -static inline void *crypto_shash_ctx(struct crypto_shash *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -static inline struct crypto_instance *shash_crypto_instance( - struct shash_instance *inst) -{ - return container_of(&inst->alg.base, struct crypto_instance, alg); -} - -static inline struct shash_instance *shash_instance( - struct crypto_instance *inst) -{ - return container_of(__crypto_shash_alg(&inst->alg), - struct shash_instance, alg); -} - -static inline void *shash_instance_ctx(struct shash_instance *inst) -{ - return crypto_instance_ctx(shash_crypto_instance(inst)); -} - -static inline struct shash_instance *shash_alloc_instance( - const char *name, struct crypto_alg *alg) -{ - return crypto_alloc_instance2(name, alg, - sizeof(struct shash_alg) - sizeof(*alg)); -} - -static inline struct crypto_shash *crypto_spawn_shash( - struct crypto_shash_spawn *spawn) -{ - return crypto_spawn_tfm2(&spawn->base); -} - -static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm) -{ - return crypto_tfm_ctx_aligned(&tfm->base); -} - -static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm) -{ - return container_of(tfm, struct crypto_shash, base); -} - -#endif /* _CRYPTO_INTERNAL_HASH_H */ - diff --git a/ANDROID_3.4.5/include/crypto/internal/rng.h b/ANDROID_3.4.5/include/crypto/internal/rng.h deleted file mode 100644 index 89697336..00000000 --- a/ANDROID_3.4.5/include/crypto/internal/rng.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * RNG: Random Number Generator algorithms under the crypto API - * - * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_INTERNAL_RNG_H -#define _CRYPTO_INTERNAL_RNG_H - -#include <crypto/algapi.h> -#include <crypto/rng.h> - -extern const struct crypto_type crypto_rng_type; - -static inline void *crypto_rng_ctx(struct crypto_rng *tfm) -{ - return crypto_tfm_ctx(&tfm->base); -} - -#endif diff --git a/ANDROID_3.4.5/include/crypto/internal/skcipher.h b/ANDROID_3.4.5/include/crypto/internal/skcipher.h deleted file mode 100644 index 06e8b32d..00000000 --- a/ANDROID_3.4.5/include/crypto/internal/skcipher.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Symmetric key ciphers. - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_INTERNAL_SKCIPHER_H -#define _CRYPTO_INTERNAL_SKCIPHER_H - -#include <crypto/algapi.h> -#include <crypto/skcipher.h> -#include <linux/types.h> - -struct rtattr; - -struct crypto_skcipher_spawn { - struct crypto_spawn base; -}; - -extern const struct crypto_type crypto_givcipher_type; - -static inline void crypto_set_skcipher_spawn( - struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst) -{ - crypto_set_spawn(&spawn->base, inst); -} - -int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, - u32 type, u32 mask); - -struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask); - -static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) -{ - crypto_drop_spawn(&spawn->base); -} - -static inline struct crypto_alg *crypto_skcipher_spawn_alg( - struct crypto_skcipher_spawn *spawn) -{ - return spawn->base.alg; -} - -static inline struct crypto_ablkcipher *crypto_spawn_skcipher( - struct crypto_skcipher_spawn *spawn) -{ - return __crypto_ablkcipher_cast( - crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0), - crypto_skcipher_mask(0))); -} - -int skcipher_null_givencrypt(struct skcipher_givcrypt_request *req); -int skcipher_null_givdecrypt(struct skcipher_givcrypt_request *req); -const char *crypto_default_geniv(const struct crypto_alg *alg); - -struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl, - struct rtattr **tb, u32 type, - u32 mask); -void skcipher_geniv_free(struct crypto_instance *inst); -int skcipher_geniv_init(struct crypto_tfm *tfm); -void skcipher_geniv_exit(struct crypto_tfm *tfm); - -static inline struct crypto_ablkcipher *skcipher_geniv_cipher( - struct crypto_ablkcipher *geniv) -{ - return crypto_ablkcipher_crt(geniv)->base; -} - -static inline int skcipher_enqueue_givcrypt( - struct crypto_queue *queue, struct skcipher_givcrypt_request *request) -{ - return ablkcipher_enqueue_request(queue, &request->creq); -} - -static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( - struct crypto_queue *queue) -{ - return __crypto_dequeue_request( - queue, offsetof(struct skcipher_givcrypt_request, creq.base)); -} - -static inline void *skcipher_givcrypt_reqctx( - struct skcipher_givcrypt_request *req) -{ - return ablkcipher_request_ctx(&req->creq); -} - -static inline void ablkcipher_request_complete(struct ablkcipher_request *req, - int err) -{ - req->base.complete(&req->base, err); -} - -static inline void skcipher_givcrypt_complete( - struct skcipher_givcrypt_request *req, int err) -{ - ablkcipher_request_complete(&req->creq, err); -} - -static inline u32 ablkcipher_request_flags(struct ablkcipher_request *req) -{ - return req->base.flags; -} - -#endif /* _CRYPTO_INTERNAL_SKCIPHER_H */ - diff --git a/ANDROID_3.4.5/include/crypto/lrw.h b/ANDROID_3.4.5/include/crypto/lrw.h deleted file mode 100644 index 25a2c871..00000000 --- a/ANDROID_3.4.5/include/crypto/lrw.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _CRYPTO_LRW_H -#define _CRYPTO_LRW_H - -#include <crypto/b128ops.h> - -struct scatterlist; -struct gf128mul_64k; -struct blkcipher_desc; - -#define LRW_BLOCK_SIZE 16 - -struct lrw_table_ctx { - /* optimizes multiplying a random (non incrementing, as at the - * start of a new sector) value with key2, we could also have - * used 4k optimization tables or no optimization at all. In the - * latter case we would have to store key2 here */ - struct gf128mul_64k *table; - /* stores: - * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 }, - * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 } - * key2*{ 0,0,...1,1,1,1,1 }, etc - * needed for optimized multiplication of incrementing values - * with key2 */ - be128 mulinc[128]; -}; - -int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak); -void lrw_free_table(struct lrw_table_ctx *ctx); - -struct lrw_crypt_req { - be128 *tbuf; - unsigned int tbuflen; - - struct lrw_table_ctx *table_ctx; - void *crypt_ctx; - void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes); -}; - -int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes, - struct lrw_crypt_req *req); - -#endif /* _CRYPTO_LRW_H */ diff --git a/ANDROID_3.4.5/include/crypto/md5.h b/ANDROID_3.4.5/include/crypto/md5.h deleted file mode 100644 index 65f299b0..00000000 --- a/ANDROID_3.4.5/include/crypto/md5.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _CRYPTO_MD5_H -#define _CRYPTO_MD5_H - -#include <linux/types.h> - -#define MD5_DIGEST_SIZE 16 -#define MD5_HMAC_BLOCK_SIZE 64 -#define MD5_BLOCK_WORDS 16 -#define MD5_HASH_WORDS 4 - -struct md5_state { - u32 hash[MD5_HASH_WORDS]; - u32 block[MD5_BLOCK_WORDS]; - u64 byte_count; -}; - -#endif diff --git a/ANDROID_3.4.5/include/crypto/padlock.h b/ANDROID_3.4.5/include/crypto/padlock.h deleted file mode 100644 index d2cfa2ef..00000000 --- a/ANDROID_3.4.5/include/crypto/padlock.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Driver for VIA PadLock - * - * Copyright (c) 2004 Michal Ludvig <michal@logix.cz> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_PADLOCK_H -#define _CRYPTO_PADLOCK_H - -#define PADLOCK_ALIGNMENT 16 - -#define PFX KBUILD_MODNAME ": " - -#define PADLOCK_CRA_PRIORITY 300 -#define PADLOCK_COMPOSITE_PRIORITY 400 - -#ifdef CONFIG_64BIT -#define STACK_ALIGN 16 -#else -#define STACK_ALIGN 4 -#endif - -#endif /* _CRYPTO_PADLOCK_H */ diff --git a/ANDROID_3.4.5/include/crypto/pcrypt.h b/ANDROID_3.4.5/include/crypto/pcrypt.h deleted file mode 100644 index d7d8bd8c..00000000 --- a/ANDROID_3.4.5/include/crypto/pcrypt.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * pcrypt - Parallel crypto engine. - * - * Copyright (C) 2009 secunet Security Networks AG - * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef _CRYPTO_PCRYPT_H -#define _CRYPTO_PCRYPT_H - -#include <linux/crypto.h> -#include <linux/kernel.h> -#include <linux/padata.h> - -struct pcrypt_request { - struct padata_priv padata; - void *data; - void *__ctx[] CRYPTO_MINALIGN_ATTR; -}; - -static inline void *pcrypt_request_ctx(struct pcrypt_request *req) -{ - return req->__ctx; -} - -static inline -struct padata_priv *pcrypt_request_padata(struct pcrypt_request *req) -{ - return &req->padata; -} - -static inline -struct pcrypt_request *pcrypt_padata_request(struct padata_priv *padata) -{ - return container_of(padata, struct pcrypt_request, padata); -} - -#endif diff --git a/ANDROID_3.4.5/include/crypto/rng.h b/ANDROID_3.4.5/include/crypto/rng.h deleted file mode 100644 index c93f9b91..00000000 --- a/ANDROID_3.4.5/include/crypto/rng.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * RNG: Random Number Generator algorithms under the crypto API - * - * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_RNG_H -#define _CRYPTO_RNG_H - -#include <linux/crypto.h> - -extern struct crypto_rng *crypto_default_rng; - -int crypto_get_default_rng(void); -void crypto_put_default_rng(void); - -static inline struct crypto_rng *__crypto_rng_cast(struct crypto_tfm *tfm) -{ - return (struct crypto_rng *)tfm; -} - -static inline struct crypto_rng *crypto_alloc_rng(const char *alg_name, - u32 type, u32 mask) -{ - type &= ~CRYPTO_ALG_TYPE_MASK; - type |= CRYPTO_ALG_TYPE_RNG; - mask |= CRYPTO_ALG_TYPE_MASK; - - return __crypto_rng_cast(crypto_alloc_base(alg_name, type, mask)); -} - -static inline struct crypto_tfm *crypto_rng_tfm(struct crypto_rng *tfm) -{ - return &tfm->base; -} - -static inline struct rng_alg *crypto_rng_alg(struct crypto_rng *tfm) -{ - return &crypto_rng_tfm(tfm)->__crt_alg->cra_rng; -} - -static inline struct rng_tfm *crypto_rng_crt(struct crypto_rng *tfm) -{ - return &crypto_rng_tfm(tfm)->crt_rng; -} - -static inline void crypto_free_rng(struct crypto_rng *tfm) -{ - crypto_free_tfm(crypto_rng_tfm(tfm)); -} - -static inline int crypto_rng_get_bytes(struct crypto_rng *tfm, - u8 *rdata, unsigned int dlen) -{ - return crypto_rng_crt(tfm)->rng_gen_random(tfm, rdata, dlen); -} - -static inline int crypto_rng_reset(struct crypto_rng *tfm, - u8 *seed, unsigned int slen) -{ - return crypto_rng_crt(tfm)->rng_reset(tfm, seed, slen); -} - -static inline int crypto_rng_seedsize(struct crypto_rng *tfm) -{ - return crypto_rng_alg(tfm)->seedsize; -} - -#endif diff --git a/ANDROID_3.4.5/include/crypto/scatterwalk.h b/ANDROID_3.4.5/include/crypto/scatterwalk.h deleted file mode 100644 index 3744d2a6..00000000 --- a/ANDROID_3.4.5/include/crypto/scatterwalk.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Cryptographic scatter and gather helpers. - * - * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> - * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com> - * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com> - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_SCATTERWALK_H -#define _CRYPTO_SCATTERWALK_H - -#include <asm/kmap_types.h> -#include <crypto/algapi.h> -#include <linux/hardirq.h> -#include <linux/highmem.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/scatterlist.h> -#include <linux/sched.h> - -static inline void crypto_yield(u32 flags) -{ - if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) - cond_resched(); -} - -static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, - struct scatterlist *sg2) -{ - sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); - sg1[num - 1].page_link &= ~0x02; -} - -static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) -{ - if (sg_is_last(sg)) - return NULL; - - return (++sg)->length ? sg : (void *)sg_page(sg); -} - -static inline void scatterwalk_crypto_chain(struct scatterlist *head, - struct scatterlist *sg, - int chain, int num) -{ - if (chain) { - head->length += sg->length; - sg = scatterwalk_sg_next(sg); - } - - if (sg) - scatterwalk_sg_chain(head, num, sg); - else - sg_mark_end(head); -} - -static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, - struct scatter_walk *walk_out) -{ - return !(((sg_page(walk_in->sg) - sg_page(walk_out->sg)) << PAGE_SHIFT) + - (int)(walk_in->offset - walk_out->offset)); -} - -static inline unsigned int scatterwalk_pagelen(struct scatter_walk *walk) -{ - unsigned int len = walk->sg->offset + walk->sg->length - walk->offset; - unsigned int len_this_page = offset_in_page(~walk->offset) + 1; - return len_this_page > len ? len : len_this_page; -} - -static inline unsigned int scatterwalk_clamp(struct scatter_walk *walk, - unsigned int nbytes) -{ - unsigned int len_this_page = scatterwalk_pagelen(walk); - return nbytes > len_this_page ? len_this_page : nbytes; -} - -static inline void scatterwalk_advance(struct scatter_walk *walk, - unsigned int nbytes) -{ - walk->offset += nbytes; -} - -static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk, - unsigned int alignmask) -{ - return !(walk->offset & alignmask); -} - -static inline struct page *scatterwalk_page(struct scatter_walk *walk) -{ - return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); -} - -static inline void scatterwalk_unmap(void *vaddr) -{ - kunmap_atomic(vaddr); -} - -void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); -void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, - size_t nbytes, int out); -void *scatterwalk_map(struct scatter_walk *walk); -void scatterwalk_done(struct scatter_walk *walk, int out, int more); - -void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, - unsigned int start, unsigned int nbytes, int out); - -#endif /* _CRYPTO_SCATTERWALK_H */ diff --git a/ANDROID_3.4.5/include/crypto/serpent.h b/ANDROID_3.4.5/include/crypto/serpent.h deleted file mode 100644 index b7e0941e..00000000 --- a/ANDROID_3.4.5/include/crypto/serpent.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Common values for serpent algorithms - */ - -#ifndef _CRYPTO_SERPENT_H -#define _CRYPTO_SERPENT_H - -#include <linux/types.h> -#include <linux/crypto.h> - -#define SERPENT_MIN_KEY_SIZE 0 -#define SERPENT_MAX_KEY_SIZE 32 -#define SERPENT_EXPKEY_WORDS 132 -#define SERPENT_BLOCK_SIZE 16 - -struct serpent_ctx { - u32 expkey[SERPENT_EXPKEY_WORDS]; -}; - -int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key, - unsigned int keylen); -int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen); - -void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src); -void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src); - -#endif diff --git a/ANDROID_3.4.5/include/crypto/sha.h b/ANDROID_3.4.5/include/crypto/sha.h deleted file mode 100644 index c6c9c1fe..00000000 --- a/ANDROID_3.4.5/include/crypto/sha.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Common values for SHA algorithms - */ - -#ifndef _CRYPTO_SHA_H -#define _CRYPTO_SHA_H - -#include <linux/types.h> - -#define SHA1_DIGEST_SIZE 20 -#define SHA1_BLOCK_SIZE 64 - -#define SHA224_DIGEST_SIZE 28 -#define SHA224_BLOCK_SIZE 64 - -#define SHA256_DIGEST_SIZE 32 -#define SHA256_BLOCK_SIZE 64 - -#define SHA384_DIGEST_SIZE 48 -#define SHA384_BLOCK_SIZE 128 - -#define SHA512_DIGEST_SIZE 64 -#define SHA512_BLOCK_SIZE 128 - -#define SHA1_H0 0x67452301UL -#define SHA1_H1 0xefcdab89UL -#define SHA1_H2 0x98badcfeUL -#define SHA1_H3 0x10325476UL -#define SHA1_H4 0xc3d2e1f0UL - -#define SHA224_H0 0xc1059ed8UL -#define SHA224_H1 0x367cd507UL -#define SHA224_H2 0x3070dd17UL -#define SHA224_H3 0xf70e5939UL -#define SHA224_H4 0xffc00b31UL -#define SHA224_H5 0x68581511UL -#define SHA224_H6 0x64f98fa7UL -#define SHA224_H7 0xbefa4fa4UL - -#define SHA256_H0 0x6a09e667UL -#define SHA256_H1 0xbb67ae85UL -#define SHA256_H2 0x3c6ef372UL -#define SHA256_H3 0xa54ff53aUL -#define SHA256_H4 0x510e527fUL -#define SHA256_H5 0x9b05688cUL -#define SHA256_H6 0x1f83d9abUL -#define SHA256_H7 0x5be0cd19UL - -#define SHA384_H0 0xcbbb9d5dc1059ed8ULL -#define SHA384_H1 0x629a292a367cd507ULL -#define SHA384_H2 0x9159015a3070dd17ULL -#define SHA384_H3 0x152fecd8f70e5939ULL -#define SHA384_H4 0x67332667ffc00b31ULL -#define SHA384_H5 0x8eb44a8768581511ULL -#define SHA384_H6 0xdb0c2e0d64f98fa7ULL -#define SHA384_H7 0x47b5481dbefa4fa4ULL - -#define SHA512_H0 0x6a09e667f3bcc908ULL -#define SHA512_H1 0xbb67ae8584caa73bULL -#define SHA512_H2 0x3c6ef372fe94f82bULL -#define SHA512_H3 0xa54ff53a5f1d36f1ULL -#define SHA512_H4 0x510e527fade682d1ULL -#define SHA512_H5 0x9b05688c2b3e6c1fULL -#define SHA512_H6 0x1f83d9abfb41bd6bULL -#define SHA512_H7 0x5be0cd19137e2179ULL - -struct sha1_state { - u64 count; - u32 state[SHA1_DIGEST_SIZE / 4]; - u8 buffer[SHA1_BLOCK_SIZE]; -}; - -struct sha256_state { - u64 count; - u32 state[SHA256_DIGEST_SIZE / 4]; - u8 buf[SHA256_BLOCK_SIZE]; -}; - -struct sha512_state { - u64 count[2]; - u64 state[SHA512_DIGEST_SIZE / 8]; - u8 buf[SHA512_BLOCK_SIZE]; -}; - -struct shash_desc; - -extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data, - unsigned int len); - -#endif diff --git a/ANDROID_3.4.5/include/crypto/skcipher.h b/ANDROID_3.4.5/include/crypto/skcipher.h deleted file mode 100644 index 25fd6126..00000000 --- a/ANDROID_3.4.5/include/crypto/skcipher.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Symmetric key ciphers. - * - * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#ifndef _CRYPTO_SKCIPHER_H -#define _CRYPTO_SKCIPHER_H - -#include <linux/crypto.h> -#include <linux/kernel.h> -#include <linux/slab.h> - -/** - * struct skcipher_givcrypt_request - Crypto request with IV generation - * @seq: Sequence number for IV generation - * @giv: Space for generated IV - * @creq: The crypto request itself - */ -struct skcipher_givcrypt_request { - u64 seq; - u8 *giv; - - struct ablkcipher_request creq; -}; - -static inline struct crypto_ablkcipher *skcipher_givcrypt_reqtfm( - struct skcipher_givcrypt_request *req) -{ - return crypto_ablkcipher_reqtfm(&req->creq); -} - -static inline int crypto_skcipher_givencrypt( - struct skcipher_givcrypt_request *req) -{ - struct ablkcipher_tfm *crt = - crypto_ablkcipher_crt(skcipher_givcrypt_reqtfm(req)); - return crt->givencrypt(req); -}; - -static inline int crypto_skcipher_givdecrypt( - struct skcipher_givcrypt_request *req) -{ - struct ablkcipher_tfm *crt = - crypto_ablkcipher_crt(skcipher_givcrypt_reqtfm(req)); - return crt->givdecrypt(req); -}; - -static inline void skcipher_givcrypt_set_tfm( - struct skcipher_givcrypt_request *req, struct crypto_ablkcipher *tfm) -{ - req->creq.base.tfm = crypto_ablkcipher_tfm(tfm); -} - -static inline struct skcipher_givcrypt_request *skcipher_givcrypt_cast( - struct crypto_async_request *req) -{ - return container_of(ablkcipher_request_cast(req), - struct skcipher_givcrypt_request, creq); -} - -static inline struct skcipher_givcrypt_request *skcipher_givcrypt_alloc( - struct crypto_ablkcipher *tfm, gfp_t gfp) -{ - struct skcipher_givcrypt_request *req; - - req = kmalloc(sizeof(struct skcipher_givcrypt_request) + - crypto_ablkcipher_reqsize(tfm), gfp); - - if (likely(req)) - skcipher_givcrypt_set_tfm(req, tfm); - - return req; -} - -static inline void skcipher_givcrypt_free(struct skcipher_givcrypt_request *req) -{ - kfree(req); -} - -static inline void skcipher_givcrypt_set_callback( - struct skcipher_givcrypt_request *req, u32 flags, - crypto_completion_t complete, void *data) -{ - ablkcipher_request_set_callback(&req->creq, flags, complete, data); -} - -static inline void skcipher_givcrypt_set_crypt( - struct skcipher_givcrypt_request *req, - struct scatterlist *src, struct scatterlist *dst, - unsigned int nbytes, void *iv) -{ - ablkcipher_request_set_crypt(&req->creq, src, dst, nbytes, iv); -} - -static inline void skcipher_givcrypt_set_giv( - struct skcipher_givcrypt_request *req, u8 *giv, u64 seq) -{ - req->giv = giv; - req->seq = seq; -} - -#endif /* _CRYPTO_SKCIPHER_H */ - diff --git a/ANDROID_3.4.5/include/crypto/twofish.h b/ANDROID_3.4.5/include/crypto/twofish.h deleted file mode 100644 index 095c901a..00000000 --- a/ANDROID_3.4.5/include/crypto/twofish.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _CRYPTO_TWOFISH_H -#define _CRYPTO_TWOFISH_H - -#include <linux/types.h> - -#define TF_MIN_KEY_SIZE 16 -#define TF_MAX_KEY_SIZE 32 -#define TF_BLOCK_SIZE 16 - -struct crypto_tfm; - -/* Structure for an expanded Twofish key. s contains the key-dependent - * S-boxes composed with the MDS matrix; w contains the eight "whitening" - * subkeys, K[0] through K[7]. k holds the remaining, "round" subkeys. Note - * that k[i] corresponds to what the Twofish paper calls K[i+8]. */ -struct twofish_ctx { - u32 s[4][256], w[8], k[32]; -}; - -int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key, - unsigned int key_len, u32 *flags); -int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); - -#endif diff --git a/ANDROID_3.4.5/include/crypto/vmac.h b/ANDROID_3.4.5/include/crypto/vmac.h deleted file mode 100644 index c4467c55..00000000 --- a/ANDROID_3.4.5/include/crypto/vmac.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Modified to interface to the Linux kernel - * Copyright (c) 2009, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ - -#ifndef __CRYPTO_VMAC_H -#define __CRYPTO_VMAC_H - -/* -------------------------------------------------------------------------- - * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai. - * This implementation is herby placed in the public domain. - * The authors offers no warranty. Use at your own risk. - * Please send bug reports to the authors. - * Last modified: 17 APR 08, 1700 PDT - * ----------------------------------------------------------------------- */ - -/* - * User definable settings. - */ -#define VMAC_TAG_LEN 64 -#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */ -#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8) -#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/ - -/* - * This implementation uses u32 and u64 as names for unsigned 32- - * and 64-bit integer types. These are defined in C99 stdint.h. The - * following may need adaptation if you are not running a C99 or - * Microsoft C environment. - */ -struct vmac_ctx { - u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)]; - u64 polykey[2*VMAC_TAG_LEN/64]; - u64 l3key[2*VMAC_TAG_LEN/64]; - u64 polytmp[2*VMAC_TAG_LEN/64]; - u64 cached_nonce[2]; - u64 cached_aes[2]; - int first_block_processed; -}; - -typedef u64 vmac_t; - -struct vmac_ctx_t { - struct crypto_cipher *child; - struct vmac_ctx __vmac_ctx; -}; - -#endif /* __CRYPTO_VMAC_H */ diff --git a/ANDROID_3.4.5/include/crypto/xts.h b/ANDROID_3.4.5/include/crypto/xts.h deleted file mode 100644 index 72c09eb5..00000000 --- a/ANDROID_3.4.5/include/crypto/xts.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _CRYPTO_XTS_H -#define _CRYPTO_XTS_H - -#include <crypto/b128ops.h> - -struct scatterlist; -struct blkcipher_desc; - -#define XTS_BLOCK_SIZE 16 - -struct xts_crypt_req { - be128 *tbuf; - unsigned int tbuflen; - - void *tweak_ctx; - void (*tweak_fn)(void *ctx, u8* dst, const u8* src); - void *crypt_ctx; - void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes); -}; - -#define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x)) - -int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, - struct scatterlist *src, unsigned int nbytes, - struct xts_crypt_req *req); - -#endif /* _CRYPTO_XTS_H */ |