IOT-2539 remove unused function warning
authorGeorge Nash <george.nash@intel.com>
Wed, 2 Aug 2017 22:40:48 +0000 (15:40 -0700)
committerGeorge Nash <george.nash@intel.com>
Mon, 28 Aug 2017 23:17:32 +0000 (23:17 +0000)
The static function GenerateEccKeyPair in occertutility.c
in unused and can be delete.

Note: there is a line for line copy of this function also
found in certhelpers.c that is used. So deleting this
function will not cause the code to be lost.

Bug: https://jira.iotivity.org/browse/IOT-2539
Change-Id: I3a5aefdd316cf5cedd6af58811358ebdd3589838
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21735
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
(cherry picked from commit b678dcbb8be1b0eb00ba48625ba511fa2412901c)

resource/csdk/security/src/occertutility.c

index 06c0ed0..8510f89 100644 (file)
@@ -84,59 +84,6 @@ static const unsigned char s_ekuRole[] = { 0x30, 0x0C, 0x06, 0x0A, 0x2B, 0x06, 0
 /* ASN.1 DER encoding of the EKU for both identity and roles (for use by CAs) */
 static const unsigned char s_ekuCA[] = { 0x30, 0x18, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xDE, 0x7C, 0x01, 0x06, 0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xDE, 0x7C, 0x01, 0x07 };
 
-/**
- * Generates elliptic curve keypair.
- *
- * @param[out]  pk    mbedtls public key container
- *
- * @return  0 on success or <0 on error
- */
-static int GenerateEccKeyPair(mbedtls_pk_context *pk)
-{
-    int ret = 0;
-    mbedtls_entropy_context entropy;
-    mbedtls_ctr_drbg_context ctr_drbg;
-
-    OIC_LOG_V(DEBUG, TAG, "In %s", __func__);
-    VERIFY_NON_NULL_RET(pk, TAG, "Param pk is NULL", -1);
-
-    // Initialize the DRBG context
-    mbedtls_ctr_drbg_init(&ctr_drbg);
-    mbedtls_entropy_init(&entropy);
-    ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
-                                &entropy, (const unsigned char *)PERSONALIZATION_STRING, sizeof(PERSONALIZATION_STRING));
-
-    if (0 > ret)
-    {
-        OIC_LOG_V(ERROR, TAG, "Seed initialization failed! %d", ret);
-        OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);
-        goto exit;
-    }
-    mbedtls_ctr_drbg_set_prediction_resistance(&ctr_drbg, MBEDTLS_CTR_DRBG_PR_ON);
-    ret = mbedtls_pk_setup(pk, mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY));
-    if (0 > ret)
-    {
-        OIC_LOG_V(ERROR, TAG, "mbedtls_pk_setup error %d", ret);
-        OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);
-        goto exit;
-    }
-    ret = mbedtls_ecp_gen_key(MBEDTLS_ECP_DP_SECP256R1, mbedtls_pk_ec(*pk), mbedtls_ctr_drbg_random, &ctr_drbg);
-    if (0 > ret)
-    {
-        OIC_LOG(ERROR, TAG, "mbedtls_ecp_gen_keypair error");
-        OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);
-        goto exit;
-    }
-
-exit:
-
-    mbedtls_ctr_drbg_free(&ctr_drbg);
-    mbedtls_entropy_free(&entropy);
-
-    OIC_LOG_V(DEBUG, TAG, "Out %s", __func__);
-    return 0;
-}
-
 OCStackResult OC_CALL OCGenerateRandomSerialNumber(char **serial, size_t *serialLen)
 {
     int ret = 0;