summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2009-11-06 13:31:37 +0000
committerNanang Izzuddin <nanang@teluu.com>2009-11-06 13:31:37 +0000
commit5ad076e71b93972ac204bfae7749695f04e59ab0 (patch)
tree8e5e3b34396d937cd85eb01da2a8f9bea5076844
parentc7909ede03c0e1c8ca16812879a001cde325e158 (diff)
Ticket #957:
- Updated Symbian PJLIB test build setting to enable SSL sock test. - Fixed ciphers enumeration in Symbian SSL sock. - Fixed OpenSSL SSL sock to avoid initializing OpenSSL multiple times. - Fixed SSL unit test to avoid divide-by-zero in setting random seed. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2990 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--build.symbian/pjlib_test.mmp4
-rw-r--r--pjlib/src/pj/ssl_sock_ossl.c9
-rw-r--r--pjlib/src/pj/ssl_sock_symbian.cpp3
-rw-r--r--pjlib/src/pjlib-test/ssl_sock.c4
4 files changed, 12 insertions, 8 deletions
diff --git a/build.symbian/pjlib_test.mmp b/build.symbian/pjlib_test.mmp
index 406b0d50..462b1182 100644
--- a/build.symbian/pjlib_test.mmp
+++ b/build.symbian/pjlib_test.mmp
@@ -46,6 +46,7 @@ SOURCE select.c
SOURCE sleep.c
SOURCE sock.c
SOURCE sock_perf.c
+SOURCE ssl_sock.c
SOURCE string.c
SOURCE test_wrap.cpp
SOURCE thread.c
@@ -68,7 +69,7 @@ SYSTEMINCLUDE ..\pjlib\include
SYSTEMINCLUDE \epoc32\include
SYSTEMINCLUDE \epoc32\include\libc
-LIBRARY esock.lib insock.lib charconv.lib euser.lib estlib.lib
+LIBRARY esock.lib insock.lib charconv.lib euser.lib estlib.lib securesocket.lib
#ifdef WINSCW
STATICLIBRARY eexe.lib ecrt0.lib
#endif
@@ -76,3 +77,4 @@ STATICLIBRARY eexe.lib ecrt0.lib
// Need a bit of mem for logging in the app.
EPOCSTACKSIZE 32768
+CAPABILITY NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment
diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c
index 76c321aa..9c016a3a 100644
--- a/pjlib/src/pj/ssl_sock_ossl.c
+++ b/pjlib/src/pj/ssl_sock_ossl.c
@@ -248,7 +248,7 @@ static pj_str_t ssl_strerror(pj_status_t status,
errstr.ptr = buf;
errstr.slen = pj_ansi_snprintf(buf, bufsize,
- "Unknown OpenSSL error %d",
+ "Unknown OpenSSL error %ul",
ssl_err);
return errstr;
@@ -267,9 +267,11 @@ static unsigned openssl_cipher_num;
/* Initialize OpenSSL */
static pj_status_t init_openssl(void)
{
- if (++openssl_init_count != 1)
+ if (openssl_init_count)
return PJ_SUCCESS;
+ openssl_init_count = 1;
+
/* Register error subsystem */
if (!openssl_reg_strerr) {
pj_status_t status;
@@ -334,8 +336,7 @@ static pj_status_t init_openssl(void)
/* Shutdown OpenSSL */
static void shutdown_openssl(void)
{
- if (--openssl_init_count != 0)
- return;
+ PJ_UNUSED_ARG(openssl_init_count);
}
diff --git a/pjlib/src/pj/ssl_sock_symbian.cpp b/pjlib/src/pj/ssl_sock_symbian.cpp
index 0619fd98..18dfd7c0 100644
--- a/pjlib/src/pj/ssl_sock_symbian.cpp
+++ b/pjlib/src/pj/ssl_sock_symbian.cpp
@@ -447,7 +447,8 @@ PJ_DEF(pj_status_t) pj_ssl_cipher_get_availables (pj_ssl_cipher ciphers[],
if (ciphers_num_ > PJ_ARRAY_SIZE(ciphers_))
ciphers_num_ = PJ_ARRAY_SIZE(ciphers_);
for (i = 0; i < ciphers_num_; ++i)
- ciphers_[i] = (pj_ssl_cipher)ciphers_buf[i*2];
+ ciphers_[i] = (pj_ssl_cipher)(ciphers_buf[i*2]*10 +
+ ciphers_buf[i*2+1]);
}
delete secure_sock;
diff --git a/pjlib/src/pjlib-test/ssl_sock.c b/pjlib/src/pjlib-test/ssl_sock.c
index a1f9dca2..e3563b67 100644
--- a/pjlib/src/pjlib-test/ssl_sock.c
+++ b/pjlib/src/pjlib-test/ssl_sock.c
@@ -610,7 +610,7 @@ static int echo_test(pj_ssl_sock_proto srv_proto, pj_ssl_sock_proto cli_proto,
pj_time_val now;
pj_gettimeofday(&now);
- pj_srand((pj_rand()%now.sec) * (pj_rand()%now.msec));
+ pj_srand((unsigned)now.sec);
state_cli.send_str_len = (pj_rand() % 5 + 1) * 1024 + pj_rand() % 1024;
}
state_cli.send_str = pj_pool_alloc(pool, state_cli.send_str_len);
@@ -1006,7 +1006,7 @@ static int perf_test(unsigned clients, unsigned ms_handshake_timeout)
pj_time_val now;
pj_gettimeofday(&now);
- pj_srand((pj_rand()%now.sec) * (pj_rand()%now.msec));
+ pj_srand((unsigned)now.sec);
}
/* Allocate SSL socket pointers and test state */