refactored DH group nonce exchange

This commit is contained in:
Andreas Steffen
2011-11-28 14:39:50 +01:00
parent 6728e09d39
commit cc1406d6fa
10 changed files with 364 additions and 398 deletions
+31 -29
View File
@@ -40,12 +40,7 @@ typedef struct pts_t pts_t;
#define REVERSE_SOLIDUS_UTF 0x5C
/**
* Lenght of the generated nonce used for calculation of shared secret
*/
#define NONCE_LEN 20
/**
* Lenght of the generated nonce used for calculation of shared secret
* Length of the generated nonce used for calculation of shared secret
*/
#define ASSESSMENT_SECRET_LEN 20
@@ -55,12 +50,12 @@ typedef struct pts_t pts_t;
#define MAX_NUM_PCR 24
/**
* Number of bytes can be savedin a PCR of TPM, TPM Spec 1.2
* Number of bytes that can be saved in a PCR of TPM, TPM Spec 1.2
*/
#define PCR_LEN 20
/**
* Class implementing the TCG Platform Trust System (PTS)
* Class implementing the TCG Platform Trust Service (PTS)
*
*/
struct pts_t {
@@ -82,57 +77,64 @@ struct pts_t {
/**
* Get PTS Measurement Algorithm
*
* @return Measurement algorithm
* @return PTS measurement algorithm
*/
pts_meas_algorithms_t (*get_meas_algorithm)(pts_t *this);
/**
* Set PTS Measurement Algorithm
*
* @param algorithm Measurement algorithm
* @param algorithm PTS measurement algorithm
*/
void (*set_meas_algorithm)(pts_t *this, pts_meas_algorithms_t algorithm);
/**
* Set PTS Diffie-Hellman object
* Get DH Hash Algorithm
*
* @param dh DH object
* @return DH hash algorithm
*/
bool (*create_dh)(pts_t *this, pts_dh_group_t group);
pts_meas_algorithms_t (*get_dh_hash_algorithm)(pts_t *this);
/**
* Set DH Hash Algorithm
*
* @param algorithm DH hash algorithm
*/
void (*set_dh_hash_algorithm)(pts_t *this, pts_meas_algorithms_t algorithm);
/**
* Create PTS Diffie-Hellman object and nonce
*
* @param group PTS DH group
* @param nonce_len Nonce length
* @return TRUE if creation was successful
*
*/
bool (*create_dh_nonce)(pts_t *this, pts_dh_group_t group, int nonce_len);
/**
* Get my Diffie-Hellman public value
*
* @param value My public DH value
* @param nonce My DH nonce
*/
void (*get_my_public_value)(pts_t *this, chunk_t *value);
void (*get_my_public_value)(pts_t *this, chunk_t *value, chunk_t *nonce);
/**
* Set peer Diffie.Hellman public value
*
* @param value Peer public DH value
* @param nonce Peer DH nonce
*/
void (*set_peer_public_value) (pts_t *this, chunk_t value);
void (*set_peer_public_value) (pts_t *this, chunk_t value, chunk_t nonce);
/**
* Calculates secret assessment value to be used for TPM Quote as an external data
* Calculates secret assessment value to be used for TPM Quote as ExternalData
*
* @param initiator_nonce Initiator nonce (IMV nonce)
* @param responder_nonce Responder nonce (IMC nonce)
* @param algorithm Hashing algorithm
* @return TRUE unless both DH public values
* and nonces are set
*/
bool (*calculate_secret) (pts_t *this, chunk_t initiator_nonce,
chunk_t responder_nonce,
pts_meas_algorithms_t algorithm);
/**
* Returns secret assessment value to be used for TPM Quote as an external data
*
* @return Secret assessment value
*/
chunk_t (*get_secret) (pts_t *this);
bool (*calculate_secret) (pts_t *this);
/**
* Get Platform and OS Info