Parse UUID in parentheses 91/203791/1
authorOleksii Beketov <ol.beketov@samsung.com>
Wed, 10 Apr 2019 16:01:15 +0000 (19:01 +0300)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 18 Apr 2019 00:52:37 +0000 (09:52 +0900)
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/474
(cherry picked from c7dc17bd0571265e187e73148b8b7ab153b3f1ff)

Change-Id: Ic1509d9164c80d8cd9b10f0404db61b52772c48b
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index c3c3580..af3a839 100644 (file)
@@ -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);