Commit bf58ff73 authored by garciay's avatar garciay
Browse files

Bug fixed in f_calculateDigestFromCertificate()

Update certificate descriptions in ItsSecurityBaseComponent component
parent 94ec8cbc
Loading
Loading
Loading
Loading
+11 −12
Original line number Original line Diff line number Diff line
@@ -96,7 +96,7 @@ module LibItsSecurity_Functions {
        /**
        /**
        * @desc    Calculate digest over the certificate
        * @desc    Calculate digest over the certificate
        * @param   p_cert The certificate
        * @param   p_cert The certificate
        * @return  the digest
        * @return  the HashedId8 value
        * @see Draft ETSI TS 103 097 V1.1.13 Clause 4.2.13   HashedId8
        * @see Draft ETSI TS 103 097 V1.1.13 Clause 4.2.13   HashedId8
        */
        */
        function f_calculateDigestFromCertificate(
        function f_calculateDigestFromCertificate(
@@ -105,22 +105,21 @@ module LibItsSecurity_Functions {
            var octetstring v_toBeHashedData;
            var octetstring v_toBeHashedData;
            var octetstring v_hash;
            var octetstring v_hash;
                        
                        
            // Search for digest in the signer_infos field first
            for (var integer v_counter := 0; v_counter < lengthof(p_cert.signer_infos); v_counter := v_counter + 1) {
                if (p_cert.signer_infos[v_counter].type_ == e_certificate_digest_with_sha256) {
                    return p_cert.signer_infos[v_counter].signerInfo.digest;
                }
            } // End of 'for' statement
            
            // Digest not found, compute it
            log ("f_calculateDigestFromCertificate: Not found in certificate, compute it");
            v_toBeHashedData := bit2oct(encvalue(p_cert));
            v_toBeHashedData := bit2oct(encvalue(p_cert));
            v_hash := f_hashWithSha256(v_toBeHashedData);
            v_hash := f_hashWithSha256(v_toBeHashedData);
            return substr(v_hash, lengthof(v_hash) - 8, 8);
            return substr(v_hash, lengthof(v_hash) - 8, 8);
        }
        } // End of function f_calculateDigestFromCertificate
        
        
        group hostSignatureHelpers {
        group hostSignatureHelpers {
            
            
            /**
            * @desc    Initialize [out] certificates according to the specified certificate name
            * @param   p_certificateName The certificate name to be used
            * @param   p_aaCertificate The AA certificate [out]
            * @param   p_atCertificate The AT certificate [out]
            * @return  true on succes, false otherwise
            * @see Draft ETSI TS 103 097 V1.1.13 Clause 4.2.13   HashedId8
            */
            function f_prepareCertificates(
            function f_prepareCertificates(
                                           in template (omit) charstring p_certificateName,
                                           in template (omit) charstring p_certificateName,
                                           out Certificate p_aaCertificate,
                                           out Certificate p_aaCertificate,
+5 −5
Original line number Original line Diff line number Diff line
@@ -33,11 +33,11 @@ module LibItsSecurity_TestSystem {
            var ThreeDLocation vc_location; 
            var ThreeDLocation vc_location; 
            
            
            // Test Adapter certificates & private keys
            // Test Adapter certificates & private keys
            const charstring cc_taCertA := "TA_CERT_A"; /** Default certificate to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertA := "TA_CERT_A"; /** Default certificate, without region validity restriction, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertB := "TA_CERT_B"; /** Certificate with a circular region to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertB := "TA_CERT_B"; /** Certificate with a circular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertC := "TA_CERT_C"; /** Certificate with a rectangular region to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertC := "TA_CERT_C"; /** Certificate with a rectangular region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertD := "TA_CERT_D"; /** Certificate with a polygonal region to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertD := "TA_CERT_D"; /** Certificate with a polygonal region, to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertE := "TA_CERT_E"; /** Certificate with a region identifier to be used when secured messages are sent from TA to IUT */
            const charstring cc_taCertE := "TA_CERT_E"; /** Certificate with a region identifier, to be used when secured messages are sent from TA to IUT */
            
            
        } // End of ItsSecurityBaseComponent
        } // End of ItsSecurityBaseComponent