Function report |
Source Code:security\keys\key.c |
Create Date:2022-07-28 18:15:36 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:key_alloc - Allocate a key of the specified type.*@type: The type of key to allocate.*@desc: The key description to allow the key to be searched out.*@uid: The owner of the new key.*@gid: The group ID for the new key's group permissions.
Proto:struct key *key_alloc(struct key_type *type, const char *desc, kuid_t uid, kgid_t gid, const struct cred *cred, key_perm_t perm, unsigned long flags, struct key_restriction *restrict_link)
Type:struct key
Parameter:
Type | Parameter | Name |
---|---|---|
struct key_type * | type | |
const char * | desc | |
kuid_t | uid | |
kgid_t | gid | |
const struct cred * | cred | |
key_perm_t | perm | |
unsigned long | flags | |
struct key_restriction * | restrict_link |
238 | If vet_description Then |
250 | user = Get the key quota record for a user, allocating a new record if one doesn't* already exist. |
251 | If Not user Then Go to no_memory_1 |
257 | maxkeys = If uid_eq(uid, GLOBAL_ROOT_UID) Then 's key count quota Else general key count quota |
259 | maxbytes = If uid_eq(uid, GLOBAL_ROOT_UID) Then 's key space quota Else general key space quota |
263 | If Not (flags & add to quota, permit even if overrun ) Then |
272 | spin_unlock( & lock) |
277 | If Not key Then Go to no_memory_2 |
282 | If Not description Then Go to no_memory_3 |
285 | key_set_index_key( & index_key) |
288 | init_rwsem( & change vs change sem ) |
289 | lockdep_set_class( & change vs change sem , & key->sem lock class ) |
290 | owner of this key = user |
295 | access permissions = perm |
299 | If Not (flags & in quota ) Then status flags (change with bitops) |= 1 << set if key consumes quota |
301 | If flags & Key is built into kernel Then status flags (change with bitops) |= 1 << set if key is built in to the kernel |
303 | If flags & allocating a user or user session keyring Then status flags (change with bitops) |= 1 << set if key is a user or user session keyring |
311 | ret = security_key_alloc(key, cred, flags) |
312 | If ret < 0 Then Go to security_error |
317 | atomic_inc( & umber of keys ) |
320 | error : |
321 | Return key |
323 | security_error : |
324 | kfree(description) |
325 | kmem_cache_free(key_jar, key) |
330 | spin_unlock( & lock) |
334 | Go to error |
336 | no_memory_3 : |
337 | kmem_cache_free(key_jar, key) |
338 | no_memory_2 : |
343 | spin_unlock( & lock) |
346 | no_memory_1 : |
348 | Go to error |
350 | no_quota : |
351 | spin_unlock( & lock) |
354 | Go to error |
Name | Describe |
---|---|
key_create_or_update | key_create_or_update - Update or create and instantiate a key.*@keyring_ref: A pointer to the destination keyring with possession flag.*@type: The type of key.*@description: The searchable description for the key. |
keyring_alloc | Allocate a keyring and link into the destination keyring. |
construct_alloc_key | Allocate a new key in under-construction state and attempt to link it in to* the requested keyring.* May return a key that's already under construction instead if there was a* race between two thread calling request_key(). |
request_key_auth_new | Create an authorisation token for /sbin/request-key or whoever to gain* access to the caller's security data. |
add_new_master_key | Allocate a new fscrypt_master_key which contains the given secret, set it as* the payload of a new 'struct key' of type fscrypt, and link the 'struct key'* into the given keyring. Synchronized by fscrypt_add_key_mutex. |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |