Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: third_party/libxslt/libexslt/crypto.c

Issue 1848793005: Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxslt/libexslt/Makefile.in ('k') | third_party/libxslt/libexslt/date.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libexslt/crypto.c
diff --git a/third_party/libxslt/libexslt/crypto.c b/third_party/libxslt/libexslt/crypto.c
index d142bb65fef7273305a8673d95e9a70d9488498e..6aa9dd2540fa1aec58c3cc8b746bb0f07275df37 100644
--- a/third_party/libxslt/libexslt/crypto.c
+++ b/third_party/libxslt/libexslt/crypto.c
@@ -457,7 +457,8 @@ exsltCryptoGcryptRc4Decrypt (xmlXPathParserContextPtr ctxt,
* @ctxt: an XPath parser context
* @nargs: the number of arguments
*
- * Helper function which checks for and returns first string argument and its length
+ * Helper function which checks for and returns first string argument and its
+ * length in bytes.
*/
static int
exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs,
@@ -471,7 +472,7 @@ exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs,
}
*str = xmlXPathPopString (ctxt);
- str_len = xmlUTF8Strlen (*str);
+ str_len = xmlStrlen (*str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
@@ -591,7 +592,7 @@ exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) {
static void
exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
- int key_len = 0, key_size = 0;
+ int key_len = 0;
int str_len = 0, bin_len = 0, hex_len = 0;
xmlChar *key = NULL, *str = NULL, *padkey = NULL;
xmlChar *bin = NULL, *hex = NULL;
@@ -604,7 +605,7 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
tctxt = xsltXPathGetTransformContext(ctxt);
str = xmlXPathPopString (ctxt);
- str_len = xmlUTF8Strlen (str);
+ str_len = xmlStrlen (str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
@@ -613,7 +614,7 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
}
key = xmlXPathPopString (ctxt);
- key_len = xmlUTF8Strlen (key);
+ key_len = xmlStrlen (key);
if (key_len == 0) {
xmlXPathReturnEmptyString (ctxt);
@@ -632,15 +633,14 @@ exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
}
memset(padkey, 0, RC4_KEY_LENGTH + 1);
- key_size = xmlUTF8Strsize (key, key_len);
- if ((key_size > RC4_KEY_LENGTH) || (key_size < 0)) {
+ if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) {
xsltTransformError(tctxt, NULL, tctxt->inst,
"exsltCryptoRc4EncryptFunction: key size too long or key broken\n");
tctxt->state = XSLT_STATE_STOPPED;
xmlXPathReturnEmptyString (ctxt);
goto done;
}
- memcpy (padkey, key, key_size);
+ memcpy (padkey, key, key_len);
/* encrypt it */
bin_len = str_len;
@@ -689,7 +689,7 @@ done:
static void
exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
- int key_len = 0, key_size = 0;
+ int key_len = 0;
int str_len = 0, bin_len = 0, ret_len = 0;
xmlChar *key = NULL, *str = NULL, *padkey = NULL, *bin =
NULL, *ret = NULL;
@@ -702,7 +702,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
tctxt = xsltXPathGetTransformContext(ctxt);
str = xmlXPathPopString (ctxt);
- str_len = xmlUTF8Strlen (str);
+ str_len = xmlStrlen (str);
if (str_len == 0) {
xmlXPathReturnEmptyString (ctxt);
@@ -711,7 +711,7 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
}
key = xmlXPathPopString (ctxt);
- key_len = xmlUTF8Strlen (key);
+ key_len = xmlStrlen (key);
if (key_len == 0) {
xmlXPathReturnEmptyString (ctxt);
@@ -729,15 +729,14 @@ exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) {
goto done;
}
memset(padkey, 0, RC4_KEY_LENGTH + 1);
- key_size = xmlUTF8Strsize (key, key_len);
- if ((key_size > RC4_KEY_LENGTH) || (key_size < 0)) {
+ if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) {
xsltTransformError(tctxt, NULL, tctxt->inst,
"exsltCryptoRc4EncryptFunction: key size too long or key broken\n");
tctxt->state = XSLT_STATE_STOPPED;
xmlXPathReturnEmptyString (ctxt);
goto done;
}
- memcpy (padkey, key, key_size);
+ memcpy (padkey, key, key_len);
/* decode hex to binary */
bin_len = str_len;
« no previous file with comments | « third_party/libxslt/libexslt/Makefile.in ('k') | third_party/libxslt/libexslt/date.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698