@@ -1732,7 +1732,7 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
1732
1732
}
1733
1733
1734
1734
/* quick wrapper in case payload size != request_size (write same) */
1735
- static void drbd_csum_ee_size (struct crypto_ahash * h ,
1735
+ static void drbd_csum_ee_size (struct crypto_shash * h ,
1736
1736
struct drbd_peer_request * r , void * d ,
1737
1737
unsigned int payload_size )
1738
1738
{
@@ -1769,7 +1769,7 @@ read_in_block(struct drbd_peer_device *peer_device, u64 id, sector_t sector,
1769
1769
1770
1770
digest_size = 0 ;
1771
1771
if (!trim && peer_device -> connection -> peer_integrity_tfm ) {
1772
- digest_size = crypto_ahash_digestsize (peer_device -> connection -> peer_integrity_tfm );
1772
+ digest_size = crypto_shash_digestsize (peer_device -> connection -> peer_integrity_tfm );
1773
1773
/*
1774
1774
* FIXME: Receive the incoming digest into the receive buffer
1775
1775
* here, together with its struct p_data?
@@ -1905,7 +1905,7 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req
1905
1905
1906
1906
digest_size = 0 ;
1907
1907
if (peer_device -> connection -> peer_integrity_tfm ) {
1908
- digest_size = crypto_ahash_digestsize (peer_device -> connection -> peer_integrity_tfm );
1908
+ digest_size = crypto_shash_digestsize (peer_device -> connection -> peer_integrity_tfm );
1909
1909
err = drbd_recv_all_warn (peer_device -> connection , dig_in , digest_size );
1910
1910
if (err )
1911
1911
return err ;
@@ -3542,7 +3542,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
3542
3542
int p_proto , p_discard_my_data , p_two_primaries , cf ;
3543
3543
struct net_conf * nc , * old_net_conf , * new_net_conf = NULL ;
3544
3544
char integrity_alg [SHARED_SECRET_MAX ] = "" ;
3545
- struct crypto_ahash * peer_integrity_tfm = NULL ;
3545
+ struct crypto_shash * peer_integrity_tfm = NULL ;
3546
3546
void * int_dig_in = NULL , * int_dig_vv = NULL ;
3547
3547
3548
3548
p_proto = be32_to_cpu (p -> protocol );
@@ -3623,15 +3623,15 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
3623
3623
* change.
3624
3624
*/
3625
3625
3626
- peer_integrity_tfm = crypto_alloc_ahash (integrity_alg , 0 , CRYPTO_ALG_ASYNC );
3626
+ peer_integrity_tfm = crypto_alloc_shash (integrity_alg , 0 , CRYPTO_ALG_ASYNC );
3627
3627
if (IS_ERR (peer_integrity_tfm )) {
3628
3628
peer_integrity_tfm = NULL ;
3629
3629
drbd_err (connection , "peer data-integrity-alg %s not supported\n" ,
3630
3630
integrity_alg );
3631
3631
goto disconnect ;
3632
3632
}
3633
3633
3634
- hash_size = crypto_ahash_digestsize (peer_integrity_tfm );
3634
+ hash_size = crypto_shash_digestsize (peer_integrity_tfm );
3635
3635
int_dig_in = kmalloc (hash_size , GFP_KERNEL );
3636
3636
int_dig_vv = kmalloc (hash_size , GFP_KERNEL );
3637
3637
if (!(int_dig_in && int_dig_vv )) {
@@ -3661,7 +3661,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
3661
3661
mutex_unlock (& connection -> resource -> conf_update );
3662
3662
mutex_unlock (& connection -> data .mutex );
3663
3663
3664
- crypto_free_ahash (connection -> peer_integrity_tfm );
3664
+ crypto_free_shash (connection -> peer_integrity_tfm );
3665
3665
kfree (connection -> int_dig_in );
3666
3666
kfree (connection -> int_dig_vv );
3667
3667
connection -> peer_integrity_tfm = peer_integrity_tfm ;
@@ -3679,7 +3679,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
3679
3679
disconnect_rcu_unlock :
3680
3680
rcu_read_unlock ();
3681
3681
disconnect :
3682
- crypto_free_ahash (peer_integrity_tfm );
3682
+ crypto_free_shash (peer_integrity_tfm );
3683
3683
kfree (int_dig_in );
3684
3684
kfree (int_dig_vv );
3685
3685
conn_request_state (connection , NS (conn , C_DISCONNECTING ), CS_HARD );
@@ -3691,15 +3691,16 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
3691
3691
* return: NULL (alg name was "")
3692
3692
* ERR_PTR(error) if something goes wrong
3693
3693
* or the crypto hash ptr, if it worked out ok. */
3694
- static struct crypto_ahash * drbd_crypto_alloc_digest_safe (const struct drbd_device * device ,
3694
+ static struct crypto_shash * drbd_crypto_alloc_digest_safe (
3695
+ const struct drbd_device * device ,
3695
3696
const char * alg , const char * name )
3696
3697
{
3697
- struct crypto_ahash * tfm ;
3698
+ struct crypto_shash * tfm ;
3698
3699
3699
3700
if (!alg [0 ])
3700
3701
return NULL ;
3701
3702
3702
- tfm = crypto_alloc_ahash (alg , 0 , CRYPTO_ALG_ASYNC );
3703
+ tfm = crypto_alloc_shash (alg , 0 , 0 );
3703
3704
if (IS_ERR (tfm )) {
3704
3705
drbd_err (device , "Can not allocate \"%s\" as %s (reason: %ld)\n" ,
3705
3706
alg , name , PTR_ERR (tfm ));
@@ -3752,8 +3753,8 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
3752
3753
struct drbd_device * device ;
3753
3754
struct p_rs_param_95 * p ;
3754
3755
unsigned int header_size , data_size , exp_max_sz ;
3755
- struct crypto_ahash * verify_tfm = NULL ;
3756
- struct crypto_ahash * csums_tfm = NULL ;
3756
+ struct crypto_shash * verify_tfm = NULL ;
3757
+ struct crypto_shash * csums_tfm = NULL ;
3757
3758
struct net_conf * old_net_conf , * new_net_conf = NULL ;
3758
3759
struct disk_conf * old_disk_conf = NULL , * new_disk_conf = NULL ;
3759
3760
const int apv = connection -> agreed_pro_version ;
@@ -3900,14 +3901,14 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
3900
3901
if (verify_tfm ) {
3901
3902
strcpy (new_net_conf -> verify_alg , p -> verify_alg );
3902
3903
new_net_conf -> verify_alg_len = strlen (p -> verify_alg ) + 1 ;
3903
- crypto_free_ahash (peer_device -> connection -> verify_tfm );
3904
+ crypto_free_shash (peer_device -> connection -> verify_tfm );
3904
3905
peer_device -> connection -> verify_tfm = verify_tfm ;
3905
3906
drbd_info (device , "using verify-alg: \"%s\"\n" , p -> verify_alg );
3906
3907
}
3907
3908
if (csums_tfm ) {
3908
3909
strcpy (new_net_conf -> csums_alg , p -> csums_alg );
3909
3910
new_net_conf -> csums_alg_len = strlen (p -> csums_alg ) + 1 ;
3910
- crypto_free_ahash (peer_device -> connection -> csums_tfm );
3911
+ crypto_free_shash (peer_device -> connection -> csums_tfm );
3911
3912
peer_device -> connection -> csums_tfm = csums_tfm ;
3912
3913
drbd_info (device , "using csums-alg: \"%s\"\n" , p -> csums_alg );
3913
3914
}
@@ -3951,9 +3952,9 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
3951
3952
mutex_unlock (& connection -> resource -> conf_update );
3952
3953
/* just for completeness: actually not needed,
3953
3954
* as this is not reached if csums_tfm was ok. */
3954
- crypto_free_ahash (csums_tfm );
3955
+ crypto_free_shash (csums_tfm );
3955
3956
/* but free the verify_tfm again, if csums_tfm did not work out */
3956
- crypto_free_ahash (verify_tfm );
3957
+ crypto_free_shash (verify_tfm );
3957
3958
conn_request_state (peer_device -> connection , NS (conn , C_DISCONNECTING ), CS_HARD );
3958
3959
return - EIO ;
3959
3960
}
0 commit comments