Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
TTCN-3 Libraries
LibIts
Compare revisions
87d844cc4272334377ad31bb5befa9d0ed23792f...4b09f4e418e6e62ce9be0a9a44a5c1c9805585d9
Commits (1)
Unify security external function names
· 4b09f4e4
Yann Garcia
authored
Mar 29, 2020
4b09f4e4
Expand all
Show whitespace changes
Inline
Side-by-side
ttcn/Pki/LibItsPki_Functions.ttcn
View file @
4b09f4e4
...
...
@@ -591,12 +591,12 @@ module LibItsPki_Functions {
if
(
PX_VE_ALG
==
e_nist_p256
)
{
return
f_signWithEcdsaNistp256WithSha256
(
p_toBeSignedSecuredMessage
,
p_certificateIssuer
,
p_privateKey
);
}
else
if
(
PX_VE_ALG
==
e_brainpool_p256_r1
)
{
return
f_signWithEcdsaBrainpoolp256WithSha256
(
p_toBeSignedSecuredMessage
,
p_certificateIssuer
,
p_privateKey
);
return
f_signWithEcdsaBrainpoolp256
r1
WithSha256
(
p_toBeSignedSecuredMessage
,
p_certificateIssuer
,
p_privateKey
);
}
else
if
(
PX_VE_ALG
==
e_brainpool_p384_r1
)
{
if
(
p_certificateIssuer
==
int2oct
(
0
,
32
))
{
return
f_signWithEcdsaBrainpoolp384WithSha384
(
p_toBeSignedSecuredMessage
,
int2oct
(
0
,
48
),
p_privateKey
);
return
f_signWithEcdsaBrainpoolp384
r1
WithSha384
(
p_toBeSignedSecuredMessage
,
int2oct
(
0
,
48
),
p_privateKey
);
}
else
{
return
f_signWithEcdsaBrainpoolp384WithSha384
(
p_toBeSignedSecuredMessage
,
p_certificateIssuer
,
p_privateKey
);
return
f_signWithEcdsaBrainpoolp384
r1
WithSha384
(
p_toBeSignedSecuredMessage
,
p_certificateIssuer
,
p_privateKey
);
}
}
...
...
@@ -634,14 +634,14 @@ module LibItsPki_Functions {
}
}
else
if
(
ischosen
(
p_verification_key
.
ecdsaBrainpoolP256r1
))
{
if
(
ischosen
(
p_verification_key
.
ecdsaBrainpoolP256r1
.
compressed_y_0
))
{
v_ret
:=
f_verifyWithEcdsaBrainpoolp256WithSha256
(
v_ret
:=
f_verifyWithEcdsaBrainpoolp256
r1
WithSha256
(
p_tbs
,
p_issuer
,
p_signature_
.
ecdsaBrainpoolP256r1Signature
.
rSig
.
x_only
&
p_signature_
.
ecdsaBrainpoolP256r1Signature
.
sSig
,
p_verification_key
.
ecdsaBrainpoolP256r1
.
compressed_y_0
,
0
);
}
else
{
v_ret
:=
f_verifyWithEcdsaBrainpoolp256WithSha256
(
v_ret
:=
f_verifyWithEcdsaBrainpoolp256
r1
WithSha256
(
p_tbs
,
p_issuer
,
p_signature_
.
ecdsaBrainpoolP256r1Signature
.
rSig
.
x_only
&
p_signature_
.
ecdsaBrainpoolP256r1Signature
.
sSig
,
...
...
@@ -650,14 +650,14 @@ module LibItsPki_Functions {
}
}
else
if
(
ischosen
(
p_verification_key
.
ecdsaBrainpoolP384r1
))
{
if
(
ischosen
(
p_verification_key
.
ecdsaBrainpoolP384r1
.
compressed_y_0
))
{
v_ret
:=
f_verifyWithEcdsaBrainpoolp384WithSha384
(
v_ret
:=
f_verifyWithEcdsaBrainpoolp384
r1
WithSha384
(
p_tbs
,
p_issuer
,
p_signature_
.
ecdsaBrainpoolP384r1Signature
.
rSig
.
x_only
&
p_signature_
.
ecdsaBrainpoolP384r1Signature
.
sSig
,
p_verification_key
.
ecdsaBrainpoolP384r1
.
compressed_y_0
,
0
);
}
else
{
v_ret
:=
f_verifyWithEcdsaBrainpoolp384WithSha384
(
v_ret
:=
f_verifyWithEcdsaBrainpoolp384
r1
WithSha384
(
p_tbs
,
p_issuer
,
p_signature_
.
ecdsaBrainpoolP384r1Signature
.
rSig
.
x_only
&
p_signature_
.
ecdsaBrainpoolP384r1Signature
.
sSig
,
...
...
@@ -2300,7 +2300,7 @@ module LibItsPki_Functions {
// In case of ITS-S privacy, v_signed_at_signature contained the data to be encrypted
if
(
ischosen
(
p_ec_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP384r1
))
{
v_hashId
:=
sha384
;
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp384WithSha384
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp384
r1
WithSha384
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_signature
:=
valueof
(
m_signature_ecdsaBrainpoolP384r1
(
m_ecdsaP384Signature
(
...
...
@@ -2314,7 +2314,7 @@ module LibItsPki_Functions {
}
else
{
v_hashId
:=
sha256
;
if
(
ischosen
(
p_ec_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP256r1
))
{
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp256WithSha256
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp256
r1
WithSha256
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_signature
:=
valueof
(
m_signature_ecdsaBrainpoolP256r1
(
m_ecdsaP256Signature
(
...
...
@@ -2405,7 +2405,7 @@ module LibItsPki_Functions {
log
(
"f_generate_inner_at_request: Wrong BrainpoolP256r1 encryption variant"
);
return
false
;
}
v_enc_signed_ec_signature
:=
f_encryptWithEciesBrainpoolp256WithSha256
(
bit2oct
(
encvalue
(
v_signed_at_signature
)),
v_public_enc_key
,
v_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
v_aes_sym_key
,
v_encrypted_sym_key
,
v_authentication_vector
,
v_nonce
);
v_enc_signed_ec_signature
:=
f_encryptWithEciesBrainpoolp256
r1
WithSha256
(
bit2oct
(
encvalue
(
v_signed_at_signature
)),
v_public_enc_key
,
v_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
v_aes_sym_key
,
v_encrypted_sym_key
,
v_authentication_vector
,
v_nonce
);
if
(
v_public_compressed_ephemeral_mode
==
0
)
{
v_eccP256_curve_point
:=
valueof
(
m_eccP256CurvePoint_compressed_y_0
(
v_public_compressed_ephemeral_key
));
}
else
{
...
...
@@ -2687,7 +2687,7 @@ module LibItsPki_Functions {
// TODO Simplify with f_signWithEcdsa
if
(
ischosen
(
p_ec_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP384r1
))
{
v_hashId
:=
sha384
;
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp384WithSha384
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp384
r1
WithSha384
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_signature
:=
valueof
(
m_signature_ecdsaBrainpoolP384r1
(
m_ecdsaP384Signature
(
...
...
@@ -2701,7 +2701,7 @@ module LibItsPki_Functions {
}
else
{
v_hashId
:=
sha256
;
if
(
ischosen
(
p_ec_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP256r1
))
{
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp256WithSha256
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_tbs_signed
:=
f_signWithEcdsaBrainpoolp256
r1
WithSha256
(
bit2oct
(
encvalue
(
v_tbs
)),
v_ec_hash
,
p_ec_private_key
);
v_signature
:=
valueof
(
m_signature_ecdsaBrainpoolP256r1
(
m_ecdsaP256Signature
(
...
...
@@ -2791,7 +2791,7 @@ module LibItsPki_Functions {
log
(
"f_generate_inner_at_request_with_wrong_parameters: Wrong BrainpoolP256r1 encryption variant"
);
return
false
;
}
v_enc_signed_ec_signature
:=
f_encryptWithEciesBrainpoolp256WithSha256
(
bit2oct
(
encvalue
(
v_signed_at_signature
)),
v_public_enc_key
,
v_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
v_aes_sym_key
,
v_encrypted_sym_key
,
v_authentication_vector
,
v_nonce
);
v_enc_signed_ec_signature
:=
f_encryptWithEciesBrainpoolp256
r1
WithSha256
(
bit2oct
(
encvalue
(
v_signed_at_signature
)),
v_public_enc_key
,
v_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
v_aes_sym_key
,
v_encrypted_sym_key
,
v_authentication_vector
,
v_nonce
);
if
(
v_public_compressed_ephemeral_mode
==
0
)
{
v_eccP256_curve_point
:=
valueof
(
m_eccP256CurvePoint_compressed_y_0
(
v_public_compressed_ephemeral_key
));
}
else
{
...
...
@@ -3456,7 +3456,7 @@ module LibItsPki_Functions {
if
(
p_enc_algorithm
==
e_nist_p256
)
{
v_encrypted_request
:=
f_encryptWithEciesNistp256WithSha256
(
v_encoded_request
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
if
(
p_enc_algorithm
==
e_brainpool_p256_r1
)
{
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256WithSha256
(
v_encoded_request
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256
r1
WithSha256
(
v_encoded_request
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
{
log
(
"f_build_pki_secured_request_message_signed_with_pop: Wrong encryption variant"
);
return
false
;
...
...
@@ -3568,7 +3568,7 @@ module LibItsPki_Functions {
if
(
p_enc_algorithm
==
e_nist_p256
)
{
v_encrypted_request
:=
f_encryptWithEciesNistp256WithSha256
(
p_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
if
(
p_enc_algorithm
==
e_brainpool_p256_r1
)
{
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256WithSha256
(
p_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256
r1
WithSha256
(
p_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
{
log
(
"f_build_pki_secured_request_message: Wrong encryption variant"
);
return
false
;
...
...
@@ -3672,7 +3672,7 @@ module LibItsPki_Functions {
if
(
p_enc_algorithm
==
e_nist_p256
)
{
v_encrypted_request
:=
f_encryptWithEciesNistp256WithSha256
(
v_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
if
(
p_enc_algorithm
==
e_brainpool_p256_r1
)
{
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256WithSha256
(
v_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
v_encrypted_request
:=
f_encryptWithEciesBrainpoolp256
r1
WithSha256
(
v_pki_message
,
p_public_key_compressed
,
p_compressed_mode
,
p_salt
,
v_public_compressed_ephemeral_key
,
v_public_compressed_ephemeral_mode
,
p_aes_sym_key
,
p_encrypted_sym_key
,
p_authentication_vector
,
p_nonce
);
}
else
{
log
(
"f_build_pki_secured_request_message_for_authorization: Wrong encryption variant"
);
return
false
;
...
...
ttcn/Security/LibItsSecurity_Functions.ttcn
View file @
4b09f4e4
This diff is collapsed.
Click to expand it.