]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
libimcv: Allow pts_t.set_peer_public_value() to fail
authorMartin Willi <martin@revosec.ch>
Mon, 23 Mar 2015 10:28:57 +0000 (11:28 +0100)
committerMartin Willi <martin@revosec.ch>
Mon, 23 Mar 2015 16:54:02 +0000 (17:54 +0100)
src/libimcv/plugins/imc_attestation/imc_attestation_process.c
src/libimcv/plugins/imv_attestation/imv_attestation_process.c
src/libimcv/pts/pts.c
src/libimcv/pts/pts.h

index 6f8e4ea5a98b3dc9f3f557d53b9e3a400dde36e1..f24aec881b6e411436e9173418ec901599fec6fd 100644 (file)
@@ -178,8 +178,10 @@ bool imc_attestation_process(pa_tnc_attr_t *attr, imc_msg_t *msg,
                                return FALSE;
                        }
 
-                       pts->set_peer_public_value(pts, initiator_value, initiator_nonce);
-                       if (!pts->calculate_secret(pts))
+
+                       if (!pts->set_peer_public_value(pts, initiator_value,
+                                                                                       initiator_nonce) ||
+                               !pts->calculate_secret(pts))
                        {
                                return FALSE;
                        }
index bad536abec22043a9c6fe7215e593d7befc4f564..fbeb6618e87edf464187186a814accd53d2da3a8 100644 (file)
@@ -134,11 +134,11 @@ bool imv_attestation_process(pa_tnc_attr_t *attr, imv_msg_t *out_msg,
                        }
 
                        responder_value = attr_cast->get_responder_value(attr_cast);
-                       pts->set_peer_public_value(pts, responder_value,
-                                                                                       responder_nonce);
 
                        /* Calculate secret assessment value */
-                       if (!pts->calculate_secret(pts))
+                       if (!pts->set_peer_public_value(pts, responder_value,
+                                                                                       responder_nonce) ||
+                               !pts->calculate_secret(pts))
                        {
                                return FALSE;
                        }
index 6deccc82ab0c5ea3217218ca5c3e59d12b69c5ab..8d13bfca454c49cc3725980965cb523e3ef12da5 100644 (file)
@@ -232,7 +232,7 @@ METHOD(pts_t, get_my_public_value, bool,
        return TRUE;
 }
 
-METHOD(pts_t, set_peer_public_value, void,
+METHOD(pts_t, set_peer_public_value, bool,
        private_pts_t *this, chunk_t value, chunk_t nonce)
 {
        this->dh->set_other_public_value(this->dh, value);
@@ -246,6 +246,7 @@ METHOD(pts_t, set_peer_public_value, void,
        {
                this->responder_nonce = nonce;
        }
+       return TRUE;
 }
 
 METHOD(pts_t, calculate_secret, bool,
index 4d3284e36660e3f304a34f0987b440369c8c8896..d525306dd812b8047f309d9af06e6e43aba304ef 100644 (file)
@@ -152,8 +152,9 @@ struct pts_t {
         *
         * @param value                         Peer public DH value
         * @param nonce                         Peer DH nonce
+        * @return                                      TRUE if public value set successfully
         */
-       void (*set_peer_public_value) (pts_t *this, chunk_t value, chunk_t nonce);
+       bool (*set_peer_public_value) (pts_t *this, chunk_t value, chunk_t nonce);
 
        /**
         * Calculates assessment secret to be used for TPM Quote as ExternalData