Revert "Add no hash api" 2.1b_release accepted/tizen_2.1/20130425.033118 submit/tizen_2.1/20130424.232900
authorCecilLim <cc1.yim@samsung.com>
Tue, 16 Apr 2013 09:22:45 +0000 (18:22 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 16 Apr 2013 09:22:45 +0000 (18:22 +0900)
This reverts commit 009ee334d238867c7c5cd2aa9220bdea6a0fdd32

vcore/src/vcore/SignatureValidator.cpp
vcore/src/vcore/SignatureValidator.h
vcore/src/vcore/XmlsecAdapter.cpp
vcore/src/vcore/XmlsecAdapter.h

index 270349e..366ea59 100644 (file)
@@ -49,18 +49,12 @@ public:
         SignatureData &data,
         const std::string &widgetContentPath) = 0;
 
-
-       virtual SignatureValidator::Result setPartialHashList(std::list<std::string>& targetUri) = 0;
-       virtual bool setNoHash(bool noHash) = 0;
-
     explicit ImplSignatureValidator(bool ocspEnable,
                   bool crlEnable,
                   bool complianceMode)
       : m_ocspEnable(ocspEnable)
       , m_crlEnable(crlEnable)
       , m_complianceModeEnabled(complianceMode)
-      , m_noHash(false)
-      ,m_partialHash(false)
     {}
 
     virtual ~ImplSignatureValidator(){}
@@ -113,8 +107,6 @@ protected:
     bool m_ocspEnable;
     bool m_crlEnable;
     bool m_complianceModeEnabled;
-       bool m_noHash;  // sign, cert, no hash
-       bool m_partialHash;     //partialHash
 };
 
 class ImplTizenSignatureValidator : public SignatureValidator::ImplSignatureValidator
@@ -123,12 +115,6 @@ class ImplTizenSignatureValidator : public SignatureValidator::ImplSignatureVali
     SignatureValidator::Result check(SignatureData &data,
             const std::string &widgetContentPath);
 
-       bool setNoHash(bool noHash){ 
-               LogDebug("setNoHash : noHash  >>");
-               m_noHash = noHash;      }
-       
-       SignatureValidator::Result setPartialHashList(std::list<std::string>& targetUri);
-
     explicit ImplTizenSignatureValidator(bool ocspEnable,
                        bool crlEnable,
                        bool complianceMode)
@@ -138,23 +124,6 @@ class ImplTizenSignatureValidator : public SignatureValidator::ImplSignatureVali
     virtual ~ImplTizenSignatureValidator() {}
 };
 
-SignatureValidator::Result 
-ImplTizenSignatureValidator::setPartialHashList(std::list<std::string>& targetUri)
-{      
-       LogDebug("setPartialHashList start >>");
-
-       m_partialHash = true;
-       if (XmlSec::NO_ERROR != XmlSecSingleton::Instance().setPartialHashList(targetUri)) {
-               LogWarning("Installation break - setPartialHashList fail!");    
-               LogDebug("setPartialHashList end : fail >>");   
-               return SignatureValidator::SIGNATURE_INVALID;
-       }
-
-       LogDebug("setPartialHashList end : success >>");
-   return SignatureValidator::SIGNATURE_VALID;
-}
-
-
 SignatureValidator::Result ImplTizenSignatureValidator::check(
         SignatureData &data,
         const std::string &widgetContentPath)
