Newer
Older
/**
* @author ETSI / STF481
* @version $URL$
* $Id$
* @desc Module containing functions for Security Protocol
*
*/
module LibItsSecurity_Functions {
// LibCommon
import from LibCommon_BasicTypesAndValues {
type
UInt64
}
import from LibCommon_DataStrings {
type
Oct32
}
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import from LibItsSecurity_TestSystem all;
group configurationFunctions {
/**
* @desc
*/
function f_cf01Up() runs on ItsGnSecurity {
// Map
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
map(self:gnSecurityPort, system:gnSecurityPort);
// Connect
f_connect4SelfOrClientSync();
activate(a_cf01Down());
// Initialze the IUT/DUT
f_initialState();
} // End of function f_cf01Up
function f_cf01Down() runs on ItsGnSecurity {
// Unmap
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
unmap(self:gnSecurityPort, system:gnSecurityPort);
// Disconnect
f_disconnect4SelfOrClientSync();
} // End of function f_cf01Down
} // End of group configurationFunctions
group preambles {
/**
* @desc Brings the IUT into an initial state.
*/
function f_initialState() runs on ItsBaseGnSecurity {
// TODO
}
} // End of group preambles
group postambles {
} // End of group postambles
group securityAltsteps {
/**
* @desc The base default behavior.
*/
altstep a_default() runs on ItsGnSecurity {
[] gnSecurityPort.receive(mw_gnSecurityInd(?)) {
log("*** a_default: WARNING: Received an unexpected message ***");
repeat;
}
[] gnSecurityPort.receive {
log("*** a_default: WARNING: Received an unexpected message ***");
repeat;
}
[] tc_wait.timeout {
log("*** a_default: ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[] tc_ac.timeout {
log("*** a_default: ERROR: Timeout while awaiting the reception of a message ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[] a_shutdown() {
log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
} // End of 'altstep' statement
altstep a_cf01Down() runs on ItsGnSecurity {
[] a_shutdown() {
f_cf01Down();
log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
} // End of 'altstep' statement
} // End of group securityAltsteps
group helpersFunctions {
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/**
* @desc Produces a 256-bit (32-byte) hash value
* @param TODO
* @return TODO
*/
function f_hashWithSha256(in octetstring p_toBeHashedData) {
}
/**
* @desc Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signaturee
* @param TODO
* @return TODO
*/
function f_signWithEcdsaNistp256WithSha256() {
}
/**
* @desc Verify the signature of the specified data
* @param TODO
* @return true on success, false otherwise
*/
function f_verifyWithEcdsaNistp256WithSha256() return boolean {
return false;
}
/**
* @desc Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm
* @param TODO
* @return true on success, false otherwise
*/
function f_generateKeyPair() return boolean {
return false;
}
} // End of group helpersFunctions
group externalFunctions {
/**
* @desc Produces a 256-bit (32-byte) hash value
* @param p_toBeHashedData Data to be used to calculate the hash value
* @return The hash value
*/
external function fx_hashWithSha256(in octetstring p_toBeHashedData) return Oct32;
/**
* @desc Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signaturee
* @param p_toBeSignedData The data to be signed
* @param p_privateKey The private key
* @return The signature value
*/
external function fx_signWithEcdsaNistp256WithSha256(in octetstring p_toBeSignedData, in UInt64 p_privateKey) return octetstring;
/**
* @desc Verify the signature of the specified data
* @param p_toBeVerifiedData The data to be verified
* @param p_signature The signature
* @param p_ecdsaNistp256PublicKeyX The public key (x coordinate)
* @param p_ecdsaNistp256PublicKeyY The public key (y coordinate)
* @return true on success, false otherwise
*/
external function fx_verifyWithEcdsaNistp256WithSha256(in octetstring p_toBeVerifiedData, in octetstring p_signature, in Oct32 p_ecdsaNistp256PublicKeyX, in Oct32 p_ecdsaNistp256PublicKeyY) return boolean;
/**
* @desc Produce a new public/private key pair based on Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm
* @param p_privateKey The new private key value
* @param p_publicKeyX The new public key value (x coordinate)
* @param p_publicKeyX The new public key value (y coordinate)
* @return true on success, false otherwise
*/
external function fx_generateKeyPair(out UInt64 p_privateKey, out UInt64 p_publicKeyX, out UInt64 p_publicKeyY) return boolean;
} // End of group externalFunctions