Remove some params in checkList 61/52561/4
authorKyungwook Tak <k.tak@samsung.com>
Tue, 24 Nov 2015 08:09:00 +0000 (17:09 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Wed, 25 Nov 2015 01:28:25 +0000 (10:28 +0900)
 * checkList checks reference only in list in UriList param
   and it should not check all files in content path.
   So checkReference flag and contentPath isn't needed.

Change-Id: I9e1d15d31fbc63bd0f78e99b6436c719d84e2609
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
vcore/vcore/SignatureValidator.cpp
vcore/vcore/SignatureValidator.h

index ec3a1f2..16b862c 100644 (file)
@@ -91,10 +91,8 @@ public:
                SignatureData &outData);
 
        VCerr checkList(
-               const std::string &contentPath,
-               const UriList &uriList,
                bool checkOcsp,
-               bool checkReferences,
+               const UriList &uriList,
                SignatureData &outData);
 
        VCerr makeChainBySignature(
@@ -110,10 +108,8 @@ private:
                bool checkReferences);
 
        VCerr baseCheckList(
-               const std::string &contentPath,
-               const UriList &uriList,
                bool checkOcsp,
-               bool checkReferences);
+               const UriList &uriList);
 
        VCerr makeDataBySignature(bool completeWithSystemCert);
        VCerr additionalCheck(VCerr result);
@@ -396,10 +392,8 @@ VCerr SignatureValidator::Impl::baseCheck(
 }
 
 VCerr SignatureValidator::Impl::baseCheckList(
-       const std::string &contentPath,
-       const UriList &uriList,
        bool checkOcsp,
-       bool checkReferences)
+       const UriList &uriList)
 {
        try {
                VCerr result = preStep();
@@ -412,20 +406,10 @@ VCerr SignatureValidator::Impl::baseCheckList(
                        XmlSecSingleton::Instance().validatePartialHash(m_context, uriList);
 
                m_data.setReference(m_context.referenceSet);
-               /*
                if (!checkObjectReferences()) {
                        LogWarning("Failed to check Object References");
                        return E_SIG_INVALID_REF;
                }
-               */
-
-               if (checkReferences) {
-                       ReferenceValidator fileValidator(contentPath);
-                       if (ReferenceValidator::NO_ERROR != fileValidator.checkReferences(m_data)) {
-                               LogWarning("Invalid package - file references broken");
-                               return E_SIG_INVALID_REF;
-                       }
-               }
 
                if (checkOcsp && Ocsp::check(m_data) == Ocsp::Result::REVOKED) {
                        LogError("Certificate is Revoked by OCSP server.");
@@ -484,15 +468,13 @@ VCerr SignatureValidator::Impl::check(
 }
 
 VCerr SignatureValidator::Impl::checkList(
-       const std::string &contentPath,
-       const UriList &uriList,
        bool checkOcsp,
-       bool checkReferences,
+       const UriList &uriList,
        SignatureData &outData)
 {
        VCerr result;
 
-       result = baseCheckList(contentPath, uriList, checkOcsp, checkReferences);
+       result = baseCheckList(checkOcsp, uriList);
        result = additionalCheck(result);
 
        outData = m_data;
@@ -536,8 +518,7 @@ std::string SignatureValidator::Impl::errorToString(VCerr code)
 
 SignatureValidator::SignatureValidator(const SignatureFileInfo &info)
 {
-       std::unique_ptr<SignatureValidator::Impl> impl(new(std::nothrow) SignatureValidator::Impl(info))
-;
+       std::unique_ptr<SignatureValidator::Impl> impl(new(std::nothrow) SignatureValidator::Impl(info));
        m_pImpl = std::move(impl);
 }
 SignatureValidator::~SignatureValidator() {}
@@ -567,20 +548,16 @@ VCerr SignatureValidator::check(
 }
 
 VCerr SignatureValidator::checkList(
-       const std::string &contentPath,
-       const UriList &uriList,
        bool checkOcsp,
-       bool checkReferences,
+       const UriList &uriList,
        SignatureData &outData)
 {
        if (!m_pImpl)
                return E_SIG_OUT_OF_MEM;
 
        return m_pImpl->checkList(
-                       contentPath,
-                       uriList,
                        checkOcsp,
-                       checkReferences,
+                       uriList,
                        outData);
 }
 
index f488ad6..3ab17b7 100644 (file)
@@ -36,6 +36,34 @@ namespace ValidationCore {
 using UriList = std::list<std::string>;
 
 /*
+ *  Types of Reference checking
+ *
+ *  1. XmlSec validate (default)
+ *        - check reference based on Reference tag on signature xml.
+ *        - Get URI from Reference tag, generate digest value and compare it with value written
+ *        - If value with calculated and written isn't same, validate fail returned.
+ *        * What if file doesn't exist which is written on Reference tag?
+ *        * What if Reference tag doesn't exist for existing file? -> cannot checked.
+ *
+ *  2. checkObjectReferences (default on check function, not checkList)
+ *        - check Reference of 'Object' tag.
+ *        - it's mutual-exclusive check with  1. XmlSec validate.
+ *
+ *  3. ReferenceValidator (enabled when flag on)
+ *        - check file based on content path from parameter
+ *        - check is all existing file is on the Reference tag list on signature xml
+ *        - If file path(URI) cannot found on reference set, validate fail returned.
+ *
+ *
+ *  Signature validation disregarded case
+ *
+ *  1. author signature: store id contains TIZEN_DEVELOPER
+ *
+ *  2. distributor signature: signature number is 1
+ *                            and doesn't contain visibility in store id set
+ */
+
+/*
  *  Error code defined on vcore/Error.h
  */
 class SignatureValidator {
@@ -54,10 +82,8 @@ public:
         SignatureData &outData);
 
     VCerr checkList(
-        const std::string &contentPath,
-        const UriList &uriList,
         bool checkOcsp,
-        bool checkReferences,
+        const UriList &uriList,
         SignatureData &outData);
 
     /*