Commit e0799691 authored by Kevin Kane's avatar Kevin Kane

Merge branch '1.3-rel'

Change-Id: Iab4933db4040259fa14e8d0a085ffb6b7ff4739d
Signed-off-by: default avatarKevin Kane <kkane@microsoft.com>
parents 9a041ba5 2696830c
......@@ -217,7 +217,7 @@ MPMResult MPMLoad(MPMPluginHandle *pluginHandle, const char *pluginName, MPMCall
MPMResult result = MPM_RESULT_INTERNAL_ERROR;
MPMPluginRunTime *functionSymbolTable;
if ((pluginName == NULL))
if (pluginName == NULL)
{
OIC_LOG(ERROR, TAG, "PluginName is NULL");
return result;
......
......@@ -207,7 +207,7 @@ static bool parseAuthorizedBridge(cJSON *object)
bool collectAuthorizedClients(const char *macAddrString, char *clientArray, uint32_t *numClients)
{
if ((macAddrString == NULL))
if (macAddrString == NULL)
{
OIC_LOG_V(ERROR, TAG, "Mac id is NULL");
return false;
......
......@@ -722,7 +722,7 @@ OCEntityHandlerResult handleEntityHandlerRequests(
try
{
if ((entityHandlerRequest == NULL))
if (entityHandlerRequest == NULL)
{
throw "Entity handler received a null entity request context" ;
}
......
......@@ -41,13 +41,15 @@ if env['CC'] == 'cl':
env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
# Work around [IOT-1986]
# During some Windows multi-threaded builds, SCons/Python/Pywin32 appear to try
# linking with oc.lib while another SCons thread started executing InstallTarget()
# for this static LIB, but didn't finish yet. That behavior results in linker errors.
# Work around this issue by linking with the source of InstallTarget(), rather
# than the target.
# Work around [IOT-1986]
# During some Windows multi-threaded builds, SCons/Python/Pywin32 appear to try
# linking with these static libraries while another SCons thread started executing
# InstallTarget() for this static LIB, but didn't finish yet. That behavior results
# in linker errors. Work around this issue by linking with the source of InstallTarget(),
# rather than the target.
env.PrependUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'src')])
env.PrependUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'oc_logger')])
env.PrependUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk', 'resource-directory')])
env.AppendUnique(PATH = os.environ['PATH'])
env['PDB'] = '${TARGET.base}.pdb'
......
......@@ -19,7 +19,7 @@
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Import('env')
import SCons.Errors
import os
import sys
import subprocess
......@@ -79,10 +79,13 @@ if not found:
if os.path.exists('.git/HEAD'):
# Apply ocf patch on git revision
cmd = 'git checkout development && git reset --hard ' + mbedtls_revision + ' && git clean -f && git apply --whitespace=fix ../ocf.patch'
os.system(cmd)
res = os.system(cmd)
else:
print "mbedtls: error: missing %s" % pattern
Exit(1)
# Fallback to regular patch command
cmd = 'patch -p1 -l -f < ../ocf.patch'
res = os.system(cmd)
if 0 != res:
raise SCons.Errors.StopError('mbedtls: issue on applying patch: %d' % res)
os.chdir(start_dir)
......
......@@ -33,7 +33,6 @@ cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
cp -R ./extlibs/mbedtls $sourcedir/tmp/extlibs
cp -R ./extlibs/gtest $sourcedir/tmp/extlibs
cp -LR ./extlibs/sqlite3 $sourcedir/tmp/extlibs
cp -R ./extlibs/timer $sourcedir/tmp/extlibs
cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
cp -R ./extlibs/libcoap $sourcedir/tmp/extlibs
cp -R ./resource $sourcedir/tmp
......@@ -56,6 +55,8 @@ cd $sourcedir/tmp
secured=1
gbscommand="gbs build -A armv7l "
nproc=$(expr 1 + $(expr `nproc --ignore=1` / 2 ) )
gbscommand=$gbscommand" --define '_smp_mflags -j$nproc'"
for ARGUMENT_VALUE in $*
do
......
......@@ -6,26 +6,26 @@ PROJECT_VERSION = env.get('PROJECT_VERSION')
TARGET_ARCH = env.get('TARGET_ARCH')
if env.get('RELEASE'):
RELEASE="release"
RELEASE="release"
else:
RELEASE="debug"
RELEASE="debug"
SECURED = env.get('SECURED')
target_os = env.get('TARGET_OS')
if env.get('WITH_CLOUD'):
CLOUD=1
CLOUD=1
else:
CLOUD=0
CLOUD=0
if env.get('WITH_TCP'):
TCP=1
TCP=1
else:
TCP=0
TCP=0
if env.get('MULTIPLE_OWNER'):
ANDROID_MULTIPLE_OWNER=1
ANDROID_MULTIPLE_OWNER=1
else:
ANDROID_MULTIPLE_OWNER=0
ANDROID_MULTIPLE_OWNER=0
MQ = env.get('WITH_MQ')
MQ_SUB = 0
......@@ -38,31 +38,31 @@ TRANSPORT_BLE = 0
TRANSPORT_NFC = 0
if 'SUB' in MQ:
MQ_SUB = 1
MQ_SUB = 1
if 'PUB' in MQ:
MQ_PUB = 1
MQ_PUB = 1
if 'BROKER' in MQ:
MQ_BROKER = 1
MQ_BROKER = 1
if 'ALL' in TARGET_TRANSPORT:
TRANSPORT_EDR = 1
TRANSPORT_BLE = 1
TRANSPORT_NFC = 1
print "Android Transport is ALL"
TRANSPORT_EDR = 1
TRANSPORT_BLE = 1
TRANSPORT_NFC = 1
print "Android Transport is ALL"
else:
if 'BT' in TARGET_TRANSPORT:
TRANSPORT_EDR = 1
if 'BLE' in TARGET_TRANSPORT:
TRANSPORT_BLE = 1
if 'NFC' in TARGET_TRANSPORT:
TRANSPORT_NFC = 1
if 'BT' in TARGET_TRANSPORT:
TRANSPORT_EDR = 1
if 'BLE' in TARGET_TRANSPORT:
TRANSPORT_BLE = 1
if 'NFC' in TARGET_TRANSPORT:
TRANSPORT_NFC = 1
if target_os == "android":
android_home = env.get('ANDROID_HOME')
os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
print '''
android_home = env.get('ANDROID_HOME')
os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
print '''
***************************************** Info ********************************
* Either 'Android API 21' is not installed or 'Android SDK Build Tools *
* 20.0.0' is not installed. The Android SDK Manager will now open. Please *
......@@ -88,12 +88,15 @@ if target_os == "android":
...Opening Android SDK Manager now. Once you are finished, the build will continue.
'''
os.system(android_home + '/tools/android')
os.system(android_home + '/tools/android')
def ensure_libs(target, source, env):
return target, [source, env.get('BUILD_DIR') + 'liboc.so', env.get('BUILD_DIR') + 'liboc_logger.so', env.get('BUILD_DIR') + 'libocstack-jni.so']
return target, [source, env.get('BUILD_DIR') + 'libca-interface.so',
env.get('BUILD_DIR') + 'liboc.so',
env.get('BUILD_DIR') + 'liboc_logger.so',
env.get('BUILD_DIR') + 'libocstack-jni.so']
SConscript('jni/SConscript')
jniOut = SConscript('jni/SConscript')
jdk_env = Environment(ENV=os.environ)
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
......@@ -102,44 +105,45 @@ cmdBuildApi=jdk_env.Gradle(target="base/objs", source="common/src/main/java/org/
examples_target = "java"
if target_os == 'android':
examples_target = "android"
examples_target = "android"
jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
#cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, ))
cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
if target_os != 'android':
exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
Depends(exampleAclFiles, cmdBuildExamples)
exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
Depends(exampleAclFiles, cmdBuildExamples)
Depends(cmdBuildExamples, cmdBuildApi)
Depends(cmdBuildExamples, jniOut)
if target_os == 'android':
jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-android/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/cloudprovisioningclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/DirectPairing/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/provisioningclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simplebase/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclientserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-android/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/cloudprovisioningclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/devicediscoveryserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/DirectPairing/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgegroupserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/fridgeserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/groupserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/presenceserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/provisioningclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simplebase/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleclientserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-android/simpleserver/build/')
else:
jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-linux/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclientserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/iotivity-linux/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclient/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleclientserver/build/')
jdk_env.Clean(cmdBuildExamples, '#/java/examples-java/simpleserver/build/')
env.AppendUnique(baseAAR = cmdBuildApi)
......@@ -50,6 +50,7 @@ import org.iotivity.base.OcResourceResponse;
import org.iotivity.base.PlatformConfig;
import org.iotivity.base.QualityOfService;
import org.iotivity.base.ServiceType;
import org.iotivity.ca.CaInterface;
import java.io.PrintWriter;
import java.io.StringWriter;
......@@ -510,6 +511,9 @@ public class MessageFragment extends Fragment implements OcResource.OnGetListene
// ******************************************************************************
private void initOcPlatform(ModeType type) {
// BLE Advertisement is enabled by default.
CaInterface.setBTConfigure(2);
PlatformConfig cfg = new PlatformConfig(mActivity, mContext,
ServiceType.IN_PROC,
type,
......
......@@ -196,7 +196,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcRepresentation_setValueStringN
}
std::string key = env->GetStringUTFChars(jKey, nullptr);
std::string value = env->GetStringUTFChars(jValue, nullptr);
std::string value;
if(jValue)
value = env->GetStringUTFChars(jValue, nullptr);
rep->setValue(key, value);
}
......
......@@ -616,6 +616,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
g_mid_OcOicSecPdAcl_get_recurrences = env->GetMethodID(g_cls_OcOicSecPdAcl, "getRecurrences", "(I)Ljava/lang/String;");
VERIFY_VARIABLE_NULL(g_mid_OcOicSecPdAcl_get_recurrences);
#ifdef SECURED
#ifdef WITH_CLOUD
#ifdef __WITH_TLS__
//OcCloudProvisioning
......@@ -630,6 +631,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
g_mid_OcCloudProvisioning_getPort = env->GetMethodID(g_cls_OcCloudProvisioning, "getPort", "()I");
VERIFY_VARIABLE_NULL(g_mid_OcCloudProvisioning_getPort);
#endif
#endif
#endif
return JNI_CURRENT_VERSION;
}
......
......@@ -85,6 +85,9 @@ if target_os == 'android':
if target_os in ['darwin', 'ios']:
jni_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
if env.get('SECURED') == '1':
jni_env.AppendUnique(CPPDEFINES=['SECURED'])
if env.get('WITH_CLOUD'):
jni_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
......
......@@ -54,8 +54,7 @@ elevator_server_env.PrependUnique(LIBS = [
'oc',
'connectivity_abstraction',
'coap',
'octbstack',
'oc_logger',
'octbstack'
])
if elevator_server_env.get('SECURED') == '1':
......@@ -64,9 +63,8 @@ if elevator_server_env.get('SECURED') == '1':
if target_os in ['msys_nt', 'windows']:
elevator_server_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
elevator_server_env.PrependUnique(LIBS = ['resource_directory'])
else:
elevator_server_env.PrependUnique(LIBS = ['oc_logger'])
if target_os not in ['windows', 'msys_nt']:
elevator_server_env.AppendUnique(LIBS = ['dl'])
......
......@@ -49,14 +49,18 @@ ipca_lib_env.PrependUnique(CPPPATH = [
'#/extlibs/cjson',
])
ipca_lib_env.Replace(WINDOWS_INSERT_DEF = ['1'])
if target_os in ['windows', 'msys_nt']:
ipca_lib_env.Replace(WINDOWS_INSERT_DEF = ['1'])
else:
ipca_lib_env.PrependUnique(LIBS = [
'oc_logger'
])
ipca_lib_env.PrependUnique(LIBS = [
'oc',
'connectivity_abstraction',
'coap',
'octbstack',
'oc_logger'
'octbstack'
])
if ipca_env.get('SECURED') == '1':
......@@ -79,9 +83,6 @@ if target_os in ['linux']:
ipca_lib_env.PrependUnique(LIBS = ['gcov'])
ipca_lib_env.AppendUnique(CXXFLAGS = ['--coverage'])
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
ipca_lib_env.PrependUnique(LIBS = ['resource_directory'])
######################################################################
# Source files and Targets
######################################################################
......
......@@ -58,7 +58,7 @@ ipcatest_env.AppendUnique(CPPPATH = [
])
ipcatest_env.PrependUnique(LIBS = [
'oc_logger',
'oc_logger_internal',
'octbstack',
'ipca_static'
])
......@@ -81,9 +81,6 @@ if use_iotivity == 1:
if target_os in ['msys_nt', 'windows']:
ipcatest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
ipcatest_env.PrependUnique(LIBS = ['resource_directory'])
if ipcatest_env.get('MULTIPLE_OWNER') == '1':
ipcatest_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
......
......@@ -63,6 +63,7 @@ class OICAllocTestsBase : public testing::Test
{
public:
OICAllocTestsBase() :
m_allocatedSize(0),
m_pBuffer(NULL)
{}
......
......@@ -250,6 +250,7 @@ CAResult_t CASetRAInfo(const CARAInfo_t *caraInfo);
*/
CAResult_t CASetProxyUri(const char *uri);
#ifdef IP_ADAPTER
/**
* This function return zone id related from ifindex and address.
*
......@@ -259,6 +260,7 @@ CAResult_t CASetProxyUri(const char *uri);
* @return ::CA_STATUS_OK or ::CA_STATUS_INVALID_PARAM
*/
CAResult_t CAGetLinkLocalZoneId(uint32_t ifindex, char **zoneId);
#endif
#ifdef __cplusplus
} /* extern "C" */
......
......@@ -67,9 +67,9 @@ typedef int (*CAgetPskCredentialsHandler)(CADtlsPskCredType_t type,
uint8_t *result, size_t result_length);
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
#ifdef MULTIPLE_OWNER
/**
* API to get a secure connected peer information
* API to get security information about a connected peer
*
* @param[in] peer peer information includs IP address and port.
* @param[out] sep copy of secure endpoint info
......@@ -77,7 +77,6 @@ typedef int (*CAgetPskCredentialsHandler)(CADtlsPskCredType_t type,
* @return CA_STATUS_OK on success; other error otherwise
*/
CAResult_t CAGetSecureEndpointData(const CAEndpoint_t *peer, CASecureEndpoint_t *sep);
#endif //MULTIPLE_OWNER
/**
* Adds a bit to the attributes field of a secure endpoint.
......
......@@ -152,7 +152,7 @@ CAResult_t CAUtilCMTerminate();
* @param[in] isCloud with cloud or not.
* @return ::CA_STATUS_OK or Appropriate error code.
*/
CAResult_t CAUtilCMUpdateRemoteDeviceInfo(const CAEndpoint_t endpoint, bool isCloud);
CAResult_t CAUtilCMUpdateRemoteDeviceInfo(const CAEndpoint_t *endpoint, bool isCloud);
/**
* Reset RemoteDevice Info. for Connection Manager
......
......@@ -55,7 +55,6 @@ mkdir -p $sourcedir/tmp/con/sample/external/inc
cp -R $cur_dir/external/inc/* $sourcedir/tmp/con/sample/external/inc/
cp -R ./extlibs/mbedtls/ $sourcedir/tmp/con/mbedtls/
cp -R ./extlibs/timer/ $sourcedir/tmp/con/extlibs/
cp -R ./extlibs/libcoap/ $sourcedir/tmp/con/extlibs/
mkdir -p $sourcedir/tmp/con/c_common
cp -R ./resource/c_common/* $sourcedir/tmp/con/c_common/
......
......@@ -2391,10 +2391,11 @@ static int pHash (const unsigned char *key, size_t keyLen,
const unsigned char *random2, size_t random2Len,
unsigned char *buf, size_t bufLen)
{
unsigned char A[RANDOM_LEN] = {0};
unsigned char tmp[RANDOM_LEN] = {0};
unsigned char A[MBEDTLS_MD_MAX_SIZE] = {0};
unsigned char tmp[MBEDTLS_MD_MAX_SIZE] = {0};
size_t dLen; /* digest length */
size_t len = 0; /* result length */
const mbedtls_md_type_t hashAlg = MBEDTLS_MD_SHA256;
VERIFY_TRUE_RET(bufLen <= INT_MAX, NET_SSL_TAG, "buffer too large", -1);
VERIFY_NON_NULL_RET(key, NET_SSL_TAG, "key is NULL", -1);
......@@ -2409,8 +2410,8 @@ static int pHash (const unsigned char *key, size_t keyLen,
mbedtls_md_init(&hmacA);
mbedtls_md_init(&hmacP);
CHECK_MBEDTLS_RET(mbedtls_md_setup, &hmacA, mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), 1);
CHECK_MBEDTLS_RET(mbedtls_md_setup, &hmacP, mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), 1);
CHECK_MBEDTLS_RET(mbedtls_md_setup, &hmacA, mbedtls_md_info_from_type(hashAlg), 1);
CHECK_MBEDTLS_RET(mbedtls_md_setup, &hmacP, mbedtls_md_info_from_type(hashAlg), 1);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacA, key, keyLen );
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacA, label, labelLen);
......@@ -2418,7 +2419,7 @@ static int pHash (const unsigned char *key, size_t keyLen,
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacA, random2, random2Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_finish, &hmacA, A);
dLen = RANDOM_LEN;
dLen = mbedtls_md_get_size(mbedtls_md_info_from_type(hashAlg));
CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacP, key, keyLen);
......@@ -2430,10 +2431,9 @@ static int pHash (const unsigned char *key, size_t keyLen,
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, label, labelLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random1, random1Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random2, random2Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_finish, &hmacP, tmp);
len += RANDOM_LEN;
len += dLen;
memcpy(buf, tmp, dLen);
buf += dLen;
......@@ -2444,16 +2444,18 @@ static int pHash (const unsigned char *key, size_t keyLen,
CHECK_MBEDTLS_RET(mbedtls_md_hmac_finish, &hmacA, A);
}
CHECK_MBEDTLS_RET(mbedtls_md_hmac_reset, &hmacP);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacP, key, keyLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, A, dLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, label, labelLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random1, random1Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random2, random2Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_finish, &hmacP, tmp);
if ((bufLen % dLen) != 0)
{
CHECK_MBEDTLS_RET(mbedtls_md_hmac_reset, &hmacP);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacP, key, keyLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, A, dLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, label, labelLen);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random1, random1Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_update, &hmacP, random2, random2Len);
CHECK_MBEDTLS_RET(mbedtls_md_hmac_finish, &hmacP, tmp);
memcpy(buf, tmp, bufLen - len);
memcpy(buf, tmp, bufLen - len);
}
mbedtls_md_free(&hmacA);
mbedtls_md_free(&hmacP);
......
......@@ -1923,7 +1923,7 @@ uint8_t CACheckBlockErrorType(CABlockData_t *currData, coap_block_t *receivedBlo
OIC_LOG(ERROR, TAG, "too large size");
// set the block size to be smaller than COAP_MAX_PDU_SIZE
for (unsigned int size = CA_DEFAULT_BLOCK_SIZE; size >= 0; size--)
for (unsigned int size = CA_DEFAULT_BLOCK_SIZE; ; size--)
{
if (COAP_MAX_PDU_SIZE >= (size_t)BLOCK_SIZE(size) + optionLen)
{
......@@ -1932,6 +1932,10 @@ uint8_t CACheckBlockErrorType(CABlockData_t *currData, coap_block_t *receivedBlo
currData->block1.szx = size;
break;
}
if (0 == size)
{
break;
}
}
return CA_BLOCK_TOO_LARGE;
}
......
......@@ -138,7 +138,7 @@ void CARegisterHandler(CARequestCallback ReqHandler, CAResponseCallback RespHand
}
#if defined(__WITH_DTLS__) || defined(__WITH_TLS__)
#ifdef MULTIPLE_OWNER
CAResult_t CAGetSecureEndpointData(const CAEndpoint_t *peer, CASecureEndpoint_t *sep)
{
OIC_LOG(DEBUG, TAG, "IN CAGetSecurePeerInfo");
......@@ -152,7 +152,6 @@ CAResult_t CAGetSecureEndpointData(const CAEndpoint_t *peer, CASecureEndpoint_t
OIC_LOG(DEBUG, TAG, "OUT CAGetSecurePeerInfo");
return GetCASecureEndpointData(peer, sep);
}
#endif //MULTIPLE_OWNER
bool CASetSecureEndpointAttribute(const CAEndpoint_t* peer, uint32_t attribute)
{
......
......@@ -65,7 +65,6 @@ if catest_env.get('SECURED') == '1':
if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
if 'CLIENT' in rd_mode and target_os not in ['arduino', 'darwin', 'ios', 'windows', 'winrt']:
catest_env.PrependUnique(LIBS = ['oc', 'oc_logger'])
catest_env.PrependUnique(LIBS = ['resource_directory'])