Use GP 1.1.0 EDCH algorithm names 46/297246/2
authorDongsun Lee <ds73.lee@samsung.com>
Wed, 16 Aug 2023 00:57:43 +0000 (09:57 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Wed, 16 Aug 2023 01:08:28 +0000 (10:08 +0900)
- Use TEE_ALG_ECDH_PXXX(1.1.0) instead of TEE_ALG_ECDH_DERIVE_SHARED_SECRET(v1.1.1)

Change-Id: Iea77df5984248873f52949a2f04034c2ca47a8d0

ssflib/src/ssf_crypto.cpp

index 92c948b382057046837990a396dd909846631963..7a1a8ec708f8bc59516a6763ec8b8905af2c70e6 100644 (file)
@@ -939,7 +939,6 @@ int crypto_internal_open(crypto_internal_operation *operation)
        case TEE_ALG_ECDH_P256:
        case TEE_ALG_ECDH_P384:
        case TEE_ALG_ECDH_P521:
-       case TEE_ALG_ECDH_DERIVE_SHARED_SECRET:
                return 0; // do nothing
        default:
                return sw_crypto_open(operation);
@@ -964,7 +963,6 @@ int crypto_internal_close(crypto_internal_operation *operation)
        case TEE_ALG_ECDH_P256:
        case TEE_ALG_ECDH_P384:
        case TEE_ALG_ECDH_P521:
-       case TEE_ALG_ECDH_DERIVE_SHARED_SECRET:
                return 0; // do nothing
        default:
                return sw_crypto_close(operation);
@@ -1773,15 +1771,12 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algori
                case TEE_ALG_ECDH_P256:
                case TEE_ALG_ECDH_P384:
                case TEE_ALG_ECDH_P521:
-               if (mode != TEE_MODE_SIGN && mode != TEE_MODE_VERIFY) {
+               if (mode != TEE_MODE_DERIVE) {
                                return TEE_ERROR_NOT_SUPPORTED;
                }
 
-                       alg_class = TEE_OPERATION_ASYMMETRIC_SIGNATURE;
-                       if (mode == TEE_MODE_SIGN)
-                               key_object_type = TEE_TYPE_ECDH_KEYPAIR;
-                       else
-                               key_object_type = TEE_TYPE_ECDH_KEYPAIR;
+                       alg_class = TEE_OPERATION_KEY_DERIVATION;
+                       key_object_type = TEE_TYPE_ECDH_KEYPAIR;
                        break;
 
                /* Algorithm Class is KEY DERIVATION */
@@ -1794,15 +1789,6 @@ TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algori
                        key_object_type = TEE_TYPE_DH_KEYPAIR;
                        break;
 
-               case TEE_ALG_ECDH_DERIVE_SHARED_SECRET:
-               if (mode != TEE_MODE_DERIVE) {
-                               return TEE_ERROR_NOT_SUPPORTED;
-               }
-
-                       alg_class = TEE_OPERATION_KEY_DERIVATION;
-                       key_object_type = TEE_TYPE_ECDH_KEYPAIR;
-                       break;
-
                default:
                        LOGE(MODULE_SSF_LIB, "Not Support Algorithm : %X", algorithm);
                        rc =  TEE_ERROR_NOT_SUPPORTED;
@@ -2891,7 +2877,7 @@ TEE_Result TEE_AsymmetricVerifyDigest( TEE_OperationHandle operation, const TEE_
        }
 }
 
-// Only TEE_ALG_ECDH_DERIVE_SHARED_SECRET supported for now.
+// Only TEE_ALG_ECDH_PXXX supported for now.
 void TEE_DeriveKey( TEE_OperationHandle operation, TEE_Attribute* params, uint32_t paramCount, TEE_ObjectHandle derivedKey)
 {
        PERMISSION_CHECK_RETURN_VOID(PERM_CRYPTO);