Lines Matching refs:key

159 void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
169 BYTE key[8];
179 /* Add parity bits to the key */
182 tmp = key[i];
183 key_blob.key[i] = (tmp >> i) | next | 1;
186 key_blob.key[i] = next | 1;
242 void * aes_encrypt_init(const u8 *key, size_t len)
248 BYTE key[16];
260 os_memcpy(key_blob.key, key, len);
323 void * aes_decrypt_init(const u8 *key, size_t len)
325 return aes_encrypt_init(key, len);
355 HCRYPTKEY key;
358 struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
366 BYTE key[32];
387 * be able to import longer keys (HMAC-SHA1 uses 20-byte key).
391 if (key_len > sizeof(key_blob.key))
393 os_memcpy(key_blob.key, key, key_len);
417 &ctx->key)) {
425 if (!CryptCreateHash(ctx->prov, calg, ctx->key, 0, &ctx->hash)) {
499 CryptDestroyKey(ctx->key);
509 HCRYPTKEY key;
514 const u8 *iv, const u8 *key,
521 BYTE key[32];
529 if (key_len > sizeof(key_blob.key))
531 os_memcpy(key_blob.key, key, key_len);
569 sizeof(key_blob), 0, 0, &ctx->key)) {
574 if (!CryptSetKeyParam(ctx->key, KP_MODE, (BYTE *) &mode, 0)) {
579 if (iv && !CryptSetKeyParam(ctx->key, KP_IV, (BYTE *) iv, 0)) {
587 CryptDestroyKey(ctx->key);
603 if (!CryptEncrypt(ctx->key, 0, FALSE, 0, crypt, &dlen, len)) {
620 if (!CryptDecrypt(ctx->key, 0, FALSE, 0, plain, &dlen)) {
631 CryptDestroyKey(ctx->key);
648 struct crypto_public_key * crypto_public_key_import(const u8 *key, size_t len)
655 struct crypto_private_key * crypto_private_key_import(const u8 *key,
707 int crypto_public_key_encrypt_pkcs1_v15(struct crypto_public_key *key,
723 if (!CryptEncrypt(key->rsa, 0, TRUE, 0, tmp, &clen, *outlen)) {
725 "public key: %d", (int) GetLastError());
742 int crypto_private_key_sign_pkcs1(struct crypto_private_key *key,
751 void crypto_public_key_free(struct crypto_public_key *key)
753 if (key) {
754 CryptDestroyKey(key->rsa);
755 CryptReleaseContext(key->prov, 0);
756 os_free(key);
761 void crypto_private_key_free(struct crypto_private_key *key)
763 if (key) {
764 CryptDestroyKey(key->rsa);
765 CryptReleaseContext(key->prov, 0);
766 os_free(key);