Skip to content

Commit

Permalink
Merge pull request #44 from anhu/maxq10xx
Browse files Browse the repository at this point in the history
Bring in support for MAXQ1065
  • Loading branch information
dgarske authored Jan 24, 2025
2 parents 5e8b4f1 + 7cb9d12 commit b55a575
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 11 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ See wolfpkcs11/store.h for prototypes of functions to implement.

Sets the private key's label against the public key when generating key pairs.

#### MAXQ10xx

Support has been added to use the maxq10xx hardware for cryptographic operations
and storage of certificate.

NOTE: In the code, we have embedded a test key. This must be changed for
production environments!! Please contact Analog Devices to learn how to
obtain and use a production key.

## Environment variables

Expand Down
24 changes: 23 additions & 1 deletion src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -2635,8 +2635,30 @@ CK_RV C_SignInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
return CKR_ARGUMENTS_BAD;

ret = WP11_Object_Find(session, hKey, &obj);
if (ret != 0)
#ifdef WOLFSSL_MAXQ10XX_CRYPTO
if ((ret != 0) && (hKey == 0) && (pMechanism->mechanism == CKM_ECDSA)) {
/* Check for the expected devId because we are not setting the object.
* If this wasn't MAXQ it would be strange behaviour. */
if (session->devId != MAXQ_DEVICE_ID) {
return CKR_MECHANISM_PARAM_INVALID;
}

if (pMechanism->pParameter != NULL || pMechanism->ulParameterLen != 0) {
return CKR_MECHANISM_PARAM_INVALID;
}

/* The private key is pre-provisioned so no object to set. */
init = WP11_INIT_ECDSA_SIGN;
WP11_Session_SetMechanism(session, pMechanism->mechanism);
WP11_Session_SetOpInitialized(session, init);

return CKR_OK;
}
else
#endif
if (ret != 0) {
return CKR_OBJECT_HANDLE_INVALID;
}

type = WP11_Object_GetType(obj);
switch (pMechanism->mechanism) {
Expand Down
Loading

0 comments on commit b55a575

Please sign in to comment.