|
@@ -1732,7 +1732,7 @@ static int receive_Barrier(struct drbd_connection *connection, struct packet_inf
|
|
|
}
|
|
|
|
|
|
/* quick wrapper in case payload size != request_size (write same) */
|
|
|
-static void drbd_csum_ee_size(struct crypto_ahash *h,
|
|
|
+static void drbd_csum_ee_size(struct crypto_shash *h,
|
|
|
struct drbd_peer_request *r, void *d,
|
|
|
unsigned int payload_size)
|
|
|
{
|
|
@@ -1769,7 +1769,7 @@ read_in_block(struct drbd_peer_device *peer_device, u64 id, sector_t sector,
|
|
|
|
|
|
digest_size = 0;
|
|
|
if (!trim && peer_device->connection->peer_integrity_tfm) {
|
|
|
- digest_size = crypto_ahash_digestsize(peer_device->connection->peer_integrity_tfm);
|
|
|
+ digest_size = crypto_shash_digestsize(peer_device->connection->peer_integrity_tfm);
|
|
|
/*
|
|
|
* FIXME: Receive the incoming digest into the receive buffer
|
|
|
* 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
|
|
|
|
|
|
digest_size = 0;
|
|
|
if (peer_device->connection->peer_integrity_tfm) {
|
|
|
- digest_size = crypto_ahash_digestsize(peer_device->connection->peer_integrity_tfm);
|
|
|
+ digest_size = crypto_shash_digestsize(peer_device->connection->peer_integrity_tfm);
|
|
|
err = drbd_recv_all_warn(peer_device->connection, dig_in, digest_size);
|
|
|
if (err)
|
|
|
return err;
|
|
@@ -3542,7 +3542,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
|
|
|
int p_proto, p_discard_my_data, p_two_primaries, cf;
|
|
|
struct net_conf *nc, *old_net_conf, *new_net_conf = NULL;
|
|
|
char integrity_alg[SHARED_SECRET_MAX] = "";
|
|
|
- struct crypto_ahash *peer_integrity_tfm = NULL;
|
|
|
+ struct crypto_shash *peer_integrity_tfm = NULL;
|
|
|
void *int_dig_in = NULL, *int_dig_vv = NULL;
|
|
|
|
|
|
p_proto = be32_to_cpu(p->protocol);
|
|
@@ -3623,7 +3623,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
|
|
|
* change.
|
|
|
*/
|
|
|
|
|
|
- peer_integrity_tfm = crypto_alloc_ahash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
|
|
|
+ peer_integrity_tfm = crypto_alloc_shash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
|
|
|
if (IS_ERR(peer_integrity_tfm)) {
|
|
|
peer_integrity_tfm = NULL;
|
|
|
drbd_err(connection, "peer data-integrity-alg %s not supported\n",
|
|
@@ -3631,7 +3631,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
|
|
|
goto disconnect;
|
|
|
}
|
|
|
|
|
|
- hash_size = crypto_ahash_digestsize(peer_integrity_tfm);
|
|
|
+ hash_size = crypto_shash_digestsize(peer_integrity_tfm);
|
|
|
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
|
|
|
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
|
|
|
if (!(int_dig_in && int_dig_vv)) {
|
|
@@ -3661,7 +3661,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
|
|
|
mutex_unlock(&connection->resource->conf_update);
|
|
|
mutex_unlock(&connection->data.mutex);
|
|
|
|
|
|
- crypto_free_ahash(connection->peer_integrity_tfm);
|
|
|
+ crypto_free_shash(connection->peer_integrity_tfm);
|
|
|
kfree(connection->int_dig_in);
|
|
|
kfree(connection->int_dig_vv);
|
|
|
connection->peer_integrity_tfm = peer_integrity_tfm;
|
|
@@ -3679,7 +3679,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in
|
|
|
disconnect_rcu_unlock:
|
|
|
rcu_read_unlock();
|
|
|
disconnect:
|
|
|
- crypto_free_ahash(peer_integrity_tfm);
|
|
|
+ crypto_free_shash(peer_integrity_tfm);
|
|
|
kfree(int_dig_in);
|
|
|
kfree(int_dig_vv);
|
|
|
conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
|
|
@@ -3691,15 +3691,16 @@ disconnect:
|
|
|
* return: NULL (alg name was "")
|
|
|
* ERR_PTR(error) if something goes wrong
|
|
|
* or the crypto hash ptr, if it worked out ok. */
|
|
|
-static struct crypto_ahash *drbd_crypto_alloc_digest_safe(const struct drbd_device *device,
|
|
|
+static struct crypto_shash *drbd_crypto_alloc_digest_safe(
|
|
|
+ const struct drbd_device *device,
|
|
|
const char *alg, const char *name)
|
|
|
{
|
|
|
- struct crypto_ahash *tfm;
|
|
|
+ struct crypto_shash *tfm;
|
|
|
|
|
|
if (!alg[0])
|
|
|
return NULL;
|
|
|
|
|
|
- tfm = crypto_alloc_ahash(alg, 0, CRYPTO_ALG_ASYNC);
|
|
|
+ tfm = crypto_alloc_shash(alg, 0, 0);
|
|
|
if (IS_ERR(tfm)) {
|
|
|
drbd_err(device, "Can not allocate \"%s\" as %s (reason: %ld)\n",
|
|
|
alg, name, PTR_ERR(tfm));
|
|
@@ -3752,8 +3753,8 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
|
|
|
struct drbd_device *device;
|
|
|
struct p_rs_param_95 *p;
|
|
|
unsigned int header_size, data_size, exp_max_sz;
|
|
|
- struct crypto_ahash *verify_tfm = NULL;
|
|
|
- struct crypto_ahash *csums_tfm = NULL;
|
|
|
+ struct crypto_shash *verify_tfm = NULL;
|
|
|
+ struct crypto_shash *csums_tfm = NULL;
|
|
|
struct net_conf *old_net_conf, *new_net_conf = NULL;
|
|
|
struct disk_conf *old_disk_conf = NULL, *new_disk_conf = NULL;
|
|
|
const int apv = connection->agreed_pro_version;
|
|
@@ -3900,14 +3901,14 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
|
|
|
if (verify_tfm) {
|
|
|
strcpy(new_net_conf->verify_alg, p->verify_alg);
|
|
|
new_net_conf->verify_alg_len = strlen(p->verify_alg) + 1;
|
|
|
- crypto_free_ahash(peer_device->connection->verify_tfm);
|
|
|
+ crypto_free_shash(peer_device->connection->verify_tfm);
|
|
|
peer_device->connection->verify_tfm = verify_tfm;
|
|
|
drbd_info(device, "using verify-alg: \"%s\"\n", p->verify_alg);
|
|
|
}
|
|
|
if (csums_tfm) {
|
|
|
strcpy(new_net_conf->csums_alg, p->csums_alg);
|
|
|
new_net_conf->csums_alg_len = strlen(p->csums_alg) + 1;
|
|
|
- crypto_free_ahash(peer_device->connection->csums_tfm);
|
|
|
+ crypto_free_shash(peer_device->connection->csums_tfm);
|
|
|
peer_device->connection->csums_tfm = csums_tfm;
|
|
|
drbd_info(device, "using csums-alg: \"%s\"\n", p->csums_alg);
|
|
|
}
|
|
@@ -3951,9 +3952,9 @@ disconnect:
|
|
|
mutex_unlock(&connection->resource->conf_update);
|
|
|
/* just for completeness: actually not needed,
|
|
|
* as this is not reached if csums_tfm was ok. */
|
|
|
- crypto_free_ahash(csums_tfm);
|
|
|
+ crypto_free_shash(csums_tfm);
|
|
|
/* but free the verify_tfm again, if csums_tfm did not work out */
|
|
|
- crypto_free_ahash(verify_tfm);
|
|
|
+ crypto_free_shash(verify_tfm);
|
|
|
conn_request_state(peer_device->connection, NS(conn, C_DISCONNECTING), CS_HARD);
|
|
|
return -EIO;
|
|
|
}
|