Skip to content

Commit 0ec3a09

Browse files
Mandeep ShettyErich Keane
Mandeep Shetty
authored and
Erich Keane
committed
Removed libsafec dependency since source for libsafec was taken down.
The sourceforge site taken down. Removed the dependancy since the xmpp lib was needed for remote access. This issue is tracked in IOT-617. Change-Id: I709871b06bd7bd957654f94361812519abd2305c Signed-off-by: Mandeep Shetty <[email protected]> Reviewed-on: https://gerrit.iotivity.org/gerrit/1705 Tested-by: jenkins-iotivity <[email protected]> Reviewed-by: Charlie Lenahan <[email protected]> Reviewed-by: Erich Keane <[email protected]>
1 parent 503a35f commit 0ec3a09

17 files changed

+48
-25
lines changed

build_common/SConscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def versionSufficient(sourceVer, requiredVer):
233233
if 'linux' in env['HOST']:
234234
# Check g++ version (GCC C-version shouldn't matter as much, but can be checked too
235235
# here if needed)
236-
REQUIRED_VER = "4.6.2"
236+
REQUIRED_VER = "4.6"
237237
# Check gcc version
238238
if not versionSufficient(env['CXXVERSION'], REQUIRED_VER):
239239
print "g++ version is insufficient to compile the client. Required:", REQUIRED_VER, " Found:", env['CXXVERSION']

external/SConscript.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
Import('env')
2222

2323
# Windows does not require safec, as the functions used are present in its C standard library
24-
if env['PLATFORM'] not in ['win']:
25-
SConscript([
26-
'safec/SConscript.py',
27-
], duplicate = 0)
24+
# if env['PLATFORM'] not in ['win']:
25+
# SConscript([
26+
# 'safec/SConscript.py',
27+
# ], duplicate = 0)
2828

2929
SConscript([
3030
'asio/SConscript.py',

ra_xmpp/SConscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
],
5454
LIBS = ['strophe'])
5555
ra_xmpp_env.Append(
56-
LIBS = ['ccfxmpp','safec-1.0','pthread'],
56+
LIBS = ['ccfxmpp','pthread'],
5757
LIBPATH = ['#src']
5858
)
5959

