char ctx[crypto_shash_descsize(tfm_ctx->fallback)]; } desc; int rc;desc.shash.tfm = tfm_ctx->fallback; desc.shash.flags = CRYPTO_TFM_REQ_MAY_SLEEP; if (unlikely(req_ctx->first_hash)) { crypto_shash_init(&desc.shash); crypto_shash_update(&desc.shash, req_ctx->buffer, ...
* @statesize: see struct ahash_alg * @descsize: Size of the operational state for the message digest. This state * size is the memory size that needs to be allocated for * shash_desc.__ctx * @stat: Statistics for hash algorithm.*...
void (*exit_tfm)(struct crypto_shash *tfm); int (*clone_tfm)(struct crypto_shash *dst, struct crypto_shash *src);unsigned int descsize;@@ -297,6 +301,8 @@ static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) ...
1int rc; 2rc = crypto_shash_init(desc); 3// error handling 初始化完成后,就可以将呼叫update API来对指定的message进行hash运算。 1rc = crypto_shash_update(desc, message, message_len); 2// error handling 最後,呼叫 final 來取得 hash 結果。 1 u8 result[DIGEST_SIZE]; 2 rc = crypto_shas...
structsdesc{structshash_descshash;charctx[];};staticstructsdesc*init_sdesc(structcrypto_shash*alg){structsdesc*sdesc;intsize;size=sizeof(structshash_desc)+crypto_shash_descsize(alg);sdesc=kmalloc(size,GFP_KERNEL);if(!sdesc)returnERR_PTR(-ENOMEM);sdesc->shash.tfm=alg;sdesc->shash.flags=...
tfm=crypto_alloc_shash("sha256",0,0);if(IS_ERR(tfm))returnPTR_ERR(tfm);desc=kzalloc(sizeof(structshash_desc)+crypto_shash_descsize(tfm),GFP_KERNEL);if(!desc){crypto_free_shash(tfm);return-ENOMEM;} desc->tfm=tfm;desc->flags=0;ret=crypto_shash_init(desc);if(ret)gotoout;ret=...
crypto_shash_descsize(pdesc->tfm) - bs; ctx->len = 0; memset(dg, 0, bs); return 0; } static int crypto_cbcmac_digest_update(struct shash_desc *pdesc, const u8 *p, unsigned int len) { struct crypto_shash *parent = pdesc->tfm; struct cbcmac_tfm_ctx *tctx = crypto_shash_...
/ crypto / vmac.c v6 v5 v5.19 v5.18 v5.17 v5.16 v5.15 v5.15.175 v5.15.174 v5.15.173 v5.15.172 v5.15.171 v5.15.170 v5.15.169 v5.15.168 v5.15.167 v5.15.166 v5.15.165 v5.15.164 v5.15.163 v5.15.162 v5.15.161 v5.15.160 v5.15.159 v5.15.158 v...
8size = sizeof(struct shash_desc) + crypto_shash_descsize(hash); 9desc = kmalloc(size, GFP_KERNEL); 建立好shash_desc之后,接着执行初始化的API, 这个API主要会呼叫transformation implementation的init function,用意是让对应的crypto engine能够进行初始化或是重置等,以准备接下来的运算行为。
desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac_tfm), GFP_KERNEL);if(!desc)returnERR_PTR(-ENOMEM); desc->tfm = hmac_tfm; desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; rc = crypto_shash_setkey(hmac_tfm, evmkey, evmkey_len);if(rc)gotoout; ...