@@ -906,41 +906,41 @@ smb311_update_preauth_hash(struct cifs_ses *ses, struct TCP_Server_Info *server,
906906 || (hdr -> Status !=
907907 cpu_to_le32 (NT_STATUS_MORE_PROCESSING_REQUIRED ))))
908908 return 0 ;
909+
909910ok :
910- rc = cifs_alloc_hash ("sha512" , & sha512 );
911- if (rc ) {
912- cifs_dbg (VFS , "%s: Could not allocate SHA512 shash, rc=%d\n" , __func__ , rc );
911+ rc = smb311_crypto_shash_allocate (server );
912+ if (rc )
913913 return rc ;
914- }
915914
915+ sha512 = server -> secmech .sha512 ;
916916 rc = crypto_shash_init (sha512 );
917917 if (rc ) {
918- cifs_dbg (VFS , "%s: Could not init SHA512 shash, rc=%d \n" , __func__ , rc );
919- goto err_free ;
918+ cifs_dbg (VFS , "%s: Could not init sha512 shash\n" , __func__ );
919+ return rc ;
920920 }
921921
922922 rc = crypto_shash_update (sha512 , ses -> preauth_sha_hash ,
923923 SMB2_PREAUTH_HASH_SIZE );
924924 if (rc ) {
925- cifs_dbg (VFS , "%s: Could not update SHA512 shash, rc=%d \n" , __func__ , rc );
926- goto err_free ;
925+ cifs_dbg (VFS , "%s: Could not update sha512 shash\n" , __func__ );
926+ return rc ;
927927 }
928928
929929 for (i = 0 ; i < nvec ; i ++ ) {
930930 rc = crypto_shash_update (sha512 , iov [i ].iov_base , iov [i ].iov_len );
931931 if (rc ) {
932- cifs_dbg (VFS , "%s: Could not update SHA512 shash, rc=%d\n" , __func__ , rc );
933- goto err_free ;
932+ cifs_dbg (VFS , "%s: Could not update sha512 shash\n" ,
933+ __func__ );
934+ return rc ;
934935 }
935936 }
936937
937938 rc = crypto_shash_final (sha512 , ses -> preauth_sha_hash );
938939 if (rc ) {
939- cifs_dbg (VFS , "%s: Could not finalize SHA12 shash, rc=%d\n" , __func__ , rc );
940- goto err_free ;
940+ cifs_dbg (VFS , "%s: Could not finalize sha512 shash\n" ,
941+ __func__ );
942+ return rc ;
941943 }
942- err_free :
943- cifs_free_hash (& sha512 );
944944
945945 return 0 ;
946946}
0 commit comments