public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Using the openssl library - weird warnings
@ 2001-11-04  9:19 Ujval Lodha
  0 siblings, 0 replies; only message in thread
From: Ujval Lodha @ 2001-11-04  9:19 UTC (permalink / raw)
  To: gcc-help

Hi!

I am using the openssl des <openssl/des.h> 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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-11-15  4:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-04  9:19 Using the openssl library - weird warnings Ujval Lodha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).