rust-cryptoki
rust-cryptoki copied to clipboard
feat: add bindings for riscv64gc-unknown-linux-gnu target
This change adds riscv64gc-unknown-linux-gnu bindings for cryptoki-sys crate and adds the target to ci.sh and regenerate_bindings.sh for future updates. This change will enable building the package for risvc in Fedora.
n.b., in order to build locally I disabled the unused_qualifications lint due to the following:
error: unnecessary qualification
--> cryptoki/src/mechanism/mod.rs:979:33
|
979 | ulParameterLen: std::mem::size_of::<CK_GCM_PARAMS>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> cryptoki/src/lib.rs:51:8
|
51 | unused_qualifications,
| ^^^^^^^^^^^^^^^^^^^^^
help: remove the unnecessary path segments
|
979 - ulParameterLen: std::mem::size_of::<CK_GCM_PARAMS>()
979 + ulParameterLen: size_of::<CK_GCM_PARAMS>()
|
error: unnecessary qualification
--> cryptoki/src/mechanism/mod.rs:1042:25
|
1042 | ulParameterLen: std::mem::size_of::<T>()
| ^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
1042 - ulParameterLen: std::mem::size_of::<T>()
1042 + ulParameterLen: size_of::<T>()
|
error: unnecessary qualification
--> cryptoki/src/object.rs:620:48
|
620 | | Attribute::WrapWithTrusted(_) => std::mem::size_of::<bool>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
620 - | Attribute::WrapWithTrusted(_) => std::mem::size_of::<bool>(),
620 + | Attribute::WrapWithTrusted(_) => size_of::<bool>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:623:17
|
623 | std::mem::size_of::<CK_UTF8CHAR>() * bytes.len()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
623 - std::mem::size_of::<CK_UTF8CHAR>() * bytes.len()
623 + size_of::<CK_UTF8CHAR>() * bytes.len()
|
error: unnecessary qualification
--> cryptoki/src/object.rs:627:46
|
627 | Attribute::CertificateType(_) => std::mem::size_of::<CK_CERTIFICATE_TYPE>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
627 - Attribute::CertificateType(_) => std::mem::size_of::<CK_CERTIFICATE_TYPE>(),
627 + Attribute::CertificateType(_) => size_of::<CK_CERTIFICATE_TYPE>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:629:36
|
629 | Attribute::Class(_) => std::mem::size_of::<CK_OBJECT_CLASS>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
629 - Attribute::Class(_) => std::mem::size_of::<CK_OBJECT_CLASS>(),
629 + Attribute::Class(_) => size_of::<CK_OBJECT_CLASS>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:639:46
|
639 | Attribute::KeyGenMechanism(_) => std::mem::size_of::<CK_MECHANISM_TYPE>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
639 - Attribute::KeyGenMechanism(_) => std::mem::size_of::<CK_MECHANISM_TYPE>(),
639 + Attribute::KeyGenMechanism(_) => size_of::<CK_MECHANISM_TYPE>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:640:38
|
640 | Attribute::KeyType(_) => std::mem::size_of::<CK_KEY_TYPE>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
640 - Attribute::KeyType(_) => std::mem::size_of::<CK_KEY_TYPE>(),
640 + Attribute::KeyType(_) => size_of::<CK_KEY_TYPE>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:642:42
|
642 | Attribute::ModulusBits(_) => std::mem::size_of::<CK_ULONG>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
642 - Attribute::ModulusBits(_) => std::mem::size_of::<CK_ULONG>(),
642 + Attribute::ModulusBits(_) => size_of::<CK_ULONG>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:654:39
|
654 | Attribute::ValueLen(_) => std::mem::size_of::<CK_ULONG>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
654 - Attribute::ValueLen(_) => std::mem::size_of::<CK_ULONG>(),
654 + Attribute::ValueLen(_) => size_of::<CK_ULONG>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:655:64
|
655 | Attribute::EndDate(_) | Attribute::StartDate(_) => std::mem::size_of::<CK_DATE>(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
655 - Attribute::EndDate(_) | Attribute::StartDate(_) => std::mem::size_of::<CK_DATE>(),
655 + Attribute::EndDate(_) | Attribute::StartDate(_) => size_of::<CK_DATE>(),
|
error: unnecessary qualification
--> cryptoki/src/object.rs:658:17
|
658 | std::mem::size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
658 - std::mem::size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
658 + size_of::<CK_MECHANISM_TYPE>() * mechanisms.len()
|
error: unnecessary qualification
--> cryptoki/src/object.rs:770:24
|
770 | let as_array: [u8; std::mem::size_of::<CK_BBOOL>()] = slice.try_into()?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: remove the unnecessary path segments
|
770 - let as_array: [u8; std::mem::size_of::<CK_BBOOL>()] = slice.try_into()?;
770 + let as_array: [u8; size_of::<CK_BBOOL>()] = slice.try_into()?;
|
error: could not compile `cryptoki` (lib) due to 13 previous errors
If this change is not preferred or required, I can drop the hunk from the PR.
I think this looks good. The lint you had to disabled should be accounted for in main so if you could rebase we'd proceed with this one.
Sorry for the delay - I guess it's holiday season :sweat_smile:
I'm happy with the patch, but as @wiktor-k says, would be good to rebase and re-enable the lint. Apologies for the long delay 🥲
All set. Sorry for the delay, and thank you!
I am wondering if you are missing adding the target in the GitHub workflow files (in .github). Compare with PRs doing similar changes for example #166 and #190. The CI might pass after that?
I think I managed to make it work in #251 !
Done in #251!