Subject: Another krb5 enum patch
To: , , <assar@netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: tech-crypto
Date: 01/06/2002 13:53:50
At present, the "usage" argument of create_checksum is defined to be a
krb5_key_usage, which is an enum with values 1--24.  However, in one of
the three places create_checksum is called from, this argument is zero,
and in the other two, it's the output of one of the *_USAGE macros, which
will produce values outside the range of the enum.  Similarly, the only
use made of this argument is to pass it to do_checksum, which expects an
unsigned int.  Thus, I'd like to suggest the following patch, to make
"usage" an unsigned int as well.

Index: crypto/dist/heimdal/lib/krb5/crypto.c
===================================================================
RCS file: /cvsroot/basesrc/crypto/dist/heimdal/lib/krb5/crypto.c,v
retrieving revision 1.7
diff -u -r1.7 crypto.c
--- crypto/dist/heimdal/lib/krb5/crypto.c	2001/09/17 12:32:38	1.7
+++ crypto/dist/heimdal/lib/krb5/crypto.c	2002/01/03 22:34:10
@@ -1447,7 +1447,7 @@
 static krb5_error_code
 create_checksum(krb5_context context,
 		krb5_crypto crypto,
-		krb5_key_usage usage, /* not krb5_key_usage */
+		unsigned usage, /* not krb5_key_usage */
 		krb5_cksumtype type, /* 0 -> pick from crypto */
 		void *data,
 		size_t len,

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>