This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: ECDH and ECDSA

Part Number: CC2642R

Hello,

I try out the NISP-256, NISTP-384 and NISTP-521 on the CC2642 and the simplelink SDK version 3_30_00_03.  Here are the results:

For P256: (curve size = 32)

  • Able to generate a private-public key pair
  • Able to generate a shared secret from 2 private-public key pairs
  • Able to sign a message
  • Able to verify a signed message

For P384: (curve size = 48)

  • Able to generate a private-public key pair
  • Able to generate a shared secret from 2 private-public key pairs
  • Able to sign a message
  • However, not able to verify a signed message

For P521: (curve size = 64, 65 and 66)

  • Not able to even generate a private-public key pair.

Is there an issue with P384 and P521 on the version of my SDK?  Would it solve my issue with P384 and P512 if I upgrade my SDK to the latest one?

Thanks

Victor Nguyen

  • Hi,

    We will look into it and get back to you ASAP. Please bear with us.

    Thanks,

    PM

  • Hi,

    Some questions to clarify a little bit.

    Which test vectors failed? Was the result generated wrong? Which error was returned? Did the application crash?

    Regards,

  • Hi,

    For the P384, it failed when I do the signature verify.  I was able to generate a signature (r,s).  However, when I use that signature to verify, it gives error (-4) which is ECDSA_STATUS_S_LARGER_THAN_ORDER.  Here is the snippet of code:

    #define CURVE_LENGTH 48

    uint8_t theirPrivateKeyingMaterial[CURVE_LENGTH] = {0};
    uint8_t theirPublicKeyingMaterial[2 * CURVE_LENGTH + 1] = {0};
    uint8_t r[CURVE_LENGTH] = {0};
    uint8_t s[CURVE_LENGTH] = {0};

    // Sign the cipher text message
    ECDSA_init();

    ECDSA_Params_init(&ecdsaParams);

    // Since we are using default ECDSA_Params, we just pass in NULL for that parameter.
    ecdsaHandle = ECDSA_open(0, NULL);

    if (!ecdsaHandle) {
    // Handle error
    while(1);
    }

    CryptoKeyPlaintext_initKey(&theirPrivateKey, theirPrivateKeyingMaterial, sizeof(theirPrivateKeyingMaterial));

    // Initialize parameters for generating a signature
    ECDSA_OperationSign_init(&operationSign);
    //operationSign.curve = &ECCParams_NISTP256;
    operationSign.curve = &ECCParams_NISTP384;
    //operationSign.curve = &ECCParams_NISTP521;
    operationSign.myPrivateKey = &theirPrivateKey;
    operationSign.hash = VictorMsg;
    operationSign.r = r;
    operationSign.s = s;

    // Generate the signature
    operationResult = ECDSA_sign_mod(ecdsaHandle, &operationSign);

    if (operationResult != ECDSA_STATUS_SUCCESS) {
    // Handle error
    while(1);
    }

    ECDSA_close(ecdsaHandle);

    // Since we are using default ECDSA_Params, we just pass in NULL for that parameter.
    ecdsaHandle = ECDSA_open(0, NULL);

    if (!ecdsaHandle) {
    // Handle error
    while(1);
    }

    CryptoKeyPlaintext_initKey(&theirPublicKey, theirPublicKeyingMaterial, sizeof(theirPublicKeyingMaterial));

    // Initialize parameters for verifying a signature
    ECDSA_OperationVerify_init(&operationVerify);
    //operationVerify.curve = &ECCParams_NISTP256;
    operationVerify.curve = &ECCParams_NISTP384;
    //operationVerify.curve = &ECCParams_NISTP521;
    operationVerify.theirPublicKey = &theirPublicKey;
    operationVerify.hash = VictorMsg;
    operationVerify.r = r;
    operationVerify.s = s;

    operationResult = ECDSA_verify(ecdsaHandle, &operationVerify);

    if (operationResult != ECDSA_STATUS_SUCCESS) {
    // Handle error
    while(1);
    }

    By the way, it works when I use curve = &ECCParams_NISTP256.with the same code.

    Thanks

  • Any progress on this issue?

    Thanks

  • Hi Victor,

    Sorry for the delay on this. I will look into it this week.

    Regard.

  • Have any update on this issue?

    Thanks,

  • Hello FI,

    Have you had a chance to look into this issue?  Try to make a decision to go with NISP-384 or NISP-256.

    Thanks,

    Victor Nguyen