ektrah / libsodium-core

libsodium for .NET - A secure cryptographic library
MIT License
134 stars 41 forks source link

iOS and Android support #80

Open ektrah opened 2 years ago

ektrah commented 2 years ago

954f93686c77ec7fa68ab79042a9667f7f9fa1c3 removed support for iOS and Android. It would be nice to have it back. This should probably be based on the .NET 6.

ektrah commented 6 months ago

libsodium-core supports iOS, tvOS, and Mac Catalyst starting from version 1.4.0-preview.1.

However, this has not been extensively tested. Please provide feedback in this issue whether it works or not.

Please indicate the target platform (iOS, tvOS, or Mac Catalyst), development platform (macOS, Windows, ...), and .NET SDK used, including version numbers.

Both positive and negative reports are welcome!

MartyIX commented 6 months ago

I tested with .NET MAUI application on Mac Catalyst (arm64) and it seems to work. I tested that with the previous version, I can observe a crash. So I believe the new preview version fixes my issue :)

Toine-db commented 5 months ago

Seems to work fine on arm64 devices, but on x86_64 simulators it doesn't work out of the box.

It gets following error: with Sodium.Core" Version="1.4.0-preview.1 target net8.0-ios (8.0.21/8.0.100)

Undefined symbols for architecture x86_64:
  "_crypto_aead_aes256gcm_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_aes256gcm_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_aes256gcm_is_available", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_ietf_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_ietf_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_xchacha20poly1305_ietf_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_xchacha20poly1305_ietf_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha256", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha256_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha512", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha512256", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha512256_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_auth_hmacsha512_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_curve25519xsalsa20poly1305_keypair", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_curve25519xsalsa20poly1305_seed_keypair", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_easy", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_open_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_open_easy", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_seal", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_box_seal_open", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_generichash_blake2b", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_generichash_blake2b_final", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_generichash_blake2b_init", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_generichash_blake2b_salt_personal", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_generichash_blake2b_update", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_hash_sha256", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_hash_sha512", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_onetimeauth_poly1305", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_onetimeauth_poly1305_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_scryptsalsa208sha256", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_scryptsalsa208sha256_str", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_scryptsalsa208sha256_str_needs_rehash", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_scryptsalsa208sha256_str_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_str", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_str_needs_rehash", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_pwhash_str_verify", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_scalarmult_curve25519_base", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_secretbox_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_secretbox_easy", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_secretbox_open_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_secretbox_open_easy", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_shorthash_siphash24", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_keypair", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_open", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_pk_to_curve25519", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_seed_keypair", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_sk_to_curve25519", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_sk_to_pk", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_sk_to_seed", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_sign_ed25519_verify_detached", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_stream_chacha20_ietf_xor", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_stream_chacha20_xor", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_stream_xchacha20_xor", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_stream_xsalsa20_xor", referenced from:
     -exported_symbol[s_list] command line option
  "_randombytes_buf", referenced from:
     -exported_symbol[s_list] command line option
  "_randombytes_uniform", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_base642bin", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_base64_encoded_len", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_bin2base64", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_compare", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_increment", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_init", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_library_version_major", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_library_version_minor", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_set_misuse_handler", referenced from:
     -exported_symbol[s_list] command line option
  "_sodium_version_string", referenced from:
     -exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

0>Xamarin.Shared.Sdk.targets(1560,3): Error  : clang++ exited with code 1:
Undefined symbols for architecture x86_64:
  "_crypto_aead_aes256gcm_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_aes256gcm_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_aes256gcm_is_available", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_ietf_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_chacha20poly1305_ietf_encrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_xchacha20poly1305_ietf_decrypt", referenced from:
     -exported_symbol[s_list] command line option
  "_crypto_aead_xchacha20poly1305_ietf_encrypt", referenced from:
     -exported_symbol[s_list] comma
 0>------- Finished building project: .....
tomuxmon commented 4 months ago

FYI: win-arm64 build is not working coming from libsodium nuget

more info here