/linux/security/ipe/ |
H A D | digest.c | 6 #include "digest.h" 9 * ipe_digest_parse() - parse a digest in IPE's policy. 15 * Use this function to create a property to parse the digest 16 * consistently. The parsed digest will be saved in @value in IPE's 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() [all …]
|
H A D | audit.c | 16 #include "digest.h" 67 * @rh: Supplies a pointer to the digest structure. 76 * audit_fsv_digest() - audit the digest of a fsverity_digest property. 78 * @d: Supplies a pointer to the digest structure. 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()
|
H A D | hooks.c | 16 #include "digest.h" 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()
|
/linux/fs/verity/ |
H A D | measure.c | 3 * Ioctl to get a verity file's digest 15 * fsverity_ioctl_measure() - get a verity file's digest 16 * @filp: file to get digest of 19 * Retrieve the file digest that the kernel is enforcing for reads from a verity 40 * return the digest if it fits in the available space. We write back in fsverity_ioctl_measure() 56 if (copy_to_user(uarg->digest, vi->file_digest, hash_alg->digest_size)) in fsverity_ioctl_measure() 64 * fsverity_get_digest() - get a verity file's digest 65 * @inode: inode to get digest of 66 * @raw_digest: (out) the raw file digest 67 * @alg: (out) the digest's algorithm, as a FS_VERITY_HASH_ALG_* value [all …]
|
/linux/lib/crypto/ |
H A D | sha1.c | 72 * @digest: 160 bit digest to update 77 * 160-bit internal state (@digest) with a single 512-bit data block (@data). 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() [all …]
|
/linux/security/integrity/ima/ |
H A D | ima_template_lib.c | 289 static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, in ima_eventdigest_init_common() argument 294 * digest formats: in ima_eventdigest_init_common() 295 * - DATA_FMT_DIGEST: digest in ima_eventdigest_init_common() 296 * - DATA_FMT_DIGEST_WITH_ALGO: <hash algo> + ':' + '\0' + digest, in ima_eventdigest_init_common() 298 * <digest type> + ':' + <hash algo> + ':' + '\0' + digest, in ima_eventdigest_init_common() 300 * where 'DATA_FMT_DIGEST' is the original digest format ('d') in ima_eventdigest_init_common() 302 * where <digest type> is either "ima" or "verity", in ima_eventdigest_init_common() 321 if (digest) { in ima_eventdigest_init_common() 322 memcpy(buffer + offset, digest, digestsize); in ima_eventdigest_init_common() 325 * If digest is NULL, the event being recorded is a violation. in ima_eventdigest_init_common() [all …]
|
H A D | ima_queue.c | 47 /* lookup up the digest value in the hash table, and return the entry */ 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() 233 /* for unmapped TPM algorithms digest is still a padded SHA1 */ in ima_init_digests() 237 memset(digests[i].digest, 0xff, digest_size); in ima_init_digests()
|
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() 643 /* for unmapped TPM algorithms digest is still a padded SHA1 */ in ima_calc_field_array_hash() 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() 790 * Knowing which TPM bank is read to calculate the boot_aggregate digest 793 * aggregate digest as stored in the measurement list. [all …]
|
H A D | ima_modsig.c | 23 /* This digest will go in the 'd-modsig' field of the IMA template. */ 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()
|
/linux/crypto/asymmetric_keys/ |
H A D | pkcs7_verify.c | 20 * Digest the relevant parts of the PKCS#7 data 33 /* The digest was calculated already. */ in pkcs7_digest() 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() 61 /* Digest the message [RFC2315 9.3] */ in pkcs7_digest() 63 sig->digest); in pkcs7_digest() 66 pr_devel("MsgDigest = [%*ph]\n", 8, sig->digest); in pkcs7_digest() 69 * message digest attribute amongst them which corresponds to the in pkcs7_digest() 70 * digest we just calculated. in pkcs7_digest() [all …]
|
H A D | verify_pefile.c | 242 * Load the contents of the PE binary into the digest, leaving out the image 252 /* Digest the header and data directory, but leave out the image in pefile_digest_pe_contents() 319 * Digest the contents of the PE binary, leaving out the image checksum and the 328 void *digest; in pefile_digest_pe() local 344 pr_warn("Digest size mismatch (%zx != %x)\n", in pefile_digest_pe() 349 pr_debug("Digest: desc=%zu size=%zu\n", desc_size, digest_size); in pefile_digest_pe() 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() 372 /* Check that the PE file digest matches that in the MSCODE part of the in pefile_digest_pe() [all …]
|
/linux/arch/x86/crypto/ |
H A D | sha512-ssse3-asm.S | 57 digest = %rdi define 84 # MSG, DIGEST, K_t, W_t are arrays 90 # Output Digest (arg2) 91 #define DIGEST(i) 8*i(digest) macro 272 # Purpose: Updates the SHA512 digest stored at "state" with the message 299 mov DIGEST(0), a_64 300 mov DIGEST(1), b_64 301 mov DIGEST(2), c_64 302 mov DIGEST(3), d_64 303 mov DIGEST(4), e_64 [all …]
|
H A D | sha512-avx-asm.S | 57 digest = %rdi define 86 # MSG, DIGEST, K_t, W_t are arrays 92 # Output Digest (arg2) 93 #define DIGEST(i) 8*i(digest) macro 271 # Purpose: Updates the SHA512 digest stored at "state" with the message 297 mov DIGEST(0), a_64 298 mov DIGEST(1), b_64 299 mov DIGEST(2), c_64 300 mov DIGEST(3), d_64 301 mov DIGEST(4), e_64 [all …]
|
/linux/Documentation/crypto/ |
H A D | api-digest.rst | 1 Message Digest Algorithm Definitions 5 :doc: Message Digest Algorithm Definitions 10 Asynchronous Message Digest API 14 :doc: Asynchronous Message Digest API 28 Synchronous Message Digest API 32 :doc: Synchronous Message Digest API
|
/linux/tools/testing/selftests/arm64/fp/ |
H A D | kernel-test.c | 28 static char *digest; variable 197 digest = malloc(digest_len); in create_socket() 198 if (!digest) { in create_socket() 199 printf("Failed to allocated %d byte digest\n", digest_len); in create_socket() 236 printf("No digest returned\n"); in compute_digest() 242 printf("Failed to get digest: %s (%d)\n", in compute_digest() 302 * Compute a reference digest we hope is repeatable, we do in main() 307 printf("Failed to compute reference digest\n"); in main() 314 if (!compute_digest(digest)) { in main() 315 printf("Failed to compute digest, ite in main() [all...] |
/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],
|
/linux/include/crypto/ |
H A D | kdf_sp800108.h | 17 * @kmd Keyed message digest whose key was set with crypto_kdf108_setkey or 18 * unkeyed message digest 38 * @kmd Keyed message digest allocated by the caller. The key should not have 40 * @key Seed key to be used to initialize the keyed message digest context. 46 * the message digest size of the used keyed message digest. This limitation
|
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/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 | 34 * sets, for example, fsverity_digest or only the digest[] part of it. 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/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 95 uint8_t hash_algo; /* Digest algorithm [enum hash_algo] */ 104 * containing either the fsverity_descriptor struct digest or, in the 111 __u8 hash_algorithm; /* Digest algorithm [enum hash_algo] */ 131 const char *digest, int digestlen); 142 const char *digest, int digestlen) in integrity_digsig_verify() argument
|
/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/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() 149 dev_warn(hace_dev->dev, "dma_map() rctx digest error\n"); in aspeed_ahash_dma_prepare() 190 rctx->digest_dma_addr = dma_map_single(hace_dev->dev, rctx->digest, in aspeed_ahash_dma_prepare_sg() 194 dev_warn(hace_dev->dev, "dma_map() rctx digest error\n"); in aspeed_ahash_dma_prepare_sg() 286 * Copy digest to the corresponding request result. 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() 378 dev_warn(hace_dev->dev, "dma_map() rctx digest error\n"); in aspeed_ahash_hmac_resume() [all …]
|
/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/linux/ |
H A D | nvme-tcp.h | 84 * @digest: digest types enabled 91 __u8 digest; member 102 * @digest: digest types enabled 109 __u8 digest; member
|