Lines Matching full:hmac

38  * ubifs_hash_calc_hmac - calculate a HMAC from a hash
40 * @hash: the node to calculate a HMAC for
41 * @hmac: the returned HMAC
46 u8 *hmac) in ubifs_hash_calc_hmac() argument
48 return crypto_shash_tfm_digest(c->hmac_tfm, hash, c->hash_len, hmac); in ubifs_hash_calc_hmac()
58 * It creates a HMAC from the given input hash and writes it to the node.
80 err = ubifs_hash_calc_hmac(c, hash, auth->hmac); in ubifs_prepare_auth_node()
275 snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", in ubifs_init_authentication()
326 ubifs_err(c, "hmac %s is bigger than maximum allowed hmac size (%d > %d)", in ubifs_init_authentication()
376 * ubifs_node_calc_hmac - calculate the HMAC of a UBIFS node
378 * @node: the node to insert a HMAC into.
380 * @ofs_hmac: the offset in the node where the HMAC is inserted
381 * @hmac: returned HMAC
383 * This function calculates a HMAC of a UBIFS node. The HMAC is expected to be
384 * embedded into the node, so this area is not covered by the HMAC. Also not
388 int len, int ofs_hmac, void *hmac) in ubifs_node_calc_hmac() argument
403 /* behind common node header CRC up to HMAC begin */ in ubifs_node_calc_hmac()
408 /* behind HMAC, if any */ in ubifs_node_calc_hmac()
416 return crypto_shash_final(shash, hmac); in ubifs_node_calc_hmac()
420 * __ubifs_node_insert_hmac - insert a HMAC into a UBIFS node
422 * @node: the node to insert a HMAC into.
424 * @ofs_hmac: the offset in the node where the HMAC is inserted
426 * This function inserts a HMAC at offset @ofs_hmac into the node given in
438 * __ubifs_node_verify_hmac - verify the HMAC of UBIFS node
440 * @node: the node to insert a HMAC into.
442 * @ofs_hmac: the offset in the node where the HMAC is inserted
444 * This function verifies the HMAC at offset @ofs_hmac of the node given in
451 u8 *hmac; in __ubifs_node_verify_hmac() local
454 hmac = kmalloc(hmac_len, GFP_NOFS); in __ubifs_node_verify_hmac()
455 if (!hmac) in __ubifs_node_verify_hmac()
458 err = ubifs_node_calc_hmac(c, node, len, ofs_hmac, hmac); in __ubifs_node_verify_hmac()
460 kfree(hmac); in __ubifs_node_verify_hmac()
464 err = crypto_memneq(hmac, node + ofs_hmac, hmac_len); in __ubifs_node_verify_hmac()
466 kfree(hmac); in __ubifs_node_verify_hmac()
497 * ubifs_hmac_wkm - Create a HMAC of the well known message
499 * @hmac: The HMAC of the well known message
501 * This function creates a HMAC of a well known message. This is used
508 int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac) in ubifs_hmac_wkm() argument
516 sizeof(well_known_message) - 1, hmac); in ubifs_hmac_wkm()
520 * ubifs_hmac_zero - test if a HMAC is zero
522 * @hmac: the HMAC to test
524 * This function tests if a HMAC is zero and returns true if it is
527 bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac) in ubifs_hmac_zero() argument
529 return !memchr_inv(hmac, 0, c->hmac_desc_len); in ubifs_hmac_zero()