aeolwyr / tergent Goto Github PK
View Code? Open in Web Editor NEWA cryptoki library that uses Android keystore as the backend
License: GNU General Public License v3.0
A cryptoki library that uses Android keystore as the backend
License: GNU General Public License v3.0
For keys with validity set > 0 the unlocking is described in the README. However there is a possibility to unlock with fingerprint using the termux-fingerprint command as well:
termux-fingerprint 1>/dev/null && ssh example.com
To make things more easy you can set an alias in .bashrc or .zshrc
% eval $(tergent)
Agent pid 20638
% ssh-add .ssh/id_ed25519
Enter passphrase for .ssh/id_ed25519:
Could not add identity ".ssh/id_ed25519": agent refused operation
zsh: exit 1 ssh-add .ssh/id_ed25519
first of all, tergent just works well for me, I use it with automatic key locking, thanks for it.
However, when I try to use agent forwarding with ssh -A ...
from termux, it does not work. I couldn't find any pointer about this.
Sometimes it's needed to do an ssh from the server where I sshed. :)
thanks
It will be good for PGP (with https://github.com/alonbl/gnupg-pkcs11-scd ) if externally imported key could be supported.
I am trying to use your tool on an xiaomi mi8 with MIUI 10.01 but without success.
Termux v. 0.75
Termux api v. 0.37
tergent v. 0.1.1-1 aarch64 (release)
Here is the log:
➜ termux-keystore list
[ {
"alias": "martin@mia",
"algorithm": "RSA",
"size": 2048,
"inside_secure_hardware": true,
"user_authentication": {
"required": false,
"enforced_by_secure_hardware": false
}
},
{
"alias": "TermuxFingerprintAPIKey"
}
]
➜ eval $(tergent)
Agent pid 21139
➜ ssh-add -l
thread '' panicked at 'Cannot read one of the keys.', libcore/option.rs:989:5
note: Run with RUST_BACKTRACE=1
for a backtrace.
error fetching identities: communication with agent failed
I noticed that I can use tergent with ssh-agent
just fine: #15 (comment)
But ssh-add -s $PREFIX/lib/libtergent.so
asks for a PIN (empty pin is fine), which doesn't make much sense to me, and makes it harder to include that setup in an automated startup script.
Why does ssh-add
ask for a PIN here, and can it be avoided?
Currently we are trying to implement the ssh-agent interface. Although it works fine for the main use case, implementing the other use cases is becoming a challenge, see #3. tergent is rejecting almost all messages except a few that is needed for ssh. ssh-agent protocol does not seem like it was created to have multiple implementations.
PKCS#11/Cryptoki, on the other hand, is widely used for interfacing with the hardware keys. The main interface of tergent could be replaced so that we will build a library file, and the standard ssh tools can still interface with it.
Going this way, we won't need to implement various ssh-agent functionalities and flags, and there won't be a process running constantly. The tergent library will translate the commands as needed.
The official documentation can be found here: http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html
Would love to use this, but haven't been able to build it myself. Would you mind compiling an arm release?
This is a really neat program. Would love to see it installable through pkg.
It would be nice if tergent could trigger biometric authentication if signing fails, then retry sigining.
I've already done alias ssh='termux-fingerprint 1>/dev/null; ssh'
, but:
Should be as simple as extending the bridge to support api_method
Fingerprint
and call it if signing fails.
I tried the tergent on my android phone. I did follow all the steps and tried to connect using ssh -vv user@myServer
. I saw the key was accepted, but I could not log in to the server. When I use my current password protected key I have no problem to log in and see the server welcome message and the command prompt.
How can I diagnose what the problem is and how to solve it?
This agent is great, except for the fact that currently you cannot copy one specific keyfile AFAIK. Ssh-copy-id copies all available keys and idk if there's a way to specify the file when the keys are in Android's keystore. Would it be possible to implement this? Or is that a restriction of Android's keystore?
thanks for developing this tergent library.
I would have a question, which is not really clear to me is that after I generated a RSA or EC key based on the README, the
ssh-keygen -D $PREFIX/lib/libtergent.so
is asking for a PIN:
Enter PIN for 'tergent': PKCS#11 login failed: error 84 login failed cannot read public key from pkcs11
maybe there are other users facing this problem...
so it's not clear to me that is the termux keystore involved in storing the key or not...
thanks
Setting up a new device (Yoga Tab 11) and am unable to successfully connect to my server.
Key generation seemed to work fine and ssh-keygen
reports the key is available:
$ ssh-keygen -D $PREFIX/lib/libtergent.so
ssh-rsa AAAA... josh
...and I added the public key to my server. However, connecting fails with a cryptic error:
$ ssh -v josh@server
...
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: josh RSA SHA256:... token
debug1: Server accepts key: josh RSA SHA256:... token
debug1: pkcs11_check_obj_bool_attrib: provider "/data/data/com.termux/files/usr/lib/libtergent.so" slot 0 object 0: attrib 514 = 0
debug1: identity_sign: sshkey_sign: error in libcrypto
sign_and_send_pubkey: signing failed for RSA "josh": error in libcrypto
debug1: pkcs11_k11_free: parent 0xb400007b97d32690 ptr 0x0 idx 1
debug1: No more authentication methods to try.
Any idea what's happening or how I can get more information about the error in libcrypto?
This is a great framework, thanks so much for this!
Would it be possible to approve individual ssh sessions with the fingerprint sensor/face ID?
At the moment the exportability protection doesn't mean a lot, because anyone with access to termux (eg, through sending an intent, or writing to termux's storage/bash profile) can use the stored details in ssh-config to connect over SSH and add a new key to ~/.ssh/authorized_keys of all stored hosts.
And, the Keystore is always unlocked immediately when the phone is unlocked. So, this doesn't seem to add much more protection than just relying on the phone's disk encryption / privilege seperation and skipping the keystore entirely.
Would it be possible to use setUserAuthenticationRequired(true) in the creation of the keys, and then prompt the user for each ssh connection? This would allow the keys to stay locked until the user needs them, at which point they can deny a request if they weren't expecting it, greatly improving the security overall.
I think it would require some handling of the ssh connection process, such as mentioned here:
"Cryptographic operations involving keys which require user authentication to take place for every operation can only use biometric authentication. This is achieved by initializing a cryptographic operation (Signature
, Cipher
, Mac
) with the key, wrapping it into a BiometricPrompt.CryptoObject
, invoking BiometricPrompt.authenticate
with CryptoObject
, and proceeding with the cryptographic operation only if the authentication flow succeeds. "
I followed the README's instructions on setting up an environment and verified the Rust/NDK setup was correct before trying to compile the latest release. I am getting these errors and am not experienced enough with Rust to try and resolve them myself. Any help is appreciated
Fresh autocfg v1.0.0
Fresh cfg-if v0.1.10
Fresh unicode-xid v0.2.1
Fresh ppv-lite86 v0.2.8
Fresh itoa v0.4.6
Fresh base64 v0.12.3
Fresh once_cell v1.4.0
Fresh hex v0.4.2
Fresh libc v0.2.74
Fresh proc-macro2 v1.0.19
Fresh serde v1.0.114
Fresh ryu v1.0.5
Fresh bitflags v1.2.1
Fresh num-traits v0.2.12
Fresh getrandom v0.1.14
Fresh time v0.1.43
Fresh quote v1.0.7
Fresh num-integer v0.1.43
Fresh rand_core v0.5.1
Fresh nix v0.18.0
Fresh serde_json v1.0.57
Fresh rand_chacha v0.2.2
Fresh syn v1.0.38
Fresh num-bigint v0.2.6
Fresh chrono v0.4.13
Fresh rand v0.7.3
Fresh num-derive v0.3.1
Fresh simple_asn1 v0.4.1
Fresh uuid v0.8.1
Compiling tergent v1.0.0 (/tmp/tergent)
Running `rustc --crate-name tergent --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=b6a2965ef93bb5e8 --out-dir /tmp/tergent/target/armv7-linux-androideabi/debug/deps --target armv7-linux-androideabi -C 'linker=/home/rebel/$HOME/Android/NDK/arm/bin/arm-linux-androideabi-clang' -C incremental=/tmp/tergent/target/armv7-linux-androideabi/debug/incremental -L dependency=/tmp/tergent/target/armv7-linux-androideabi/debug/deps -L dependency=/tmp/tergent/target/debug/deps --extern base64=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libbase64-04c3ff0d903d612e.rlib --extern bitflags=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libbitflags-0839c713eceb861a.rlib --extern hex=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libhex-d4ae58abeaa8109d.rlib --extern nix=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libnix-a9ab1027aef873d6.rlib --extern num_derive=/tmp/tergent/target/debug/deps/libnum_derive-29bdb6f1125bd4f2.so --extern num_traits=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libnum_traits-84af4dabd83ecda9.rlib --extern once_cell=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libonce_cell-93c75b6cffc1ed95.rlib --extern serde_json=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libserde_json-33982e169e2395ce.rlib --extern simple_asn1=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libsimple_asn1-9807816f7d31f61c.rlib --extern uuid=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libuuid-c723d9c5bf67b153.rlib`
error[E0308]: mismatched types
--> src/lib.rs:114:38
|
114 | token_info.total_public_memory = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert `token_info.total_public_memory` from `u32` to `u64`, matching the type of `unavailable_information`
|
114 | u64::from(token_info.total_public_memory) = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/lib.rs:115:37
|
115 | token_info.free_public_memory = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert `token_info.free_public_memory` from `u32` to `u64`, matching the type of `unavailable_information`
|
115 | u64::from(token_info.free_public_memory) = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/lib.rs:116:39
|
116 | token_info.total_private_memory = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert `token_info.total_private_memory` from `u32` to `u64`, matching the type of `unavailable_information`
|
116 | u64::from(token_info.total_private_memory) = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/lib.rs:117:38
|
117 | token_info.free_private_memory = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
help: you can convert `token_info.free_private_memory` from `u32` to `u64`, matching the type of `unavailable_information`
|
117 | u64::from(token_info.free_private_memory) = unavailable_information;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/lib.rs:196:33
|
196 | unsafe { *session = index }
| ^^^^^ expected `u32`, found `u64`
|
help: you can convert `*session` from `u32` to `u64`, matching the type of `index`
|
196 | unsafe { u64::from(*session) = index }
| ^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/lib.rs:208:25
|
208 | match state::remove(session) {
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0308]: mismatched types
--> src/lib.rs:304:28
|
304 | let state = state::get(session);
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0277]: the trait bound `u64: std::convert::From<pkcs11::key_type::KeyType>` is not satisfied
--> src/lib.rs:342:18
|
342 | .try_into()
| ^^^^^^^^ the trait `std::convert::From<pkcs11::key_type::KeyType>` is not implemented for `u64`
|
= help: the following implementations were found:
<u64 as std::convert::From<bool>>
<u64 as std::convert::From<std::num::NonZeroU64>>
<u64 as std::convert::From<u16>>
<u64 as std::convert::From<u32>>
<u64 as std::convert::From<u8>>
= note: required because of the requirements on the impl of `std::convert::Into<u64>` for `pkcs11::key_type::KeyType`
= note: required because of the requirements on the impl of `std::convert::TryFrom<pkcs11::key_type::KeyType>` for `u64`
= note: required because of the requirements on the impl of `std::convert::TryInto<u64>` for `pkcs11::key_type::KeyType`
error[E0277]: the trait bound `pkcs11::object_class::ObjectClass: std::convert::From<u64>` is not satisfied
--> src/lib.rs:439:89
|
439 | if let Ok(ObjectClass::PublicKey) | Ok(ObjectClass::PrivateKey) = class.try_into() {
| ^^^^^^^^ the trait `std::convert::From<u64>` is not implemented for `pkcs11::object_class::ObjectClass`
|
= note: required because of the requirements on the impl of `std::convert::Into<pkcs11::object_class::ObjectClass>` for `u64`
= note: required because of the requirements on the impl of `std::convert::TryFrom<u64>` for `pkcs11::object_class::ObjectClass`
= note: required because of the requirements on the impl of `std::convert::TryInto<pkcs11::object_class::ObjectClass>` for `u64`
error[E0308]: mismatched types
--> src/lib.rs:463:28
|
463 | let state = state::get(session);
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0308]: mismatched types
--> src/lib.rs:487:28
|
487 | let state = state::get(session);
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0308]: mismatched types
--> src/lib.rs:643:28
|
643 | let state = state::get(session);
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0308]: mismatched types
--> src/lib.rs:697:32
|
697 | let state = state::get(session);
| ^^^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `session.into()`
error[E0308]: mismatched types
--> src/pkcs11/mod.rs:64:30
|
64 | self.value_len = len;
| ^^^ expected `u32`, found `u64`
|
help: you can convert `self.value_len` from `u32` to `u64`, matching the type of `len`
|
64 | u64::from(self.value_len) = len;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/pkcs11/mod.rs:68:29
|
68 | if self.value_len < len {
| ^^^ expected `u32`, found `u64`
|
help: you can convert `self.value_len` from `u32` to `u64`, matching the type of `len`
|
68 | if u64::from(self.value_len) < len {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/pkcs11/mod.rs:75:26
|
75 | self.value_len = len;
| ^^^ expected `u32`, found `u64`
|
help: you can convert `self.value_len` from `u32` to `u64`, matching the type of `len`
|
75 | u64::from(self.value_len) = len;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> src/pkcs11/notification.rs:16:32
|
16 | Notification::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/notification.rs:23:9
|
22 | fn try_from(value: Notification) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
23 | Notification::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/user_type.rs:17:28
|
17 | UserType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/user_type.rs:24:9
|
23 | fn try_from(value: UserType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
24 | UserType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/session_state.rs:19:32
|
19 | SessionState::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/session_state.rs:26:9
|
25 | fn try_from(value: SessionState) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
26 | SessionState::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/object_class.rs:24:31
|
24 | ObjectClass::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/object_class.rs:31:9
|
30 | fn try_from(value: ObjectClass) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
31 | ObjectClass::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/hardware_feature_type.rs:18:39
|
18 | HardwareFeatureType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/hardware_feature_type.rs:25:9
|
24 | fn try_from(value: HardwareFeatureType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
25 | HardwareFeatureType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/key_type.rs:56:27
|
56 | KeyType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/key_type.rs:63:9
|
62 | fn try_from(value: KeyType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
63 | KeyType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/certificate_category.rs:18:39
|
18 | CertificateCategory::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/certificate_category.rs:25:9
|
24 | fn try_from(value: CertificateCategory) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
25 | CertificateCategory::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/security_domain.rs:18:34
|
18 | SecurityDomain::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/security_domain.rs:25:9
|
24 | fn try_from(value: SecurityDomain) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
25 | SecurityDomain::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/certificate_type.rs:18:35
|
18 | CertificateType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/certificate_type.rs:25:9
|
24 | fn try_from(value: CertificateType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
25 | CertificateType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/attribute_type.rs:120:33
|
120 | AttributeType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/attribute_type.rs:127:9
|
126 | fn try_from(value: AttributeType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
127 | AttributeType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/otp.rs:34:26
|
34 | Format::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/otp.rs:41:9
|
40 | fn try_from(value: Format) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
41 | Format::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/otp.rs:48:25
|
48 | Param::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/otp.rs:55:9
|
54 | fn try_from(value: Param) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
55 | Param::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/mechanism_type.rs:338:33
|
338 | MechanismType::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/mechanism_type.rs:345:9
|
344 | fn try_from(value: MechanismType) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
345 | MechanismType::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/return_value.rs:109:31
|
109 | ReturnValue::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/return_value.rs:116:9
|
115 | fn try_from(value: ReturnValue) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
116 | ReturnValue::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/mask_generation_function.rs:19:42
|
19 | MaskGenerationFunction::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/mask_generation_function.rs:26:9
|
25 | fn try_from(value: MaskGenerationFunction) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
26 | MaskGenerationFunction::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/key_derivation_function.rs:23:41
|
23 | KeyDerivationFunction::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/key_derivation_function.rs:30:9
|
29 | fn try_from(value: KeyDerivationFunction) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
30 | KeyDerivationFunction::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error[E0308]: mismatched types
--> src/pkcs11/pseudo_random_function.rs:22:40
|
22 | PseudoRandomFunction::from_u64(value).ok_or(())
| ^^^^^
| |
| expected `u64`, found `u32`
| help: you can convert an `u32` to `u64`: `value.into()`
error[E0308]: mismatched types
--> src/pkcs11/pseudo_random_function.rs:29:9
|
28 | fn try_from(value: PseudoRandomFunction) -> Result<Self, Self::Error> {
| ------------------------- expected `std::result::Result<u32, ()>` because of return type
29 | PseudoRandomFunction::to_u64(&value).ok_or(())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
|
= note: expected enum `std::result::Result<u32, _>`
found enum `std::result::Result<u64, _>`
error: aborting due to 50 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `tergent`.
Caused by:
process didn't exit successfully: `rustc --crate-name tergent --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type cdylib --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=b6a2965ef93bb5e8 --out-dir /tmp/tergent/target/armv7-linux-androideabi/debug/deps --target armv7-linux-androideabi -C 'linker=/home/rebel/$HOME/Android/NDK/arm/bin/arm-linux-androideabi-clang' -C incremental=/tmp/tergent/target/armv7-linux-androideabi/debug/incremental -L dependency=/tmp/tergent/target/armv7-linux-androideabi/debug/deps -L dependency=/tmp/tergent/target/debug/deps --extern base64=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libbase64-04c3ff0d903d612e.rlib --extern bitflags=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libbitflags-0839c713eceb861a.rlib --extern hex=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libhex-d4ae58abeaa8109d.rlib --extern nix=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libnix-a9ab1027aef873d6.rlib --extern num_derive=/tmp/tergent/target/debug/deps/libnum_derive-29bdb6f1125bd4f2.so --extern num_traits=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libnum_traits-84af4dabd83ecda9.rlib --extern once_cell=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libonce_cell-93c75b6cffc1ed95.rlib --extern serde_json=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libserde_json-33982e169e2395ce.rlib --extern simple_asn1=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libsimple_asn1-9807816f7d31f61c.rlib --extern uuid=/tmp/tergent/target/armv7-linux-androideabi/debug/deps/libuuid-c723d9c5bf67b153.rlib` (exit code: 1)
Right now, if the user specifies the -a flag, the application will crash.
Currently there is no mechanism to differentiate between
In case 1, we must not touch the directory.
In case 2, we have to clean it up at shutdown.
This function is responsible for setting up the cleanup functions. It will fail if the parent directory already exists.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.