Lines Matching +full:2 +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
120 struct pkey_protkey pk[2];
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()
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()
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()
459 u8 ckey[2 * AES_MAX_KEY_SIZE]; in xts_paes_set_key()
462 if (xts_key_len % 2) in xts_paes_set_key()
465 key_len = xts_key_len / 2; 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()
489 return xts_verify_key(tfm, ckey, 2*ckey_len); in xts_paes_set_key()
567 .min_keysize = 2 * PAES_MIN_KEYSIZE,
568 .max_keysize = 2 * PAES_MAX_KEYSIZE,
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()
666 if (nbytes >= 2*AES_BLOCK_SIZE && locked) in ctr_paes_crypt()