Fix compilaton for ARM architecture 22/218422/1 accepted/tizen_unified accepted/tizen/unified/20191125.135525 submit/tizen/20191125.082655
authorTomasz Swierczek <t.swierczek@samsung.com>
Fri, 22 Nov 2019 05:46:21 +0000 (06:46 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Fri, 22 Nov 2019 05:52:17 +0000 (06:52 +0100)
ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

Change-Id: I167ad1f98318e2d06a4ae2d3eb1110216bf9772c

ta/src/der_parse.c
ta/src/internal.c

index b1b9be5a9d7afa6d4eab1d26206bc99bd9003cd4..04ba70a506f5be4cb05e19c95e2620dfce6250d6 100644 (file)
@@ -76,8 +76,9 @@ fail:
 static size_t findNonZeroInt(DerData *it) {
        while (it->size) {
                const uint8_t tag = *it->data;
+               ssize_t len;
                scroll(it, 1);
-               ssize_t len = getLen(it);
+               len = getLen(it);
                if (len < 0)
                        goto fail;
                switch (tag) {
@@ -101,13 +102,16 @@ fail:
 }
 
 TEE_Result derParseAsymKey(const uint8_t *inp, size_t inpSize, DerData out[], size_t outSize) {
+       DerData in;
+       size_t len0;
        assert(inp);
        assert(inpSize);
        assert(out);
        assert(outSize);
 
-       DerData in = { .data = (uint8_t *)inp, .size = inpSize };
-       const size_t len0 = findNonZeroInt(&in);
+       in.data = (uint8_t *)inp;
+       in.size = inpSize;
+       len0 = findNonZeroInt(&in);
        switch (len0) {
        case 1+512/8:
        case 1+1024/8:
index b7ba514b26198843373c8ab83647fb51c6ad7f88..f844cd897f8ff4ce1856d76657340158483da39b 100644 (file)
@@ -131,11 +131,12 @@ static TEE_Result KM_CreateTransientObject(uint32_t object_type,
                                            uint32_t attr_size,
                                            TEE_ObjectHandle *hndl)
 {
+       TEE_Result ret;
        assert(attr);
        assert(attr_size);
        assert(hndl);
 
-       TEE_Result ret = TEE_AllocateTransientObject(object_type, max_object_size, hndl);
+       ret = TEE_AllocateTransientObject(object_type, max_object_size, hndl);
        if (TEE_SUCCESS != ret) {
                LOG("TEE_AllocateTransientObject has failed with=%x. Arguments=(object_type=%X, "
                        "max_object_size=%u.", ret, object_type, max_object_size);
@@ -166,6 +167,7 @@ TEE_Result KM_CreateAsymKey(tz_data_type type, KM_BinaryData der, TEE_ObjectHand
        TEE_Attribute attr[MAX_ATTRIBUTES_SIZE];
        const uint32_t *attrId;
        uint32_t attrCount, keyType;
+       TEE_Result ret;
 
        switch (type) {
        case TYPE_AKEY_PUBLIC_DSA:
@@ -193,7 +195,7 @@ TEE_Result KM_CreateAsymKey(tz_data_type type, KM_BinaryData der, TEE_ObjectHand
                return TEE_ERROR_BAD_PARAMETERS;
        }
 
-       TEE_Result ret = derParseAsymKey(der.data, der.data_size, derAttr, attrCount);
+       ret = derParseAsymKey(der.data, der.data_size, derAttr, attrCount);
        if (TEE_SUCCESS != ret) {
                LOG("Unable to parse der for key type %u", type);
                return ret;