diff --git a/blocks/block.c b/blocks/block.c index 8dcdfcd..d2e4ec4 100644 --- a/blocks/block.c +++ b/blocks/block.c @@ -129,7 +129,7 @@ int ipfs_blocks_block_new(struct Block** block) { int ipfs_blocks_block_add_data(const unsigned char* data, size_t data_size, struct Block* block) { // cid unsigned char hash[32]; - if (libp2p_crypto_hashing_sha256((char*)data, data_size, &hash[0]) == 0) { + if (libp2p_crypto_hashing_sha256(data, data_size, &hash[0]) == 0) { return 0; } diff --git a/core/null.c b/core/null.c index a8405f3..8888bd1 100644 --- a/core/null.c +++ b/core/null.c @@ -48,7 +48,7 @@ void *ipfs_null_connection (void *ptr) if (ipfs_null_requesting_secio(results, bytes_read)) { struct SecureSession secure_session; secure_session.stream = stream; - if (!libp2p_secio_handshake(&secure_session, &connection_param->local_node->identity->private_key)) { + if (!libp2p_secio_handshake(&secure_session, &connection_param->local_node->identity->private_key, 1)) { // rejecting connection break; } diff --git a/merkledag/merkledag.c b/merkledag/merkledag.c index 0f72837..fd2fdec 100644 --- a/merkledag/merkledag.c +++ b/merkledag/merkledag.c @@ -35,7 +35,7 @@ int ipfs_merkledag_add(struct Node* node, struct FSRepo* fs_repo, size_t* bytes_ if (node->hash == NULL) { return 0; } - if (libp2p_crypto_hashing_sha256((char*)protobuf, bytes_encoded, &node->hash[0]) == 0) { + if (libp2p_crypto_hashing_sha256(protobuf, bytes_encoded, &node->hash[0]) == 0) { free(node->hash); return 0; } diff --git a/test/cid/test_cid.h b/test/cid/test_cid.h index abba40b..c2239c0 100644 --- a/test/cid/test_cid.h +++ b/test/cid/test_cid.h @@ -41,7 +41,7 @@ int test_cid_cast_multihash() { unsigned char hashed[32]; memset(hashed, 0, 32); // hash the string - libp2p_crypto_hashing_sha256(string_to_hash, strlen(string_to_hash), hashed); + libp2p_crypto_hashing_sha256((unsigned char*)string_to_hash, strlen(string_to_hash), hashed); size_t multihash_size = mh_new_length(MH_H_SHA2_256, 32); unsigned char multihash[multihash_size]; memset(multihash, 0, multihash_size); @@ -75,7 +75,7 @@ int test_cid_cast_non_multihash() { unsigned char hashed[32]; memset(hashed, 0, 32); // hash the string - libp2p_crypto_hashing_sha256(string_to_hash, strlen(string_to_hash), hashed); + libp2p_crypto_hashing_sha256((unsigned char*)string_to_hash, strlen(string_to_hash), hashed); // now make it a hash with a version and codec embedded in varints before the hash size_t array_size = 34; // 32 for the hash, 2 for the 2 varints diff --git a/unixfs/unixfs.c b/unixfs/unixfs.c index 23d054f..7eb4d76 100644 --- a/unixfs/unixfs.c +++ b/unixfs/unixfs.c @@ -130,7 +130,7 @@ int ipfs_unixfs_add_data(unsigned char* data, size_t data_length, struct UnixFS* free(unix_fs->bytes); return 0; } - if (libp2p_crypto_hashing_sha256((char*)data, data_length, &unix_fs->hash[0]) == 0) { + if (libp2p_crypto_hashing_sha256(data, data_length, &unix_fs->hash[0]) == 0) { free(unix_fs->bytes); free(unix_fs->hash); return 0;