shishi-commit
[Top][All Lists]
Advanced

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

shishi/lib ap.c


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

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

Modified files:
        lib            : ap.c 

Log message:
        (shishi_ap): Docfix.
        (shishi_ap_etype): New.
        (shishi_ap_tktoptions): Use shishi_ap_etype.
        (shishi_ap_tktoptionsdata): Likewise.
        (shishi_ap_tktoptionsasn1usage): Likewise.

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

Patches:
Index: shishi/lib/ap.c
diff -u shishi/lib/ap.c:1.57 shishi/lib/ap.c:1.58
--- shishi/lib/ap.c:1.57        Sat Sep  6 15:57:16 2003
+++ shishi/lib/ap.c     Thu Nov 27 14:05:54 2003
@@ -42,7 +42,12 @@
  * @handle: shishi handle as allocated by shishi_init().
  * @ap: pointer to new structure that holds information about AP exchange
  *
- * Create a new AP exchange.
+ * Create a new AP exchange with a random subkey of the default
+ * encryption type from configuration.  Note that there is no
+ * guarantee that the receiver will understand that key type, you
+ * should probably use shishi_ap_etype() or shishi_ap_nosubkey()
+ * instead.  In the future, this function will likely behave as
+ * shishi_ap_nosubkey() and shishi_ap_nosubkey() will be removed.
  *
  * Return value: Returns SHISHI_OK iff successful.
  **/
@@ -71,6 +76,43 @@
 }
 
 /**
+ * shishi_ap_etype:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @ap: pointer to new structure that holds information about AP exchange
+ * @etype: encryption type of newly generated random subkey.
+ *
+ * Create a new AP exchange with a random subkey of indicated
+ * encryption type.
+ *
+ * Return value: Returns SHISHI_OK iff successful.
+ **/
+int
+shishi_ap_etype (Shishi * handle, Shishi_ap ** ap, int etype)
+{
+  int res;
+
+  res = shishi_ap_nosubkey (handle, ap);
+  if (res != SHISHI_OK)
+    {
+      shishi_error_printf (handle, "Could not create Authenticator: %s\n",
+                          shishi_error (handle));
+      return res;
+    }
+
+  res = shishi_authenticator_add_random_subkey_etype (handle,
+                                                     (*ap)->authenticator,
+                                                     etype);
+  if (res != SHISHI_OK)
+    {
+      shishi_error_printf (handle, "Could not add random subkey in AP: %s\n",
+                          shishi_strerror (res));
+      return res;
+    }
+
+  return SHISHI_OK;
+}
+
+/**
  * shishi_ap_nosubkey:
  * @handle: shishi handle as allocated by shishi_init().
  * @ap: pointer to new structure that holds information about AP exchange
@@ -263,7 +305,9 @@
  * @options: AP-REQ options to set in newly created AP.
  *
  * Create a new AP exchange using shishi_ap(), and set the ticket and
- * AP-REQ apoptions using shishi_ap_set_tktoption().
+ * AP-REQ apoptions using shishi_ap_set_tktoption().  A random session
+ * key is added to the authenticator, using the same keytype as the
+ * ticket.
  *
  * Return value: Returns SHISHI_OK iff successful.
  **/
@@ -273,7 +317,7 @@
 {
   int rc;
 
-  rc = shishi_ap (handle, ap);
+  rc = shishi_ap_etype (handle, ap, shishi_tkt_keytype_fast (tkt));
   if (rc != SHISHI_OK)
     return rc;
 
@@ -295,7 +339,8 @@
  *
  * Create a new AP exchange using shishi_ap(), and set the ticket,
  * AP-REQ apoptions and the Authenticator checksum data using
- * shishi_ap_set_tktoptionsdata().
+ * shishi_ap_set_tktoptionsdata(). A random session key is added to
+ * the authenticator, using the same keytype as the ticket.
  *
  * Return value: Returns SHISHI_OK iff successful.
  **/
@@ -307,7 +352,7 @@
 {
   int rc;
 
-  rc = shishi_ap (handle, ap);
+  rc = shishi_ap_etype (handle, ap, shishi_tkt_keytype_fast (tkt));
   if (rc != SHISHI_OK)
     return rc;
 
@@ -331,7 +376,9 @@
  *
  * Create a new AP exchange using shishi_ap(), and set ticket, options
  * and authenticator checksum data from the DER encoding of the ASN.1
- * field using shishi_ap_set_tktoptionsasn1usage().
+ * field using shishi_ap_set_tktoptionsasn1usage().  A random session
+ * key is added to the authenticator, using the same keytype as the
+ * ticket.
  *
  * Return value: Returns SHISHI_OK iff successful.
  **/
@@ -347,7 +394,7 @@
 {
   int rc;
 
-  rc = shishi_ap (handle, ap);
+  rc = shishi_ap_etype (handle, ap, shishi_tkt_keytype_fast (tkt));
   if (rc != SHISHI_OK)
     return rc;
 




reply via email to

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