Skip to content

Commit 450f344

Browse files
committed
More EVP_CIPHER_CTX_reset changes
Changes to be committed: modified: src/libopensc/card-gpk.c modified: src/libopensc/card-piv.c
1 parent eeadd82 commit 450f344

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/libopensc/card-gpk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,14 +908,14 @@ gpk_set_filekey(const u8 *key, const u8 *challenge,
908908
if (!EVP_EncryptUpdate(ctx, kats, &outl, r_rn+4, 8))
909909
r = SC_ERROR_INTERNAL;
910910

911-
if (!EVP_CIPHER_CTX_cleanup(ctx))
911+
if (!EVP_CIPHER_CTX_reset(ctx))
912912
r = SC_ERROR_INTERNAL;
913913
if (r == SC_SUCCESS) {
914-
EVP_CIPHER_CTX_init(ctx);
914+
EVP_CIPHER_CTX_reset(ctx);
915915
EVP_EncryptInit_ex(ctx, EVP_des_ede(), NULL, out, NULL);
916916
if (!EVP_EncryptUpdate(ctx, kats+8, &outl, r_rn+4, 8))
917917
r = SC_ERROR_INTERNAL;
918-
if (!EVP_CIPHER_CTX_cleanup(ctx))
918+
if (!EVP_CIPHER_CTX_reset(ctx))
919919
r = SC_ERROR_INTERNAL;
920920
}
921921
memset(out, 0, sizeof(out));
@@ -925,7 +925,7 @@ gpk_set_filekey(const u8 *key, const u8 *challenge,
925925
* here? INVALID_ARGS doesn't seem quite right
926926
*/
927927
if (r == SC_SUCCESS) {
928-
EVP_CIPHER_CTX_init(ctx);
928+
EVP_CIPHER_CTX_reset(ctx);
929929
EVP_EncryptInit_ex(ctx, EVP_des_ede(), NULL, kats, NULL);
930930
if (!EVP_EncryptUpdate(ctx, out, &outl, challenge, 8))
931931
r = SC_ERROR_INTERNAL;

src/libopensc/card-piv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ static int piv_general_mutual_authenticate(sc_card_t *card,
17781778
goto err;
17791779
}
17801780

1781-
EVP_CIPHER_CTX_cleanup(ctx);
1781+
EVP_CIPHER_CTX_reset(ctx);
17821782

17831783
if (!EVP_DecryptInit(ctx, cipher, key, NULL)) {
17841784
r = SC_ERROR_INTERNAL;

0 commit comments

Comments
 (0)