shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shishi/lib authenticator.c


From: shishi-commit
Subject: shishi/lib authenticator.c
Date: Thu, 27 Nov 2003 14:05:11 -0500

CVSROOT:        /cvsroot/shishi
Module name:    shishi
Branch:         
Changes by:     Simon Josefsson <address@hidden>        03/11/27 14:05:11

Modified files:
        lib            : authenticator.c 

Log message:
        (shishi_authenticator_add_random_subkey_etype): New.
        (shishi_authenticator_add_random_subkey): Use it.  Docfix.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/authenticator.c.diff?tr1=1.47&tr2=1.48&r1=text&r2=text

Patches:
Index: shishi/lib/authenticator.c
diff -u shishi/lib/authenticator.c:1.47 shishi/lib/authenticator.c:1.48
--- shishi/lib/authenticator.c:1.47     Thu Nov 27 13:14:19 2003
+++ shishi/lib/authenticator.c  Thu Nov 27 14:05:10 2003
@@ -842,7 +842,8 @@
  * @handle: shishi handle as allocated by shishi_init().
  * @authenticator: authenticator as allocated by shishi_authenticator().
  *
- * Generate random subkey and store it in the authenticator.
+ * Generate random subkey, of the default encryption type from
+ * configuration, and store it in the authenticator.
  *
  * Return value: Returns SHISHI_OK iff successful.
  **/
@@ -850,22 +851,46 @@
 shishi_authenticator_add_random_subkey (Shishi * handle,
                                        Shishi_asn1 authenticator)
 {
+  int n;
   int res;
   int *etypes;
-  Shishi_key *subkey;
 
-  res = shishi_cfg_clientkdcetype (handle, &etypes);
-  if (!res)
+  n = shishi_cfg_clientkdcetype (handle, &etypes);
+  if (n <= 0)
+    return SHISHI_TICKET_BAD_KEYTYPE; /* XXX */
+
+  res = shishi_authenticator_add_random_subkey_etype (handle, authenticator,
+                                                     etypes[0]);
+  if (res != SHISHI_OK)
     return res;
 
-  res = shishi_key_random (handle, etypes[0], &subkey);
+  return res;
+}
+
+/**
+ * shishi_authenticator_add_random_subkey_etype:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @authenticator: authenticator as allocated by shishi_authenticator().
+ * @etype: encryption type of random key to generate.
+ *
+ * Generate random subkey of indicated encryption type, and store it
+ * in the authenticator.
+ *
+ * Return value: Returns SHISHI_OK iff successful.
+ **/
+int
+shishi_authenticator_add_random_subkey_etype (Shishi * handle,
+                                             Shishi_asn1 authenticator,
+                                             int etype)
+{
+  int res;
+  Shishi_key *subkey;
+
+  res = shishi_key_random (handle, etype, &subkey);
   if (res != SHISHI_OK)
     return res;
 
-  res = shishi_authenticator_set_subkey (handle, authenticator,
-                                        shishi_key_type (subkey),
-                                        shishi_key_value (subkey),
-                                        shishi_key_length (subkey));
+  res = shishi_authenticator_add_subkey (handle, authenticator, subkey);
 
   shishi_key_done (subkey);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]