mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
* Remove hash/hmac restart from crypto backend and make it part of hash/hmac final.
Some backend implementation did reset context by default, so this should create backend api consistent. git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@578 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -121,7 +121,7 @@ int crypt_hash_init(struct crypt_hash **ctx, const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int crypt_hash_restart(struct crypt_hash *ctx)
|
||||
static int crypt_hash_restart(struct crypt_hash *ctx)
|
||||
{
|
||||
if (PK11_DigestBegin(ctx->md) != SECSuccess)
|
||||
return -EINVAL;
|
||||
@@ -154,6 +154,9 @@ int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length)
|
||||
if (tmp_len < length)
|
||||
return -EINVAL;
|
||||
|
||||
if (crypt_hash_restart(ctx))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -220,7 +223,7 @@ bad:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int crypt_hmac_restart(struct crypt_hmac *ctx)
|
||||
static int crypt_hmac_restart(struct crypt_hmac *ctx)
|
||||
{
|
||||
if (PK11_DigestBegin(ctx->md) != SECSuccess)
|
||||
return -EINVAL;
|
||||
@@ -253,6 +256,9 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length)
|
||||
if (tmp_len < length)
|
||||
return -EINVAL;
|
||||
|
||||
if (crypt_hmac_restart(ctx))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user