summaryrefslogtreecommitdiff
path: root/include/crypto/skcipher.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-05-17 03:14:09 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2018-05-17 07:24:39 -0400
commit62e4df2a38081f62fd1bd657459b7ffb2d4f522c (patch)
tree9b4ed5d3c597e19894ca77299b53057efe071c50 /include/crypto/skcipher.h
parent426e88e41cdcecd007a689daf4fe432bb61303ec (diff)
drop dead code
Diffstat (limited to 'include/crypto/skcipher.h')
-rw-r--r--include/crypto/skcipher.h111
1 files changed, 31 insertions, 80 deletions
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 8b5f4254..c9e887c9 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -14,89 +14,49 @@
#define _CRYPTO_SKCIPHER_H
#include <linux/crypto.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-struct skcipher_request {
- unsigned int cryptlen;
-
- u8 *iv;
-
- struct scatterlist *src;
- struct scatterlist *dst;
+struct crypto_skcipher;
+struct skcipher_request;
- struct crypto_tfm *tfm;
- //struct crypto_async_request base;
-
- void *__ctx[] CRYPTO_MINALIGN_ATTR;
+struct skcipher_alg {
+ struct crypto_alg base;
};
-struct crypto_skcipher {
- int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
- unsigned int keylen);
- int (*encrypt)(struct skcipher_request *req);
- int (*decrypt)(struct skcipher_request *req);
-
- unsigned int ivsize;
- unsigned int reqsize;
- unsigned int keysize;
+int crypto_register_skcipher(struct skcipher_alg *alg);
- struct crypto_tfm base;
-};
-
-struct skcipher_alg {
+struct crypto_skcipher {
int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
unsigned int keylen);
int (*encrypt)(struct skcipher_request *req);
int (*decrypt)(struct skcipher_request *req);
- int (*init)(struct crypto_skcipher *tfm);
- void (*exit)(struct crypto_skcipher *tfm);
- unsigned int min_keysize;
- unsigned int max_keysize;
- unsigned int ivsize;
- unsigned int chunksize;
- unsigned int walksize;
+ unsigned ivsize;
+ unsigned keysize;
- struct crypto_alg base;
+ struct crypto_tfm base;
};
-#define SKCIPHER_REQUEST_ON_STACK(name, tfm) \
- char __##name##_desc[sizeof(struct skcipher_request) + \
- crypto_skcipher_reqsize(tfm)] CRYPTO_MINALIGN_ATTR; \
- struct skcipher_request *name = (void *)__##name##_desc
-
-static inline void *crypto_skcipher_ctx(struct crypto_skcipher *tfm)
-{
- return crypto_tfm_ctx(&tfm->base);
-}
-
-static inline struct crypto_skcipher *__crypto_skcipher_cast(
- struct crypto_tfm *tfm)
-{
- return container_of(tfm, struct crypto_skcipher, base);
-}
-
struct crypto_skcipher *crypto_alloc_skcipher(const char *alg_name,
u32 type, u32 mask);
-static inline struct crypto_tfm *crypto_skcipher_tfm(
- struct crypto_skcipher *tfm)
-{
- return &tfm->base;
-}
-
static inline void crypto_free_skcipher(struct crypto_skcipher *tfm)
{
- crypto_destroy_tfm(tfm, crypto_skcipher_tfm(tfm));
+ kfree(tfm);
}
-static inline struct skcipher_alg *crypto_skcipher_alg(
- struct crypto_skcipher *tfm)
-{
- return container_of(crypto_skcipher_tfm(tfm)->__crt_alg,
- struct skcipher_alg, base);
-}
+struct skcipher_request {
+ unsigned cryptlen;
+ u8 *iv;
+
+ struct scatterlist *src;
+ struct scatterlist *dst;
+
+ struct crypto_tfm *tfm;
+};
+
+#define SKCIPHER_REQUEST_ON_STACK(name, tfm) \
+ struct skcipher_request __##name##_desc; \
+ struct skcipher_request *name = &__##name##_desc
static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen)
@@ -107,32 +67,23 @@ static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
static inline struct crypto_skcipher *crypto_skcipher_reqtfm(
struct skcipher_request *req)
{
- return __crypto_skcipher_cast(req->tfm);
+ return container_of(req->tfm, struct crypto_skcipher, base);
}
static inline int crypto_skcipher_encrypt(struct skcipher_request *req)
{
- struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
-
- return tfm->encrypt(req);
+ return crypto_skcipher_reqtfm(req)->encrypt(req);
}
static inline int crypto_skcipher_decrypt(struct skcipher_request *req)
{
- struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
-
- return tfm->decrypt(req);
-}
-
-static inline unsigned int crypto_skcipher_reqsize(struct crypto_skcipher *tfm)
-{
- return tfm->reqsize;
+ return crypto_skcipher_reqtfm(req)->decrypt(req);
}
static inline void skcipher_request_set_tfm(struct skcipher_request *req,
struct crypto_skcipher *tfm)
{
- req->tfm = crypto_skcipher_tfm(tfm);
+ req->tfm = &tfm->base;
}
static inline void skcipher_request_set_crypt(
@@ -140,10 +91,10 @@ static inline void skcipher_request_set_crypt(
struct scatterlist *src, struct scatterlist *dst,
unsigned int cryptlen, void *iv)
{
- req->src = src;
- req->dst = dst;
- req->cryptlen = cryptlen;
- req->iv = iv;
+ req->src = src;
+ req->dst = dst;
+ req->cryptlen = cryptlen;
+ req->iv = iv;
}
#endif /* _CRYPTO_SKCIPHER_H */