mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 05:38:00 +00:00
ltq-deu: update initialisations for hmac algorithms
The processing in the hmac algorithms depends on the status fields: count, dbn and started. Not all were initialised in the init method and after finishing the final method. Added missing fields to init method and call init method after finishing final. The memsets have the wrong size in the original driver and did not clear everything and are not necessary. Since no memset is done in the kernels generic implementation, memsets were removed. Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de>
This commit is contained in:
parent
6ade9d1dda
commit
006fee0dad
@ -185,6 +185,7 @@ static int md5_hmac_init(struct shash_desc *desc)
|
||||
|
||||
mctx->dbn = 0; //dbn workaround
|
||||
mctx->started = 0;
|
||||
mctx->byte_count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -338,10 +339,7 @@ static int md5_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_final
|
||||
|
||||
if (hash_final) {
|
||||
/* reset the context after we finish with the hash */
|
||||
mctx->byte_count = 0;
|
||||
memset(&mctx->hash[0], 0, sizeof(MD5_HASH_WORDS));
|
||||
memset(&mctx->block[0], 0, sizeof(MD5_BLOCK_WORDS));
|
||||
memset(&mctx->temp[0], 0, MD5_HMAC_DBN_TEMP_SIZE);
|
||||
md5_hmac_init(desc);
|
||||
} else {
|
||||
mctx->dbn = 0;
|
||||
}
|
||||
|
@ -189,6 +189,7 @@ static int sha1_hmac_init(struct shash_desc *desc)
|
||||
//printk("debug ln: %d, fn: %s\n", __LINE__, __func__);
|
||||
sctx->dbn = 0; //dbn workaround
|
||||
sctx->started = 0;
|
||||
sctx->count = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -351,8 +352,7 @@ static int sha1_hmac_final_impl(struct shash_desc *desc, u8 *out, bool hash_fina
|
||||
CRTCL_SECT_HASH_END;
|
||||
|
||||
if (hash_final) {
|
||||
memset(&sctx->buffer[0], 0, SHA1_HMAC_BLOCK_SIZE);
|
||||
sctx->count = 0;
|
||||
sha1_hmac_init(desc);
|
||||
} else {
|
||||
sctx->dbn = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user