Lines Matching full:hmac

39  * ubifs_hash_calc_hmac - calculate a HMAC from a hash
41 * @hash: the node to calculate a HMAC for
42 * @hmac: the returned HMAC
47 u8 *hmac) in ubifs_hash_calc_hmac() argument
49 return crypto_shash_tfm_digest(c->hmac_tfm, hash, c->hash_len, hmac); in ubifs_hash_calc_hmac()
59 * It creates a HMAC from the given input hash and writes it to the node.
81 err = ubifs_hash_calc_hmac(c, hash, auth->hmac); in ubifs_prepare_auth_node()
276 snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", in ubifs_init_authentication()
327 ubifs_err(c, "hmac %s is bigger than maximum allowed hmac size (%d > %d)", in ubifs_init_authentication()
377 * ubifs_node_calc_hmac - calculate the HMAC of a UBIFS node
379 * @node: the node to insert a HMAC into.
381 * @ofs_hmac: the offset in the node where the HMAC is inserted
382 * @hmac: returned HMAC
384 * This function calculates a HMAC of a UBIFS node. The HMAC is expected to be
385 * embedded into the node, so this area is not covered by the HMAC. Also not
389 int len, int ofs_hmac, void *hmac) in ubifs_node_calc_hmac() argument
404 /* behind common node header CRC up to HMAC begin */ in ubifs_node_calc_hmac()
409 /* behind HMAC, if any */ in ubifs_node_calc_hmac()
417 return crypto_shash_final(shash, hmac); in ubifs_node_calc_hmac()
421 * __ubifs_node_insert_hmac - insert a HMAC into a UBIFS node
423 * @node: the node to insert a HMAC into.
425 * @ofs_hmac: the offset in the node where the HMAC is inserted
427 * This function inserts a HMAC at offset @ofs_hmac into the node given in
439 * __ubifs_node_verify_hmac - verify the HMAC of UBIFS node
441 * @node: the node to insert a HMAC into.
443 * @ofs_hmac: the offset in the node where the HMAC is inserted
445 * This function verifies the HMAC at offset @ofs_hmac of the node given in
452 u8 *hmac; in __ubifs_node_verify_hmac() local
455 hmac = kmalloc(hmac_len, GFP_NOFS); in __ubifs_node_verify_hmac()
456 if (!hmac) in __ubifs_node_verify_hmac()
459 err = ubifs_node_calc_hmac(c, node, len, ofs_hmac, hmac); in __ubifs_node_verify_hmac()
461 kfree(hmac); in __ubifs_node_verify_hmac()
465 err = crypto_memneq(hmac, node + ofs_hmac, hmac_len); in __ubifs_node_verify_hmac()
467 kfree(hmac); in __ubifs_node_verify_hmac()
498 * ubifs_hmac_wkm - Create a HMAC of the well known message
500 * @hmac: The HMAC of the well known message
502 * This function creates a HMAC of a well known message. This is used
509 int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac) in ubifs_hmac_wkm() argument
529 err = crypto_shash_final(shash, hmac); in ubifs_hmac_wkm()
536 * ubifs_hmac_zero - test if a HMAC is zero
538 * @hmac: the HMAC to test
540 * This function tests if a HMAC is zero and returns true if it is
543 bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac) in ubifs_hmac_zero() argument
545 return !memchr_inv(hmac, 0, c->hmac_desc_len); in ubifs_hmac_zero()