aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-03-23 11:28:57 +0100
committerMartin Willi <martin@revosec.ch>2015-03-23 17:54:02 +0100
commit8a7dbf3c2a0a4e8a4a503b630dbad0d46ae25756 (patch)
tree60d5d7ec420de2d2a93ea76812f43a4c7b635527
parent83cda57e2d0639eca19bcd956f4736d4cdcf7849 (diff)
downloadstrongswan-8a7dbf3c2a0a4e8a4a503b630dbad0d46ae25756.tar.bz2
strongswan-8a7dbf3c2a0a4e8a4a503b630dbad0d46ae25756.tar.xz
libimcv: Allow pts_t.set_peer_public_value() to fail
-rw-r--r--src/libimcv/plugins/imc_attestation/imc_attestation_process.c6
-rw-r--r--src/libimcv/plugins/imv_attestation/imv_attestation_process.c6
-rw-r--r--src/libimcv/pts/pts.c3
-rw-r--r--src/libimcv/pts/pts.h3
4 files changed, 11 insertions, 7 deletions
diff --git a/src/libimcv/plugins/imc_attestation/imc_attestation_process.c b/src/libimcv/plugins/imc_attestation/imc_attestation_process.c
index 6f8e4ea5a..f24aec881 100644
--- a/src/libimcv/plugins/imc_attestation/imc_attestation_process.c
+++ b/src/libimcv/plugins/imc_attestation/imc_attestation_process.c
@@ -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;
}
diff --git a/src/libimcv/plugins/imv_attestation/imv_attestation_process.c b/src/libimcv/plugins/imv_attestation/imv_attestation_process.c
index bad536abe..fbeb6618e 100644
--- a/src/libimcv/plugins/imv_attestation/imv_attestation_process.c
+++ b/src/libimcv/plugins/imv_attestation/imv_attestation_process.c
@@ -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;
}
diff --git a/src/libimcv/pts/pts.c b/src/libimcv/pts/pts.c
index 6deccc82a..8d13bfca4 100644
--- a/src/libimcv/pts/pts.c
+++ b/src/libimcv/pts/pts.c
@@ -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,
diff --git a/src/libimcv/pts/pts.h b/src/libimcv/pts/pts.h
index 4d3284e36..d525306dd 100644
--- a/src/libimcv/pts/pts.h
+++ b/src/libimcv/pts/pts.h
@@ -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