convert pts_meas_algo_t to hash_algorithm_type

This commit is contained in:
Andreas Steffen
2011-09-08 12:08:10 +02:00
parent 3f3664ec43
commit c1a7cb1206
2 changed files with 26 additions and 1 deletions
+17 -1
View File
@@ -16,7 +16,6 @@
#include "tcg_pts_meas_algo.h"
#include <debug.h>
#include <crypto/hashers/hasher.h>
/**
* Described in header.
@@ -75,3 +74,20 @@ bool tcg_pts_probe_meas_algorithms(pts_meas_algorithms_t *algorithms)
return FALSE;
}
/**
* Described in header.
*/
hash_algorithm_t tcg_pts_meas_to_hash_algorithm(pts_meas_algorithms_t algorithm)
{
switch (algorithm)
{
case PTS_MEAS_ALGO_SHA1:
return HASH_SHA1;
case PTS_MEAS_ALGO_SHA256:
return HASH_SHA256;
case PTS_MEAS_ALGO_SHA384:
return HASH_SHA384;
default:
return HASH_UNKNOWN;
}
}
+9
View File
@@ -22,6 +22,7 @@
#define TCG_PTS_MEAS_ALGO_H_
#include <library.h>
#include <crypto/hashers/hasher.h>
typedef enum pts_meas_algorithms_t pts_meas_algorithms_t;
@@ -54,4 +55,12 @@ enum pts_meas_algorithms_t {
*/
bool tcg_pts_probe_meas_algorithms(pts_meas_algorithms_t *algorithms);
/**
* Convert pts_meas_algorithms_t to hash_algorithm_t
*
* @param algorithm PTS measurement algorithm type
* @return libstrongswan hash algorithm type
*/
hash_algorithm_t tcg_pts_meas_to_hash_algorithm(pts_meas_algorithms_t algorithm);
#endif /** TCG_PTS_MEAS_ALGO_H_ @}*/