X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=crypto%2Finternal.h;h=37515beafc8ce44ff501d15d617968248656b59f;hb=cb220c1af49644786944c549518b491d4c654030;hp=964b9a60ca24413f07b1fe8410f7ac3198642135;hpb=af6f5e3247a68074e384ef93c0b4bce1b73c9d80;p=linux-2.6 diff --git a/crypto/internal.h b/crypto/internal.h index 964b9a60ca..37515beafc 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include extern enum km_type crypto_km_types[]; @@ -42,20 +42,6 @@ static inline void crypto_yield(struct crypto_tfm *tfm) cond_resched(); } -static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) -{ - return (void *)&tfm[1]; -} - -struct crypto_alg *crypto_alg_lookup(const char *name); - -/* A far more intelligent version of this is planned. For now, just - * try an exact match on the name of the algorithm. */ -static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) -{ - return try_then_request_module(crypto_alg_lookup(name), name); -} - #ifdef CONFIG_CRYPTO_HMAC int crypto_alloc_hmac_block(struct crypto_tfm *tfm); void crypto_free_hmac_block(struct crypto_tfm *tfm); @@ -76,6 +62,33 @@ static inline void crypto_init_proc(void) { } #endif +static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg, + int flags) +{ + return alg->cra_ctxsize; +} + +static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg, + int flags) +{ + unsigned int len = alg->cra_ctxsize; + + switch (flags & CRYPTO_TFM_MODE_MASK) { + case CRYPTO_TFM_MODE_CBC: + len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1); + len += alg->cra_blocksize; + break; + } + + return len; +} + +static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg, + int flags) +{ + return alg->cra_ctxsize; +} + int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags);