Added empty getter/setter for AIK
authorSansar Choinyambuu <schoinya@hsr.ch>
Fri, 26 Aug 2011 12:16:12 +0000 (14:16 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 8 Sep 2011 10:08:14 +0000 (12:08 +0200)
src/libimcv/tcg/pts/pts.c
src/libimcv/tcg/pts/pts.h

index e5e2566..a19cb16 100644 (file)
@@ -59,6 +59,16 @@ struct private_pts_t {
         */
        chunk_t tpm_version_info;
        
+       /**
+        * Contains a Attestation Identity Key
+        */
+       chunk_t aik;
+       
+       /**
+        * True if AIK is naked public key, not a certificate
+        */
+       bool is_naked_key;
+       
 };
 
 METHOD(pts_t, get_proto_caps, pts_proto_caps_flag_t,
@@ -145,10 +155,35 @@ METHOD(pts_t, set_tpm_version_info, void,
        print_tpm_version_info(this);
 }
 
-
 /**
- * Get Hash Measurement of a file
+ * Obtain an AIK
  */
+static bool obtain_aik(chunk_t *aik, bool *is_naked_key)
+{
+       /* TODO: Start working here */
+       return TRUE;
+}
+
+METHOD(pts_t, get_aik, bool,
+       private_pts_t *this, chunk_t *aik, bool *is_naked_key)
+{
+       if(obtain_aik(aik, is_naked_key) != TSS_SUCCESS )
+       {
+               return FALSE;
+       }
+       
+       *aik = this->aik;
+       *is_naked_key = this->is_naked_key;
+       
+       return TRUE;
+}
+
+METHOD(pts_t, set_aik, void,
+       private_pts_t *this, chunk_t aik, bool is_naked_key)
+{
+       this->aik = chunk_clone(aik);
+       this->is_naked_key = is_naked_key;
+}
 
 METHOD(pts_t, hash_file, bool,
        private_pts_t *this, chunk_t path, chunk_t *out)
@@ -195,10 +230,6 @@ METHOD(pts_t, hash_file, bool,
        return true;
 }
 
-/**
- * Get hash of all the files in a directory
- */
-
 METHOD(pts_t, hash_directory, bool,
        private_pts_t *this, chunk_t path, linked_list_t **file_measurements)
 {
@@ -303,6 +334,8 @@ pts_t *pts_create(bool is_imc)
                        .set_meas_algorithm = _set_meas_algorithm,
                        .get_tpm_version_info = _get_tpm_version_info,
                        .set_tpm_version_info = _set_tpm_version_info,
+                       .get_aik = _get_aik,
+                       .set_aik = _set_aik,
                        .hash_file = _hash_file,
                        .hash_directory = _hash_directory,
                        .destroy = _destroy,
index d249a78..63e718c 100644 (file)
@@ -90,6 +90,23 @@ struct pts_t {
        void (*set_tpm_version_info)(pts_t *this, chunk_t info);
        
        /**
+        * Get Attestation Identity Key
+        *
+        * @param aik                   chunk containing a AIK naked public key or certificate
+        * @param is_naked_key          TRUE if AIK is naked public key, without certificate
+        * @return                      TRUE if AIK available
+        */
+       bool (*get_aik)(pts_t *this, chunk_t *aik, bool *is_naked_key);
+       
+       /**
+        * Set Attestation Identity Key
+        *
+        * @param aik                   chunk containing a AIK naked public key or certificate 
+        * @param is_naked_key          TRUE if AIK is naked public key, without certificate
+        */
+       void (*set_aik)(pts_t *this, chunk_t aik, bool is_naked_key);
+       
+       /**
         * Hash the given file
         *
         * @param path                  absolute path to file to be hashed