Changeset View
Changeset View
Standalone View
Standalone View
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); | ret = ENOMEM; | ||||
bjk: I guess we could hx509_set_error_string() here if we wanted.
Also it looks like we leak clear. | |||||
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); | ||||
▲ Show 20 Lines • Show All 568 Lines • Show Last 20 Lines |
I guess we could hx509_set_error_string() here if we wanted.
Also it looks like we leak clear.data.