Commit c7f582f5 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: sha512-mb - remove HASH_FIRST flag

The HASH_FIRST flag is never set.  Remove it.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ee689d16
...@@ -107,15 +107,6 @@ static asmlinkage struct job_sha512* (*sha512_job_mgr_flush) ...@@ -107,15 +107,6 @@ static asmlinkage struct job_sha512* (*sha512_job_mgr_flush)
static asmlinkage struct job_sha512* (*sha512_job_mgr_get_comp_job) static asmlinkage struct job_sha512* (*sha512_job_mgr_get_comp_job)
(struct sha512_mb_mgr *state); (struct sha512_mb_mgr *state);
inline void sha512_init_digest(uint64_t *digest)
{
static const uint64_t initial_digest[SHA512_DIGEST_LENGTH] = {
SHA512_H0, SHA512_H1, SHA512_H2,
SHA512_H3, SHA512_H4, SHA512_H5,
SHA512_H6, SHA512_H7 };
memcpy(digest, initial_digest, sizeof(initial_digest));
}
inline uint32_t sha512_pad(uint8_t padblock[SHA512_BLOCK_SIZE * 2], inline uint32_t sha512_pad(uint8_t padblock[SHA512_BLOCK_SIZE * 2],
uint64_t total_len) uint64_t total_len)
{ {
...@@ -263,11 +254,8 @@ static struct sha512_hash_ctx ...@@ -263,11 +254,8 @@ static struct sha512_hash_ctx
mgr = cstate->mgr; mgr = cstate->mgr;
spin_lock_irqsave(&cstate->work_lock, irqflags); spin_lock_irqsave(&cstate->work_lock, irqflags);
if (flags & (~HASH_ENTIRE)) { if (flags & ~(HASH_UPDATE | HASH_LAST)) {
/* /* User should not pass anything other than UPDATE or LAST */
* User should not pass anything other than FIRST, UPDATE, or
* LAST
*/
ctx->error = HASH_CTX_ERROR_INVALID_FLAGS; ctx->error = HASH_CTX_ERROR_INVALID_FLAGS;
goto unlock; goto unlock;
} }
...@@ -278,24 +266,12 @@ static struct sha512_hash_ctx ...@@ -278,24 +266,12 @@ static struct sha512_hash_ctx
goto unlock; goto unlock;
} }
if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) { if (ctx->status & HASH_CTX_STS_COMPLETE) {
/* Cannot update a finished job. */ /* Cannot update a finished job. */
ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED; ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED;
goto unlock; goto unlock;
} }
if (flags & HASH_FIRST) {
/* Init digest */
sha512_init_digest(ctx->job.result_digest);
/* Reset byte counter */
ctx->total_length = 0;
/* Clear extra blocks */
ctx->partial_block_buffer_length = 0;
}
/* /*
* If we made it here, there were no errors during this call to * If we made it here, there were no errors during this call to
* submit * submit
......
...@@ -57,11 +57,9 @@ ...@@ -57,11 +57,9 @@
#include "sha512_mb_mgr.h" #include "sha512_mb_mgr.h"
#define HASH_UPDATE 0x00 #define HASH_UPDATE 0x00
#define HASH_FIRST 0x01 #define HASH_LAST 0x01
#define HASH_LAST 0x02 #define HASH_DONE 0x02
#define HASH_ENTIRE 0x03 #define HASH_FINAL 0x04
#define HASH_DONE 0x04
#define HASH_FINAL 0x08
#define HASH_CTX_STS_IDLE 0x00 #define HASH_CTX_STS_IDLE 0x00
#define HASH_CTX_STS_PROCESSING 0x01 #define HASH_CTX_STS_PROCESSING 0x01
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment