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

Missing constants for x86_64-unknown-linux-gnu #134

Open
j-chmielewski opened this issue Mar 16, 2023 · 6 comments
Open

Missing constants for x86_64-unknown-linux-gnu #134

j-chmielewski opened this issue Mar 16, 2023 · 6 comments

Comments

@j-chmielewski
Copy link

Latest version of cryptoki-sys does not include CKF_EC_F_2M constant and so compilation of cryptoki v0.4.1 as dependency fails.

My system:

Linux blade 6.2.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 03 Mar 2023 15:58:31 +0000 x86_64 GNU/Linux

Steps to reproduce

cargo new cryptoki-repro
cd cryptoki-repro
cargo add [email protected]
cargo build

Fails with message:

error[E0425]: cannot find value `CKF_EC_F_2M` in this scope
   --> /home/jck/.cargo/registry/src/github.com-1ecc6299db9ec823/cryptoki-0.4.1/src/mechanism/mechanism_info.rs:26:25
    |
26  |         const EC_F_2M = CKF_EC_F_2M;
    |                         ^^^^^^^^^^^ help: a constant with a similar name exists: `CKF_EC_F_P`
    |
   ::: /home/jck/.cargo/registry/src/github.com-1ecc6299db9ec823/cryptoki-sys-0.1.5/src/bindings/x86_64-unknown-linux-gnu.rs:581:1
    |
581 | pub const CKF_EC_F_P: CK_FLAGS = 1048576;
    | ------------------------------ similarly named constant `CKF_EC_F_P` defined here

error[E0425]: cannot find value `CKF_EC_ECPARAMETERS` in this scope
  --> /home/jck/.cargo/registry/src/github.com-1ecc6299db9ec823/cryptoki-0.4.1/src/mechanism/mechanism_info.rs:27:33
   |
27 |         const EC_ECPARAMETERS = CKF_EC_ECPARAMETERS;
   |                                 ^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `CKF_ERROR_STATE` in this scope
  --> /home/jck/.cargo/registry/src/github.com-1ecc6299db9ec823/cryptoki-0.4.1/src/slot/token_info.rs:35:29
   |
35 |         const ERROR_STATE = CKF_ERROR_STATE;
   |                             ^^^^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0425`.
error: could not compile `cryptoki` due to 3 previous errors

I can see that latest main branch code contains those constants so perhaps all that is to be done is tagging a new version?

@wiktor-k
Copy link
Collaborator

I can reproduce this problem. Adding generate-bindings feature does not help.

I did succeed when I used crate directly via git: cryptoki = { version = "0.4.1", git = "https://github.com/parallaxsecond/rust-cryptoki" }. Maybe recent changes in #130 helped?

@augjoh
Copy link

augjoh commented Mar 19, 2023

I'm having the same problems. These constants disappeared in packaged pkcs11.h of [email protected]:

296d295
< #define CKF_ERROR_STATE		(1UL << 24)
1048,1049d1046
< #define CKF_EC_F_2M		(1UL << 21)
< #define CKF_EC_ECPARAMETERS	(1UL << 22)

@cfrantz
Copy link

cfrantz commented Apr 20, 2023

I'm having the same problem.

It seems as though there may have been error releasing or tagging.

cryptoki-0.4.1 was created on 2022-09-29.
cryptoki-0.4.0 was created on 2022-09-07.
cryptoki-0.3.0 was created on 2022-01-14.

Then, on 2023-03-15, cryptoki-0.3.1 and cryptoki-sys-0.1.5 were created on the cryptoki-0.3.0 branch. Crates.io shows the cryptoki-sys dep for cryptoki as "^0.1.4", so cargo selects 0.1.5.

If I manually say cryptoki-sys = "=0.1.4" in my Cargo.toml, I can build. Of course, this means you're depending on a cryptoki-sys that is 9 months older than cryptoki...

@ionut-arm
Copy link
Member

ionut-arm commented Apr 23, 2023

Ok, sorry for the huge delay.

So, it seems when we branched out cryptoki-0.3.x to release Parsec back in March, we branched from the latest v0.3 of cryptoki. We made some changes to cryptoki-sys and upstreamed that as 0.1.5 - however the problem here is that we had added other stuff to cryptoki-sys since that v0.3 of cryptoki. Which means this newest version of cryptoki-sys is actually missing some stuff that is present in main.

My suggestions here are:

  • we bump the main version of cryptoki-sys to 0.1.6 and release that ASAP (see Cryptoki-sys 0.1.6 #138 )
  • we yank 0.1.5 of cryptoki

Apologies everyone for this mistake, it is yet another lesson in juggling the versions of two interdependent crates in the same repo :[

cc @gowthamsk-arm - I don't think this would affect Parsec in any way.

@ionut-arm
Copy link
Member

Update: I have released v0.1.6 of cryptoki-sys. I'll be yanking 0.1.5 tomorrow.

@nbdd0121
Copy link

cryptoki-sys 0.1.5 doesn't seem to be yanked.

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

No branches or pull requests

6 participants