24
24
*/
25
25
static int key2protkey (const struct pkey_apqn * apqns , size_t nr_apqns ,
26
26
const u8 * key , size_t keylen ,
27
- u8 * protkey , u32 * protkeylen , u32 * protkeytype )
27
+ u8 * protkey , u32 * protkeylen , u32 * protkeytype ,
28
+ u32 xflags )
28
29
{
29
30
int rc ;
30
31
31
32
/* try the direct way */
32
33
rc = pkey_handler_key_to_protkey (apqns , nr_apqns ,
33
34
key , keylen ,
34
35
protkey , protkeylen ,
35
- protkeytype );
36
+ protkeytype , xflags );
36
37
37
38
/* if this did not work, try the slowpath way */
38
39
if (rc == - ENODEV ) {
39
40
rc = pkey_handler_slowpath_key_to_protkey (apqns , nr_apqns ,
40
41
key , keylen ,
41
42
protkey , protkeylen ,
42
- protkeytype );
43
+ protkeytype , xflags );
43
44
if (rc )
44
45
rc = - ENODEV ;
45
46
}
@@ -55,13 +56,14 @@ int pkey_key2protkey(const u8 *key, u32 keylen,
55
56
u8 * protkey , u32 * protkeylen , u32 * protkeytype )
56
57
{
57
58
int rc ;
59
+ const u32 xflags = 0 ;
58
60
59
61
rc = key2protkey (NULL , 0 , key , keylen ,
60
- protkey , protkeylen , protkeytype );
62
+ protkey , protkeylen , protkeytype , xflags );
61
63
if (rc == - ENODEV ) {
62
64
pkey_handler_request_modules ();
63
65
rc = key2protkey (NULL , 0 , key , keylen ,
64
- protkey , protkeylen , protkeytype );
66
+ protkey , protkeylen , protkeytype , xflags );
65
67
}
66
68
67
69
return rc ;
@@ -103,7 +105,7 @@ static int pkey_ioctl_genseck(struct pkey_genseck __user *ugs)
103
105
keybuflen = sizeof (kgs .seckey .seckey );
104
106
rc = pkey_handler_gen_key (& apqn , 1 ,
105
107
kgs .keytype , PKEY_TYPE_CCA_DATA , 0 , 0 ,
106
- kgs .seckey .seckey , & keybuflen , NULL );
108
+ kgs .seckey .seckey , & keybuflen , NULL , 0 );
107
109
pr_debug ("gen_key()=%d\n" , rc );
108
110
if (!rc && copy_to_user (ugs , & kgs , sizeof (kgs )))
109
111
rc = - EFAULT ;
@@ -129,7 +131,7 @@ static int pkey_ioctl_clr2seck(struct pkey_clr2seck __user *ucs)
129
131
kcs .keytype , PKEY_TYPE_CCA_DATA , 0 , 0 ,
130
132
kcs .clrkey .clrkey ,
131
133
pkey_keytype_aes_to_size (kcs .keytype ),
132
- kcs .seckey .seckey , & keybuflen , NULL );
134
+ kcs .seckey .seckey , & keybuflen , NULL , 0 );
133
135
pr_debug ("clr_to_key()=%d\n" , rc );
134
136
if (!rc && copy_to_user (ucs , & kcs , sizeof (kcs )))
135
137
rc = - EFAULT ;
@@ -154,7 +156,8 @@ static int pkey_ioctl_sec2protk(struct pkey_sec2protk __user *usp)
154
156
ksp .seckey .seckey ,
155
157
sizeof (ksp .seckey .seckey ),
156
158
ksp .protkey .protkey ,
157
- & ksp .protkey .len , & ksp .protkey .type );
159
+ & ksp .protkey .len , & ksp .protkey .type ,
160
+ 0 );
158
161
pr_debug ("key_to_protkey()=%d\n" , rc );
159
162
if (!rc && copy_to_user (usp , & ksp , sizeof (ksp )))
160
163
rc = - EFAULT ;
@@ -198,7 +201,7 @@ static int pkey_ioctl_clr2protk(struct pkey_clr2protk __user *ucp)
198
201
rc = key2protkey (NULL , 0 ,
199
202
tmpbuf , sizeof (* t ) + keylen ,
200
203
kcp .protkey .protkey ,
201
- & kcp .protkey .len , & kcp .protkey .type );
204
+ & kcp .protkey .len , & kcp .protkey .type , 0 );
202
205
pr_debug ("key2protkey()=%d\n" , rc );
203
206
204
207
kfree_sensitive (tmpbuf );
@@ -228,12 +231,12 @@ static int pkey_ioctl_findcard(struct pkey_findcard __user *ufc)
228
231
rc = pkey_handler_apqns_for_key (kfc .seckey .seckey ,
229
232
sizeof (kfc .seckey .seckey ),
230
233
PKEY_FLAGS_MATCH_CUR_MKVP ,
231
- apqns , & nr_apqns );
234
+ apqns , & nr_apqns , 0 );
232
235
if (rc == - ENODEV )
233
236
rc = pkey_handler_apqns_for_key (kfc .seckey .seckey ,
234
237
sizeof (kfc .seckey .seckey ),
235
238
PKEY_FLAGS_MATCH_ALT_MKVP ,
236
- apqns , & nr_apqns );
239
+ apqns , & nr_apqns , 0 );
237
240
pr_debug ("apqns_for_key()=%d\n" , rc );
238
241
if (rc ) {
239
242
kfree (apqns );
@@ -262,7 +265,7 @@ static int pkey_ioctl_skey2pkey(struct pkey_skey2pkey __user *usp)
262
265
sizeof (ksp .seckey .seckey ),
263
266
ksp .protkey .protkey ,
264
267
& ksp .protkey .len ,
265
- & ksp .protkey .type );
268
+ & ksp .protkey .type , 0 );
266
269
pr_debug ("key_to_protkey()=%d\n" , rc );
267
270
if (!rc && copy_to_user (usp , & ksp , sizeof (ksp )))
268
271
rc = - EFAULT ;
@@ -285,7 +288,7 @@ static int pkey_ioctl_verifykey(struct pkey_verifykey __user *uvk)
285
288
rc = pkey_handler_verify_key (kvk .seckey .seckey ,
286
289
sizeof (kvk .seckey .seckey ),
287
290
& kvk .cardnr , & kvk .domain ,
288
- & keytype , & keybitsize , & flags );
291
+ & keytype , & keybitsize , & flags , 0 );
289
292
pr_debug ("verify_key()=%d\n" , rc );
290
293
if (!rc && keytype != PKEY_TYPE_CCA_DATA )
291
294
rc = - EINVAL ;
@@ -312,7 +315,7 @@ static int pkey_ioctl_genprotk(struct pkey_genprotk __user *ugp)
312
315
rc = pkey_handler_gen_key (NULL , 0 , kgp .keytype ,
313
316
PKEY_TYPE_PROTKEY , 0 , 0 ,
314
317
kgp .protkey .protkey , & kgp .protkey .len ,
315
- & kgp .protkey .type );
318
+ & kgp .protkey .type , 0 );
316
319
pr_debug ("gen_key()=%d\n" , rc );
317
320
if (!rc && copy_to_user (ugp , & kgp , sizeof (kgp )))
318
321
rc = - EFAULT ;
@@ -354,7 +357,7 @@ static int pkey_ioctl_verifyprotk(struct pkey_verifyprotk __user *uvp)
354
357
memcpy (t -> protkey , kvp .protkey .protkey , kvp .protkey .len );
355
358
356
359
rc = pkey_handler_verify_key (tmpbuf , sizeof (* t ),
357
- NULL , NULL , NULL , NULL , NULL );
360
+ NULL , NULL , NULL , NULL , NULL , 0 );
358
361
pr_debug ("verify_key()=%d\n" , rc );
359
362
360
363
kfree_sensitive (tmpbuf );
@@ -377,7 +380,7 @@ static int pkey_ioctl_kblob2protk(struct pkey_kblob2pkey __user *utp)
377
380
ktp .protkey .len = sizeof (ktp .protkey .protkey );
378
381
rc = key2protkey (NULL , 0 , kkey , ktp .keylen ,
379
382
ktp .protkey .protkey , & ktp .protkey .len ,
380
- & ktp .protkey .type );
383
+ & ktp .protkey .type , 0 );
381
384
pr_debug ("key2protkey()=%d\n" , rc );
382
385
kfree_sensitive (kkey );
383
386
if (!rc && copy_to_user (utp , & ktp , sizeof (ktp )))
@@ -414,7 +417,7 @@ static int pkey_ioctl_genseck2(struct pkey_genseck2 __user *ugs)
414
417
}
415
418
rc = pkey_handler_gen_key (apqns , kgs .apqn_entries ,
416
419
u , kgs .type , kgs .size , kgs .keygenflags ,
417
- kkey , & klen , NULL );
420
+ kkey , & klen , NULL , 0 );
418
421
pr_debug ("gen_key()=%d\n" , rc );
419
422
kfree (apqns );
420
423
if (rc ) {
@@ -471,7 +474,7 @@ static int pkey_ioctl_clr2seck2(struct pkey_clr2seck2 __user *ucs)
471
474
rc = pkey_handler_clr_to_key (apqns , kcs .apqn_entries ,
472
475
u , kcs .type , kcs .size , kcs .keygenflags ,
473
476
kcs .clrkey .clrkey , kcs .size / 8 ,
474
- kkey , & klen , NULL );
477
+ kkey , & klen , NULL , 0 );
475
478
pr_debug ("clr_to_key()=%d\n" , rc );
476
479
kfree (apqns );
477
480
if (rc ) {
@@ -514,7 +517,7 @@ static int pkey_ioctl_verifykey2(struct pkey_verifykey2 __user *uvk)
514
517
515
518
rc = pkey_handler_verify_key (kkey , kvk .keylen ,
516
519
& kvk .cardnr , & kvk .domain ,
517
- & kvk .type , & kvk .size , & kvk .flags );
520
+ & kvk .type , & kvk .size , & kvk .flags , 0 );
518
521
pr_debug ("verify_key()=%d\n" , rc );
519
522
520
523
kfree_sensitive (kkey );
@@ -544,7 +547,7 @@ static int pkey_ioctl_kblob2protk2(struct pkey_kblob2pkey2 __user *utp)
544
547
ktp .protkey .len = sizeof (ktp .protkey .protkey );
545
548
rc = key2protkey (apqns , ktp .apqn_entries , kkey , ktp .keylen ,
546
549
ktp .protkey .protkey , & ktp .protkey .len ,
547
- & ktp .protkey .type );
550
+ & ktp .protkey .type , 0 );
548
551
pr_debug ("key2protkey()=%d\n" , rc );
549
552
kfree (apqns );
550
553
kfree_sensitive (kkey );
@@ -579,7 +582,7 @@ static int pkey_ioctl_apqns4k(struct pkey_apqns4key __user *uak)
579
582
return PTR_ERR (kkey );
580
583
}
581
584
rc = pkey_handler_apqns_for_key (kkey , kak .keylen , kak .flags ,
582
- apqns , & nr_apqns );
585
+ apqns , & nr_apqns , 0 );
583
586
pr_debug ("apqns_for_key()=%d\n" , rc );
584
587
kfree_sensitive (kkey );
585
588
if (rc && rc != - ENOSPC ) {
@@ -626,7 +629,7 @@ static int pkey_ioctl_apqns4kt(struct pkey_apqns4keytype __user *uat)
626
629
}
627
630
rc = pkey_handler_apqns_for_keytype (kat .type ,
628
631
kat .cur_mkvp , kat .alt_mkvp ,
629
- kat .flags , apqns , & nr_apqns );
632
+ kat .flags , apqns , & nr_apqns , 0 );
630
633
pr_debug ("apqns_for_keytype()=%d\n" , rc );
631
634
if (rc && rc != - ENOSPC ) {
632
635
kfree (apqns );
@@ -678,7 +681,7 @@ static int pkey_ioctl_kblob2protk3(struct pkey_kblob2pkey3 __user *utp)
678
681
return - ENOMEM ;
679
682
}
680
683
rc = key2protkey (apqns , ktp .apqn_entries , kkey , ktp .keylen ,
681
- protkey , & protkeylen , & ktp .pkeytype );
684
+ protkey , & protkeylen , & ktp .pkeytype , 0 );
682
685
pr_debug ("key2protkey()=%d\n" , rc );
683
686
kfree (apqns );
684
687
kfree_sensitive (kkey );
0 commit comments