| Function report | 
| Source Code: security\keys\key.c | Create Date:2022-07-28 18:15:25 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:Allocate a serial number for a key. These are assigned randomly to avoid* security issues through covert channel problems.
Proto:static inline void key_alloc_serial(struct key *key)
Type:void
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct key * | key | 
| 140 | Do | 
| 141 | get_random_bytes( & key serial number , size of key serial number ) | 
| 143 | key serial number >>= 1 | 
| 144 | When key serial number < 3 cycle | 
| 146 | spin_lock( & key_serial_lock) | 
| 148 | attempt_insertion : | 
| 149 | parent = NULL | 
| 154 | xkey = rb_entry(parent, structkey, serial_node) | 
| 156 | If key serial number < key serial number Then p = rb_left | 
| 158 | Else if key serial number > key serial number Then p = rb_right | 
| 160 | Else Go to serial_exists | 
| 165 | rb_link_node( & serial_node, parent, p) | 
| 166 | rb_insert_color( & serial_node, & ree of keys indexed by serial ) | 
| 168 | spin_unlock( & key_serial_lock) | 
| 169 | Return | 
| 173 | serial_exists : | 
| 174 | cycle | 
| 175 | key serial number ++ | 
| 176 | If key serial number < 3 Then | 
| 177 | key serial number = 3 | 
| 178 | Go to attempt_insertion | 
| 182 | If Not parent Then Go to attempt_insertion | 
| 185 | xkey = rb_entry(parent, structkey, serial_node) | 
| 186 | If key serial number < key serial number Then Go to attempt_insertion | 
| Name | Describe | 
|---|---|
| key_alloc | 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. | 
| 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 |