svn rev #25194: trunk/src/ include/ include/krb5/ lib/krb5/ lib/krb5/krb/ plugins/preauth/pkinit/

hartmans@MIT.EDU hartmans at MIT.EDU
Sun Sep 18 20:35:10 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25194
Commit By: hartmans
Log Message:
pkinit: add supportedKDFs and kdfID to structures

* Extend auth_pack
* extend dh_rep
* add krb5_free_octet_data
* extend pkinit free functions


Changed Files:
U   trunk/src/include/k5-int-pkinit.h
U   trunk/src/include/krb5/krb5.hin
U   trunk/src/lib/krb5/krb/kfree.c
U   trunk/src/lib/krb5/libkrb5.exports
U   trunk/src/plugins/preauth/pkinit/pkinit_lib.c
Modified: trunk/src/include/k5-int-pkinit.h
===================================================================
--- trunk/src/include/k5-int-pkinit.h	2011-09-19 00:35:06 UTC (rev 25193)
+++ trunk/src/include/k5-int-pkinit.h	2011-09-19 00:35:10 UTC (rev 25194)
@@ -65,12 +65,13 @@
     krb5_octet_data             subjectPublicKey; /* BIT STRING */
 } krb5_subject_pk_info;
 
-/* AuthPack */
+/** AuthPack  from RFC 4556*/
 typedef struct _krb5_auth_pack {
     krb5_pk_authenticator       pkAuthenticator;
     krb5_subject_pk_info        *clientPublicValue; /* Optional */
     krb5_algorithm_identifier   **supportedCMSTypes; /* Optional */
     krb5_octet_data             clientDHNonce; /* Optional */
+krb5_octet_data **supportedKDFs; /*< object identifiers of KDFs; OPTIONAL*/
 } krb5_auth_pack;
 
 /* AuthPack draft9 */
@@ -116,10 +117,11 @@
     krb5_octet_data kdcPkId; /* Optional */
 } krb5_pa_pk_as_req;
 
-/* DHRepInfo */
+/** Pkinit DHRepInfo */
 typedef struct _krb5_dh_rep_info {
     krb5_octet_data dhSignedData;
     krb5_octet_data serverDHNonce; /* Optional */
+    krb5_octet_data *kdfID; /**< OID of selected KDF OPTIONAL*/
 } krb5_dh_rep_info;
 
 /* KDCDHKeyInfo */

Modified: trunk/src/include/krb5/krb5.hin
===================================================================
--- trunk/src/include/krb5/krb5.hin	2011-09-19 00:35:06 UTC (rev 25193)
+++ trunk/src/include/krb5/krb5.hin	2011-09-19 00:35:10 UTC (rev 25194)
@@ -4647,8 +4647,23 @@
 krb5_free_data(krb5_context context, krb5_data *val);
 
 /**
- * Free the contents of a krb_data structure.
+ * @brief Free storage associated with a @c krb5_octet_data structure and its pointer.
  *
+ * @param context           Context structure [input, output]
+ * @param val               Pointer to data structure to be freed [input, output]
+ *
+ * @return
+ * None
+ */
+void KRB5_CALLCONV
+krb5_free_octet_data(krb5_context context, krb5_octet_data *val);
+
+/**
+ * @brief Free the contents of a @c _krb5_data structure and zero the data field.
+ *
+ * @param context           Context structure [input, output]
+ * @param val               Pointer to data structure to be freed [input, output]
+ *
  * @param [in] context          Library context
  * @param [in] val              Data structure to free contents of
  *

Modified: trunk/src/lib/krb5/krb/kfree.c
===================================================================
--- trunk/src/lib/krb5/krb/kfree.c	2011-09-19 00:35:06 UTC (rev 25193)
+++ trunk/src/lib/krb5/krb/kfree.c	2011-09-19 00:35:10 UTC (rev 25194)
@@ -236,7 +236,17 @@
     free(val);
 }
 
+
 void KRB5_CALLCONV
+krb5_free_octet_data(krb5_context context, krb5_octet_data *val)
+{
+    if (val == NULL)
+        return;
+    free(val->data);
+    free(val);
+}
+
+void KRB5_CALLCONV
 krb5_free_data_contents(krb5_context context, krb5_data *val)
 {
     if (val == NULL)

Modified: trunk/src/lib/krb5/libkrb5.exports
===================================================================
--- trunk/src/lib/krb5/libkrb5.exports	2011-09-19 00:35:06 UTC (rev 25193)
+++ trunk/src/lib/krb5/libkrb5.exports	2011-09-19 00:35:10 UTC (rev 25194)
@@ -302,6 +302,7 @@
 krb5_free_krbhst
 krb5_free_ktypes
 krb5_free_last_req
+krb5_free_octet_data
 krb5_free_pa_data
 krb5_free_pa_enc_ts
 krb5_free_pa_for_user

Modified: trunk/src/plugins/preauth/pkinit/pkinit_lib.c
===================================================================
--- trunk/src/plugins/preauth/pkinit/pkinit_lib.c	2011-09-19 00:35:06 UTC (rev 25193)
+++ trunk/src/plugins/preauth/pkinit/pkinit_lib.c	2011-09-19 00:35:10 UTC (rev 25194)
@@ -163,6 +163,14 @@
     free((*in)->pkAuthenticator.paChecksum.contents);
     if ((*in)->supportedCMSTypes != NULL)
         free_krb5_algorithm_identifiers(&((*in)->supportedCMSTypes));
+    if (*(*in)->supportedKDFs) {
+        krb5_octet_data **supportedKDFs =
+            (*in)->supportedKDFs;
+        unsigned i;
+        for (i = 0; supportedKDFs[i]; i++)
+            krb5_free_octet_data(NULL, supportedKDFs[i]);
+        free(supportedKDFs);
+    }
     free(*in);
 }
 
@@ -181,6 +189,7 @@
     if (*in == NULL) return;
     switch ((*in)->choice) {
     case choice_pa_pk_as_rep_dhInfo:
+        krb5_free_octet_data(NULL, (*in)->u.dh_Info.kdfID);
         free((*in)->u.dh_Info.dhSignedData.data);
         break;
     case choice_pa_pk_as_rep_encKeyPack:




More information about the cvs-krb5 mailing list