Changeset View
Changeset View
Standalone View
Standalone View
projects/openssl111/crypto/heimdal/lib/hx509/ks_file.c
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | try_decrypt(hx509_context context, | ||||
hx509_set_error_string(context, 0, ENOMEM, | hx509_set_error_string(context, 0, ENOMEM, | ||||
"Out of memory to decrypt for private key"); | "Out of memory to decrypt for private key"); | ||||
ret = ENOMEM; | ret = ENOMEM; | ||||
goto out; | goto out; | ||||
} | } | ||||
clear.length = len; | clear.length = len; | ||||
{ | { | ||||
EVP_CIPHER_CTX ctx; | EVP_CIPHER_CTX *ctx; | ||||
EVP_CIPHER_CTX_init(&ctx); | |||||
EVP_CipherInit_ex(&ctx, c, NULL, key, ivdata, 0); | ctx = EVP_CIPHER_CTX_new(); | ||||
EVP_Cipher(&ctx, clear.data, cipher, len); | if (ctx == NULL) { | ||||
EVP_CIPHER_CTX_cleanup(&ctx); | hx509_set_error_string(context, 0, ENOMEM, | ||||
"Out of memory to decrypt for private key"); | |||||
ret = ENOMEM; | |||||
goto out; | |||||
} | } | ||||
EVP_CipherInit_ex(ctx, c, NULL, key, ivdata, 0); | |||||
EVP_Cipher(ctx, clear.data, cipher, len); | |||||
EVP_CIPHER_CTX_free(ctx); | |||||
} | |||||
ret = _hx509_collector_private_key_add(context, | ret = _hx509_collector_private_key_add(context, | ||||
collector, | collector, | ||||
alg, | alg, | ||||
NULL, | NULL, | ||||
&clear, | &clear, | ||||
NULL); | NULL); | ||||
memset(clear.data, 0, clear.length); | memset(clear.data, 0, clear.length); | ||||
free(clear.data); | |||||
out: | out: | ||||
free(clear.data); | |||||
memset(key, 0, keylen); | memset(key, 0, keylen); | ||||
free(key); | free(key); | ||||
return ret; | return ret; | ||||
} | } | ||||
static int | static int | ||||
parse_pkcs8_private_key(hx509_context context, const char *fn, | parse_pkcs8_private_key(hx509_context context, const char *fn, | ||||
struct hx509_collector *c, | struct hx509_collector *c, | ||||
▲ Show 20 Lines • Show All 556 Lines • Show Last 20 Lines |