| 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 |
|
|
| 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; |
| 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 |
} |
} |
| 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 |
} |
} |