pem: Clear chunks after decrypting files
This commit is contained in:
@@ -147,7 +147,7 @@ static status_t pem_decrypt(chunk_t *blob, encryption_algorithm_t alg,
|
|||||||
}
|
}
|
||||||
crypter->destroy(crypter);
|
crypter->destroy(crypter);
|
||||||
memcpy(blob->ptr, decrypted.ptr, blob->len);
|
memcpy(blob->ptr, decrypted.ptr, blob->len);
|
||||||
chunk_free(&decrypted);
|
chunk_clear(&decrypted);
|
||||||
|
|
||||||
/* determine amount of padding */
|
/* determine amount of padding */
|
||||||
last_padding_pos = blob->ptr + blob->len - 1;
|
last_padding_pos = blob->ptr + blob->len - 1;
|
||||||
@@ -354,7 +354,7 @@ static status_t pem_to_bin(chunk_t *blob, bool *pgp)
|
|||||||
memcpy(blob->ptr, chunk.ptr, chunk.len);
|
memcpy(blob->ptr, chunk.ptr, chunk.len);
|
||||||
blob->len = chunk.len;
|
blob->len = chunk.len;
|
||||||
}
|
}
|
||||||
free(chunk.ptr);
|
chunk_clear(&chunk);
|
||||||
if (status != INVALID_ARG)
|
if (status != INVALID_ARG)
|
||||||
{ /* try again only if passphrase invalid */
|
{ /* try again only if passphrase invalid */
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user