0001
0002
0003
0004
0005
0006 #ifndef _SHA_H_
0007 #define _SHA_H_
0008
0009 #include <crypto/scatterwalk.h>
0010 #include <crypto/sha1.h>
0011 #include <crypto/sha2.h>
0012
0013 #include "common.h"
0014 #include "core.h"
0015
0016 #define QCE_SHA_MAX_BLOCKSIZE SHA256_BLOCK_SIZE
0017 #define QCE_SHA_MAX_DIGESTSIZE SHA256_DIGEST_SIZE
0018
0019 struct qce_sha_ctx {
0020 u8 authkey[QCE_SHA_MAX_BLOCKSIZE];
0021 };
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 struct qce_sha_reqctx {
0043 u8 buf[QCE_SHA_MAX_BLOCKSIZE];
0044 u8 tmpbuf[QCE_SHA_MAX_BLOCKSIZE];
0045 u8 digest[QCE_SHA_MAX_DIGESTSIZE];
0046 unsigned int buflen;
0047 unsigned long flags;
0048 struct scatterlist *src_orig;
0049 unsigned int nbytes_orig;
0050 int src_nents;
0051 __be32 byte_count[2];
0052 u64 count;
0053 bool first_blk;
0054 bool last_blk;
0055 struct scatterlist sg[2];
0056 u8 *authkey;
0057 unsigned int authklen;
0058 struct scatterlist result_sg;
0059 };
0060
0061 static inline struct qce_alg_template *to_ahash_tmpl(struct crypto_tfm *tfm)
0062 {
0063 struct crypto_ahash *ahash = __crypto_ahash_cast(tfm);
0064 struct ahash_alg *alg = container_of(crypto_hash_alg_common(ahash),
0065 struct ahash_alg, halg);
0066
0067 return container_of(alg, struct qce_alg_template, alg.ahash);
0068 }
0069
0070 extern const struct qce_algo_ops ahash_ops;
0071
0072 #endif