@@ -251,8 +251,8 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
251251 return rc ;
252252}
253253
254- static int generate_key (struct cifs_ses * ses , struct kvec label ,
255- struct kvec context , __u8 * key , unsigned int key_size )
254+ static void generate_key (struct cifs_ses * ses , struct kvec label ,
255+ struct kvec context , __u8 * key , unsigned int key_size )
256256{
257257 unsigned char zero = 0x0 ;
258258 __u8 i [4 ] = {0 , 0 , 0 , 1 };
@@ -281,7 +281,6 @@ static int generate_key(struct cifs_ses *ses, struct kvec label,
281281 hmac_sha256_final (& hmac_ctx , prfhash );
282282
283283 memcpy (key , prfhash , key_size );
284- return 0 ;
285284}
286285
287286struct derivation {
@@ -300,7 +299,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
300299 struct TCP_Server_Info * server ,
301300 const struct derivation_triplet * ptriplet )
302301{
303- int rc ;
304302 bool is_binding = false;
305303 int chan_index = 0 ;
306304
@@ -331,38 +329,27 @@ generate_smb3signingkey(struct cifs_ses *ses,
331329 */
332330
333331 if (is_binding ) {
334- rc = generate_key (ses , ptriplet -> signing .label ,
335- ptriplet -> signing .context ,
336- ses -> chans [chan_index ].signkey ,
337- SMB3_SIGN_KEY_SIZE );
338- if (rc )
339- return rc ;
332+ generate_key (ses , ptriplet -> signing .label ,
333+ ptriplet -> signing .context ,
334+ ses -> chans [chan_index ].signkey ,
335+ SMB3_SIGN_KEY_SIZE );
340336 } else {
341- rc = generate_key (ses , ptriplet -> signing .label ,
342- ptriplet -> signing .context ,
343- ses -> smb3signingkey ,
344- SMB3_SIGN_KEY_SIZE );
345- if (rc )
346- return rc ;
337+ generate_key (ses , ptriplet -> signing .label ,
338+ ptriplet -> signing .context ,
339+ ses -> smb3signingkey , SMB3_SIGN_KEY_SIZE );
347340
348341 /* safe to access primary channel, since it will never go away */
349342 spin_lock (& ses -> chan_lock );
350343 memcpy (ses -> chans [chan_index ].signkey , ses -> smb3signingkey ,
351344 SMB3_SIGN_KEY_SIZE );
352345 spin_unlock (& ses -> chan_lock );
353346
354- rc = generate_key (ses , ptriplet -> encryption .label ,
355- ptriplet -> encryption .context ,
356- ses -> smb3encryptionkey ,
357- SMB3_ENC_DEC_KEY_SIZE );
358- if (rc )
359- return rc ;
360- rc = generate_key (ses , ptriplet -> decryption .label ,
361- ptriplet -> decryption .context ,
362- ses -> smb3decryptionkey ,
363- SMB3_ENC_DEC_KEY_SIZE );
364- if (rc )
365- return rc ;
347+ generate_key (ses , ptriplet -> encryption .label ,
348+ ptriplet -> encryption .context ,
349+ ses -> smb3encryptionkey , SMB3_ENC_DEC_KEY_SIZE );
350+ generate_key (ses , ptriplet -> decryption .label ,
351+ ptriplet -> decryption .context ,
352+ ses -> smb3decryptionkey , SMB3_ENC_DEC_KEY_SIZE );
366353 }
367354
368355#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
@@ -391,7 +378,7 @@ generate_smb3signingkey(struct cifs_ses *ses,
391378 SMB3_GCM128_CRYPTKEY_SIZE , ses -> smb3decryptionkey );
392379 }
393380#endif
394- return rc ;
381+ return 0 ;
395382}
396383
397384int
0 commit comments