/[Apache-SVN]/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGAlgorithmHandlerDefault.cpp
ViewVC logotype

Diff of /santuario/xml-security-cpp/trunk/xsec/dsig/DSIGAlgorithmHandlerDefault.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1125752 by scantor, Sat May 21 17:50:17 2011 UTC revision 1493960 by scantor, Mon Jun 17 22:27:28 2013 UTC
# Line 60  bool compareBase64StringToRaw(const char Line 60  bool compareBase64StringToRaw(const char
60          // Compare at most maxCompare bits (if maxCompare > 0)          // Compare at most maxCompare bits (if maxCompare > 0)
61          // Note - whilst the other parameters are bytes, maxCompare is bits          // Note - whilst the other parameters are bytes, maxCompare is bits
62    
63            // The div function below takes signed int, so make sure the value
64            // is safe to cast.
65            if ((int) maxCompare < 0) {
66    
67                    throw XSECException(XSECException::CryptoProviderError,
68                                    "Comparison length was unsafe");
69    
70            }
71    
72          unsigned char outputStr[MAXB64BUFSIZE];          unsigned char outputStr[MAXB64BUFSIZE];
73          unsigned int outputLen = 0;          unsigned int outputLen = 0;
74                    
# Line 126  bool compareBase64StringToRaw(const char Line 135  bool compareBase64StringToRaw(const char
135    
136          char mask = 0x01;          char mask = 0x01;
137          if (maxCompare != 0) {          if (maxCompare != 0) {
138              for (j = 0 ; j < (unsigned int) d.rem; ++i) {              for (j = 0 ; j < (unsigned int) d.rem; ++j) {
139    
140                      if ((raw[i] & mask) != (outputStr[i] & mask))                      if ((raw[i] & mask) != (outputStr[i] & mask))
141                              return false;                              return false;
# Line 516  unsigned int DSIGAlgorithmHandlerDefault Line 525  unsigned int DSIGAlgorithmHandlerDefault
525                  // Signature already created, so just translate to base 64 and enter string                  // Signature already created, so just translate to base 64 and enter string
526    
527          // FIX: CVE-2009-0217          // FIX: CVE-2009-0217
528          if (outputLength > 0 && (outputLength < 80 || outputLength < hashLen / 2)) {          if (outputLength > 0 && (outputLength > hashLen || outputLength < 80 || outputLength < hashLen / 2)) {
529              throw XSECException(XSECException::AlgorithmMapperError,              throw XSECException(XSECException::AlgorithmMapperError,
530                  "HMACOutputLength set to unsafe value.");                  "HMACOutputLength set to unsafe value.");
531          }          }
# Line 641  bool DSIGAlgorithmHandlerDefault::verify Line 650  bool DSIGAlgorithmHandlerDefault::verify
650                  // Already done - just compare calculated value with read value                  // Already done - just compare calculated value with read value
651    
652          // FIX: CVE-2009-0217          // FIX: CVE-2009-0217
653          if (outputLength > 0 && (outputLength < 80 || outputLength < hashLen / 2)) {          if (outputLength > 0 && (outputLength > hashLen || outputLength < 80 || outputLength < hashLen / 2)) {
654              throw XSECException(XSECException::AlgorithmMapperError,              throw XSECException(XSECException::AlgorithmMapperError,
655                  "HMACOutputLength set to unsafe value.");                  "HMACOutputLength set to unsafe value.");
656          }          }

Legend:
Removed from v.1125752  
changed lines
  Added in v.1493960

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26