Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TTCN-3 Libraries
LibIts
Commits
e9769e49
Commit
e9769e49
authored
Oct 10, 2014
by
garciay
Browse files
Major bug fixed in f_acEnableSecurity()
parent
dd9890b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
ttcn/GeoNetworking/LibItsGeoNetworking_Functions.ttcn
View file @
e9769e49
...
...
@@ -1729,12 +1729,12 @@ module LibItsGeoNetworking_Functions {
var
template
(
value
)
ToBeSignedSecuredMessage
v_toBeSignedSecuredMessageDigest
;
var
template
(
value
)
ToBeSignedSecuredMessage
v_toBeSignedSecuredMessageCertificate
;
f_loadCertificates
(
"cfg01"
);
// Build the beacon template
v_toBeSignedSecuredMessageDigest
:=
f_buildSecuredMessagePayloadToBeSigned
();
v_toBeSignedSecuredMessageCertificate
:=
f_buildSecuredMessagePayloadToBeSigned
(
true
);
f_loadCertificates
(
"cfg01"
);
return
f_acTriggerEvent
(
AcGnPrimitive
:
{
acEnableSecurity
:=
m_enableSecurity
(
vc_signingPrivateKey
,
...
...
@@ -2424,20 +2424,21 @@ module LibItsGeoNetworking_Functions {
*/
function
f_waitForCertificate
(
out
Certificate
p_cert
)
runs
on
ItsGeoNetworking
return
boolean
{
)
runs
on
ItsGeoNetworking
return
boolean
{
var
SecuredMessage
v_recv
;
var
boolean
v_ret
:=
false
;
alt
{
[]
a_securedMessageWithCertificate
(
v_recv
)
{
var
SignerInfo
v_si
;
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
)
==
true
)
{
p_cert
:=
v_si
.
signerInfo
.
certificate
;
v_ret
:=
true
;
}
}
}
}
// End of 'alt' statement
return
v_ret
;
}
// End of function f_waitForCertificate
...
...
@@ -2450,10 +2451,11 @@ module LibItsGeoNetworking_Functions {
return
boolean
{
var
SecuredMessage
v_recv
;
var
boolean
v_ret
:=
false
;
alt
{
[]
a_securedMessageWithCertificateChain
(
v_recv
){
[]
a_securedMessageWithCertificateChain
(
v_recv
)
{
var
SignerInfo
v_si
;
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
)){
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
))
{
p_chain
:=
v_si
.
signerInfo
.
certificates
;
v_ret
:=
true
;
}
...
...
@@ -2478,7 +2480,7 @@ module LibItsGeoNetworking_Functions {
if
(
f_getCertificateSignerInfo
(
v_si
.
signerInfo
.
certificate
,
v_si
))
{
if
(
match
(
v_si
.
type_
,
e_certificate_digest_with_ecdsap256
))
{
f_sendCertificateRequest
(
v_si
.
signerInfo
.
digest
,
p_CamPayload
);
if
(
tc_ac
.
running
){
if
(
tc_ac
.
running
)
{
tc_ac
.
stop
;
tc_ac
.
start
;
}
v_ret
:=
true
;
...
...
@@ -2493,19 +2495,22 @@ module LibItsGeoNetworking_Functions {
* @desc Ask for the certificate chain and wait for GN message with security containing certificate chain as a signer info
* @return the certificate chain used for sign received message
*/
function
f_askAndWaitForCertificateChain
(
out
CertificateChain
p_chain
,
in
template
(
value
)
octetstring
p_CamPayload
)
runs
on
ItsGeoNetworking
return
boolean
{
function
f_askAndWaitForCertificateChain
(
out
CertificateChain
p_chain
,
in
template
(
value
)
octetstring
p_CamPayload
)
runs
on
ItsGeoNetworking
return
boolean
{
// Local variables
var
SecuredMessage
v_recv
;
var
SignerInfo
v_si
;
var
boolean
v_ret
:=
false
;
alt
{
[]
a_securedMessageWithCertificate
(
v_recv
)
{
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
))
{
if
(
f_getCertificateSignerInfo
(
v_si
.
signerInfo
.
certificate
,
v_si
))
{
if
(
match
(
v_si
.
type_
,
e_certificate_digest_with_ecdsap256
))
{
f_sendCertificateRequest
(
v_si
.
signerInfo
.
digest
,
p_CamPayload
);
if
(
tc_ac
.
running
){
if
(
tc_ac
.
running
)
{
tc_ac
.
stop
;
tc_ac
.
start
;
}
repeat
;
...
...
@@ -2513,37 +2518,39 @@ module LibItsGeoNetworking_Functions {
}
}
}
[]
a_securedMessageWithCertificateChain
(
v_recv
){
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
)){
[]
a_securedMessageWithCertificateChain
(
v_recv
)
{
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
))
{
p_chain
:=
v_si
.
signerInfo
.
certificates
;
v_ret
:=
true
;
}
}
}
}
// End of 'alt' statement
return
v_ret
;
}
}
// End of function f_askAndWaitForCertificateChain
/**
* @desc Wait for GN message with security containing digest as a signer info
* @return the digest of the certificate been used to sign received message
*/
function
f_waitForDigest
(
out
HashedId8
p_digest
)
runs
on
ItsGeoNetworking
return
boolean
{
function
f_waitForDigest
(
out
HashedId8
p_digest
)
runs
on
ItsGeoNetworking
return
boolean
{
// Local variables
var
SecuredMessage
v_recv
;
var
boolean
v_ret
:=
false
;
alt
{
[]
a_securedMessageWithDigest
(
v_recv
){
[]
a_securedMessageWithDigest
(
v_recv
)
{
var
SignerInfo
v_si
;
if
(
f_getMsgSignerInfo
(
v_recv
,
v_si
))
{
p_digest
:=
v_si
.
signerInfo
.
digest
;
v_ret
:=
true
;
}
}
}
}
// End of 'alt' statement
return
v_ret
;
}
}
// End of function f_waitForDigest
}
// End of group waitingHelpers
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment