Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
security/integrity/ima/ima_template_lib.c
int ima_parse_buf(void *bufstartp, void *bufendp, void **bufcurp, int maxfields, struct ima_field_data *fields, int *curfields, unsigned long *len_mask, int enforce_mask, char *bufname) { void *bufp = bufstartp; int i; for (i = 0; i < maxfields; i++) { if (len_mask == NULL...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize, u8 digest_type, u8 hash_algo, struct ima_field_data *field_data) { u8 buffer[DIGEST_TYPE_NAME_LEN_MAX + CRYPTO_MAX_ALG_NAME + 2 + IMA_MAX_DIGEST_SIZE] = {...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
int ima_eventdigest_ng_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { u8 *cur_digest = NULL, hash_algo = ima_hash_algo; u32 cur_digestsize = 0; if (event_data->violation) goto out; cur_digest = event_data->iint->ima_hash->digest; cur_digestsize =...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
static int ima_eventname_init_common(struct ima_event_data *event_data, struct ima_field_data *field_data, bool size_limit) { const char *cur_filename = NULL; u32 cur_filename_len = 0; BUG_ON(event_data->filename == NULL && event_data->fil...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
int ima_eventsig_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { struct evm_ima_xattr_data *xattr_value = event_data->xattr_value; if (!xattr_value || (xattr_value->type != EVM_IMA_XATTR_DIGSIG && xattr_value->type != IMA_VERITY_DIGSIG)) ...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
int ima_eventbuf_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { if ((!event_data->buf) || (event_data->buf_len == 0)) return 0; return ima_write_template_field_data(event_data->buf, event_data->buf_len, DATA_FMT_HEX, fie...
[ 1, 0 ]
Linux Kernel
security/integrity/ima/ima_template_lib.c
int ima_eventinodeuid_init(struct ima_event_data *event_data, struct ima_field_data *field_data) { return ima_eventinodedac_init_common(event_data, field_data, true); }
[ 0, 0 ]
Linux Kernel
security/integrity/integrity.h
static inline int integrity_init_keyring(const unsigned int id) { return 0; }
[ 0, 0 ]
Linux Kernel
security/integrity/integrity.h
static inline int asymmetric_verify(struct key *keyring, const char *sig, int siglen, const char *data, int datalen) { return -EOPNOTSUPP; } #endif
[ 0, 0 ]
Linux Kernel
security/integrity/integrity.h
static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result, int info) {}
[ 0, 0 ]
Linux Kernel
security/integrity/integrity.h
static inline void __init add_to_platform_keyring(const char *source, const void *data, size_t len) {} #endif #ifdef CONFIG_INTEGRITY_MACHINE_KEYRING
[ 0, 0 ]
Linux Kernel
security/integrity/integrity_audit.c
void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result, int audit_info) { integrity_audit_message(audit_msgno, inode, fname, op, cause, result, audit_info, 0);...
[ 0, 0 ]
Linux Kernel
security/integrity/integrity_audit.c
void integrity_audit_message(int audit_msgno, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result, int audit_info, int errno) { struct audit_buffer *ab; char name[TASK_COMM_LEN]; if (...
[ 1, 0 ]
Linux Kernel
security/integrity/platform_certs/efi_parser.c
int __init parse_efi_signature_list( const char *source, const void *data, size_t size, efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *)) { efi_element_handler_t handler; unsigned int offs = 0; pr_devel("-->%s(,%zu)\n", __func__, size); while (size > 0) { const efi_signature_data_...
[ 1, 0 ]
Linux Kernel
security/integrity/platform_certs/load_powerpc.c
static __init void *get_cert_list(u8 *key, unsigned long keylen, uint64_t *size) { int rc; void *db; rc = secvar_ops->get(key, keylen, NULL, size); if (rc) { pr_err("Couldn't get size: %d\n", rc); return NULL; } db = kmalloc(*size, GFP_KERNEL); if (!db) retu...
[ 0, 0 ]
Linux Kernel
security/integrity/platform_certs/load_uefi.c
static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, unsigned long *size, efi_status_t *status) { unsigned long lsize = 4; unsigned long tmpdb[4]; void *db; *status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb); if (*status == EFI_NOT_FOUND) ret...
[ 1, 0 ]
Linux Kernel
security/integrity/platform_certs/load_uefi.c
static int __init load_moklist_certs(void) { struct efi_mokvar_table_entry *mokvar_entry; efi_guid_t mok_var = EFI_SHIM_LOCK_GUID; void *mok; unsigned long moksize; efi_status_t status; int rc; mokvar_entry = efi_mokvar_entry_find("MokListRT"); if (mokvar_entry) { rc = parse_efi_signature_list("UEF...
[ 0, 0 ]
Linux Kernel
security/integrity/platform_certs/machine_keyring.c
static __init bool uefi_check_trust_mok_keys(void) { struct efi_mokvar_table_entry *mokvar_entry; mokvar_entry = efi_mokvar_entry_find("MokListTrustedRT"); if (mokvar_entry) return true; return false; }
[ 0, 0 ]
Linux Kernel
security/integrity/platform_certs/machine_keyring.c
bool __init trust_moklist(void) { static bool initialized; if (!initialized) { initialized = true; if (uefi_check_trust_mok_keys()) trust_mok = true; } return trust_mok; }
[ 0, 0 ]
Linux Kernel
security/keys/big_key.c
void big_key_free_preparse(struct key_preparsed_payload *prep) { struct big_key_payload *payload = to_big_key_payload(prep->payload); if (prep->datalen > BIG_KEY_FILE_THRESHOLD) path_put(&payload->path); kfree_sensitive(payload->data); }
[ 0, 0 ]
Linux Kernel
security/keys/big_key.c
void big_key_destroy(struct key *key) { struct big_key_payload *payload = to_big_key_payload(key->payload); if (payload->length > BIG_KEY_FILE_THRESHOLD) { path_put(&payload->path); payload->path.mnt = NULL; payload->path.dentry = NULL; } kfree_sensitive(payload->data); payload->data = NULL; }
[ 0, 0 ]
Linux Kernel
security/keys/big_key.c
int big_key_update(struct key *key, struct key_preparsed_payload *prep) { int ret; ret = key_payload_reserve(key, prep->datalen); if (ret < 0) return ret; if (key_is_positive(key)) big_key_destroy(key); return generic_key_instantiate(key, prep); }
[ 0, 0 ]
Linux Kernel
security/keys/dh.c
static int keyctl_dh_compute_kdf(struct crypto_shash *hash, char __user *buffer, size_t buflen, uint8_t *kbuf, size_t kbuflen) { struct kvec kbuf_iov = {.iov_base = kbuf, .iov_len = kbuflen}; uint8_t *outbuf = NULL; int ret; size_t outbuf_len = roundup(buflen, crypto_shash_dige...
[ 0, 0 ]
Linux Kernel
security/keys/encrypted-keys/ecryptfs_format.c
int ecryptfs_fill_auth_tok(struct ecryptfs_auth_tok *auth_tok, const char *key_desc) { int major, minor; ecryptfs_get_versions(&major, &minor, NULL); auth_tok->version = (((uint16_t)(major << 8) & 0xFF00) | ((uint16_t)minor & 0x00FF)); auth_tok->token_type = ECRYPTFS_PASSWORD; ...
[ 1, 1 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static struct skcipher_request *init_skcipher_req(const u8 *key, unsigned int key_len) { struct skcipher_request *req; struct crypto_skcipher *tfm; int ret; tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) { pr_err("encry...
[ 0, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static int datablob_hmac_append(struct encrypted_key_payload *epayload, const u8 *master_key, size_t master_keylen) { u8 derived_key[HASH_SIZE]; u8 *digest; int ret; ret = get_derived_key(derived_key, AUTH_KEY, master_key, master_keylen); if (ret < 0) goto out; digest ...
[ 1, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static void __ekey_init(struct encrypted_key_payload *epayload, const char *format, const char *master_desc, const char *datalen) { unsigned int format_len; format_len = (!format) ? strlen(key_format_default) : strlen(format); epayload->format = epayload->payload_...
[ 1, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static int encrypted_update(struct key *key, struct key_preparsed_payload *prep) { struct encrypted_key_payload *epayload = key->payload.data[0]; struct encrypted_key_payload *new_epayload; char *buf; char *new_master_desc = NULL; const char *format = NULL; size_t datalen = prep-...
[ 1, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static long encrypted_read(const struct key *key, char *buffer, size_t buflen) { struct encrypted_key_payload *epayload; struct key *mkey; const u8 *master_key; size_t master_keylen; char derived_key[HASH_SIZE]; char *ascii_buf; size_t asciiblob_len; int ret; epayload = dereference_key_locked(key); ...
[ 1, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.c
static void __exit cleanup_encrypted(void) { crypto_free_shash(hash_tfm); unregister_key_type(&key_type_encrypted); }
[ 0, 0 ]
Linux Kernel
security/keys/encrypted-keys/encrypted.h
static inline void dump_encrypted_data(struct encrypted_key_payload *epayload, unsigned int encrypted_datalen) {}
[ 0, 0 ]
Linux Kernel
security/keys/gc.c
void key_schedule_gc(time64_t gc_at) { unsigned long expires; time64_t now = ktime_get_real_seconds(); kenter("%lld", gc_at - now); if (gc_at <= now || test_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags)) { kdebug("IMMEDIATE"); schedule_work(&key_gc_work); } else if (gc_at < key_gc_next_run) { kdebug("...
[ 0, 0 ]
Linux Kernel
security/keys/gc.c
void key_gc_keytype(struct key_type *ktype) { kenter("%s", ktype->name); key_gc_dead_keytype = ktype; set_bit(KEY_GC_REAPING_KEYTYPE, &key_gc_flags); smp_mb(); set_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags); kdebug("schedule"); schedule_work(&key_gc_work); kdebug("sleep"); wait_on_bit(&key_gc_flags, K...
[ 0, 0 ]
Linux Kernel
security/keys/gc.c
static noinline void key_gc_unused_keys(struct list_head *keys) { while (!list_empty(keys)) { struct key *key = list_entry(keys->next, struct key, graveyard_link); short state = key->state; list_del(&key->graveyard_link); kdebug("- %u", key->serial); key_check(key); #ifdef CONFIG_KEY_NOTIFICATI...
[ 1, 0 ]
Linux Kernel
security/keys/internal.h
static inline long keyctl_get_persistent(uid_t uid, key_serial_t destring) { return -EOPNOTSUPP; } #endif
[ 0, 0 ]
Linux Kernel
security/keys/internal.h
static inline long keyctl_pkey_query(key_serial_t id, const char __user *_info, struct keyctl_pkey_query __user *_res) { return -EOPNOTSUPP; }
[ 0, 0 ]
Linux Kernel
security/keys/key.c
static void mark_key_instantiated(struct key *key, int reject_error) { smp_store_release(&key->state, (reject_error < 0) ? reject_error : KEY_IS_POSITIVE); }
[ 0, 0 ]
Linux Kernel
security/keys/key.c
void key_put(struct key *key) { if (key) { key_check(key); if (refcount_dec_and_test(&key->usage)) schedule_work(&key_gc_work); } }
[ 0, 0 ]
Linux Kernel
security/keys/key.c
int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep) { int ret; pr_devel("==>%s()\n", __func__); ret = key_payload_reserve(key, prep->quotalen); if (ret == 0) { rcu_assign_keypointer(key, prep->payload.data[0]); key->payload.data[1] = prep->paylo...
[ 0, 0 ]
Linux Kernel
security/keys/key.c
void __init key_init(void) { key_jar = kmem_cache_create("key_jar", sizeof(struct key), 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); /* add the special key types */ list_add_tail(&key_type_keyring.link, &key_types_list); list_add_tail(&key_type_dead.link, &key_types_list); list_a...
[ 1, 0 ]
Linux Kernel
security/keys/keyctl.c
long keyctl_keyring_link(key_serial_t id, key_serial_t ringid) { key_ref_t keyring_ref, key_ref; long ret; keyring_ref = lookup_user_key(ringid, KEY_LOOKUP_CREATE, KEY_NEED_WRITE); if (IS_ERR(keyring_ref)) { ret = PTR_ERR(keyring_ref); goto error; } key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE,...
[ 0, 0 ]
Linux Kernel
security/keys/keyctl.c
long keyctl_keyring_move(key_serial_t id, key_serial_t from_ringid, key_serial_t to_ringid, unsigned int flags) { key_ref_t key_ref, from_ref, to_ref; long ret; if (flags & ~KEYCTL_MOVE_EXCL) return -EINVAL; key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); if (IS...
[ 0, 0 ]
Linux Kernel
security/keys/keyctl.c
long keyctl_instantiate_key_iov(key_serial_t id, const struct iovec __user *_payload_iov, unsigned ioc, key_serial_t ringid) { struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; struct iov_iter from; long ret; if (!_payload_iov) ioc = 0; ...
[ 0, 0 ]
Linux Kernel
security/keys/keyctl.c
long keyctl_reject_key(key_serial_t id, unsigned timeout, unsigned error, key_serial_t ringid) { const struct cred *cred = current_cred(); struct request_key_auth *rka; struct key *instkey, *dest_keyring; long ret; kenter("%d,%u,%u,%d", id, timeout, error, ringid); if (error <= 0 ||...
[ 1, 0 ]
Linux Kernel
security/keys/keyctl.c
long keyctl_capabilities(unsigned char __user *_buffer, size_t buflen) { size_t size = buflen; if (size > 0) { if (size > sizeof(keyrings_capabilities)) size = sizeof(keyrings_capabilities); if (copy_to_user(_buffer, keyrings_capabilities, size) != 0) return -EFAULT; if (size < buflen && cl...
[ 1, 0 ]
Linux Kernel
security/keys/keyctl_pkey.c
static int keyctl_pkey_params_get_2(const struct keyctl_pkey_params __user *_params, const char __user *_info, int op, struct kernel_pkey_params *params) { struct keyctl_pkey_params uparams; struct kernel_pkey_query info; int ret; memset(params, 0, sizeof(*para...
[ 1, 0 ]
Linux Kernel
security/keys/keyctl_pkey.c
long keyctl_pkey_query(key_serial_t id, const char __user *_info, struct keyctl_pkey_query __user *_res) { struct kernel_pkey_params params; struct kernel_pkey_query res; long ret; ret = keyctl_pkey_params_get(id, _info, &params); if (ret < 0) goto error; ret = params.key->type-...
[ 1, 0 ]
Linux Kernel
security/keys/keyring.c
static inline bool keyring_ptr_is_keyring(const struct assoc_array_ptr *x) { return (unsigned long)x & KEYRING_PTR_SUBTYPE; }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
void key_remove_domain(struct key_tag *domain_tag) { domain_tag->removed = true; if (!key_put_tag(domain_tag)) key_schedule_gc_links(); }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
static bool keyring_compare_object(const void *object, const void *data) { const struct keyring_index_key *index_key = data; const struct key *key = keyring_ptr_to_key(object); return key->index_key.type == index_key->type && key->index_key.domain_tag == index_key->domain_tag && key->index_key...
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
static void keyring_describe(const struct key *keyring, struct seq_file *m) { if (keyring->description) seq_puts(m, keyring->description); else seq_puts(m, "[anon]"); if (key_is_positive(keyring)) { if (keyring->keys.nr_leaves_on_tree != 0) seq_printf(m, ": %lu", keyring->keys.nr_leaves_on_tree...
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
int restrict_link_reject(struct key *keyring, const struct key_type *type, const union key_payload *payload, struct key *restriction_key) { return -EPERM; }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
key_ref_t keyring_search(key_ref_t keyring, struct key_type *type, const char *description, bool recurse) { struct keyring_search_context ctx = { .index_key.type = type, .index_key.description = description, .index_key.desc_len = strlen(description), .cred = current_cr...
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
static struct key_restriction * keyring_restriction_alloc(key_restrict_link_func_t check) { struct key_restriction *keyres = kzalloc(sizeof(struct key_restriction), GFP_KERNEL); if (!keyres) return ERR_PTR(-ENOMEM); keyres->check = check; return keyres; }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
key_ref_t find_key_to_update(key_ref_t keyring_ref, const struct keyring_index_key *index_key) { struct key *keyring, *key; const void *object; keyring = key_ref_to_ptr(keyring_ref); kenter("{%d},{%s,%s}", keyring->serial, index_key->type->name, index_key->description); ...
[ 1, 0 ]
Linux Kernel
security/keys/keyring.c
int __key_link_lock(struct key *keyring, const struct keyring_index_key *index_key) __acquires(&keyring->sem)
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
void __key_link(struct key *keyring, struct key *key, struct assoc_array_edit **_edit) { __key_get(key); assoc_array_insert_set_object(*_edit, keyring_key_to_ptr(key)); assoc_array_apply_edit(*_edit); *_edit = NULL; notify_key(keyring, NOTIFY_KEY_LINKED, key_serial(key)); }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
static int __key_link_check_restriction(struct key *keyring, struct key *key) { if (!keyring->restrict_link || !keyring->restrict_link->check) return 0; return keyring->restrict_link->check(keyring, key->type, &key->payload, keyring->restrict_link->key); }
[ 1, 0 ]
Linux Kernel
security/keys/keyring.c
static void keyring_revoke(struct key *keyring) { struct assoc_array_edit *edit; edit = assoc_array_clear(&keyring->keys, &keyring_assoc_array_ops); if (!IS_ERR(edit)) { if (edit) assoc_array_apply_edit(edit); key_payload_reserve(keyring, 0); } }
[ 0, 0 ]
Linux Kernel
security/keys/keyring.c
static int keyring_gc_check_iterator(const void *object, void *iterator_data) { const struct key *key = keyring_ptr_to_key(object); time64_t *limit = iterator_data; key_check(key); return key_is_dead(key, *limit); }
[ 0, 0 ]
Linux Kernel
security/keys/persistent.c
static long key_get_persistent(struct user_namespace *ns, kuid_t uid, key_ref_t dest_ref) { struct keyring_index_key index_key; struct key *persistent; key_ref_t reg_ref, persistent_ref; char buf[32]; long ret; memset(&index_key, 0, sizeof(index_key)); index_key.type = &key...
[ 1, 0 ]
Linux Kernel
security/keys/proc.c
static void *proc_key_users_start(struct seq_file *p, loff_t *_pos) __acquires(key_user_lock) { struct rb_node *_p; loff_t pos = *_pos; spin_lock(&key_user_lock); _p = key_user_first(seq_user_ns(p), &key_user_tree); while (pos > 0 && _p) { pos--; _p = key_user_next(seq_user_ns(p), _p); } r...
[ 0, 0 ]
Linux Kernel
security/keys/proc.c
static void proc_key_users_stop(struct seq_file *p, void *v) __releases(key_user_lock) { spin_unlock(&key_user_lock); }
[ 0, 0 ]
Linux Kernel
security/keys/process_keys.c
void key_fsuid_changed(struct cred *new_cred) { if (new_cred->thread_keyring) { down_write(&new_cred->thread_keyring->sem); new_cred->thread_keyring->uid = new_cred->fsuid; up_write(&new_cred->thread_keyring->sem); } }
[ 0, 0 ]
Linux Kernel
security/keys/process_keys.c
bool lookup_user_key_possessed(const struct key *key, const struct key_match_data *match_data) { return key == match_data->raw_data; }
[ 0, 0 ]
Linux Kernel
security/keys/request_key.c
static struct key *construct_key_and_link(struct keyring_search_context *ctx, const char *callout_info, size_t callout_len, void *aux, struct key *dest_keyring, ...
[ 0, 0 ]
Linux Kernel
security/keys/request_key_auth.c
static long request_key_auth_read(const struct key *key, char *buffer, size_t buflen) { struct request_key_auth *rka = dereference_key_locked(key); size_t datalen; long ret; if (!rka) return -EKEYREVOKED; datalen = rka->callout_len; ret = datalen; if (buffer && buf...
[ 1, 0 ]
Linux Kernel
security/keys/request_key_auth.c
static void request_key_auth_destroy(struct key *key) { struct request_key_auth *rka = rcu_access_pointer(key->payload.rcu_data0); kenter("{%d}", key->serial); if (rka) { rcu_assign_keypointer(key, NULL); call_rcu(&rka->rcu, request_key_auth_rcu_disposal); } }
[ 0, 0 ]
Linux Kernel
security/keys/request_key_auth.c
struct key *key_get_instantiation_authkey(key_serial_t target_id) { char description[16]; struct keyring_search_context ctx = { .index_key.type = &key_type_request_key_auth, .index_key.description = description, .cred = current_cred(), .match_data.cmp = key_default_cmp, .match_data.raw...
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_caam.c
static int trusted_caam_unseal(struct trusted_key_payload *p, char *datablob) { int ret; struct caam_blob_info info = { .input = p->blob, .input_len = p->blob_len, .output = p->key, .output_len = MAX_KEY_SIZE, .key_mod = KEYMOD, .key_mod_len = sizeof(KEYMOD) - 1, }; ret = c...
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_caam.c
static void trusted_caam_exit(void) { unregister_key_type(&key_type_trusted); caam_blob_gen_exit(blobifier); }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_core.c
static void trusted_destroy(struct key *key) { kfree_sensitive(key->payload.data[0]); }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_core.c
static int kernel_get_random(unsigned char *key, size_t key_len) { return get_random_bytes_wait(key, key_len) ?: key_len; }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tee.c
static int trusted_key_probe(struct device *dev) { struct tee_client_device *rng_device = to_tee_client_device(dev); int ret; struct tee_ioctl_open_session_arg sess_arg; memset(&sess_arg, 0, sizeof(sess_arg)); pvt_data.ctx = tee_client_open_context(NULL, optee_ctx_match, NULL, NULL); if (IS_ERR(pvt_data....
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static struct sdesc *init_sdesc(struct crypto_shash *alg) { struct sdesc *sdesc; int size; size = sizeof(struct shash_desc) + crypto_shash_descsize(alg); sdesc = kmalloc(size, GFP_KERNEL); if (!sdesc) return ERR_PTR(-ENOMEM); sdesc->shash.tfm = alg; return sdesc; }
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
int TSS_authhmac(unsigned char *digest, const unsigned char *key, unsigned int keylen, unsigned char *h1, unsigned char *h2, unsigned int h3, ...) { unsigned char paramdigest[SHA1_DIGEST_SIZE]; struct sdesc *sdesc; unsigned int dlen; unsigned char *data; unsigned char c; in...
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
int trusted_tpm_send(unsigned char *cmd, size_t buflen) { int rc; if (!chip) return -ENODEV; dump_tpm_buf(cmd); rc = tpm_send(chip, cmd, buflen); dump_tpm_buf(cmd); if (rc > 0) rc = -EPERM; return rc; }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static int pcrlock(const int pcrnum) { if (!capable(CAP_SYS_ADMIN)) return -EPERM; return tpm_pcr_extend(chip, pcrnum, digests) ? -EINVAL : 0; }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static int osap(struct tpm_buf *tb, struct osapsess *s, const unsigned char *key, uint16_t type, uint32_t handle) { unsigned char enonce[TPM_NONCE_SIZE]; unsigned char ononce[TPM_NONCE_SIZE]; int ret; ret = tpm_get_random(chip, ononce, TPM_NONCE_SIZE); if (ret < 0) return ret; if (ret ...
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static int key_unseal(struct trusted_key_payload *p, struct trusted_key_options *o) { struct tpm_buf tb; int ret; ret = tpm_buf_init(&tb, 0, 0); if (ret) return ret; ret = tpm_unseal(&tb, o->keyhandle, o->keyauth, p->blob, p->blob_len, o->blobauth, p->key, &p->ke...
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static struct trusted_key_options *trusted_options_alloc(void) { struct trusted_key_options *options; int tpm2; tpm2 = tpm_is_tpm2(chip); if (tpm2 < 0) return NULL; options = kzalloc(sizeof *options, GFP_KERNEL); if (options) { options->keytype = SRK_keytype; if (!tpm2) options->keyhan...
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static int trusted_tpm_get_random(unsigned char *key, size_t key_len) { return tpm_get_random(chip, key, key_len); }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm1.c
static void trusted_shash_release(void) { if (hashalg) crypto_free_shash(hashalg); if (hmacalg) crypto_free_shash(hmacalg); }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm2.c
static int tpm2_key_decode(struct trusted_key_payload *payload, struct trusted_key_options *options, u8 **buf) { int ret; struct tpm2_key_context ctx; u8 *blob; memset(&ctx, 0, sizeof(ctx)); ret = asn1_ber_decoder(&tpm2key_decoder, &ctx, payload->blob, pa...
[ 1, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm2.c
int tpm2_key_pub(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen) { struct tpm2_key_context *ctx = context; ctx->pub = value; ctx->pub_len = vlen; return 0; }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm2.c
int tpm2_key_priv(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen) { struct tpm2_key_context *ctx = context; ctx->priv = value; ctx->priv_len = vlen; return 0; }
[ 0, 0 ]
Linux Kernel
security/keys/trusted-keys/trusted_tpm2.c
int tpm2_unseal_trusted(struct tpm_chip *chip, struct trusted_key_payload *payload, struct trusted_key_options *options) { u32 blob_handle; int rc; rc = tpm_try_get_ops(chip); if (rc) return rc; rc = tpm2_load_cmd(chip, payload, options, &blob_handle); i...
[ 0, 0 ]
Linux Kernel
security/keys/user_defined.c
int user_update(struct key *key, struct key_preparsed_payload *prep) { struct user_key_payload *zap = NULL; int ret; ret = key_payload_reserve(key, prep->datalen); if (ret < 0) return ret; /* attach the new data, displacing the old */ key->expiry = prep->expiry; if (key_is_positive(key)) zap = d...
[ 0, 0 ]
Linux Kernel
security/keys/user_defined.c
void user_destroy(struct key *key) { struct user_key_payload *upayload = key->payload.data[0]; kfree_sensitive(upayload); }
[ 0, 0 ]
Linux Kernel
security/landlock/cred.c
static void hook_cred_free(struct cred *const cred) { struct landlock_ruleset *const dom = landlock_cred(cred)->domain; if (dom) landlock_put_ruleset_deferred(dom); }
[ 0, 0 ]
Linux Kernel
security/landlock/cred.h
static inline const struct landlock_ruleset *landlock_get_current_domain(void) { return landlock_cred(current_cred())->domain; }
[ 0, 0 ]
Linux Kernel
security/landlock/cred.h
static inline bool landlocked(const struct task_struct *const task) { bool has_dom; if (task == current) return !!landlock_get_current_domain(); rcu_read_lock(); has_dom = !!landlock_get_task_domain(task); rcu_read_unlock(); return has_dom; }
[ 0, 0 ]
Linux Kernel
security/landlock/fs.c
int landlock_append_fs_rule(struct landlock_ruleset *const ruleset, const struct path *const path, access_mask_t access_rights) { int err; struct landlock_object *object; if (!d_is_dir(path->dentry) && (access_rights | ACCESS_FILE) != ACCESS_FILE) retur...
[ 1, 0 ]
Linux Kernel
security/landlock/fs.c
static inline int check_access_path(const struct landlock_ruleset *const domain, const struct path *const path, access_mask_t access_request) { layer_mask_t layer_masks[LANDLOCK_NUM_ACCESS_FS] = {}; access_request = init_layer_masks(domain, a...
[ 0, 0 ]
Linux Kernel
security/landlock/fs.c
static int hook_move_mount(const struct path *const from_path, const struct path *const to_path) { if (!landlock_get_current_domain()) return 0; return -EPERM; }
[ 0, 0 ]
Linux Kernel
security/landlock/fs.c
static int hook_sb_pivotroot(const struct path *const old_path, const struct path *const new_path) { if (!landlock_get_current_domain()) return 0; return -EPERM; }
[ 0, 0 ]
Linux Kernel
security/landlock/fs.c
static int hook_file_open(struct file *const file) { layer_mask_t layer_masks[LANDLOCK_NUM_ACCESS_FS] = {}; access_mask_t open_access_request, full_access_request, allowed_access; const access_mask_t optional_access = LANDLOCK_ACCESS_FS_TRUNCATE; const struct landlock_ruleset *const dom = landlock_get_current_d...
[ 1, 0 ]
Linux Kernel
security/landlock/fs.h
static inline struct landlock_inode_security * landlock_inode(const struct inode *const inode) { return inode->i_security + landlock_blob_sizes.lbs_inode; }
[ 0, 0 ]
Linux Kernel
security/landlock/object.h
static inline void landlock_get_object(struct landlock_object *const object) { if (object) refcount_inc(&object->usage); }
[ 0, 0 ]
Linux Kernel
security/landlock/ptrace.c
__init void landlock_add_ptrace_hooks(void) { security_add_hooks(landlock_hooks, ARRAY_SIZE(landlock_hooks), LANDLOCK_NAME); }
[ 0, 0 ]