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

Support PKCS11 3.0 #183

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft

Support PKCS11 3.0 #183

wants to merge 21 commits into from

Conversation

qpernil
Copy link
Contributor

@qpernil qpernil commented Jun 18, 2021

PKCS11 3.0 support, and also added ed25519 support, mechanisms for which were added in pkcs11 3.0

@qpernil
Copy link
Contributor Author

qpernil commented Jul 5, 2022

Adresses #270

Comment on lines +3864 to +3878
switch (m) {
case CKM_EDDSA:
return true;

default:
break;
}

Check notice

Code scanning / CodeQL

No trivial switch statements Note

This switch statement should either handle more cases, or be rewritten as an if statement.
@@ -4946,6 +5159,214 @@
return CKR_OK;
}

CK_RV parse_ed_generate_template(CK_ATTRIBUTE_PTR pPublicKeyTemplate,

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 207 lines.
@@ -1698,7 +1786,7 @@
return CKR_OK;
}

static CK_RV load_public_key(yh_session *session, uint16_t id, EVP_PKEY *key) {
static CK_RV load_public_key(yh_session *session, uint16_t id, EVP_PKEY **key) {

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 117 lines.
}
char config[256];
assert(strlen(connector_url) + strlen("connector=") < 256);
sprintf(config, "connector=%s", connector_url);

Check failure

Code scanning / CodeQL

Unbounded write Critical

This 'call to sprintf' with input from
an environment variable
may overflow the destination.
qpernil and others added 21 commits June 3, 2024 15:47
Having problems signing with EdDSA on YubiHSM2 via PKCS11.
Getting an 
pkcs11:p11prov_Sign:The size of plaintext input data to a cryptographic operation is invalid (Out of range):interface.gen.c:679:Error returned by C_Sign
error

As I understand the PKCS11 v3.0 spec, the 1024 bit limit (note by "adma" in line 2228) applies only to "ECDSA without hashing" (CKM_ECDSA) as it only processes a hash value.

see: https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/os/pkcs11-curr-v3.0-os.html#_Toc30061189

EdDSA does not have this limit, so the size of "op_info->buffer" should be the limiting factor

see: https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/os/pkcs11-curr-v3.0-os.html#_Toc30061191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants