Lines Matching +full:1 +full:kb
58 static inline int _key_to_kb(struct key_blob *kb, in _key_to_kb() argument
76 memset(kb->keybuf, 0, sizeof(kb->keybuf)); in _key_to_kb()
77 h = (struct clearkey_header *) kb->keybuf; in _key_to_kb()
81 memcpy(kb->keybuf + sizeof(*h), key, keylen); in _key_to_kb()
82 kb->keylen = sizeof(*h) + keylen; in _key_to_kb()
83 kb->key = kb->keybuf; in _key_to_kb()
87 if (keylen <= sizeof(kb->keybuf)) in _key_to_kb()
88 kb->key = kb->keybuf; in _key_to_kb()
90 kb->key = kmalloc(keylen, GFP_KERNEL); in _key_to_kb()
91 if (!kb->key) in _key_to_kb()
94 memcpy(kb->key, key, keylen); in _key_to_kb()
95 kb->keylen = keylen; in _key_to_kb()
102 static inline void _free_kb_keybuf(struct key_blob *kb) in _free_kb_keybuf() argument
104 if (kb->key && kb->key != kb->keybuf in _free_kb_keybuf()
105 && kb->keylen > sizeof(kb->keybuf)) { in _free_kb_keybuf()
106 kfree_sensitive(kb->key); in _free_kb_keybuf()
107 kb->key = NULL; in _free_kb_keybuf()
112 struct key_blob kb; member
119 struct key_blob kb[2]; member
125 static inline int __paes_keyblob2pkey(struct key_blob *kb, in __paes_keyblob2pkey() argument
136 ret = pkey_key2protkey(kb->key, kb->keylen, in __paes_keyblob2pkey()
149 ret = __paes_keyblob2pkey(&ctx->kb, &pkey); in __paes_convert_key()
164 ctx->kb.key = NULL; in ecb_paes_init()
174 _free_kb_keybuf(&ctx->kb); in ecb_paes_exit()
203 _free_kb_keybuf(&ctx->kb); in ecb_paes_set_key()
204 rc = _key_to_kb(&ctx->kb, in_key, key_len); in ecb_paes_set_key()
232 n = nbytes & ~(AES_BLOCK_SIZE - 1); in ecb_paes_crypt()
261 .base.cra_priority = 401, /* combo: aes + ecb + 1 */
279 ctx->kb.key = NULL; in cbc_paes_init()
289 _free_kb_keybuf(&ctx->kb); in cbc_paes_exit()
318 _free_kb_keybuf(&ctx->kb); in cbc_paes_set_key()
319 rc = _key_to_kb(&ctx->kb, in_key, key_len); in cbc_paes_set_key()
349 n = nbytes & ~(AES_BLOCK_SIZE - 1); in cbc_paes_crypt()
380 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
399 ctx->kb[0].key = NULL; in xts_paes_init()
400 ctx->kb[1].key = NULL; in xts_paes_init()
410 _free_kb_keybuf(&ctx->kb[0]); in xts_paes_exit()
411 _free_kb_keybuf(&ctx->kb[1]); in xts_paes_exit()
421 if (__paes_keyblob2pkey(&ctx->kb[0], &pkey0) || in __xts_paes_convert_key()
422 __paes_keyblob2pkey(&ctx->kb[1], &pkey1)) in __xts_paes_convert_key()
427 memcpy(&ctx->pk[1], &pkey1, sizeof(pkey1)); in __xts_paes_convert_key()
440 if (ctx->pk[0].type != ctx->pk[1].type) in __xts_paes_set_key()
467 _free_kb_keybuf(&ctx->kb[0]); in xts_paes_set_key()
468 _free_kb_keybuf(&ctx->kb[1]); in xts_paes_set_key()
469 rc = _key_to_kb(&ctx->kb[0], in_key, key_len); in xts_paes_set_key()
472 rc = _key_to_kb(&ctx->kb[1], in_key + key_len, key_len); in xts_paes_set_key()
488 memcpy(ckey + ckey_len, ctx->pk[1].protkey, ckey_len); in xts_paes_set_key()
521 memcpy(pcc_param.key + offset, ctx->pk[1].protkey, keylen); in xts_paes_crypt()
529 n = nbytes & ~(AES_BLOCK_SIZE - 1); in xts_paes_crypt()
560 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
579 ctx->kb.key = NULL; in ctr_paes_init()
589 _free_kb_keybuf(&ctx->kb); in ctr_paes_exit()
619 _free_kb_keybuf(&ctx->kb); in ctr_paes_set_key()
620 rc = _key_to_kb(&ctx->kb, in_key, key_len); in ctr_paes_set_key()
633 n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1); in __ctrblk_init()
634 for (i = (n / AES_BLOCK_SIZE) - 1; i > 0; i--) { in __ctrblk_init()
697 while (1) { in ctr_paes_crypt()
719 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
720 .base.cra_blocksize = 1,