Commit b15a0d0b authored by filatov's avatar filatov
Browse files

Support for reading IUT digests from .dgs files

parent 07a0c245
Loading
Loading
Loading
Loading
+27 −4
Original line number Diff line number Diff line
@@ -496,12 +496,10 @@ module LibItsSecurity_Functions {
                }
                
                // Load certificates
                if (f_readCertificate(p_certificateName, v_atCertificate) == false) {
                    return v_hashedId8;
                if(f_getCertificateDigest(p_certificateName, v_hashedId8) == false) {
                    v_hashedId8 := '0000000000000000'O;
                }
                
                v_hashedId8 := f_calculateDigestFromCertificate(v_atCertificate);
                
                return v_hashedId8;
            } // End of function f_setupIutCertificate
             
@@ -802,6 +800,23 @@ module LibItsSecurity_Functions {
                return false;
            } // End of function f_readCertificate

            /**
            * @desc    Read the specified certificate
            * @param   p_certificateId the certificate identifier
            * @param   p_certificate   the expected certificate
            * @return  true on success, false otherwise
            */
            function f_getCertificateDigest(
                                       in charstring p_certificateId,
                                       out HashedId8 p_digest
            ) runs on ItsSecurityBaseComponent return boolean {
                if( not fx_readCertificateDigest(p_certificateId, p_digest)){
                    log("f_getCertificateDigest: Failed to retrieve digest for ", p_certificateId);
                    return false;
                }
                return true;
            } // End of function f_getCertificateDigest
            
            /**
            * @desc    Read the signing private key for the specified certificate
            * @param   p_keysId            the keys identifier
@@ -948,6 +963,14 @@ module LibItsSecurity_Functions {
            */
            external function fx_readCertificate(in charstring p_certificateId, out octetstring p_certificate) return boolean;

            /**
            * @desc    Read the specified certificate digest
            * @param   p_certificateId the certificate identifier
            * @param   p_digest   the expected certificate
            * @return  true on success, false otherwise
            */
            external function fx_readCertificateDigest(in charstring p_certificateId, out HashedId8 p_digest) return boolean;
            
			/**
			* @desc    Read the private keys for the specified certificate
			* @param   p_keysId            the keys identifier