svn rev #21984: trunk/src/lib/krb5/krb/
ghudson@MIT.EDU
ghudson at MIT.EDU
Thu Feb 12 14:43:24 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=21984
Commit By: ghudson
Log Message:
Make output parameter of krb5_generate_subkey_extended well-defined on
error, and reformat function to fit coding standards.
Changed Files:
U trunk/src/lib/krb5/krb/gen_subkey.c
Modified: trunk/src/lib/krb5/krb/gen_subkey.c
===================================================================
--- trunk/src/lib/krb5/krb/gen_subkey.c 2009-02-12 19:43:08 UTC (rev 21983)
+++ trunk/src/lib/krb5/krb/gen_subkey.c 2009-02-12 19:43:23 UTC (rev 21984)
@@ -47,20 +47,28 @@
{
krb5_error_code retval;
krb5_data seed;
+ krb5_keyblock *keyblock;
+ *subkey = NULL;
+
seed = key2data(*key);
- if ((retval = krb5_c_random_add_entropy(context, KRB5_C_RANDSOURCE_TRUSTEDPARTY, &seed)))
- return(retval);
+ retval = krb5_c_random_add_entropy(context, KRB5_C_RANDSOURCE_TRUSTEDPARTY,
+ &seed);
+ if (retval)
+ return retval;
- if ((*subkey = (krb5_keyblock *) malloc(sizeof(krb5_keyblock))) == NULL)
- return(ENOMEM);
+ keyblock = malloc(sizeof(krb5_keyblock));
+ if (!keyblock)
+ return ENOMEM;
- if ((retval = krb5_c_make_random_key(context, enctype, *subkey))) {
+ retval = krb5_c_make_random_key(context, enctype, keyblock);
+ if (retval) {
free(*subkey);
- return(retval);
+ return retval;
}
- return(0);
+ *subkey = keyblock;
+ return 0;
}
krb5_error_code
More information about the cvs-krb5
mailing list