diff options
-rw-r--r-- | ta/src/der_parse.c | 10 | ||||
-rw-r--r-- | ta/src/internal.c | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/ta/src/der_parse.c b/ta/src/der_parse.c index b1b9be5..04ba70a 100644 --- a/ta/src/der_parse.c +++ b/ta/src/der_parse.c @@ -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: diff --git a/ta/src/internal.c b/ta/src/internal.c index b7ba514..f844cd8 100644 --- a/ta/src/internal.c +++ b/ta/src/internal.c @@ -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; |