diff options
author | Sooyoung Ha <yoosah.ha@samsung.com> | 2017-08-17 15:28:36 +0900 |
---|---|---|
committer | Sooyoung Ha <yoosah.ha@samsung.com> | 2017-08-17 15:28:43 +0900 |
commit | d70f137920dd1746b66bbb3e54c4a32e9667d417 (patch) | |
tree | 7dbead9e42f036f26c3d7ac2a451ff5cfa4e307e | |
parent | 7ccf4ccd0808a5cf80ff1e2d50f5eaba88727bcb (diff) | |
parent | b373630e63d0d6924a68cb9bae08ff95fc87ae7c (diff) | |
download | sdb-d70f137920dd1746b66bbb3e54c4a32e9667d417.tar.gz sdb-d70f137920dd1746b66bbb3e54c4a32e9667d417.tar.bz2 sdb-d70f137920dd1746b66bbb3e54c4a32e9667d417.zip |
Merge branch 'tizen_studio_1.2' into opensrc
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
-rw-r--r-- | Makefile | 5 | ||||
-rwxr-xr-x | SPC/Inc/base/ecc.h | 2 | ||||
-rwxr-xr-x | SPC/Src/SAKEP.cpp | 7 | ||||
-rwxr-xr-x | SPC/Src/WhiteBox/SWAPv2_TblGen.c | 3 | ||||
-rwxr-xr-x | SPC/Src/base/bignum.c | 7 | ||||
-rwxr-xr-x | SPC/Src/base/ecc.c | 3 | ||||
-rwxr-xr-x | SPC/Src/base/pkcs1_v21.c | 2 | ||||
-rwxr-xr-x | SPC/Src/middle/symmetric.c | 3 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 13 | ||||
-rwxr-xr-x | debian/rules | 9 | ||||
-rw-r--r-- | package/changelog | 7 | ||||
-rw-r--r-- | package/pkginfo.manifest | 2 | ||||
-rw-r--r-- | src/adb_auth_host.c | 5 | ||||
-rw-r--r-- | src/common_modules.h | 2 | ||||
-rw-r--r-- | src/sdb_client.c | 8 | ||||
-rw-r--r-- | src/sdb_messages.c | 4 | ||||
-rwxr-xr-x | src/sockets.c | 4 | ||||
-rwxr-xr-x | src/transport.c | 16 |
20 files changed, 81 insertions, 27 deletions
@@ -7,6 +7,7 @@ HOST_OS := $(shell uname -s | tr A-Z a-z | cut -d'_' -f1) LBITS := $(shell getconf LONG_BIT) BINDIR := ./bin +INSTALLDIR := usr/bin MODULE := sdb ENCLIB := spc @@ -116,6 +117,10 @@ $(MODULE) : $(OBJS) @mkdir -p $(BINDIR) $(CXX) -o $(BINDIR)/$@ $^ $(SDB_LFLAGS) $(STATIC_LFLAGS) +install : + mkdir -p $(DESTDIR)/$(INSTALLDIR) + install $(BINDIR)/$(MODULE) $(DESTDIR)/$(INSTALLDIR)/$(MODULE) + clean : $(MAKE) -C $(ENCLIB_BUILD_PATH) clean rm -rf src/*.o diff --git a/SPC/Inc/base/ecc.h b/SPC/Inc/base/ecc.h index 36eb611..5079917 100755 --- a/SPC/Inc/base/ecc.h +++ b/SPC/Inc/base/ecc.h @@ -33,7 +33,7 @@ #define SDRM_EC_FREE(X) if (X) {free(X);}
#define SDRM_EC_SET_ZERO(A) do { \
- memset((A), 0, sizeof(SDRM_EC_POINT) + SDRM_ECC_ALLOC_SIZE * 5); \
+ memset((A), 0, sizeof(SDRM_EC_POINT)); \
(A)->IsInfinity = 0; \
A->x = SDRM_BN_Alloc((cc_u8*)A + sizeof(SDRM_EC_POINT), SDRM_ECC_BN_BUFSIZE); \
A->y = SDRM_BN_Alloc((cc_u8*)A->x + SDRM_ECC_ALLOC_SIZE, SDRM_ECC_BN_BUFSIZE); \
diff --git a/SPC/Src/SAKEP.cpp b/SPC/Src/SAKEP.cpp index 572059e..0c3d2d1 100755 --- a/SPC/Src/SAKEP.cpp +++ b/SPC/Src/SAKEP.cpp @@ -1699,13 +1699,14 @@ SPC_INTERNAL int SAkepApi::SetMac(unsigned char* pMac,unsigned int nMacLen) {
int reValue = 0;
m_pMac = (unsigned char*) malloc (sizeof(unsigned char) * (nMacLen+1));
- memset(m_pMac,0x00,(nMacLen+1));
if(m_pMac == NULL)
{
DRMLOG_Message(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__,"SetMac m_pMac memory allocate Error [ ErrorCode : %d ] \n",SAKEP_MEMROY_ALLOCATE_ERROR);
return SAKEP_MEMROY_ALLOCATE_ERROR;
}
+ memset(m_pMac,0x00,(nMacLen+1));
+
memcpy(m_pMac,pMac,nMacLen);
m_nMyMacLen =nMacLen; //ร฿ฐก 0314
PRINT_BUFFER("[0217] Set Mac ",m_pMac,nMacLen);
@@ -1958,9 +1959,9 @@ SPC_INTERNAL int SAkepApi::ApplyPasswordTransform(unsigned char* pPwd, unsigned if (pTransPwdLen != NULL)
{
*pTransPwdLen = nOutLen;
+ DRMLOG_HexaBytes(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__, "before ApplyPasswordTransform Password:" ,pTransPwd, *pTransPwdLen);
}
- DRMLOG_HexaBytes(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__, "before ApplyPasswordTransform Password:" ,pTransPwd, *pTransPwdLen);
DRMLOG_Message(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__,"ApplyPasswordTransform OutLen:%d ",nOutLen);
return SPC_SUCCESS;
}
@@ -2011,9 +2012,9 @@ SPC_INTERNAL int SAkepApi::ReversePasswordTransform(unsigned char* pTransPwd, un if (pPwdLen != NULL)
{
*pPwdLen = nTransPwdLen - padLen;
+ DRMLOG_HexaBytes(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__, "before ReversePasswordTransform Password:" ,pPwd, *pPwdLen);
}
- DRMLOG_HexaBytes(&SPCLogCTX,LOG_ERROR,__FILE__,__LINE__, "before ReversePasswordTransform Password:" ,pPwd, *pPwdLen);
memset(tmp, 0xAA, 16);
diff --git a/SPC/Src/WhiteBox/SWAPv2_TblGen.c b/SPC/Src/WhiteBox/SWAPv2_TblGen.c index 9fa26fb..0e78914 100755 --- a/SPC/Src/WhiteBox/SWAPv2_TblGen.c +++ b/SPC/Src/WhiteBox/SWAPv2_TblGen.c @@ -1431,7 +1431,7 @@ ERROR_PROC: memset(RoundKey, 0x00, RoundKeySize);
free(RoundKey);
}
-
+#if 0
//free TBox if not null
if (pTBox != NULL)
{
@@ -1439,6 +1439,7 @@ ERROR_PROC: memset(pTBox, 0x00, TBoxSize + PBoxSize + WPBoxSize + BPBoxSize);
free(pTBox);
}
+#endif
if(pSBox != NULL)
{
diff --git a/SPC/Src/base/bignum.c b/SPC/Src/base/bignum.c index 09e959b..7dbf248 100755 --- a/SPC/Src/base/bignum.c +++ b/SPC/Src/base/bignum.c @@ -520,8 +520,11 @@ static cc_u32 SDRM_DWD_MulSub(cc_u32 *pdDest, cc_u32 dDstLen, cc_u32 *pdSrc, cc_ {
pdDigit[1]++;
}
-
- pdDest[i] -= dTemp;
+ if(pdDest[i] > dTemp){
+ pdDest[i] -= dTemp;
+ } else {
+ pdDest[i] = dTemp - pdDest[i];
+ }
dTemp = pdDigit[1];
}
diff --git a/SPC/Src/base/ecc.c b/SPC/Src/base/ecc.c index b60b638..a5958d8 100755 --- a/SPC/Src/base/ecc.c +++ b/SPC/Src/base/ecc.c @@ -1013,7 +1013,7 @@ CRYPTOCORE_INTERNAL int SDRM_CTX_EC_2kP(SDRM_ECC_CTX *ctx, SDRM_EC_POINT *EC_Dst int window_size = 4; // window size
int w2 = (1 << (window_size - 1)) + 1; // 2^(window_size-1)+1 : the precomputation point number
int i, j, res;
- SDRM_EC_POINT *Pw[2][9]; // precomputation data
+ SDRM_EC_POINT *Pw[2][9]={0,}; // precomputation data
SDRM_BIG_MONT *Mont=NULL;
SDRM_BIG_NUM *new_a, *new_b;
SDRM_BIG_NUM *t1, *t2; // Used in coordinate change from "Modified Jacobian" to "Affine"
@@ -1088,7 +1088,6 @@ CRYPTOCORE_INTERNAL int SDRM_CTX_EC_2kP(SDRM_ECC_CTX *ctx, SDRM_EC_POINT *EC_Dst Pw[i][j] = SDRM_ECC_Init();
}
}
-
SDRM_EC_COPY(Pw[0][1], EC_Src1);
SDRM_EC_COPY(Pw[1][1], EC_Src2);
diff --git a/SPC/Src/base/pkcs1_v21.c b/SPC/Src/base/pkcs1_v21.c index c4d759f..3730518 100755 --- a/SPC/Src/base/pkcs1_v21.c +++ b/SPC/Src/base/pkcs1_v21.c @@ -294,6 +294,8 @@ CRYPTOCORE_INTERNAL int SDRM_Padding_Rsaes_oaep(SDRM_BIG_NUM* BN_Dest, SDRM_BIG_ break;
#endif //_OP64_NOTSUPPORTED
default :
+ free(EM);
+ free(Msg);
return CRYPTO_INVALID_ARGUMENT;
}
diff --git a/SPC/Src/middle/symmetric.c b/SPC/Src/middle/symmetric.c index e00eb28..2fbb25a 100755 --- a/SPC/Src/middle/symmetric.c +++ b/SPC/Src/middle/symmetric.c @@ -595,7 +595,8 @@ DECRYPTION: return CRYPTO_INVALID_ARGUMENT;
}
- memcpy(output, Block, SDRM_AES_BLOCK_SIZ -t);
+ size_t tmp = (size_t)SDRM_AES_BLOCK_SIZ - (size_t)t;
+ memcpy(output, Block, tmp);
if (outputLen != NULL)
{
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..71e92bd --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +sdb (2.3.0-1) unstable; urgency=low + + * Used 2.3.0 codebase + + -- Tizen <tizen.infra@samsung.com> Thu, 22 Dec 2016 13:09:00 +0900 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b521632 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: sdb +Priority: extra +Section: devel +Maintainer: Tizen <tizen.infra@samsung.com> +XSBC-Original-Maintainer: Chengwei Yang <chengwei.yang@intel.com>, Ed Bartosh <eduard.bartosh@intel.com> +Build-Depends: debhelper (>= 7), libncurses5-dev, libssl1.0.0, libssl-dev +Standards-Version: 3.9.2 + +Package: sdb +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: SDB client + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..c279d91 --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# +# # Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ + diff --git a/package/changelog b/package/changelog index b639fcc..f6ded00 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,10 @@ +* 2.3.2 +- increase limit of command message length +== Sooyoung Ha <yoosah.ha@samsung.com> 2017-07-06 +* 2.3.1 +- Add debian files to create deb package. +- fix static analysis issues. +== minkee Lee <minkee.lee@samsung.com> 2017-05-15 * 2.3.0 - Change the log type of "EAGAIN" error == SangJin Kim <sangjin3.kim@samsung.com> 2016-12-19 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 3b499ef..32b7f65 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version:2.3.0 +Version:2.3.2 Source:sdb Maintainer: Jaewon Lim <jaewon81.lim@samsung.com>, SangJin Kim <sangjin3.kim@samsung.com> diff --git a/src/adb_auth_host.c b/src/adb_auth_host.c index 3dc7a5c..c1f237a 100644 --- a/src/adb_auth_host.c +++ b/src/adb_auth_host.c @@ -31,6 +31,7 @@ #include "sdb.h" #include "adb_auth.h" #include "utils.h" +#include "strutils.h" /* HACK: we need the RSAPublicKey struct * but RSA_verify conflits with openssl */ @@ -139,7 +140,7 @@ static int write_public_keyfile(RSA *private_key, const char *private_key_path) FILE *outfile = NULL; char path[PATH_MAX], info[MAX_PAYLOAD_V1]; uint8_t *encoded = NULL; - size_t encoded_length; + int encoded_length; int ret = 0; if (snprintf(path, sizeof(path), "%s.pub", private_key_path) @@ -349,7 +350,7 @@ static void get_vendor_keys(struct listnode *list) { adb_keys_path = getenv("ADB_VENDOR_KEYS"); if (!adb_keys_path) return; - strncpy(keys_path, adb_keys_path, sizeof(keys_path)); + s_strncpy(keys_path, adb_keys_path, sizeof(keys_path)); path = adb_strtok_r(keys_path, ENV_PATH_SEPARATOR_STR, &save); while (path) { diff --git a/src/common_modules.h b/src/common_modules.h index 0721c16..4826fc1 100644 --- a/src/common_modules.h +++ b/src/common_modules.h @@ -40,7 +40,7 @@ #define A_VERSION 0x0100000 #define SDB_VERSION_MAJOR 2 // increments upon significant architectural changes or the achievement of important milestones #define SDB_VERSION_MINOR 3 // progress is made within a major version -#define SDB_VERSION_PATCH 0 // increments for small sets of changes +#define SDB_VERSION_PATCH 2 // increments for small sets of changes #define SDB_VERSION_MAX_LENGTH 128 diff --git a/src/sdb_client.c b/src/sdb_client.c index 6da4f00..2dc68f7 100644 --- a/src/sdb_client.c +++ b/src/sdb_client.c @@ -66,7 +66,7 @@ int send_service_with_length(int fd, const char* service, int host_fd) { } return -1; } - else if (len > 1024) { + else if (len > 2048) { if(host_fd == 0) { print_error(SDB_MESSAGE_ERROR, ERR_GENERAL_TOO_LONG_SERVICE_NAME, NULL); } @@ -352,7 +352,7 @@ int sdb_connect_getfailmsg(const char *service, char** pp_failmsg) if ((server_major != SDB_VERSION_MAJOR) || (server_minor != SDB_VERSION_MINOR) || (server_patch != SDB_VERSION_PATCH)) { - fprintf(stderr, "* The version of SDB client (%d.%d.%d) is not same with that of SDB server (%d.%d.%d).\n It may cause version compatibility problems.\n It is recommended to use SDB server with version %d.%d.%d. *\n", SDB_VERSION_MAJOR, SDB_VERSION_MINOR, SDB_VERSION_PATCH, server_major, server_minor, server_patch, SDB_VERSION_MAJOR, SDB_VERSION_MINOR, SDB_VERSION_PATCH); + fprintf(stderr, "* The version of SDB client (%d.%d.%d) and server (%d.%d.%d) are different.\n This may cause version compatibility problems.\n It is recommended to use SDB server %d.%d.%d. *\n", SDB_VERSION_MAJOR, SDB_VERSION_MINOR, SDB_VERSION_PATCH, server_major, server_minor, server_patch, SDB_VERSION_MAJOR, SDB_VERSION_MINOR, SDB_VERSION_PATCH); } } else { int ver = 0; @@ -381,7 +381,7 @@ int sdb_connect_getfailmsg(const char *service, char** pp_failmsg) } if(fd == -2) { - fprintf(stdout,"* server not running. starting it now on port %d *\n", DEFAULT_SDB_PORT); + fprintf(stdout,"* Server is not running. Start it now on port %d *\n", DEFAULT_SDB_PORT); launch_server: if (!strcmp(service, "host:start-server:only-detect-tizen")) only_detect_tizen_device = 1; @@ -391,7 +391,7 @@ launch_server: print_error(SDB_MESSAGE_ERROR, ERR_GENERAL_START_SERVER_FAIL, NULL); return -1; } else { - fprintf(stdout,"* server started successfully *\n"); + fprintf(stdout,"* Server has started successfully *\n"); } } diff --git a/src/sdb_messages.c b/src/sdb_messages.c index b3080d5..eb087c0 100644 --- a/src/sdb_messages.c +++ b/src/sdb_messages.c @@ -35,7 +35,7 @@ const char* ERR_GENERAL_INVALID_SERVICE_NAME = "invalid service name"; const char* ERR_GENERAL_WRITE_MESSAGE_SIZE_FAIL = "failed to write message size"; const char* ERR_GENERAL_INVALID_PORT = "invalid port '%s'"; const char* ERR_GENERAL_START_SERVER_FAIL = "failed to start server"; -const char* ERR_GENERAL_SERVER_NOT_RUN = "server not running"; +const char* ERR_GENERAL_SERVER_NOT_RUN = "Server is not running"; const char* ERR_GENERAL_LOG_FAIL = "failed to log"; const char* ERR_GENERAL_DUPLICATE_FAIL = "failed to duplicate '%s'"; const char* ERR_GENERAL_LAUNCH_APP_FAIL = "failed to launch application"; @@ -65,7 +65,7 @@ const char* ERR_SYNC_NOT_EXIST_FILE = "'%s' does not exist"; const char* ERR_SYNC_NOT_DIRECTORY = "'%s' is not a directory"; const char* ERR_SYNC_LOCKED = "'%s' is locked"; const char* ERR_SYNC_CANNOT_ACCESS = "cannot access '%s'"; -const char* MSG_SYNC_SECURE_WARNING = "WARNING: Your data is to be sent over an unencrypted connection and could be read by others."; +const char* MSG_SYNC_SECURE_WARNING = "WARNING: Your data are to be sent over an unencrypted connection and could be read by others."; const char* ERR_CONNECT_MORE_THAN_ONE_TARGET = "more than one target found. Specify the target with -s option."; const char* ERR_CONNECT_MORE_THAN_ONE_EMUL = "more than one emulator found. Specify the emulator with -e option."; diff --git a/src/sockets.c b/src/sockets.c index 694b111..722091d 100755 --- a/src/sockets.c +++ b/src/sockets.c @@ -798,7 +798,9 @@ static int handle_request_with_t(SDB_SOCKET* socket, char* service, TRANSPORT* t } } sendfail: - sendfailmsg(socket->fd, forward_err); + if (forward_err) { + sendfailmsg(socket->fd, forward_err); + } return 0; } diff --git a/src/transport.c b/src/transport.c index 5e4349d..8fc8309 100755 --- a/src/transport.c +++ b/src/transport.c @@ -1062,10 +1062,12 @@ void wakeup_select_func(int _fd, unsigned ev, void *data) { t->encryption = ENCR_OFF; // ํ์ฌ ์ฐ๊ฒฐ์ ๋ํ ์ํธํ ๋ชจ๋๋ฅผ off sendokmsg(sock->fd, "Encryption is OFF"); } - else{ - send_encr_fail(sock, t, ENCR_OFF_FAIL); - sendfailmsg(sock->fd, "Encryption OFF failed"); - LOG_ERROR("security_deinit failed"); + else{ + if(sock != NULL) { + send_encr_fail(sock, t, ENCR_OFF_FAIL); + sendfailmsg(sock->fd, "Encryption OFF failed"); + } + LOG_ERROR("security_deinit failed"); } local_socket_close(sock); } @@ -1091,8 +1093,10 @@ void wakeup_select_func(int _fd, unsigned ev, void *data) { } else if(p->msg.arg0 == ENCR_OFF_FAIL){ // sdbd์์ ์ํธํ ๋ชจ๋ off์ ์คํจํ์ ๊ฒฝ์ฐ ๋ฐ๋ ๋ฉ์์ง //t->encryption = ENCR_ON; - sendfailmsg(sock->fd, "Encryption OFF failed"); - local_socket_close(sock); + if (sock != NULL) { + sendfailmsg(sock->fd, "Encryption OFF failed"); + local_socket_close(sock); + } } put_apacket(enc_p); |