Commit f2b22201 authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in UDP layer

parent 35eab6d1
......@@ -40,7 +40,8 @@ udp_layer::udp_layer(const std::string & p_type, const std::string & param) : la
loggers::get_instance().error("udp_layer::udp_layer: Failed to create socket");
}
loggers::get_instance().log("udp_layer::udp_layer: socket id: %d", _fd);
if (::setsockopt(_fd, SOL_SOCKET, SO_REUSEADDR, nullptr, 0) < 0) {
int reuse = 1;
if (::setsockopt(_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) < 0) {
loggers::get_instance().warning("udp_layer::udp_layer: Failed to set SO_REUSEADDR");
}
// Bind it
......
......@@ -290,6 +290,7 @@ system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=
#TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaNistp256WithSha256_1
#TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaNistp256WithSha256_2
#TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaNistp256WithSha256_3 # Shall failed on error: Dynamic test case error: security_ecc::security_ecc (2): Failed to get coordinates
TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaNistp256WithSha256_4
#TestCodec_SecuredFuntions.tc_f_signWithEcdsaBrainpoolp256WithSha256_1
#TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaBrainpoolp256WithSha256_1
#TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaBrainpoolp256WithSha256_2
......@@ -346,7 +347,7 @@ system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=
# External functions
#TestCodec_ExternalFunctions.tc_f_computePositionUsingDistance
# Pki
TestCodec_Pki.tc_encode_inner_ec_response_1
#TestCodec_Pki.tc_encode_inner_ec_response_1
#TestCodec_Pki.tc_decode_inner_ec_response_1
#TestCodec_Pki.tc_inner_ec_request_1
#TestCodec_Pki.tc_inner_ec_request_2
......
......@@ -413,6 +413,29 @@ module TestCodec_SecuredFuntions {
setverdict(pass);
} // End of testcase tc_f_verifyWithEcdsaNistp256WithSha256_3
/**
* @desc Check sign/verify signature on raw data
* @remark To check result, use this Web sites: https://www.javacardos.com/tools/ecdsa-sign-verify, https://kjur.github.io/jsrsasign/sample/sample-ecdsa.html
*/
testcase tc_f_verifyWithEcdsaNistp256WithSha256_4() runs on TCType system TCType {
var Oct32 v_private_key := '69674ea17f88ae0e30b04cddb00abc6bf4e65db757752b1e5fe3f8bdbfb60e79'O;
var Oct32 v_publicKeyCompressed := '8a5037fa359ccb0c3437ab1451cedce10cb13a1f82658c1d985fc994d55df340'O;
var integer v_compressedMode := 0;
var octetstring v_message := '616161'O;
var octetstring v_sig := ''O;
log("v_private_key = ", v_private_key);
log("v_public_key compressed= ", v_publicKeyCompressed, " - ", v_compressedMode);
v_sig := fx_test_signWithEcdsaNistp256WithSha256(v_message, v_private_key);
log("Signature: ", v_sig);
if (fx_test_verifyWithEcdsaNistp256WithSha256(v_message, v_sig, v_publicKeyCompressed, v_compressedMode) == true) {
setverdict(pass, "Signature was verified");
} else {
setverdict(fail, "Signature wasn't verified");
}
} // End of testcase tc_f_verifyWithEcdsaNistp256WithSha256_4
testcase tc_f_signWithEcdsaBrainpoolp256WithSha256_1() runs on TCType system TCType {
var Oct32 v_private_key;
var Oct32 v_publicKeyX;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment