* 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:
Milan Broz
2011-07-25 15:24:04 +00:00
parent 03a8ba4d17
commit 23e144daf4
9 changed files with 28 additions and 29 deletions

View File

@@ -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;
}