Patch: wtls

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <1946FFE311404ED4BB2CE2B7DF6CDA61@drwho>
Here it is. Warnings were not created by -std=gnu99 but by all the other -W 
you have, specifically by -Wmissing-prototypes. This patch supplies the 
missing prototypes.

Using all your compiler flags, I was not able to reproduce your HMAC warning 
either in Solaris 10.5 or SuSE Linux. HMAC is defined in openssl, is not 
mine. I suspect you have some strange openssl setup in your Darwin.

BR,
Nikos
----- Original Message ----- 
From: "Nikos Balkanas" <[email protected]>
To: "Alexander Malysh" <[email protected]>
Cc: "Kannel Devel" <[email protected]>
Sent: Monday, September 13, 2010 11:36 AM
Subject: Re: wtls branch merged


> Thanks for bringing them to my attention. I cannot use -std=gnu99 in 
> Solaris
> and don't get those. I will compile in Linux and fix them.
>
> BR,
> Nikos
>
> ----- Original Message ----- 
> From: "Alexander Malysh" <[email protected]>
> To: "Nikos Balkanas" <[email protected]>
> Cc: "Kannel Devel" <[email protected]>
> Sent: Monday, September 13, 2010 11:14 AM
> Subject: Re: wtls branch merged
>
>
> Hi Nikos,
>
> patch commited to svn but we have more warnings wtls related:
>
> gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -DDARWIN=1 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib 
>  -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -D_LARGE_FILES= -I/sw/include/libxml2 
>  -I/sw/include -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs 
>  -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include/openssl 
>  -I/sw/include/mysql  -I/Users/alex/oracle/instantclient_10_2/sdk/include  
> -o wap/wtls-secmgr.o -c wap/wtls-secmgr.c
> wap/wtls.c:280: warning: no previous prototype for ‘send_alert’
> wap/wtls.c:401: warning: no previous prototype for ‘stateName’
> gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -DDARWIN=1 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib 
>  -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -D_LARGE_FILES= -I/sw/include/libxml2 
>  -I/sw/include -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs 
>  -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include/openssl 
>  -I/sw/include/mysql  -I/Users/alex/oracle/instantclient_10_2/sdk/include  
> -o wap/wtls_pdu.o -c wap/wtls_pdu.c
> wap/wtls_pdu.c:359: warning: no previous prototype for 
> ‘wtls_payload_guess_length’
> gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -DDARWIN=1 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib 
>  -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -D_LARGE_FILES= -I/sw/include/libxml2 
>  -I/sw/include -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs 
>  -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include/openssl 
>  -I/sw/include/mysql  -I/Users/alex/oracle/instantclient_10_2/sdk/include  
> -o wap/wtls_pdusupport.o -c wap/wtls_pdusupport.c
> wap/wtls_pdusupport.c:892: warning: no previous prototype for 
> ‘destroy_octstr’
> wap/wtls_pdusupport.c:897: warning: no previous prototype for 
> ‘destroy_octstr16’
> wap/wtls_pdusupport.c:902: warning: no previous prototype for 
> ‘destroy_octstr_fixed’
> wap/wtls_pdusupport.c:913: warning: no previous prototype for 
> ‘destroy_dhparams’
> wap/wtls_pdusupport.c:920: warning: no previous prototype for 
> ‘destroy_ecparams’
> wap/wtls_pdusupport.c:969: warning: no previous prototype for 
> ‘destroy_public_key’
> wap/wtls_pdusupport.c:1004: warning: no previous prototype for 
> ‘destroy_rsa_secret’
> wap/wtls_pdusupport.c:1016: warning: no previous prototype for 
> ‘destroy_key_exchange_id’
> wap/wtls_pdusupport.c:1092: warning: no previous prototype for 
> ‘destroy_signature’
> wap/wtls_pdusupport.c:1126: warning: no previous prototype for 
> ‘dump_void16’
> gcc -std=gnu99 -D_REENTRANT=1 -I. -Igw -g -O2 -DDARWIN=1 -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib 
>  -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -D_LARGE_FILES= -I/sw/include/libxml2 
>  -I/sw/include -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs 
>  -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include/openssl 
>  -I/sw/include/mysql  -I/Users/alex/oracle/instantclient_10_2/sdk/include  
> -o wap/wtls_statesupport.o -c wap/wtls_statesupport.c
> wap/wtls_statesupport.c:663: warning: no previous prototype for 
> ‘wtls_P_hash’
> wap/wtls_statesupport.c: In function ‘wtls_hmac_hash’:
> wap/wtls_statesupport.c:737: warning: implicit declaration of function 
> ‘HMAC’
> wap/wtls_statesupport.c:737: warning: nested extern declaration of ‘HMAC’
> wap/wtls_statesupport.c: At top level:
> wap/wtls_statesupport.c:1103: warning: no previous prototype for 
> ‘wtls_get_certificate’
> wap/wtls_statesupport.c:1184: warning: no previous prototype for 
> ‘isSupportedKeyEx’
> wap/wtls_statesupport.c:1383: warning: no previous prototype for 
> ‘add_all_handshake_data’
>
>
> Thanks,
> Alexander Malysh
>
> Am 12.09.2010 um 13:15 schrieb Nikos Balkanas:
>
>> Hi,
>>
>> Reporting from Solaris 10.5 amd64, 64bit compilation. 
>> Configured --with-wtls=openssl
>>
>> 1) Compilation: Clean. A couple of unrelated warnings fixed. Attaching 
>> patch.
>>
>> 2) Emulators used:
>>
>> a) Openwave SDK 6.2.2 wap: no problems (connection tested)
>> b) Nokia NMBS 4.0: no problems (connection & connectionless tested)
>>
>> Sites tested, following through links:
>>
>> http://wap.google.com
>> http://wap.yahoo.com
>> http://m.facebook
>>
>> Only facebook had a warning with nokia's emulator (b) about unsupported 
>> content. This was not observed with Openwave (a) and in any case it is 
>> related to wap, not wtls. The same happens in plain wtp communication.
>>
>> Overall a succesful merge.
>>
>> Thanks,
>> Nikos
>> ----- Original Message ----- From: "Alexander Malysh" 
>> <[email protected]>
>> To: "Kannel Devel" <[email protected]>
>> Cc: "Nikos Balkanas" <[email protected]>
>> Sent: Sunday, September 12, 2010 1:04 PM
>> Subject: wtls branch merged
>>
>>
>>> Hi together,
>>>
>>> just merged and commited wtls branch into trunk.
>>> Please check it and let me know if something went wrong.
>>>
>>> Thanks,
>>> Alexander Malysh
>> <kannel.diff>
>
kannel.diff (application/octet-stream, 3.9 KB)
Index: wap/wtls.c
===================================================================
--- wap/wtls.c	(revision 4843)
+++ wap/wtls.c	(working copy)
@@ -144,11 +144,14 @@
  */
 static WTLSMachine *wtls_machine_find(WAPAddrTuple * tuple, long mid);
 
