/linux/security/ipe/ |
H A D | digest.c | 27 u8 *digest = NULL; in ipe_digest_parse() local 51 digest = kzalloc(info->digest_len, GFP_KERNEL); in ipe_digest_parse() 52 if (!digest) { in ipe_digest_parse() 57 rc = hex2bin(digest, raw_digest, info->digest_len); in ipe_digest_parse() 64 info->digest = digest; in ipe_digest_parse() 69 kfree(digest); in ipe_digest_parse() 84 const struct digest_info *digest) in ipe_digest_eval() argument 86 return (expected->digest_len == digest->digest_len) && in ipe_digest_eval() 87 (!strcmp(expected->alg, digest->alg)) && in ipe_digest_eval() 88 (!memcmp(expected->digest, digest->digest, expected->digest_len)); in ipe_digest_eval() [all …]
|
H A D | hooks.c | 241 const struct dm_verity_digest *digest = NULL; in ipe_bdev_setintegrity() local 260 digest = value; in ipe_bdev_setintegrity() 266 info->digest = kmemdup(digest->digest, digest->digest_len, GFP_KERNEL); in ipe_bdev_setintegrity() 267 if (!info->digest) in ipe_bdev_setintegrity() 270 info->alg = kstrdup(digest->alg, GFP_KERNEL); in ipe_bdev_setintegrity() 274 info->digest_len = digest->digest_len; in ipe_bdev_setintegrity()
|
H A D | audit.c | 185 u8 *digest = NULL; in audit_policy() local 193 digest = kzalloc(crypto_shash_digestsize(tfm), GFP_KERNEL); in audit_policy() 194 if (!digest) in audit_policy() 203 if (crypto_shash_final(desc, digest)) in audit_policy() 209 audit_log_n_hex(ab, digest, crypto_shash_digestsize(tfm)); in audit_policy() 212 kfree(digest); in audit_policy()
|
/linux/lib/crypto/ |
H A D | sha1.c | 87 void sha1_transform(__u32 *digest, const char *data, __u32 *array) in sha1_transform() argument 92 A = digest[0]; in sha1_transform() 93 B = digest[1]; in sha1_transform() 94 C = digest[2]; in sha1_transform() 95 D = digest[3]; in sha1_transform() 96 E = digest[4]; in sha1_transform() 118 digest[0] += A; in sha1_transform() 119 digest[1] += B; in sha1_transform() 120 digest[2] += C; in sha1_transform() 121 digest[3] += D; in sha1_transform() [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | test_fsverity.c | 18 char digest[SIZEOF_STRUCT_FSVERITY_DIGEST + SHA256_DIGEST_SIZE]; variable 35 bpf_dynptr_from_mem(digest, sizeof(digest), 0, &digest_ptr); in BPF_PROG() 41 for (i = 0; i < (int)sizeof(digest); i++) { in BPF_PROG() 42 if (digest[i] != expected_digest[i]) in BPF_PROG()
|
H A D | test_sig_in_xattr.c | 38 char digest[MAGIC_SIZE + SIZEOF_STRUCT_FSVERITY_DIGEST + SHA256_DIGEST_SIZE]; variable 58 bpf_dynptr_from_mem(digest + MAGIC_SIZE, sizeof(digest) - MAGIC_SIZE, 0, &digest_ptr); in BPF_PROG() 66 bpf_dynptr_from_mem(digest, sizeof(digest), 0, &digest_ptr); in BPF_PROG()
|
/linux/arch/s390/purgatory/ |
H A D | purgatory.c | 18 u8 digest[SHA256_DIGEST_SIZE]; in verify_sha256_digest() local 27 sha256_final(&sctx, digest); in verify_sha256_digest() 29 if (memcmp(digest, purgatory_sha256_digest, sizeof(digest))) in verify_sha256_digest()
|
/linux/include/crypto/ |
H A D | poly1305.h | 88 void poly1305_final_arch(struct poly1305_desc_ctx *desc, u8 *digest); 89 void poly1305_final_generic(struct poly1305_desc_ctx *desc, u8 *digest); 91 static inline void poly1305_final(struct poly1305_desc_ctx *desc, u8 *digest) in poly1305_final() argument 94 poly1305_final_arch(desc, digest); in poly1305_final() 96 poly1305_final_generic(desc, digest); in poly1305_final()
|
/linux/arch/riscv/purgatory/ |
H A D | purgatory.c | 24 u8 digest[SHA256_DIGEST_SIZE]; in verify_sha256_digest() local 30 sha256_final(&ss, digest); in verify_sha256_digest() 31 if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)) != 0) in verify_sha256_digest()
|
/linux/arch/x86/purgatory/ |
H A D | purgatory.c | 27 u8 digest[SHA256_DIGEST_SIZE]; in verify_sha256_digest() local 36 sha256_final(&sctx, digest); in verify_sha256_digest() 38 if (memcmp(digest, purgatory_sha256_digest, sizeof(digest))) in verify_sha256_digest()
|
/linux/crypto/asymmetric_keys/ |
H A D | pkcs7_verify.c | 34 if (sig->digest) in pkcs7_digest() 51 sig->digest = kmalloc(sig->digest_size, GFP_KERNEL); in pkcs7_digest() 52 if (!sig->digest) in pkcs7_digest() 63 sig->digest); in pkcs7_digest() 66 pr_devel("MsgDigest = [%*ph]\n", 8, sig->digest); in pkcs7_digest() 88 if (memcmp(sig->digest, sinfo->msgdigest, in pkcs7_digest() 101 memset(sig->digest, 0, sig->digest_size); in pkcs7_digest() 111 sinfo->authattrs_len, sig->digest); in pkcs7_digest() 114 pr_devel("AADigest = [%*ph]\n", 8, sig->digest); in pkcs7_digest() 141 *buf = sinfo->sig->digest; in pkcs7_get_digest()
|
H A D | verify_pefile.c | 328 void *digest; in pefile_digest_pe() local 365 digest = (void *)desc + desc_size; in pefile_digest_pe() 366 ret = crypto_shash_final(desc, digest); in pefile_digest_pe() 370 pr_debug("Digest calc = [%*ph]\n", ctx->digest_len, digest); in pefile_digest_pe() 375 if (memcmp(digest, ctx->digest, ctx->digest_len) != 0) { in pefile_digest_pe() 446 ctx.digest_len, ctx.digest_len, ctx.digest); in verify_pefile_signature() 454 kfree_sensitive(ctx.digest); in verify_pefile_signature()
|
/linux/drivers/crypto/tegra/ |
H A D | tegra-se-hash.c | 36 struct tegra_se_datbuf digest; member 258 cpuvaddr[i++] = rctx->digest.addr; in tegra_sha_prep_cmd() 259 cpuvaddr[i++] = (u32)(SE_ADDR_HI_MSB(upper_32_bits(rctx->digest.addr)) | in tegra_sha_prep_cmd() 260 SE_ADDR_HI_SZ(rctx->digest.size)); in tegra_sha_prep_cmd() 396 memcpy(req->result, rctx->digest.buf, rctx->digest.size); in tegra_sha_do_final() 403 dma_free_coherent(se->dev, rctx->digest.size, rctx->digest.buf, in tegra_sha_do_final() 404 rctx->digest.addr); in tegra_sha_do_final() 517 rctx->digest.size = crypto_ahash_digestsize(tfm); in tegra_sha_init() 519 rctx->digest.buf = dma_alloc_coherent(se->dev, rctx->digest.size, in tegra_sha_init() 520 &rctx->digest.addr, GFP_KERNEL); in tegra_sha_init() [all …]
|
/linux/security/integrity/ima/ |
H A D | ima_modsig.c | 24 const u8 *digest; member 115 rc = pkcs7_get_digest(modsig->pkcs7_msg, &modsig->digest, in ima_collect_modsig() 126 const u8 **digest, u32 *digest_size) in ima_get_modsig_digest() argument 129 *digest = modsig->digest; in ima_get_modsig_digest()
|
H A D | ima_queue.c | 58 rc = memcmp(qe->entry->digests[ima_hash_algo_idx].digest, in ima_lookup_digest_entry() 111 key = ima_hash_key(entry->digests[ima_hash_algo_idx].digest); in ima_add_digest_entry() 163 u8 *digest = entry->digests[ima_hash_algo_idx].digest; in ima_add_template_entry() local 172 if (ima_lookup_digest_entry(digest, entry->pcr)) { in ima_add_template_entry() 237 memset(digests[i].digest, 0xff, digest_size); in ima_init_digests()
|
H A D | ima_appraise.c | 240 * @digest: pointer to the digest to be hashed 252 enum hash_algo algo, const u8 *digest, in calc_file_id_hash() argument 262 memcpy(file_id.hash, digest, hash_digest_size[algo]); in calc_file_id_hash() 271 * xattr_verify - verify xattr digest or signature 312 iint->ima_hash->digest, in xattr_verify() 342 iint->ima_hash->digest, in xattr_verify() 353 iint->ima_hash->digest, in xattr_verify() 381 iint->ima_hash->digest, in xattr_verify() 392 xattr_len, hash.digest, in xattr_verify() 450 const u8 *digest = NULL; ima_check_blacklist() local [all...] |
H A D | ima_crypto.c | 427 ahash_request_set_crypt(req, NULL, hash->digest, 0); in ima_calc_file_hash_atfm() 498 rc = crypto_shash_final(shash, hash->digest); in ima_calc_file_hash_tfm() 617 rc = crypto_shash_final(shash, entry->digests[tfm_idx].digest); in ima_calc_field_array_hash_tfm() 645 memcpy(entry->digests[i].digest, in ima_calc_field_array_hash() 646 entry->digests[ima_sha1_idx].digest, in ima_calc_field_array_hash() 690 ahash_request_set_crypt(req, NULL, hash->digest, 0); in calc_buffer_ahash_atfm() 741 rc = crypto_shash_final(shash, hash->digest); in calc_buffer_shash_tfm() 795 static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id, in ima_calc_boot_aggregate_tfm() argument 798 struct tpm_digest d = { .alg_id = alg_id, .digest = {0} }; in ima_calc_boot_aggregate_tfm() 816 rc = crypto_shash_update(shash, d.digest, in ima_calc_boot_aggregate_tfm() [all …]
|
/linux/security/integrity/ |
H A D | integrity.h | 46 u8 digest[SHA1_DIGEST_SIZE]; member 68 u8 digest[]; member 70 static_assert(offsetof(struct ima_digest_data, digest) == sizeof(struct ima_digest_data_hdr), 79 u8 digest[HASH_MAX_DIGESTSIZE]; member 131 const char *digest, int digestlen); 142 const char *digest, int digestlen) in integrity_digsig_verify() argument
|
/linux/security/integrity/evm/ |
H A D | evm_main.c | 186 struct evm_digest digest; in evm_verify_hmac() local 232 digest.hdr.algo = HASH_ALGO_SHA1; in evm_verify_hmac() 234 xattr_value_len, &digest, iint); in evm_verify_hmac() 237 rc = crypto_memneq(xattr_data->data, digest.digest, in evm_verify_hmac() 253 digest.hdr.algo = hdr->hash_algo; in evm_verify_hmac() 255 xattr_value_len, xattr_data->type, &digest, in evm_verify_hmac() 261 digest.digest, digest.hdr.length); in evm_verify_hmac() 290 pr_debug("digest: (%d) [%*phN]\n", digest.hdr.length, digest.hdr.length, in evm_verify_hmac() 291 digest.digest); in evm_verify_hmac() 1053 rc = evm_init_hmac(inode, xattrs, xattr_data->digest); in evm_inode_init_security()
|
/linux/crypto/ |
H A D | hctr2.c | 194 u8 digest[POLYVAL_DIGEST_SIZE]) in hctr2_hash_message() 226 return crypto_shash_final(hash_desc, digest); in hctr2_hash_message() 234 u8 digest[POLYVAL_DIGEST_SIZE]; in hctr2_finish() local 244 err = hctr2_hash_message(req, rctx->bulk_part_dst, digest); in hctr2_finish() 247 crypto_xor(rctx->first_block, digest, BLOCKCIPHER_BLOCK_SIZE); in hctr2_finish() 270 u8 digest[POLYVAL_DIGEST_SIZE]; in hctr2_crypt() local 293 err = hctr2_hash_message(req, rctx->bulk_part_src, digest); in hctr2_crypt() 296 crypto_xor(digest, rctx->first_block, BLOCKCIPHER_BLOCK_SIZE); in hctr2_crypt() 302 digest); in hctr2_crypt() 305 digest); in hctr2_crypt() [all …]
|
/linux/drivers/crypto/aspeed/ |
H A D | aspeed-hace-hash.c | 145 rctx->digest_dma_addr = dma_map_single(hace_dev->dev, rctx->digest, in aspeed_ahash_dma_prepare() 190 rctx->digest_dma_addr = dma_map_single(hace_dev->dev, rctx->digest, in aspeed_ahash_dma_prepare_sg() 303 memcpy(req->result, rctx->digest, rctx->digsize); in aspeed_ahash_transfer() 366 memcpy(rctx->buffer + rctx->block_size, rctx->digest, rctx->digsize); in aspeed_ahash_hmac_resume() 372 memcpy(rctx->digest, rctx->sha_iv, rctx->ivsize); in aspeed_ahash_hmac_resume() 374 rctx->digest_dma_addr = dma_map_single(hace_dev->dev, rctx->digest, in aspeed_ahash_hmac_resume() 417 rctx->digest, in aspeed_ahash_req_final() 684 memcpy(rctx->digest, sha1_iv, rctx->ivsize); in aspeed_sham_init() 693 memcpy(rctx->digest, sha224_iv, rctx->ivsize); in aspeed_sham_init() 702 memcpy(rctx->digest, sha256_iv, rctx->ivsize); in aspeed_sham_init() [all …]
|
/linux/drivers/char/tpm/ |
H A D | tpm2-cmd.c | 153 u8 digest[]; member 166 struct tpm_digest *digest, u16 *digest_size_ptr) in tpm2_pcr_read() argument 181 chip->allocated_banks[i].alg_id != digest->alg_id; i++) in tpm2_pcr_read() 197 tpm_buf_append_u16(&buf, digest->alg_id); in tpm2_pcr_read() 208 if (digest_size > sizeof(digest->digest) || in tpm2_pcr_read() 217 memcpy(digest->digest, out->digest, digest_size); in tpm2_pcr_read() 264 tpm_buf_append(&buf, (const unsigned char *)&digests[i].digest, in tpm2_pcr_extend() 547 struct tpm_digest digest = { .alg_id = bank->alg_id }; in tpm2_init_bank_info() local 567 return tpm2_pcr_read(chip, 0, &digest, &bank->digest_size); in tpm2_init_bank_info()
|
/linux/arch/arm64/crypto/ |
H A D | sm4-ce-glue.c | 48 asmlinkage void sm4_ce_mac_update(const u32 *rkey_enc, u8 *digest, 68 u8 digest[SM4_BLOCK_SIZE]; member 593 memset(ctx->digest, 0, SM4_BLOCK_SIZE); in sm4_mac_init() 612 crypto_xor(ctx->digest + ctx->len, p, l); in sm4_mac_update() 623 ctx->digest, ctx->digest); in sm4_mac_update() 629 sm4_ce_mac_update(tctx->key.rkey_enc, ctx->digest, p, in sm4_mac_update() 642 crypto_xor(ctx->digest, p, len); in sm4_mac_update() 657 ctx->digest[ctx->len] ^= 0x80; in sm4_cmac_final() 662 sm4_ce_mac_update(tctx->key.rkey_enc, ctx->digest, consts, 1, in sm4_cmac_final() 666 memcpy(out, ctx->digest, SM4_BLOCK_SIZE); in sm4_cmac_final() [all …]
|
/linux/security/keys/encrypted-keys/ |
H A D | encrypted.h | 40 static inline void dump_hmac(const char *str, const u8 *digest, in dump_hmac() argument 45 print_hex_dump(KERN_ERR, "hmac: ", DUMP_PREFIX_NONE, 32, 1, digest, in dump_hmac() 62 static inline void dump_hmac(const char *str, const u8 *digest, in dump_hmac() argument
|
/linux/Documentation/security/ |
H A D | IMA-templates.rst | 65 - 'd': the digest of the event (i.e. the digest of a measured file), 68 - 'd-ng': the digest of the event, calculated with an arbitrary hash 69 algorithm (field format: <hash algo>:digest); 70 - 'd-ngv2': same as d-ng, but prefixed with the "ima" or "verity" digest type 71 (field format: <digest type>:<hash algo>:digest); 72 - 'd-modsig': the digest of the event without the appended modsig; 74 - 'sig': the file signature, based on either the file's/fsverity's digest[1],
|