auth-cfg: Store signature schemes as signature_params_t objects
Due to circular references the hasher_from_signature_scheme() helper does not take a signature_params_t object.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "hasher.h"
|
||||
|
||||
#include <asn1/oid.h>
|
||||
#include <credentials/keys/signature_params.h>
|
||||
|
||||
ENUM_BEGIN(hash_algorithm_names, HASH_SHA1, HASH_IDENTITY,
|
||||
"HASH_SHA1",
|
||||
@@ -483,14 +484,21 @@ int hasher_signature_algorithm_to_oid(hash_algorithm_t alg, key_type_t key)
|
||||
/*
|
||||
* Defined in header.
|
||||
*/
|
||||
hash_algorithm_t hasher_from_signature_scheme(signature_scheme_t scheme)
|
||||
hash_algorithm_t hasher_from_signature_scheme(signature_scheme_t scheme,
|
||||
void *params)
|
||||
{
|
||||
switch (scheme)
|
||||
{
|
||||
case SIGN_UNKNOWN:
|
||||
case SIGN_RSA_EMSA_PKCS1_NULL:
|
||||
case SIGN_ECDSA_WITH_NULL:
|
||||
break;
|
||||
case SIGN_RSA_EMSA_PSS:
|
||||
if (params)
|
||||
{
|
||||
rsa_pss_params_t *pss = params;
|
||||
return pss->hash;
|
||||
}
|
||||
break;
|
||||
case SIGN_ED25519:
|
||||
case SIGN_ED448:
|
||||
|
||||
@@ -206,8 +206,10 @@ int hasher_signature_algorithm_to_oid(hash_algorithm_t alg, key_type_t key);
|
||||
* Determine the hash algorithm associated with a given signature scheme.
|
||||
*
|
||||
* @param scheme signature scheme
|
||||
* @param params optional parameters
|
||||
* @return hash algorithm (could be HASH_UNKNOWN)
|
||||
*/
|
||||
hash_algorithm_t hasher_from_signature_scheme(signature_scheme_t scheme);
|
||||
hash_algorithm_t hasher_from_signature_scheme(signature_scheme_t scheme,
|
||||
void *params);
|
||||
|
||||
#endif /** HASHER_H_ @}*/
|
||||
|
||||
Reference in New Issue
Block a user