Lines Matching +full:byte +full:- +full:len

1 // SPDX-License-Identifier: GPL-2.0
37 switch (hdr->type) { in is_pckmo_key()
39 switch (hdr->version) { in is_pckmo_key()
41 switch (t->keytype) { in is_pckmo_key()
87 int keysize, rc = -EINVAL; in pckmo_clr2protkey()
94 /* 16 byte key, 32 byte aes wkvp, total 48 bytes */ in pckmo_clr2protkey()
100 /* 24 byte key, 32 byte aes wkvp, total 56 bytes */ in pckmo_clr2protkey()
106 /* 32 byte key, 32 byte aes wkvp, total 64 bytes */ in pckmo_clr2protkey()
112 /* 32 byte key, 32 byte aes wkvp, total 64 bytes */ in pckmo_clr2protkey()
118 /* 48 byte key, 32 byte aes wkvp, total 80 bytes */ in pckmo_clr2protkey()
124 /* 80 byte key, 32 byte aes wkvp, total 112 bytes */ in pckmo_clr2protkey()
130 /* 32 byte key, 32 byte aes wkvp, total 64 bytes */ in pckmo_clr2protkey()
136 /* 64 byte key, 32 byte aes wkvp, total 96 bytes */ in pckmo_clr2protkey()
142 /* 2x16 byte keys, 32 byte aes wkvp, total 64 bytes */ in pckmo_clr2protkey()
148 /* 2x32 byte keys, 32 byte aes wkvp, total 96 bytes */ in pckmo_clr2protkey()
154 /* 64 byte key, 32 byte aes wkvp, total 96 bytes */ in pckmo_clr2protkey()
160 /* 128 byte key, 32 byte aes wkvp, total 160 bytes */ in pckmo_clr2protkey()
187 rc = -ENODEV; in pckmo_clr2protkey()
194 rc = -ENODEV; in pckmo_clr2protkey()
232 int rc = -EINVAL; in pckmo_verify_protkey()
267 rc = -EKEYREJECTED; in pckmo_verify_protkey()
282 int rc = -EINVAL; in pckmo_key2protkey()
285 return -EINVAL; in pckmo_key2protkey()
286 if (hdr->type != TOKTYPE_NON_CCA) in pckmo_key2protkey()
287 return -EINVAL; in pckmo_key2protkey()
289 switch (hdr->version) { in pckmo_key2protkey()
295 switch (t->keytype) { in pckmo_key2protkey()
301 rc = pckmo_verify_protkey(t->protkey, t->len, in pckmo_key2protkey()
302 t->keytype); in pckmo_key2protkey()
307 if (t->len != 64 || keylen != sizeof(*t) + t->len) in pckmo_key2protkey()
312 if (t->len != 96 || keylen != sizeof(*t) + t->len) in pckmo_key2protkey()
316 if (t->len != 160 || keylen != sizeof(*t) + t->len) in pckmo_key2protkey()
321 __func__, t->keytype); in pckmo_key2protkey()
324 memcpy(protkey, t->protkey, t->len); in pckmo_key2protkey()
325 *protkeylen = t->len; in pckmo_key2protkey()
326 *protkeytype = t->keytype; in pckmo_key2protkey()
335 keylen != sizeof(*t) + t->len) in pckmo_key2protkey()
337 switch (t->keytype) { in pckmo_key2protkey()
341 keysize = pkey_keytype_aes_to_size(t->keytype); in pckmo_key2protkey()
375 __func__, t->keytype); in pckmo_key2protkey()
378 if (t->len != keysize) { in pckmo_key2protkey()
379 PKEY_DBF_ERR("%s clear key token: invalid key len %u\n", in pckmo_key2protkey()
380 __func__, t->len); in pckmo_key2protkey()
383 rc = pckmo_clr2protkey(t->keytype, t->clearkey, t->len, in pckmo_key2protkey()
388 PKEY_DBF_ERR("%s unknown non-CCA token version %d\n", in pckmo_key2protkey()
389 __func__, hdr->version); in pckmo_key2protkey()
429 return -EINVAL; in pckmo_gen_protkey()
434 return -EINVAL; in pckmo_gen_protkey()
461 int rc = -EINVAL; in pckmo_verify_key()
464 return -EINVAL; in pckmo_verify_key()
465 if (hdr->type != TOKTYPE_NON_CCA) in pckmo_verify_key()
466 return -EINVAL; in pckmo_verify_key()
468 switch (hdr->version) { in pckmo_verify_key()
475 rc = pckmo_verify_protkey(t->protkey, t->len, t->keytype); in pckmo_verify_key()
479 PKEY_DBF_ERR("%s unknown non-CCA token version %d\n", in pckmo_verify_key()
480 __func__, hdr->version); in pckmo_verify_key()
536 * The pckmo instruction should be available - even if we don't in pkey_pckmo_init()
542 return -ENODEV; in pkey_pckmo_init()