Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 32bit arches #18

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

Grimler91
Copy link
Collaborator

Hi, this PR adds support for arm and i686.

Issue has been that c_ulong is u32 on arm and i686, and u64 on aarch64 and x86_64. By replacing some u64 types with c_ulong where applicable the issue is solved.

Also update dependencies while we are at it

All entries in token_info array should be c_ulong, based on definition
of CK_TOKEN_INFO in opencryptoki's pkcs11types.h.
Otherwise we get an overflow:

error: literal out of range for `isize`
  --> src/pkcs11/object_class.rs:18:21
   |
18 |     VendorDefined = 0x80000000,
   |                     ^^^^^^^^^^
   |
   = note: `#[deny(overflowing_literals)]` on by default
   = note: the literal `0x80000000` (decimal `2147483648`) does not fit into the type `isize` and will become `-2147483648isize`
Instead use macros to check size of pointers, and thereby determine if
we are on 32bit or 64bit platform.  On 32bit platforms c_ulong is u32,
and otherwise u64.

This works well for android, but I suppose there might be other exotic
platforms where size of c_ulong and size of pointers do not
necessarily follow each other.
Grimler91 added a commit to termux/termux-packages that referenced this pull request Jun 3, 2022
Tested on aarch64 as well as arm.

Upstream PR: aeolwyr/tergent#18
Grimler91 added a commit to termux/termux-packages that referenced this pull request Jun 3, 2022
Tested on aarch64 as well as arm.

Upstream PR: aeolwyr/tergent#18
@aeolwyr
Copy link
Owner

aeolwyr commented Dec 16, 2023

Hi, thank you very much for your contribution! I have not had time to work on this project in a long while, and unfortunately I still don't, so I will grant permissions and leave it up to you if you still would like to merge this or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants