crypto/sha512-mb: Correct initialization value for lane lens
Subsystems (3)
PATCH 1/2 crypto/sha512-mb: Correct initialization value for lane lens
The wrong value was used to initialize the lane lens for sha512-mb's mgr structure. This could cause a NULL pointer access of jobs structure if sha512_job_mgr_get_comp_job is called to get completed jobs. We assume that lens that don't have 0xFFFFFFFF in upper half of lens have valid job and have a job structue, leading to invalide pointer access.
Signed-off-by Tim Chen <[email protected]>
--- arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/crypto/sha512-mb/sha512_mb_mgr_init_avx2.c +4 -4
@@ -57,10 +57,10 @@ void sha512_mb_mgr_init_avx2(struct sha512_mb_mgr *state) {unsigned int j; - state->lens[0 ] =0 ; - state->lens[1 ] =1 ; - state->lens[2 ] =2 ; - state->lens[3 ] =3 ; + state->lens[0 ] =0xFFFFFFFF00000000 ; + state->lens[1 ] =0xFFFFFFFF00000001 ; + state->lens[2 ] =0xFFFFFFFF00000002 ; + state->lens[3 ] =0xFFFFFFFF00000003 ; state->unused_lanes =0xFF03020100 ;for (j =0 ; j <4 ; j++) state->ldata[j].job_in_lane =NULL ;
Signature · 1 line
2.5.5
PATCH 2/2 crypto/sha512-mb: Add missing assignemnt of request context
When handling of error condition in sha512_mb_finup, we need to set the correct request context for sha_complete_job to finish notification to issuer of the crypto request.
Signed-off-by Tim Chen <[email protected]>
--- arch/x86/crypto/sha512-mb/sha512_mb.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/crypto/sha512-mb/sha512_mb.c +1 -0
@@ -647,6 +647,7 @@ static int sha512_mb_finup(struct ahash_request *areq)if (sha_ctx->error) { ret = sha_ctx->error; + rctx =cast_hash_to_mcryptd_ctx (sha_ctx); goto done; }
Signature · 1 line
2.5.5