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
135 ret = pkey_keyblob2pkey(kb->key, kb->keylen, in __paes_keyblob2pkey()
150 ret = __paes_keyblob2pkey(&ctx->kb, &pkey); in __paes_convert_key()
165 ctx->kb.key = NULL; in ecb_paes_init()
175 _free_kb_keybuf(&ctx->kb); in ecb_paes_exit()
204 _free_kb_keybuf(&ctx->kb); in ecb_paes_set_key()
205 rc = _key_to_kb(&ctx->kb, in_key, key_len); in ecb_paes_set_key()
233 n = nbytes & ~(AES_BLOCK_SIZE - 1); in ecb_paes_crypt()
262 .base.cra_priority = 401, /* combo: aes + ecb + 1 */
280 ctx->kb.key = NULL; in cbc_paes_init()
290 _free_kb_keybuf(&ctx->kb); in cbc_paes_exit()
319 _free_kb_keybuf(&ctx->kb); in cbc_paes_set_key()
320 rc = _key_to_kb(&ctx->kb, in_key, key_len); in cbc_paes_set_key()
350 n = nbytes & ~(AES_BLOCK_SIZE - 1); in cbc_paes_crypt()
381 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
400 ctx->kb[0].key = NULL; in xts_paes_init()
401 ctx->kb[1].key = NULL; in xts_paes_init()
411 _free_kb_keybuf(&ctx->kb[0]); in xts_paes_exit()
412 _free_kb_keybuf(&ctx->kb[1]); in xts_paes_exit()
422 if (__paes_keyblob2pkey(&ctx->kb[0], &pkey0) || in __xts_paes_convert_key()
423 __paes_keyblob2pkey(&ctx->kb[1], &pkey1)) in __xts_paes_convert_key()
428 memcpy(&ctx->pk[1], &pkey1, sizeof(pkey1)); in __xts_paes_convert_key()
441 if (ctx->pk[0].type != ctx->pk[1].type) in __xts_paes_set_key()
468 _free_kb_keybuf(&ctx->kb[0]); in xts_paes_set_key()
469 _free_kb_keybuf(&ctx->kb[1]); in xts_paes_set_key()
470 rc = _key_to_kb(&ctx->kb[0], in_key, key_len); in xts_paes_set_key()
473 rc = _key_to_kb(&ctx->kb[1], in_key + key_len, key_len); in xts_paes_set_key()
489 memcpy(ckey + ckey_len, ctx->pk[1].protkey, ckey_len); in xts_paes_set_key()
522 memcpy(pcc_param.key + offset, ctx->pk[1].protkey, keylen); in xts_paes_crypt()
530 n = nbytes & ~(AES_BLOCK_SIZE - 1); in xts_paes_crypt()
561 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
580 ctx->kb.key = NULL; in ctr_paes_init()
590 _free_kb_keybuf(&ctx->kb); in ctr_paes_exit()
620 _free_kb_keybuf(&ctx->kb); in ctr_paes_set_key()
621 rc = _key_to_kb(&ctx->kb, in_key, key_len); in ctr_paes_set_key()
634 n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1); in __ctrblk_init()
635 for (i = (n / AES_BLOCK_SIZE) - 1; i > 0; i--) { in __ctrblk_init()
696 while (1) { in ctr_paes_crypt()
718 .base.cra_priority = 402, /* ecb-paes-s390 + 1 */
719 .base.cra_blocksize = 1,