@@ -307,24 +276,7 @@ SignatureValidator::Result ImplTizenSignatureValidator::check(
        //context.allowBrokenChain = true;
 
        // end
-       
-       if(m_noHash == true) 
-       {
-               LogDebug("noHash : validateNoHash >>");
-               if (XmlSec::NO_ERROR != XmlSecSingleton::Instance().validateNoHash(&context)) {
-               LogWarning("Installation break - invalid package!");
-                       return SignatureValidator::SIGNATURE_INVALID;
-               }
-       }
-       else if(m_partialHash == true)
-       {
-       LogDebug("partialHash : validatePartialHash >>");
-               if (XmlSec::NO_ERROR != XmlSecSingleton::Instance().validatePartialHash(&context)) {
-               LogWarning("Installation break - invalid package!");
-                       return SignatureValidator::SIGNATURE_INVALID;
-               }
-       }
-    else if (XmlSec::NO_ERROR != XmlSecSingleton::Instance().validate(&context)) {
+    if (XmlSec::NO_ERROR != XmlSecSingleton::Instance().validate(&context)) {
         LogWarning("Installation break - invalid package!");
         return SignatureValidator::SIGNATURE_INVALID;
     }
@@ -382,9 +334,6 @@ class ImplWacSignatureValidator : public SignatureValidator::ImplSignatureValida
   public:
     SignatureValidator::Result check(SignatureData &data,
             const std::string &widgetContentPath);
-       
-       SignatureValidator::Result setPartialHashList(std::list<std::string>& targetUri){}
-       bool setNoHash(bool noHash){}
 
     explicit ImplWacSignatureValidator(bool ocspEnable,
                      bool crlEnable,
@@ -603,16 +552,9 @@ SignatureValidator::SignatureValidator(
     bool complianceMode)
   : m_impl(0)
 {
-       if (appType == TIZEN_NO_HASH || appType == TIZEN) 
-       {
-                       m_impl = new ImplTizenSignatureValidator(ocspEnable,crlEnable,complianceMode);
-                       if(appType == TIZEN_NO_HASH)
-                       {
-                               m_impl->setNoHash(true);
-                               LogDebug( "m_impl->setNoHash(true)");
-                       }
-               }
-      else
+    if (appType == TIZEN)
+        m_impl = new ImplTizenSignatureValidator(ocspEnable,crlEnable,complianceMode);
+    else
         m_impl = new ImplWacSignatureValidator(ocspEnable,crlEnable,complianceMode);
 }
 
@@ -627,11 +569,5 @@ SignatureValidator::Result SignatureValidator::check(
     return m_impl->check(data, widgetContentPath);
 }
 
-
-SignatureValidator::Result SignatureValidator::setPartialHashList(std::list<std::string>& targetUri)
-{
-    return m_impl->setPartialHashList(targetUri);
-}
-
 } // namespace ValidationCore
 
index d977b9f..041366f 100644 (file)
@@ -36,7 +36,6 @@ public:
 
     enum AppType
     {
-           TIZEN_NO_HASH, //no-hash
         TIZEN,
         WAC20
     };
@@ -62,10 +61,6 @@ public:
         SignatureData &data,
         const std::string &widgetContentPath);
 
-
-       Result setPartialHashList(std::list<std::string>& targetUri);
-               
-
 private:
        ImplSignatureValidator *m_impl;
 };
index d5a5ae7..6bc978e 100644 (file)
@@ -36,7 +36,6 @@
 #include <xmlsec/crypto.h>
 #include <xmlsec/io.h>
 #include <xmlsec/keyinfo.h>
-#include <xmlsec/errors.h>
 
 #include <dpl/assert.h>
 #include <dpl/log/log.h>
@@ -92,10 +91,8 @@ int XmlSec::fileReadCallback(void *context,
     int output = xmlFileRead(fw->file, buffer, len);
     if (output == 0) {
         fw->released = true;
-               LogDebug("Xmlsec close: ");
         xmlFileClose(fw->file);
     }
-       LogDebug("Xmlsec reading: ");
     return output;
 }
 
@@ -103,7 +100,6 @@ int XmlSec::fileCloseCallback(void *context)
 {
     FileWrapper *fw = static_cast<FileWrapper*>(context);
     int output = 0;
-       LogDebug("Xmlsec closeing: ");
     if (!(fw->released)) {
         output = xmlFileClose(fw->file);
     }
@@ -127,21 +123,6 @@ void XmlSec::fileExtractPrefix(XmlSecContext *context)
     }
 }
 