+/* Function prototypes */
 static void main_thread(void *);
 static WTLSMachine *find_wtls_machine_using_mid(long mid);
 static void add_wtls_address(Msg * msg, WTLSMachine * wtls_machine);
 static void add_pdu(WTLSMachine * wtls_machine, wtls_PDU * pduToAdd);
 static void send_queuedpdus(WTLSMachine * wtls_machine);
+void send_alert(WAPEvent * event, WTLSMachine * wtls_machine);
+char *stateName(int s);
 
 /* The match* functions are used for searches through lists */
 static int match_handshake_type(void *item, void *pattern);
@@ -156,6 +159,7 @@
 
 extern void write_to_bearerbox(Msg * pmsg);
 extern Octstr *wtls_get_certificate(void);
+
 /*static WAPEvent *create_tr_invoke_ind(WTPRespMachine *sm, Octstr *user_data);
 static WAPEvent *create_tr_abort_ind(WTPRespMachine *sm, long abort_reason);
 static WAPEvent *create_tr_result_cnf(WTPRespMachine *sm); */
Index: wap/wtls_pdu.c
===================================================================
--- wap/wtls_pdu.c	(revision 4843)
+++ wap/wtls_pdu.c	(working copy)
@@ -76,7 +76,9 @@
 PublicKeyAlgorithm public_key_algo;
 SignatureAlgorithm signature_algo;
 
+/* Function prototypes */
 wtls_Payload *wtls_payload_unpack_from_offset(Octstr * data, int *offset);
+int wtls_payload_guess_length(Octstr * data);
 
 wtls_PDU *wtls_pdu_create(int type)
 {
Index: wap/wtls_pdusupport.c
===================================================================
--- wap/wtls_pdusupport.c	(revision 4843)
+++ wap/wtls_pdusupport.c	(working copy)
@@ -71,10 +71,22 @@
 #include "wtls_pdusupport.h"
 #include "wtls_statesupport.h"
 
-// Change this later !!!!
 extern PublicKeyAlgorithm public_key_algo;
 extern SignatureAlgorithm signature_algo;
 
+/* Function prototypes */
+
+void destroy_octstr(Octstr * data);
+void destroy_octstr16(Octstr * data);
+void destroy_octstr_fixed(Octstr * data);
+void destroy_dhparams(DHParameters * dhparams);
+void destroy_ecparams(ECParameters * ecparams);
+void destroy_public_key(PublicKey * key);
+void destroy_rsa_secret(RSASecret * secret);
+void destroy_key_exchange_id(KeyExchangeId * keyexid);
+void destroy_signature(Signature * sig);
+void dump_void16(char *dbg, int level, int i);
+
 /*****************************************************************
  * PACK functions
  */
Index: wap/wtls-secmgr.c
===================================================================
--- wap/wtls-secmgr.c	(revision 4843)
+++ wap/wtls-secmgr.c	(working copy)
@@ -104,6 +104,15 @@
 
 static void main_thread(void *);
 
+/*
+ * Public functions.
+ */
+
+void wtls_secmgr_init(void);
+void wtls_secmgr_shutdown(void);
+void wtls_secmgr_dispatch(WAPEvent *event);
+long wtls_secmgr_get_load(void);
+
 /***********************************************************************
  * The public interface to the application layer.
  */
Index: wap/wtls_statesupport.c
===================================================================
--- wap/wtls_statesupport.c	(revision 4843)
+++ wap/wtls_statesupport.c	(working copy)
@@ -131,10 +131,19 @@
            *md);
 extern unsigned char *stateName(int state);
 
+/*
+ * Function Prototypes.
+ */
+
 Octstr *wtls_hmac_hash(Octstr * key, Octstr * data, int algo);
 Octstr *wtls_hash(Octstr * inputData, WTLSMachine * wtls_machine);
 Octstr *wtls_rc5(Octstr * data, WTLSMachine * wtls_machine, int crypt);
 Octstr *wtls_des(Octstr * data, WTLSMachine * wtls_machine, int crypt);
+Octstr *wtls_P_hash(Octstr * secret, Octstr * seed, int byteLength,
+          WTLSMachine * wtls_machine);
+Octstr *wtls_get_certificate(void);
+int isSupportedKeyEx(int keyExId);
+void add_all_handshake_data(WTLSMachine * wtls_machine, List * pdu_list);
 
 /* Add here the supported KeyExchangeSuites 
    used by wtls_choose_clientkeyid */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.