Using optiga_crypt_ecc_generate_keypair with the right parameters gives " 0x202 (CMD ERROR)"

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
abhijithnalige
Level 1
Level 1
5 questions asked 10 sign-ins First reply posted

I am using "optiga_crypt_ecc_generate_keypair" to generate a keypair but I get " 0x202 (CMD ERROR)". can you please let me know whats wrong here.

Here's my API.

optiga_crypt_t *global_me_crypt;
    uint8_t pubkey[1728];
    uint16_t pubkey_len = (uint16_t)sizeof(pubkey);
optiga_crypt_ecc_generate_keypair( global_me_crypt,
                                                        OPTIGA_ECC_CURVE_NIST_P_256 :
                                                    OPTIGA_KEY_USAGE_SIGN,
                                                    FALSE,
                                                    0xE0F1,
                                                    pubkey,
                                                    &pubkey_len );
What am I missing here?
0 Likes
1 Solution
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

During the first time or successful case, the shm_open function updates errno as ENOENT because the O_CREAT was not specified in the arguments.

In the second case as you are using the same mutex name the shm_open function updates errno to a different value and it will not enter "if" block as shown in the image below.  

ShivaSai_S_0-1709633831747.png

Can you try adding the statement  "mutex.created = 1;" after the "if" block (after line 132)?

Best regards,
Shiva Sai 

 

View solution in original post

0 Likes
6 Replies
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

Can you please try creating crypt instance using the API "optiga_crypt_create()" and execute the API  optiga_crypt_ecc_generate_keypair() ?
Can you also share the screenshot of the CMD error ?

Best regards,
Shiva Sai

0 Likes
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

Can you please provide the Metadata of the object 0xE0F1 ?

Can you also provide the screenshot of the entire error displayed on the terminal ?

Best regards,
Shiva Sai 

0 Likes

Can you tell me the command to obtain Metadata.

Also, this is the only output I receive when I use "optiga_crypt_ecc_generate_keypair". How can i generate more debug?

0 Likes
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

Can you please provide the entire project ?
We will try to recreate the problem on our side.

Best regards,
Shiva Sai

0 Likes
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

I am working on this to reproduce the error.

Does the open application command work before executing the gen keypair?

Can you please enable the below logs  in the optiga_lib_config file ?

#define OPTIGA_LIB_ENABLE_UTIL_LOGGING
#define OPTIGA_LIB_ENABLE_CRYPT_LOGGING
#define OPTIGA_LIB_ENABLE_COMMS_LOGGING

Best regards,
Shiva Sai

0 Likes
ShivaSai_S
Moderator
Moderator
Moderator
100 sign-ins 25 replies posted 25 likes received

Hi @abhijithnalige ,

During the first time or successful case, the shm_open function updates errno as ENOENT because the O_CREAT was not specified in the arguments.

In the second case as you are using the same mutex name the shm_open function updates errno to a different value and it will not enter "if" block as shown in the image below.  

ShivaSai_S_0-1709633831747.png

Can you try adding the statement  "mutex.created = 1;" after the "if" block (after line 132)?

Best regards,
Shiva Sai 

 

0 Likes