libstrongswan: Encode RSA-PSS algorithmIdentifier variant
Some third party IKEv2 products expect an RSA-PSS ASN.1 algorithmIdentifier with an explicit trailerField value (CONTEXT3) instead of the DEFAULT value if the trailerField is missing. The setting charon.rsa_pss_trailerfield = yes enables the explicit encoding.
This commit is contained in:
@@ -408,6 +408,10 @@ charon.routing_table_prio
|
||||
charon.rsa_pss = no
|
||||
Whether to use RSA with PSS padding instead of PKCS#1 padding by default.
|
||||
|
||||
charon.rsa_pss_trailerfield = no
|
||||
Whether to encode an explicit trailerField value of 0x01 in the RSA-PSS
|
||||
algorithmIdentifier (CONTEXT3) or using the DEFAULT value by omitting it.
|
||||
|
||||
charon.send_delay = 0
|
||||
Delay in ms for sending packets, to simulate larger RTT.
|
||||
|
||||
|
||||
@@ -360,6 +360,7 @@ end:
|
||||
bool rsa_pss_params_build(rsa_pss_params_t *params, chunk_t *asn1)
|
||||
{
|
||||
chunk_t hash = chunk_empty, mgf = chunk_empty, slen = chunk_empty;
|
||||
chunk_t trfd = chunk_empty;
|
||||
int alg;
|
||||
|
||||
if (params->hash != HASH_SHA1)
|
||||
@@ -370,6 +371,13 @@ bool rsa_pss_params_build(rsa_pss_params_t *params, chunk_t *asn1)
|
||||
return FALSE;
|
||||
}
|
||||
hash = asn1_algorithmIdentifier(alg);
|
||||
|
||||
/* set explicit trailerField with default value of 0x01 */
|
||||
if (lib->settings->get_bool(lib->settings, "%s.rsa_pss_trailerfield",
|
||||
FALSE, lib->ns))
|
||||
{
|
||||
trfd = asn1_integer("m", asn1_integer_from_uint64(0x01));
|
||||
}
|
||||
}
|
||||
if (params->mgf1_hash != HASH_SHA1)
|
||||
{ /* with MGF1-SHA1 we MUST omit the field */
|
||||
@@ -392,9 +400,10 @@ bool rsa_pss_params_build(rsa_pss_params_t *params, chunk_t *asn1)
|
||||
{
|
||||
slen = asn1_integer("m", asn1_integer_from_uint64(params->salt_len));
|
||||
}
|
||||
*asn1 = asn1_wrap(ASN1_SEQUENCE, "mmm",
|
||||
*asn1 = asn1_wrap(ASN1_SEQUENCE, "mmmm",
|
||||
hash.len ? asn1_wrap(ASN1_CONTEXT_C_0, "m", hash) : chunk_empty,
|
||||
mgf.len ? asn1_wrap(ASN1_CONTEXT_C_1, "m", mgf) : chunk_empty,
|
||||
slen.len ? asn1_wrap(ASN1_CONTEXT_C_2, "m", slen) : chunk_empty);
|
||||
mgf.len ? asn1_wrap(ASN1_CONTEXT_C_1, "m", mgf) : chunk_empty,
|
||||
slen.len ? asn1_wrap(ASN1_CONTEXT_C_2, "m", slen) : chunk_empty,
|
||||
trfd.len ? asn1_wrap(ASN1_CONTEXT_C_3, "m", trfd) : chunk_empty);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user