From d22bd7bbfdee0c6f80e2b28f59c53198a5d905a4 Mon Sep 17 00:00:00 2001 From: Oleksii Beketov Date: Wed, 10 Apr 2019 19:01:15 +0300 Subject: [PATCH] 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 --- .../connectivity/src/adapter_util/ca_adapter_net_ssl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); -- 2.7.4