From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20312 invoked by alias); 19 Nov 2001 08:14:08 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 20291 invoked from network); 19 Nov 2001 08:14:07 -0000 Received: from unknown (HELO helium.gdc-tech.com) (203.132.205.66) by sourceware.cygnus.com with SMTP; 19 Nov 2001 08:14:07 -0000 Received: from ferrum (ferrum.gdc-tech.com [192.168.0.130]) by helium.gdc-tech.com (8.11.2/8.11.0) with ESMTP id fAJ7u5v08825 for ; Mon, 19 Nov 2001 15:56:06 +0800 From: "Ujval Lodha" To: Subject: Using the openssl library - compiler warnings Date: Wed, 07 Nov 2001 16:10:00 -0000 Message-ID: <000001c170d1$8ac003c0$8200a8c0@ferrum> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-SW-Source: 2001-11/txt/msg00068.txt.bz2 Hi! I am using the openssl des library for some code, and have encountered some weird warnings while compiling. ==> my code #1 int foo (const_des_cblock key) { des_key_schedule ks; des_set_key (&key, keySchedule); ...... } Gives a warning while compiling saying : warning: passing arg 1 of `des_set_key' from incompatible pointer type The declarations in openssl/des.h are as follows: ==> openssl/des.h ..... typedef unsigned char des_cblock[8]; ..... int des_set_key(const_des_cblock *key,des_key_schedule schedule); If I change my code to : ==> my code #2 int foo1 (const_des_cblock key1) { des_key_schedule ks; const_des_cblock key; memcpy ((void *)key, (void *)key1, 8); des_set_key (&key, keySchedule); ...... } Then there are no compilation warnings. Further, the execution of foo(..) gives incorrect results whereas foo1(..) works fine, so its not just another warning which I can ignore. If I print out the contents of the 8-char arrays pointed to by 'key' in both the cases ,it is the same. The entire encryption part is being done in foo(..) or foo1(..) only - and I have no reason to reuse the key outside of the function call(s). 1. Why the warnings in the case of foo and not in foo1; and 2. Why is the compiler compiling the two function calls differently? Regards - Ujval