From: Oleksii Beketov
Date: Wed, 10 Apr 2019 16:01:15 +0000 (+0300)
Subject: Parse UUID in parentheses
X-Git-Tag: accepted/tizen/unified/20190418.145712~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F203791%2F1;p=platform%2Fupstream%2Fiotivity.git
Parse UUID in parentheses
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/474
(cherry picked from c7dc17bd0571265e187e73148b8b7ab153b3f1ff)
Change-Id: Ic1509d9164c80d8cd9b10f0404db61b52772c48b
Signed-off-by: DoHyun Pyun
---
diff --git a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
index c3c3580..af3a839 100644
--- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
+++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
@@ -2482,6 +2482,21 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, uint32_t d
uuidPos = memmem(peerCert->subject_raw.p, peerCert->subject_raw.len,
UUID_PREFIX, sizeof(UUID_PREFIX) - 1);
+ if (NULL == uuidPos)
+ {
+ void * posLeftBrace = NULL;
+ void * posRightBrace = NULL;
+ posLeftBrace = memmem(peerCert->subject_raw.p, peerCert->subject_raw.len, "(", 1);
+ if (NULL != posLeftBrace)
+ {
+ posRightBrace = memmem(peerCert->subject_raw.p, peerCert->subject_raw.len, ")", 1);
+ if (NULL != posRightBrace && posRightBrace - posLeftBrace - 1 == UUID_LENGTH * 2 + 4)
+ {
+ uuidPos = posLeftBrace;
+ }
+ }
+ }
+
if (NULL != uuidPos)
{
memcpy(uuid, (char*) uuidPos + sizeof(UUID_PREFIX) - 1, UUID_LENGTH * 2 + 4);