mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user