| Function report | 
| Source Code: security\keys\dh.c | Create Date:2022-07-28 18:27:23 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:__keyctl_dh_compute
Proto:long __keyctl_dh_compute(struct keyctl_dh_params __user *params, char __user *buffer, size_t buflen, struct keyctl_kdf_params *kdfcopy)
Type:long
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct keyctl_dh_params __user * | params | |
| char __user * | buffer | |
| size_t | buflen | |
| struct keyctl_kdf_params * | kdfcopy | 
| 249 | If copy_from_user( & pcopy, params, size of pcopy ) != 0 Then | 
| 254 | If kdfcopy Then | 
| 262 | If buflen > KEYCTL_KDF_MAX_OUTPUT_LEN || otherinfolen > KEYCTL_KDF_MAX_OI_LEN Then | 
| 284 | dlen = dh_data_from_key(prime, & p) | 
| 285 | If dlen < 0 Then | 
| 291 | dlen = dh_data_from_key(base, & g) | 
| 292 | If dlen < 0 Then | 
| 298 | dlen = dh_data_from_key(private, & key) | 
| 299 | If dlen < 0 Then | 
| 305 | secretlen = rypto_dh_key_len() - Obtain the size of the private DH key*@params: private DH key* This function returns the packet DH key size | 
| 306 | secret = Allocation memory | 
| 307 | If Not secret Then | 
| 311 | ret = rypto_dh_encode_key() - encode the private key*@buf: Buffer allocated by the caller to hold the packet DH* private key | 
| 325 | outlen = rypto_kpp_maxsize() - Get len for output buffer* Function returns the output buffer size required for a given key | 
| 327 | If Not kdfcopy Then | 
| 332 | If buflen == 0 Then | 
| 341 | outbuf = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). | 
| 343 | If Not outbuf Then | 
| 351 | If Not req Then | 
| 358 | init_completion( & completion) | 
| 368 | If ret == -EINPROGRESS Then | 
| 375 | If kdfcopy Then | 
| 380 | If copy_from_user(outbuf + dst_len, otherinfo, otherinfolen) != 0 Then | 
| 386 | ret = keyctl_dh_compute_kdf(sdesc, buffer, buflen, outbuf, dst_len + otherinfolen, outlen - dst_len) | 
| 389 | Else if copy_to_user(buffer, outbuf, dst_len) == 0 Then | 
| 391 | Else | 
| 395 | out6 : | 
| 397 | out5 : | 
| 399 | out4 : | 
| 401 | out3 : | 
| 403 | out2 : | 
| 404 | dh_free_data( & dh_inputs) | 
| 405 | out1 : | 
| 406 | kdf_dealloc(sdesc) | 
| 407 | Return ret | 
| Name | Describe | 
|---|---|
| compat_keyctl_dh_compute | Perform the DH computation or DH based key derivation.* If successful, 0 will be returned. | 
| keyctl_dh_compute | 
| 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 |