/linux/samples/bpf/ |
H A D | hash_func01.h | 3 * Based on Paul Hsieh's (LGPG 2.1) hash function 4 * From: http://www.azillionmonkeys.com/qed/hash.html 11 __u32 hash = initval; in SuperFastHash() local 23 hash += get16bits (data); in SuperFastHash() 24 tmp = (get16bits (data+2) << 11) ^ hash; in SuperFastHash() 25 hash = (hash << 16) ^ tmp; in SuperFastHash() 27 hash += hash >> 11; in SuperFastHash() 32 case 3: hash += get16bits (data); in SuperFastHash() 33 hash ^= hash << 16; in SuperFastHash() 34 hash ^= ((signed char)data[sizeof (__u16)]) << 18; in SuperFastHash() [all …]
|
/linux/net/batman-adv/ |
H A D | hash.c | 7 #include "hash.h" 14 /* clears the hash */ 15 static void batadv_hash_init(struct batadv_hashtable *hash) in batadv_hash_init() argument 19 for (i = 0; i < hash->size; i++) { in batadv_hash_init() 20 INIT_HLIST_HEAD(&hash->table[i]); in batadv_hash_init() 21 spin_lock_init(&hash->list_locks[i]); in batadv_hash_init() 24 atomic_set(&hash->generation, 0); in batadv_hash_init() 28 * batadv_hash_destroy() - Free only the hashtable and the hash itself 29 * @hash: hash object to destroy 31 void batadv_hash_destroy(struct batadv_hashtable *hash) in batadv_hash_destroy() argument [all …]
|
H A D | hash.h | 44 /** @list_locks: spinlock for each hash list entry */ 54 /* allocates and clears the hash */ 58 void batadv_hash_set_lock_class(struct batadv_hashtable *hash, 61 /* free only the hashtable and the hash itself. */ 62 void batadv_hash_destroy(struct batadv_hashtable *hash); 66 * @hash: storage hash table 67 * @compare: callback to determine if 2 hash elements are identical 68 * @choose: callback calculating the hash index 72 * Return: 0 on success, 1 if the element already is in the hash 75 static inline int batadv_hash_add(struct batadv_hashtable *hash, in batadv_hash_add() argument [all …]
|
/linux/net/ceph/crush/ |
H A D | hash.c | 3 # include <linux/crush/hash.h> 5 # include "hash.h" 10 * https://burtleburtle.net/bob/hash/evahash.html 29 __u32 hash = crush_hash_seed ^ a; in crush_hash32_rjenkins1() local 33 crush_hashmix(b, x, hash); in crush_hash32_rjenkins1() 34 crush_hashmix(y, a, hash); in crush_hash32_rjenkins1() 35 return hash; in crush_hash32_rjenkins1() 40 __u32 hash = crush_hash_seed ^ a ^ b; in crush_hash32_rjenkins1_2() local 43 crush_hashmix(a, b, hash); in crush_hash32_rjenkins1_2() 44 crush_hashmix(x, a, hash); in crush_hash32_rjenkins1_2() [all …]
|
/linux/drivers/net/xen-netback/ |
H A D | hash.c | 50 spin_lock_irqsave(&vif->hash.cache.lock, flags); in xenvif_add_hash() 54 list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, in xenvif_add_hash() 55 lockdep_is_held(&vif->hash.cache.lock)) { in xenvif_add_hash() 65 new->seq = atomic_inc_return(&vif->hash.cache.seq); in xenvif_add_hash() 66 list_add_rcu(&new->link, &vif->hash.cache.list); in xenvif_add_hash() 68 if (++vif->hash.cache.count > xenvif_hash_cache_size) { in xenvif_add_hash() 70 vif->hash.cache.count--; in xenvif_add_hash() 75 spin_unlock_irqrestore(&vif->hash.cache.lock, flags); in xenvif_add_hash() 86 val = xen_netif_toeplitz_hash(vif->hash.key, in xenvif_new_hash() 87 sizeof(vif->hash.key), in xenvif_new_hash() [all …]
|
/linux/include/linux/ |
H A D | stringhash.h | 7 #include <linux/hash.h> 10 * Routines for hashing strings of bytes to a 32-bit hash value. 12 * These hash functions are NOT GUARANTEED STABLE between kernel 18 * malicious inputs; much slower hash functions are required for that. 29 * unsigned long hash = init_name_hash; 31 * hash = partial_name_hash(tolower(*p++), hash); 32 * hash = end_name_hash(hash); 35 * abuses it to hash 16-bit values. 38 /* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ 41 /* partial hash update function. Assume roughly 4 bits per character */ [all …]
|
H A D | xxhash.h | 2 * xxHash - Extremely Fast Hash algorithm 44 * xxHash is an extremely fast Hash algorithm, running at RAM speed limits. 64 * Q.Score is a measure of quality of the hash function. 81 * Simple Hash Functions 85 * xxh32() - calculate the 32-bit hash of the input with a given seed. 87 * @input: The data to hash. 88 * @length: The length of the data to hash. 93 * Return: The 32-bit hash of the data. 98 * xxh64() - calculate the 64-bit hash of the input with a given seed. 100 * @input: The data to hash. [all …]
|
/linux/fs/verity/ |
H A D | hash_algs.c | 3 * fs-verity hash algorithms 10 #include <crypto/hash.h> 12 /* The hash algorithms supported by fs-verity */ 31 * fsverity_get_hash_alg() - validate and prepare a hash algorithm 33 * @num: the hash algorithm number 35 * Get the struct fsverity_hash_alg for the given hash algorithm number, and 36 * ensure it has a hash transform ready to go. The hash transforms are 40 * Return: pointer to the hash alg on success, else an ERR_PTR() 51 fsverity_warn(inode, "Unknown hash algorithm number: %u", num); in fsverity_get_hash_alg() 69 "Missing crypto API support for hash algorithm \"%s\"", in fsverity_get_hash_alg() [all …]
|
/linux/net/netfilter/ipset/ |
H A D | Kconfig | 56 tristate "hash:ip set support" 59 This option adds the hash:ip set type support, by which one 66 tristate "hash:ip,mark set support" 69 This option adds the hash:ip,mark set type support, by which one 75 tristate "hash:ip,port set support" 78 This option adds the hash:ip,port set type support, by which one 84 tristate "hash:ip,port,ip set support" 87 This option adds the hash:ip,port,ip set type support, by which 94 tristate "hash:ip,port,net set support" 97 This option adds the hash:ip,port,net set type support, by which [all …]
|
/linux/Documentation/admin-guide/device-mapper/ |
H A D | verity.rst | 21 This is the type of the on-disk hash format. 37 This is the device that supplies the hash tree data. It may be 44 Each block corresponds to one digest on the hash device. 47 The size of a hash block in bytes. 56 to the root block of the hash tree. 59 The cryptographic hash algorithm used for this device. This should 63 The hexadecimal encoding of the cryptographic hash of the root hash block 64 and the salt. This hash should be trusted as there is no other authenticity 105 Use forward error correction (FEC) to recover from corruption if hash 107 may be the same device where data and hash blocks reside, in which case [all …]
|
/linux/drivers/gpu/drm/vboxvideo/ |
H A D | vbox_hgsmi.c | 11 /* One-at-a-Time Hash from https://www.burtleburtle.net/bob/hash/doobs.html */ 12 static u32 hgsmi_hash_process(u32 hash, const u8 *data, int size) in hgsmi_hash_process() argument 15 hash += *data++; in hgsmi_hash_process() 16 hash += (hash << 10); in hgsmi_hash_process() 17 hash ^= (hash >> 6); in hgsmi_hash_process() 20 return hash; in hgsmi_hash_process() 23 static u32 hgsmi_hash_end(u32 hash) in hgsmi_hash_end() argument 25 hash += (hash << 3); in hgsmi_hash_end() 26 hash ^= (hash >> 11); in hgsmi_hash_end() 27 hash += (hash << 15); in hgsmi_hash_end() [all …]
|
/linux/fs/ext4/ |
H A D | hash.c | 3 * linux/fs/ext4/hash.c 102 /* The old legacy hash */ 105 __u32 hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; in dx_hack_hash_unsigned() local 109 hash = hash1 + (hash0 ^ (((int) *ucp++) * 7152373)); in dx_hack_hash_unsigned() 111 if (hash & 0x80000000) in dx_hack_hash_unsigned() 112 hash -= 0x7fffffff; in dx_hack_hash_unsigned() 114 hash0 = hash; in dx_hack_hash_unsigned() 121 __u32 hash, hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; in dx_hack_hash_signed() local 125 hash = hash1 + (hash0 ^ (((int) *scp++) * 7152373)); in dx_hack_hash_signed() 127 if (hash & 0x80000000) in dx_hack_hash_signed() [all …]
|
/linux/security/integrity/ima/ |
H A D | ima_crypto.c | 10 * Calculates md5/sha1 file hash, template hash, boot-aggreate hash 21 #include <crypto/hash.h> 81 pr_info("Allocated hash algorithm: %s\n", in ima_init_ima_crypto() 325 struct ima_digest_data *hash, in ima_calc_file_hash_atfm() argument 336 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm() 427 ahash_request_set_crypt(req, NULL, hash->digest, 0); in ima_calc_file_hash_atfm() 435 static int ima_calc_file_ahash(struct file *file, struct ima_digest_data *hash) in ima_calc_file_ahash() argument 440 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash() 444 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash() 452 struct ima_digest_data *hash, in ima_calc_file_hash_tfm() argument [all …]
|
/linux/drivers/net/ethernet/freescale/fman/ |
H A D | fman_mac.h | 75 /* HASH defines */ 196 static inline void free_hash_table(struct eth_hash_t *hash) in free_hash_table() argument 201 if (hash) { in free_hash_table() 202 if (hash->lsts) { in free_hash_table() 203 for (i = 0; i < hash->size; i++) { in free_hash_table() 205 dequeue_addr_from_hash_entry(&hash->lsts[i]); in free_hash_table() 209 dequeue_addr_from_hash_entry(&hash-> in free_hash_table() 214 kfree(hash->lsts); in free_hash_table() 217 kfree(hash); in free_hash_table() 224 struct eth_hash_t *hash; in alloc_hash_table() local [all …]
|
/linux/fs/ubifs/ |
H A D | auth.c | 13 #include <crypto/hash.h> 21 * __ubifs_node_calc_hash - calculate the hash of a UBIFS node 23 * @node: the node to calculate a hash for 24 * @hash: the returned hash 29 u8 *hash) in __ubifs_node_calc_hash() argument 34 hash); in __ubifs_node_calc_hash() 38 * ubifs_hash_calc_hmac - calculate a HMAC from a hash 40 * @hash: the node to calculate a HMAC for 45 static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash, 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() [all …]
|
/linux/certs/ |
H A D | blacklist.c | 2 /* System hash blacklist. 24 * the size of the currently longest supported hash algorithm is 512 bits, 44 * hex digits. The hash is kept in the description. 77 /* The hash is greater than MAX_HASH_LEN. */ in blacklist_vet_description() 146 static char *get_raw_hash(const u8 *hash, size_t hash_len, in get_raw_hash() argument 172 bin2hex(p, hash, hash_len); in get_raw_hash() 179 * mark_raw_hash_blacklisted - Add a hash to the system blacklist 180 * @hash: The hash as a hex string with a type prefix (eg. "tbs:23aa429783") 182 static int mark_raw_hash_blacklisted(const char *hash) in mark_raw_hash_blacklisted() argument 188 hash, in mark_raw_hash_blacklisted() [all …]
|
/linux/security/selinux/ss/ |
H A D | hashtab.h | 3 * A hash table (hashtab) maintains associations between 6 * functions for hash computation and key comparison are 22 u32 (*hash)(const void *key); /* hash func */ member 33 struct hashtab_node **htable; /* hash table */ 34 u32 size; /* number of slots in hash table */ 35 u32 nel; /* number of elements in hash table */ 45 * Initializes a new hash table with the specified characteristics. 55 * Inserts the specified (key, datum) pair into the specified hash table. 73 hvalue = key_params.hash(key) & (h->size - 1); in hashtab_insert() 92 * Searches for the entry with the specified key in the hash table. [all …]
|
/linux/Documentation/devicetree/bindings/crypto/ |
H A D | st,stm32-hash.yaml | 4 $id: http://devicetree.org/schemas/crypto/st,stm32-hash.yaml# 7 title: STMicroelectronics STM32 HASH 9 description: The STM32 HASH block is built on the HASH block found in 19 - st,stn8820-hash 20 - stericsson,ux500-hash 21 - st,stm32f456-hash 22 - st,stm32f756-hash 23 - st,stm32mp13-hash 68 const: stericsson,ux500-hash 83 hash@54002000 { [all …]
|
/linux/scripts/ |
H A D | get_dvb_firmware | 52 my $hash = "53970ec17a538945a6d8cb608a7b3899"; 60 verify("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $hash); 70 my $hash = "237938d53a7f834c05c42b894ca68ac3"; 80 verify("$tmpdir/ZEnglish/sc_main.mc", $hash); 89 my $hash = "2105fd5bf37842fbcdfa4bfd58f3594a"; 98 verify("$tmpdir/fwtmp", $hash); 107 my $hash = "6a7e1e2f2644b162ff0502367553c72d"; 116 verify("$tmpdir/fwtmp", $hash); 125 my $hash = "1ea24dee4eea8fe971686981f34fd2e0"; 134 verify("$tmpdir/fwtmp", $hash); [all …]
|
/linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/ |
H A D | flowring.c | 62 struct brcmf_flowring_hash *hash; in brcmf_flowring_lookup() local 85 hash = flow->hash; in brcmf_flowring_lookup() 87 if ((sta || (memcmp(hash[hash_idx].mac, mac, ETH_ALEN) == 0)) && in brcmf_flowring_lookup() 88 (hash[hash_idx].fifo == fifo) && in brcmf_flowring_lookup() 89 (hash[hash_idx].ifidx == ifidx)) { in brcmf_flowring_lookup() 97 return hash[hash_idx].flowid; in brcmf_flowring_lookup() 107 struct brcmf_flowring_hash *hash; in brcmf_flowring_create() local 130 hash = flow->hash; in brcmf_flowring_create() 132 if ((hash[hash_idx].ifidx == BRCMF_FLOWRING_INVALID_IFIDX) && in brcmf_flowring_create() 133 (is_zero_ether_addr(hash[hash_idx].mac))) { in brcmf_flowring_create() [all …]
|
/linux/drivers/net/ethernet/airoha/ |
H A D | airoha_ppe.c | 381 u32 hash, hv1, hv2, hv3; in airoha_ppe_foe_get_entry_hash() local 421 hash = (hv1 & hv2) | ((~hv1) & hv3); in airoha_ppe_foe_get_entry_hash() 422 hash = (hash >> 24) | ((hash & 0xffffff) << 8); in airoha_ppe_foe_get_entry_hash() 423 hash ^= hv1 ^ hv2 ^ hv3; in airoha_ppe_foe_get_entry_hash() 424 hash ^= hash >> 16; in airoha_ppe_foe_get_entry_hash() 425 hash &= PPE_NUM_ENTRIES - 1; in airoha_ppe_foe_get_entry_hash() 427 return hash; in airoha_ppe_foe_get_entry_hash() 430 static u32 airoha_ppe_foe_get_flow_stats_index(struct airoha_ppe *ppe, u32 hash) in airoha_ppe_foe_get_flow_stats_index() argument 433 return hash; in airoha_ppe_foe_get_flow_stats_index() 435 return hash >= PPE_STATS_NUM_ENTRIES ? hash - PPE1_STATS_NUM_ENTRIES in airoha_ppe_foe_get_flow_stats_index() [all …]
|
/linux/kernel/trace/ |
H A D | ftrace.c | 35 #include <linux/hash.h> 70 /* hash bits for specific function selection */ 434 struct hlist_head *hash; member 603 memset(stat->hash, 0, in ftrace_profile_reset() 670 if (stat->hash) { in ftrace_profile_init_cpu() 678 * functions are hit. We'll make a hash of 1024 items. in ftrace_profile_init_cpu() 682 stat->hash = kcalloc(size, sizeof(struct hlist_head), GFP_KERNEL); in ftrace_profile_init_cpu() 684 if (!stat->hash) in ftrace_profile_init_cpu() 689 kfree(stat->hash); in ftrace_profile_init_cpu() 690 stat->hash = NULL; in ftrace_profile_init_cpu() [all …]
|
/linux/security/apparmor/ |
H A D | crypto.c | 14 #include <crypto/hash.h> 31 char *hash; in aa_calc_hash() local 37 hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_hash() 38 if (!hash) in aa_calc_hash() 49 error = crypto_shash_final(desc, hash); in aa_calc_hash() 53 return hash; in aa_calc_hash() 56 kfree(hash); in aa_calc_hash() 74 profile->hash = kzalloc(apparmor_hash_size, GFP_KERNEL); in aa_calc_profile_hash() 75 if (!profile->hash) in aa_calc_profile_hash() 89 error = crypto_shash_final(desc, profile->hash); in aa_calc_profile_hash() [all …]
|
/linux/drivers/gpu/drm/vmwgfx/ |
H A D | vmwgfx_cmdbuf_res.c | 39 * @hash: Hash entry for the manager hash table. 47 struct vmwgfx_hash_item hash; member 56 * @resources: Hash table containing staged and committed command buffer 86 struct vmwgfx_hash_item *hash; in vmw_cmdbuf_res_lookup() local 89 hash_for_each_possible_rcu(man->resources, hash, head, key) { in vmw_cmdbuf_res_lookup() 90 if (hash->key == key) in vmw_cmdbuf_res_lookup() 91 return hlist_entry(hash, struct vmw_cmdbuf_res, hash)->res; in vmw_cmdbuf_res_lookup() 109 hash_del_rcu(&entry->hash.head); in vmw_cmdbuf_res_free() 170 hash_add_rcu(entry->man->resources, &entry->hash.head, in vmw_cmdbuf_res_revert() 171 entry->hash.key); in vmw_cmdbuf_res_revert() [all …]
|
/linux/drivers/md/dm-vdo/ |
H A D | dedupe.c | 9 * Hash Locks: 17 * Hash_locks are assigned to hash_zones by computing a modulus on the hash itself. Each hash_zone 49 * lock, releasing the hash_lock itself back to the hash zone (BYPASSING). 74 * on the hash zone thread. finish_locking() is called by (or continued via callback from) the 97 * to DEDUPE_CONTEXT_COMPLETE, and the associated data_vio will be enqueued to run back in the hash 219 /* The block hash covered by this lock */ 220 struct uds_record_name hash; member 298 /* The hash zones themselves */ 324 "%s called on hash zone thread", name); in assert_in_hash_zone() 338 * return_hash_lock_to_pool() - (Re)initialize a hash lock and return it to its pool. [all …]
|