Lines Matching refs:akey
238 struct aes_context *akey; in aes_encrypt_init() local
256 akey = os_zalloc(sizeof(*akey)); in aes_encrypt_init()
257 if (akey == NULL) in aes_encrypt_init()
260 if (!CryptAcquireContext(&akey->prov, NULL, in aes_encrypt_init()
265 os_free(akey); in aes_encrypt_init()
269 if (!CryptImportKey(akey->prov, (BYTE *) &key_blob, sizeof(key_blob), in aes_encrypt_init()
270 0, 0, &akey->ckey)) { in aes_encrypt_init()
273 CryptReleaseContext(akey->prov, 0); in aes_encrypt_init()
274 os_free(akey); in aes_encrypt_init()
278 if (!CryptSetKeyParam(akey->ckey, KP_MODE, (BYTE *) &mode, 0)) { in aes_encrypt_init()
281 CryptDestroyKey(akey->ckey); in aes_encrypt_init()
282 CryptReleaseContext(akey->prov, 0); in aes_encrypt_init()
283 os_free(akey); in aes_encrypt_init()
287 return akey; in aes_encrypt_init()
293 struct aes_context *akey = ctx; in aes_encrypt() local
298 if (!CryptEncrypt(akey->ckey, 0, FALSE, 0, crypt, &dlen, 16)) { in aes_encrypt()
308 struct aes_context *akey = ctx; in aes_encrypt_deinit() local
309 if (akey) { in aes_encrypt_deinit()
310 CryptDestroyKey(akey->ckey); in aes_encrypt_deinit()
311 CryptReleaseContext(akey->prov, 0); in aes_encrypt_deinit()
312 os_free(akey); in aes_encrypt_deinit()
325 struct aes_context *akey = ctx; in aes_decrypt() local
331 if (!CryptDecrypt(akey->ckey, 0, FALSE, 0, plain, &dlen)) { in aes_decrypt()