X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=crypto%2Finternal.h;h=c3ab4a950f304e24b8f943dc064dc7dc828a8d5e;hb=4cc7720cd165273b08a72b4193146dffee58e34b;hp=68612874b5fde627e571b67ce1533084055e6104;hpb=f7f24758ac98a506770bc5910d33567610fa3403;p=deliverable%2Flinux.git diff --git a/crypto/internal.h b/crypto/internal.h index 68612874b5fd..c3ab4a950f30 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -2,6 +2,7 @@ * Cryptographic API. * * Copyright (c) 2002 James Morris + * Copyright (c) 2005 Herbert Xu * * 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 @@ -11,14 +12,25 @@ */ #ifndef _CRYPTO_INTERNAL_H #define _CRYPTO_INTERNAL_H -#include + +#include #include #include #include #include +#include +#include #include +#include +#include #include +struct crypto_instance; +struct crypto_template; + +extern struct list_head crypto_alg_list; +extern struct rw_semaphore crypto_alg_sem; + extern enum km_type crypto_km_types[]; static inline enum km_type crypto_kmap_type(int out) @@ -38,7 +50,7 @@ static inline void crypto_kunmap(void *vaddr, int out) static inline void crypto_yield(struct crypto_tfm *tfm) { - if (!in_atomic()) + if (tfm->crt_flags & CRYPTO_TFM_REQ_MAY_SLEEP) cond_resched(); } @@ -57,9 +69,12 @@ static inline void crypto_free_hmac_block(struct crypto_tfm *tfm) #ifdef CONFIG_PROC_FS void __init crypto_init_proc(void); +void __exit crypto_exit_proc(void); #else static inline void crypto_init_proc(void) { } +static inline void crypto_exit_proc(void) +{ } #endif static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg, @@ -75,7 +90,7 @@ static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg, switch (flags & CRYPTO_TFM_MODE_MASK) { case CRYPTO_TFM_MODE_CBC: - len = ALIGN(len, alg->cra_alignmask + 1); + len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1); len += alg->cra_blocksize; break; } @@ -101,5 +116,18 @@ void crypto_exit_digest_ops(struct crypto_tfm *tfm); void crypto_exit_cipher_ops(struct crypto_tfm *tfm); void crypto_exit_compress_ops(struct crypto_tfm *tfm); +int crypto_register_instance(struct crypto_template *tmpl, + struct crypto_instance *inst); + +static inline int crypto_tmpl_get(struct crypto_template *tmpl) +{ + return try_module_get(tmpl->module); +} + +static inline void crypto_tmpl_put(struct crypto_template *tmpl) +{ + module_put(tmpl->module); +} + #endif /* _CRYPTO_INTERNAL_H */