crypto_backend: remove superfluous memset fot hash and hmac contexts

The crypto backend crypt_hash ans crypt_hmac structs usually
contain only pointers to internal crypto lib structures, no need
to wipe them explicitly as there are no sensitive data.
It is a crypto lib responsibility to remove sensitive data
in destructor.

Only nettle backend directly contains hash context, keep it there.

This should also fix mysterious crashes in fuzzer with misaligned memset.
This commit is contained in:
Milan Broz
2023-10-27 09:36:39 +02:00
parent 0c9258484a
commit 7b6feb20b4
3 changed files with 0 additions and 6 deletions

View File

@@ -245,7 +245,6 @@ void crypt_hash_destroy(struct crypt_hash *ctx)
close(ctx->tfmfd);
if (ctx->opfd >= 0)
close(ctx->opfd);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}
@@ -324,7 +323,6 @@ void crypt_hmac_destroy(struct crypt_hmac *ctx)
close(ctx->tfmfd);
if (ctx->opfd >= 0)
close(ctx->opfd);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}