Lines Matching refs: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()
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()
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()
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()
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()