convert pts_meas_algo_t to hash_algorithm_type
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
#include "tcg_pts_meas_algo.h"
|
#include "tcg_pts_meas_algo.h"
|
||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <crypto/hashers/hasher.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Described in header.
|
* Described in header.
|
||||||
@@ -75,3 +74,20 @@ bool tcg_pts_probe_meas_algorithms(pts_meas_algorithms_t *algorithms)
|
|||||||
return FALSE;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define TCG_PTS_MEAS_ALGO_H_
|
#define TCG_PTS_MEAS_ALGO_H_
|
||||||
|
|
||||||
#include <library.h>
|
#include <library.h>
|
||||||
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
typedef enum pts_meas_algorithms_t pts_meas_algorithms_t;
|
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);
|
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_ @}*/
|
#endif /** TCG_PTS_MEAS_ALGO_H_ @}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user