-void   LogDebugPrint(const char* file, 
-                                                                int line, 
-                                                                const char* func,
-                                                                const char* errorObject,
-                                                                const char* errorSubject,
-                                                                int reason, 
-                                                                const char* msg)
-{      
-//     std::string strTemp = msg;      
-       //LogDebug("func: " << (char*)func);
-       //LogDebug("reason: " << reason);       
-       LogDebug("msg: " << msg);
-}
-
-
 XmlSec::XmlSec() :
     m_initialized(false)
 {
@@ -230,7 +211,6 @@ XmlSec::Result XmlSec::validateFile(XmlSecContext *context,
     xmlSecDSigCtxPtr dsigCtx = NULL;
     int size, res = -1;
 
-   LogDebug("XmlSec::validateFile: start >> ");
     fileExtractPrefix(context);
     LogDebug("Prefix path: " << s_prefixPath);
 
@@ -331,7 +311,6 @@ XmlSec::Result XmlSec::validateFile(XmlSecContext *context,
     }
 
 done:
-       xmlSecDSigSetNoHash(0); //set gNoHash(default : 0)
     /*   cleanup */
     if (dsigCtx != NULL) {
         xmlSecDSigCtxDestroy(dsigCtx);
@@ -388,9 +367,6 @@ void XmlSec::loadPEMCertificateFile(XmlSecContext *context,
 
 XmlSec::Result XmlSec::validate(XmlSecContext *context)
 {
-       LogDebug("XmlSec::validate: start >> ");
-
-       xmlSecErrorsSetCallback(LogDebugPrint);
     Assert(context);
     Assert(!(context->signatureFile.empty()));
     Assert(context->certificatePtr.Get() || !(context->certificatePath.empty()));
@@ -423,75 +399,4 @@ XmlSec::Result XmlSec::validate(XmlSecContext *context)
 
     return validateFile(context, mngr.get());
 }
-
-XmlSec::Result XmlSec::validateNoHash(XmlSecContext *context)
-{
-       LogDebug("XmlSec::validateNoHash start >>");
-
-       xmlSecDSigSetNoHash(1);
-    return validate(context);
-}
-
-XmlSec::Result XmlSec::validatePartialHash(XmlSecContext *context)
-{
-       LogDebug("XmlSec::validatePartialHash start >>");
-
-    return validate(context);
-}
-
-
-XmlSec::Result XmlSec::setPartialHashList(std::list<std::string>& targetUri)
-{
-       char *uri;
-       int len;
-       std::string tmpString;
-       HashUriList* pTmp =(HashUriList*)malloc(sizeof(HashUriList));
-       std::list<std::string>::const_iterator iter = targetUri.begin();
-       char* strange = NULL;
-
-       LogDebug("XmlSec::setPartialHashList start >>");
-       xmlSecErrorsSetCallback(LogDebugPrint);
-       
-       for (iter; iter != targetUri.end(); ++iter)
-       {                               
-               //tmpString.append(*iter);
-               tmpString = (*iter);
-               uri = (char*)tmpString.c_str();
-               len = tmpString.size();
-                       
-               LogDebug("setPartialHashList: uri :" << uri);
-               LogDebug("setPartialHashList: len :" << len);
-
-       
-               strange = strstr(uri, "/i");
-               if( strange != NULL)
-               {
-                       LogDebug("setPartialHashList: r-strange :" << strange);
-                       uri = strange+1;
-                       LogDebug("setPartialHashList: r-uri :" << uri);
-                       len = strlen(uri);
-               }
-                       
-               pTmp->uri = (char*)malloc(len+1);
-               memcpy(pTmp->uri, uri, len);
-               pTmp->uri[len] = '\0';          
-
-               LogDebug("setPartialHashList: " << pTmp->uri);
-
-               pTmp->pNext = (HashUriList*)malloc(sizeof(HashUriList));        
-               pTmp = pTmp->pNext;
-       
-       }
-
-       pTmp->pNext = NULL;
-
-       xmlSecDSigSetPartialHash(pTmp);
-       
-       LogDebug("XmlSec::setPartialHashList end >>");
-
-       return NO_ERROR;
-}
-
-
-
 } // namespace ValidationCore
index 07ec90e..4f36636 100644 (file)
@@ -105,11 +105,6 @@ class XmlSec : public DPL::Noncopyable
      * Context - input/output param.
      */
     Result validate(XmlSecContext *context);
-
-        Result validateNoHash(XmlSecContext *context);
-        Result validatePartialHash(XmlSecContext *context);
-        Result setPartialHashList(std::list<std::string>& targetUri);
-        
   protected:
     XmlSec();
     ~XmlSec();