1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

Issue #2889 - Follow-up: Allow generate_hash_secret_salt to be used.

Part 1 erroneously imported the 3rd patch from Mozilla assuming that we're also
already generating our salt with XML_SetHashSalt in our nsExpatDriver. Turns out
this is not the case.
This commit is contained in:
Job Bautista
2026-01-12 07:53:34 +08:00
committed by roytam1
parent ca2ef5184a
commit acefed74fe
3 changed files with 3 additions and 48 deletions
-41
View File
@@ -1,41 +0,0 @@
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
--- a/lib/xmlparse.c
+++ b/lib/xmlparse.c
@@ -608,7 +608,9 @@
static XML_Char *copyString(const XML_Char *s, XML_Parser parser);
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
static unsigned long generate_hash_secret_salt(XML_Parser parser);
+#endif
static XML_Bool startParsing(XML_Parser parser);
static XML_Parser parserCreate(const XML_Char *encodingName,
@@ -1043,6 +1045,7 @@
ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
'\0'};
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* To avoid warnings about unused functions: */
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
@@ -1250,6 +1253,7 @@
}
#endif
}
+#endif /* MOZILLA_CLIENT */
static unsigned long
get_hash_secret_salt(XML_Parser parser) {
@@ -1326,9 +1330,11 @@
static XML_Bool /* only valid for root parser */
startParsing(XML_Parser parser) {
+#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* hash functions must be initialized before setContext() is called */
if (parser->m_hash_secret_salt == 0)
parser->m_hash_secret_salt = generate_hash_secret_salt(parser);
+#endif
if (parser->m_ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it
+1 -1
View File
@@ -11,7 +11,7 @@
Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
Copyright (c) 2016 Cristian Rodr Âguez <crrodriguez@opensuse.org>
Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
+2 -6
View File
@@ -624,9 +624,7 @@ static ELEMENT_TYPE *getElementType(XML_Parser parser, const ENCODING *enc,
static XML_Char *copyString(const XML_Char *s, XML_Parser parser);
#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
static unsigned long generate_hash_secret_salt(XML_Parser parser);
#endif
static XML_Bool startParsing(XML_Parser parser);
static XML_Parser parserCreate(const XML_Char *encodingName,
@@ -1071,7 +1069,6 @@ static const XML_Char implicitContext[]
ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e,
'\0'};
#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* To avoid warnings about unused functions: */
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
@@ -1230,10 +1227,12 @@ gather_time_entropy(void) {
static unsigned long
ENTROPY_DEBUG(const char *label, unsigned long entropy) {
#ifndef MOZILLA_CLIENT /* don't report debug information */
if (getDebugLevel("EXPAT_ENTROPY_DEBUG", 0) >= 1u) {
fprintf(stderr, "expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n", label,
(int)sizeof(entropy) * 2, entropy, (unsigned long)sizeof(entropy));
}
#endif
return entropy;
}
@@ -1279,7 +1278,6 @@ generate_hash_secret_salt(XML_Parser parser) {
}
#endif
}
#endif /* MOZILLA_CLIENT */
static unsigned long
get_hash_secret_salt(XML_Parser parser) {
@@ -1356,11 +1354,9 @@ callProcessor(XML_Parser parser, const char *start, const char *end,
static XML_Bool /* only valid for root parser */
startParsing(XML_Parser parser) {
#ifndef MOZILLA_CLIENT /* we already set a salt through XML_SetHashSalt */
/* hash functions must be initialized before setContext() is called */
if (parser->m_hash_secret_salt == 0)
parser->m_hash_secret_salt = generate_hash_secret_salt(parser);
#endif
if (parser->m_ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it