ra_xmpp/c_init_test/SConscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
],
4747
LIBS = ['strophe'])
4848
ra_xmpp_test_env.Append(
49-
LIBS = ['ra_xmpp', 'ccfxmpp', 'safec-1.0', 'curl']
49+
LIBS = ['ra_xmpp', 'ccfxmpp', 'curl']
5050
)
5151
ra_xmpp_test_env.AppendUnique(
5252
LIBPATH = [

ra_xmpp/ra_xmpp.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
#include <errno.h>
5454

5555
#if !defined(_WIN32)
56+
#ifdef WITH_SAFE
5657
#include <safe_mem_lib.h>
5758
#include <safe_str_lib.h>
59+
#endif
5860
#else
5961
#define WIN32_LEAN_AND_MEAN
6062
#include <windows.h>
@@ -247,7 +249,7 @@ char *const clone_c_str(const char *const str)
247249
char *const cloned_str = malloc(str_len + 1);
248250
if (cloned_str)
249251
{
250-
memmove_s(cloned_str, str_len, str, str_len);
252+
memmove(cloned_str, str, str_len);
251253
cloned_str[str_len] = 0;
252254

253255
return cloned_str;
@@ -284,9 +286,9 @@ void xmpp_context_init(xmpp_context_t *const context)
284286
if (context)
285287
{
286288
#if (defined(__STDC_WANT_LIB_EXT1__) && (__STDC_WANT_LIB_EXT1__ >= 1))
287-
memset_s(context, sizeof(*context), 0, sizeof(*context));
289+
memset_s(context, sizeof (*context), 0, sizeof(*context));
288290
#else
289-
memset_s(context, sizeof(*context), 0);
291+
memset(context, 0, sizeof(*context));
290292
#endif
291293
context->cb = sizeof(*context);
292294
}
@@ -303,7 +305,7 @@ xmpp_context_t *clone_context(const xmpp_context_t *context)
303305
xmpp_context_t *cloned_context = calloc(1, sizeof(*context));
304306
if (cloned_context)
305307
{
306-
memmove_s(cloned_context, sizeof(*cloned_context), context, sizeof(*context));
308+
memmove(cloned_context, context, sizeof(*context));
307309
}
308310
return cloned_context;
309311
}
@@ -318,7 +320,7 @@ void xmpp_host_init(xmpp_host_t *const host, const char *const host_name,
318320
#if (defined(__STDC_WANT_LIB_EXT1__) && (__STDC_WANT_LIB_EXT1__ >= 1))
319321
memset_s(host, sizeof(*host), 0, sizeof(*host));
320322
#else
321-
memset_s(host, sizeof(*host), 0);
323+
memset(host, 0, sizeof(*host));
322324
#endif
323325
host->cb = sizeof(*host);
324326

@@ -353,9 +355,9 @@ void xmpp_identity_init(xmpp_identity_t *const identity, const char *const user_
353355
if (identity)
354356
{
355357
#if (defined(__STDC_WANT_LIB_EXT1__) && (__STDC_WANT_LIB_EXT1__ >= 1))
356-
memset_s(identity, sizeof(*identity), 0, sizeof(*identity));
358+
memset_s(identity, sizeof (*identity), 0, sizeof(*identity));
357359
#else
358-
memset_s(identity, sizeof(*identity), 0);
360+
memset(identity, 0, sizeof(*identity));
359361
#endif
360362
identity->cb = sizeof(*identity);
361363

@@ -392,7 +394,7 @@ void xmpp_proxy_init(xmpp_proxy_t *const proxy, const char *const host,
392394
#if (defined(__STDC_WANT_LIB_EXT1__) && (__STDC_WANT_LIB_EXT1__ >= 1))
393395
memset_s(proxy, sizeof(*proxy), 0, sizeof(*proxy));
394396
#else
395-
memset_s(proxy, sizeof(*proxy), 0);
397+
memset(proxy, 0, sizeof(*proxy));
396398
#endif
397399

398400

ra_xmpp/test/SConscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
],
4848
LIBS = ['strophe'])
4949
ra_xmpp_test_env.Append(
50-
LIBS = ['ra_xmpp', 'ccfxmpp', 'gtest', 'safec-1.0', 'pthread', 'curl']
50+
LIBS = ['ra_xmpp', 'ccfxmpp', 'gtest', 'pthread', 'curl']
5151
)
5252
ra_xmpp_test_env.AppendUnique(
5353
LIBPATH = [

src/common/bufferencrypt.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@
2929
#include "rand_helper.h"
3030
#include <openssl/evp.h>
3131
#include <stdint.h>
32+
#include <string.h>
3233
#include <limits>
3334
#include <algorithm>
3435

3536
extern "C"
3637
{
3738
#if !defined(_WIN32)
39+
#ifdef WITH_SAFE
3840
#include <safe_mem_lib.h>
3941
#include <safe_str_lib.h>
4042
#endif
43+
#endif
4144
}
4245

4346
#ifdef _WIN32
@@ -225,7 +228,7 @@ namespace Iotivity
225228
// Otherwise clear out the memory.
226229
::SecureZeroMemory(ptr(), allocatedSize());
227230
# else
228-
::memset_s(ptr(), allocatedSize(), 0);
231+
::memset(ptr(), 0, allocatedSize());
229232
# endif
230233
#endif
231234

@@ -278,7 +281,7 @@ namespace Iotivity
278281
newBufferRealSize - DEBUG_BYTE_BUFFER_GUARD_REGION_SIZE,
279282
ptr(), std::min(newBufferRealSize, allocatedSize()));
280283
#else
281-
::memmove_s(newPtr, newBufferRealSize, ptr(), std::min(newBufferRealSize, allocatedSize()));
284+
::memmove(newPtr, ptr(), std::min(newBufferRealSize, allocatedSize()));
282285
#endif
283286
freeBufferSecure();
284287

src/common/buffers.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@
4848
extern "C"
4949
{
5050
#if !defined(_WIN32)
51+
#ifdef WITH_SAFE
5152
#include <safe_mem_lib.h>
5253
#include <safe_str_lib.h>
5354
#endif
55+
#endif
5456
}
5557

5658
#ifdef WINCE
@@ -777,7 +779,7 @@ namespace Iotivity
777779
if (buf && size && m_position < this->size())
778780
{
779781
bytesRead = std::min(size, this->size() - m_position);
780-
memcpy_s(buf, size, &((unsigned char *)ptr())[m_position], bytesRead);
782+
memcpy(buf, &((unsigned char *)ptr())[m_position], bytesRead);
781783
m_position += bytesRead;
782784
}
783785
return bytesRead;
@@ -814,7 +816,7 @@ namespace Iotivity
814816
// the position.
815817
if (buf)
816818
{
817-
memcpy_s(&((unsigned char *)ptr())[m_position], size, buf, size);
819+
memcpy(&((unsigned char *)ptr())[m_position], buf, size);
818820
}
819821
m_position += size;
820822
appended = true;

src/xml/portabledom.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@
4545
extern "C"
4646
{
4747
#if !defined(_WIN32)
48+
#ifdef WITH_SAFE
4849
#include <safe_mem_lib.h>
4950
#include <safe_str_lib.h>
5051
#endif
52+
#endif
5153
}
5254

5355
using namespace std;
@@ -602,7 +604,7 @@ namespace Iotivity
602604
m_sourceStr = m_sourceDoc.allocate_string(0, size + 1);
603605
if (m_sourceStr)
604606
{
605-
memcpy_s(m_sourceStr, size, (const void *)utf8SrcBuffer, size);
607+
memcpy(m_sourceStr, (const void *)utf8SrcBuffer, size);
606608
m_sourceStr[size] = 0;
607609
m_sourceDoc.parse(m_sourceStr, bytesRead, parse_stop_at_next_sibling);
608610
outNode = documentElement();
@@ -627,7 +629,7 @@ namespace Iotivity
627629
m_sourceStr = m_sourceDoc.allocate_string(0, size + 1);
628630
if (m_sourceStr)
629631
{
630-
memcpy_s(m_sourceStr, size, (const void *)utf8SrcBuffer, size);
632+
memcpy(m_sourceStr, (const void *)utf8SrcBuffer, size);
631633
m_sourceStr[size] = 0;
632634
m_sourceDoc.parse(m_sourceStr, ending == EndingTest::IgnoreEnding ?
633635
parse_default : parse_validate_closing_tags);

test/SConscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# We use append rather than appendunique to force certain dynamic libraries to appear
5252
# after the static libraries. This does result in duplication on the command line.
5353
ccfxmpp_tests_env.Append(
54-
LIBS = [ccfxmpplib, 'gmock', 'gtest', 'curl', 'ssl', 'pthread', 'crypto', 'safec-1.0'],
54+
LIBS = [ccfxmpplib, 'gmock', 'gtest', 'curl', 'ssl', 'pthread', 'crypto'],
5555
)
5656
ccfxmpp_tests_env.AppendUnique(
5757
LIBPATH = [

test/ping_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
extern "C"
3838
{
3939
#if !defined(_WIN32)
40+
#ifdef WITH_SAFE
4041
#include <safe_mem_lib.h>
4142
#include <safe_str_lib.h>
43+
#endif
4244
#endif //WIN32
4345
}
4446

test/pubsub_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
extern "C"
3434
{
3535
#if !defined(_WIN32)
36+
#ifdef WITH_SAFE
3637
#include <safe_mem_lib.h>
3738
#include <safe_str_lib.h>
39+
#endif
3840
#endif //WIN32
3941
}
4042

test/register_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
extern "C"
3737
{
3838
#if !defined(_WIN32)
39+
#ifdef WITH_SAFE
3940
#include <safe_mem_lib.h>
4041
#include <safe_str_lib.h>
4142
#endif
43+
#endif
4244
}
4345

4446

test/servicedisc_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
extern "C"
3737
{
3838
#if !defined(_WIN32)
39+
#ifdef WITH_SAFE
3940
#include <safe_mem_lib.h>
4041
#include <safe_str_lib.h>
4142
#endif
43+
#endif
4244
}
4345

4446

test/xmpp_compliance_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@
4141
extern "C"
4242
{
4343
#if !defined(_WIN32)
44+
#ifdef WITH_SAFE
4445
#include <safe_mem_lib.h>
4546
#include <safe_str_lib.h>
4647
#endif
48+
#endif
4749
}
4850

4951
using namespace std;

test/xmpp_dummy_server.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646
extern "C"
4747
{
4848
#if !defined(_WIN32)
49+
#ifdef WITH_SAFE
4950
#include <safe_mem_lib.h>
5051
#include <safe_str_lib.h>
5152
#endif
53+
#endif
5254
}
5355

5456

@@ -166,7 +168,7 @@ void SegmentedDummyTCPConnect::async_receive(std::shared_ptr<ByteBuffer> buffer,
166168
// smaller too, but this should not affect normal operation.
167169
throw runtime_error("Insufficient buffer for simulated read request");
168170
}
169-
memcpy_s(buffer->get(), buffer->size(), currentData.c_str(), currentData.size());
171+
memcpy(buffer->get(), currentData.c_str(), buffer->size());
170172
nextAction();
171173
f(connect_error::SUCCESS, currentData.size());
172174
}
@@ -269,7 +271,7 @@ void SegmentedDummyTCPConnect::async_receive(std::shared_ptr<ByteBuffer> buffer,
269271
{
270272
throw runtime_error("Insufficient buffer for simulated read request");
271273
}
272-
memcpy_s(buffer->get(), buffer->size(), currentData.c_str(), currentData.size());
274+
memcpy(buffer->get(), currentData.c_str(), buffer->size());
273275
nextAction();
274276
f(connect_error::SUCCESS, currentData.size());
275277
#else

test/xmpp_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@
5151
extern "C"
5252
{
5353
#if !defined(_WIN32)
54+
#ifdef WITH_SAFE
5455
#include <safe_mem_lib.h>
5556
#include <safe_str_lib.h>
5657
#endif
58+
#endif
5759
}
5860

5961

0 commit comments

Comments
 (0)