Minor fixes to libp2p
This commit is contained in:
parent
d4fee344a7
commit
cd5d347e63
5 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue