diff --git a/README.md b/README.md index d096f92ad5..aaff26f2d5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ directory. This will contain relevant documentation regarding contributing, using and distributing this code and its binaries. If you are interested in the development and building side of things, some -information will be available on the [Pale Moon developer wiki](http://developer.palemoon.org). +information will be available on the [Pale Moon developer site](http://developer.palemoon.org). +You are also always welcome to get in touch with our community on the [Pale Moon forum](https://forum.palemoon.org/). ### A note about trademarks and branding diff --git a/application/basilisk/base/content/browser.js b/application/basilisk/base/content/browser.js index f806c5cb5f..ceca570a3b 100644 --- a/application/basilisk/base/content/browser.js +++ b/application/basilisk/base/content/browser.js @@ -2463,9 +2463,9 @@ function losslessDecodeURI(aURI) { } // Encode invisible characters (C0/C1 control characters, U+007F [DEL], - // U+00A0 [no-break space], line and paragraph separator, - // object replacement character) (bug 452979, bug 909264) - value = value.replace(/[\u0000-\u001f\u007f-\u00a0\u2028\u2029\ufffc]/g, + // U+00A0 [no-break space], line and paragraph separator, braille space + // object replacement character) (bug 452979, bug 909264, bug 1629506) + value = value.replace(/[\u0000-\u001f\u007f-\u00a0\u2028\u2029\u2800\ufffc]/g, encodeURIComponent); // Encode default ignorable characters (bug 546013) diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js index d25faabbf9..99b2c11532 100644 --- a/application/palemoon/base/content/browser.js +++ b/application/palemoon/base/content/browser.js @@ -2298,9 +2298,9 @@ function losslessDecodeURI(aURI) { } // Encode invisible characters (C0/C1 control characters, U+007F [DEL], - // U+00A0 [no-break space], line and paragraph separator, + // U+00A0 [no-break space], line and paragraph separator, braille space, // object replacement character) (bug 452979, bug 909264) - value = value.replace(/[\u0000-\u001f\u007f-\u00a0\u2028\u2029\ufffc]/g, + value = value.replace(/[\u0000-\u001f\u007f-\u00a0\u2028\u2029\u2800\ufffc]/g, encodeURIComponent); // Encode default ignorable characters (bug 546013) diff --git a/application/palemoon/config/version.txt b/application/palemoon/config/version.txt index b46e6eba85..7da4fc57ea 100644 --- a/application/palemoon/config/version.txt +++ b/application/palemoon/config/version.txt @@ -1 +1 @@ -28.9.4a1 \ No newline at end of file +28.10.1a1 \ No newline at end of file diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index c248b3a24c..229162d8a9 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -5,6 +5,8 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/EMEUtils.h" + +#include "jsfriendapi.h" // for AutoCheckCannotGC #include "mozilla/dom/UnionTypes.h" namespace mozilla { @@ -23,6 +25,7 @@ ArrayData GetArrayBufferViewOrArrayBufferData(const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView) { MOZ_ASSERT(aBufferOrView.IsArrayBuffer() || aBufferOrView.IsArrayBufferView()); + JS::AutoCheckCannotGC nogc; if (aBufferOrView.IsArrayBuffer()) { const dom::ArrayBuffer& buffer = aBufferOrView.GetAsArrayBuffer(); buffer.ComputeLengthAndData(); @@ -39,6 +42,7 @@ void CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView, nsTArray& aOutData) { + JS::AutoCheckCannotGC nogc; ArrayData data = GetArrayBufferViewOrArrayBufferData(aBufferOrView); aOutData.Clear(); if (!data.IsValid()) { @@ -47,6 +51,14 @@ CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBufferViewOrArrayBuffer& aB aOutData.AppendElements(data.mData, data.mLength); } +void CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBuffer& aBuffer, + nsTArray& aOutData) { + JS::AutoCheckCannotGC nogc; + aBuffer.ComputeLengthAndData(); + aOutData.Clear(); + aOutData.AppendElements(aBuffer.Data(), aBuffer.Length()); +} + bool IsClearkeyKeySystem(const nsAString& aKeySystem) { diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index 1794f8462b..1fa9f7590b 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -11,6 +11,7 @@ #include "mozilla/Logging.h" #include "nsString.h" #include "nsTArray.h" +#include "mozilla/dom/TypedArray.h" namespace mozilla { @@ -45,6 +46,10 @@ void CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBufferViewOrArrayBuffer& aBufferOrView, nsTArray& aOutData); +// Overload for ArrayBuffer +void CopyArrayBufferViewOrArrayBufferData(const dom::ArrayBuffer& aBufferOrView, + nsTArray& aOutData); + struct ArrayData { explicit ArrayData(const uint8_t* aData, size_t aLength) : mData(aData) diff --git a/dom/media/eme/MediaEncryptedEvent.cpp b/dom/media/eme/MediaEncryptedEvent.cpp index 8e2595fcb9..fe1c8a3bc2 100644 --- a/dom/media/eme/MediaEncryptedEvent.cpp +++ b/dom/media/eme/MediaEncryptedEvent.cpp @@ -87,10 +87,10 @@ MediaEncryptedEvent::Constructor(const GlobalObject& aGlobal, e->mInitDataType = aEventInitDict.mInitDataType; if (!aEventInitDict.mInitData.IsNull()) { const auto& a = aEventInitDict.mInitData.Value(); - a.ComputeLengthAndData(); - e->mInitData = ArrayBuffer::Create(aGlobal.Context(), - a.Length(), - a.Data()); + nsTArray initData; + CopyArrayBufferViewOrArrayBufferData(a, initData); + e->mInitData = ArrayBuffer::Create(aGlobal.Context(), initData.Length(), + initData.Elements()); if (!e->mInitData) { aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return nullptr; diff --git a/dom/media/eme/MediaKeyMessageEvent.cpp b/dom/media/eme/MediaKeyMessageEvent.cpp index 37c509e674..289d0c16e3 100644 --- a/dom/media/eme/MediaKeyMessageEvent.cpp +++ b/dom/media/eme/MediaKeyMessageEvent.cpp @@ -85,10 +85,11 @@ MediaKeyMessageEvent::Constructor(const GlobalObject& aGlobal, RefPtr e = new MediaKeyMessageEvent(owner); bool trusted = e->Init(owner); e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable); - aEventInitDict.mMessage.ComputeLengthAndData(); + nsTArray initData; + CopyArrayBufferViewOrArrayBufferData(aEventInitDict.mMessage, initData); e->mMessage = ArrayBuffer::Create(aGlobal.Context(), - aEventInitDict.mMessage.Length(), - aEventInitDict.mMessage.Data()); + initData.Length(), + initData.Elements()); if (!e->mMessage) { aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return nullptr; diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index 5684dea2de..5ebbc0feae 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -9,6 +9,7 @@ #include "ImageContainer.h" #include "DecoderDoctorDiagnostics.h" +#include "ImageContainer.h" #include "MediaDecoderReader.h" #include "MediaInfo.h" #include "mozilla/MozPromise.h" diff --git a/js/public/Class.h b/js/public/Class.h index f4fa9ccafb..3d73bce441 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -779,7 +779,7 @@ struct JSClass { // application. #define JSCLASS_GLOBAL_APPLICATION_SLOTS 5 #define JSCLASS_GLOBAL_SLOT_COUNT \ - (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 45) + (JSCLASS_GLOBAL_APPLICATION_SLOTS + JSProto_LIMIT * 2 + 46) #define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \ (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n))) #define JSCLASS_GLOBAL_FLAGS \ diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index cb3945152a..d75a3c33a0 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1029,13 +1029,17 @@ JS_ResolveStandardClass(JSContext* cx, HandleObject obj, HandleId id, bool* reso /* Check whether we're resolving 'undefined', and define it if so. */ JSAtom* idAtom = JSID_TO_ATOM(id); - JSAtom* undefinedAtom = cx->names().undefined; - if (idAtom == undefinedAtom) { + if (idAtom == cx->names().undefined) { *resolved = true; return DefineProperty(cx, global, id, UndefinedHandleValue, nullptr, nullptr, JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_RESOLVING); } + // Resolve a "globalThis" self-referential property if necessary. + if (idAtom == cx->names().globalThis) { + return GlobalObject::maybeResolveGlobalThis(cx, global, resolved); + } + /* Try for class constructors/prototypes named by well-known atoms. */ stdnm = LookupStdName(cx->names(), idAtom, standard_class_names); @@ -1088,6 +1092,7 @@ JS_MayResolveStandardClass(const JSAtomState& names, jsid id, JSObject* maybeObj // better, we need a JSContext here; it's fine as it is.) return atom == names.undefined || + atom == names.globalThis || LookupStdName(names, atom, standard_class_names) || LookupStdName(names, atom, builtin_property_names); } diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h index 420ee75353..b4a2de6f30 100644 --- a/js/src/vm/CommonPropertyNames.h +++ b/js/src/vm/CommonPropertyNames.h @@ -160,6 +160,7 @@ macro(getPropertyDescriptor, getPropertyDescriptor, "getPropertyDescriptor") \ macro(getPrototypeOf, getPrototypeOf, "getPrototypeOf") \ macro(global, global, "global") \ + macro(globalThis, globalThis, "globalThis") \ macro(Handle, Handle, "Handle") \ macro(has, has, "has") \ macro(hasOwn, hasOwn, "hasOwn") \ diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index a8d401af43..f6a53eef49 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -296,6 +296,32 @@ GlobalObject::initBuiltinConstructor(JSContext* cx, Handle global return true; } +// Resolve a "globalThis" self-referential property if necessary, +// per a stage-3 proposal. https://github.com/tc39/ecma262/pull/702 +// +// We could also do this in |FinishObjectClassInit| to trim the global +// resolve hook. Unfortunately, |ToWindowProxyIfWindow| doesn't work then: +// the browser's |nsGlobalWindow::SetNewDocument| invokes Object init +// *before* it sets the global's WindowProxy using |js::SetWindowProxy|. +// +// Refactoring global object creation code to support this approach is a +// challenge for another day. +/* static */ bool +GlobalObject::maybeResolveGlobalThis(JSContext* cx, Handle global, bool* resolved) +{ + if (global->getSlot(GLOBAL_THIS_RESOLVED).isUndefined()) { + RootedValue v(cx, ObjectValue(*ToWindowProxyIfWindow(global))); + if (!DefineProperty(cx, global, cx->names().globalThis, v, nullptr, nullptr, JSPROP_RESOLVING)) { + return false; + } + + *resolved = true; + global->setSlot(GLOBAL_THIS_RESOLVED, BooleanValue(true)); + } + + return true; +} + GlobalObject* GlobalObject::createInternal(JSContext* cx, const Class* clasp) { @@ -419,6 +445,12 @@ GlobalObject::initStandardClasses(JSContext* cx, Handle global) return false; } + // Resolve a "globalThis" self-referential property if necessary. + bool resolved; + if (!GlobalObject::maybeResolveGlobalThis(cx, global, &resolved)) { + return false; + } + for (size_t k = 0; k < JSProto_LIMIT; ++k) { if (!ensureConstructor(cx, global, static_cast(k))) return false; diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index 3fd2762f84..720f63e698 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -121,6 +121,7 @@ class GlobalObject : public NativeObject FOR_OF_PIC_CHAIN, MODULE_RESOLVE_HOOK, WINDOW_PROXY, + GLOBAL_THIS_RESOLVED, /* Total reserved-slot count for global objects. */ RESERVED_SLOTS @@ -171,6 +172,8 @@ class GlobalObject : public NativeObject static bool initBuiltinConstructor(JSContext* cx, Handle global, JSProtoKey key, HandleObject ctor, HandleObject proto); + static bool maybeResolveGlobalThis(JSContext* cx, Handle global, bool* resolved); + void setConstructor(JSProtoKey key, const Value& v) { MOZ_ASSERT(key <= JSProto_LIMIT); setSlot(APPLICATION_SLOTS + key, v); diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index f444757e8f..326468c07e 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -658,8 +658,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat // Get the border values WritingMode outerWM = aReflowInput.GetWritingMode(); - const LogicalMargin border(outerWM, - aReflowInput.mStyleBorder->GetComputedBorder()); + const LogicalMargin border(outerWM, aDelegatingFrame->GetUsedBorder()); + LogicalMargin margin = kidReflowInput.ComputedLogicalMargin().ConvertTo(outerWM, wm); diff --git a/layout/reftests/table-bordercollapse/bug1379306-ref.html b/layout/reftests/table-bordercollapse/bug1379306-ref.html new file mode 100644 index 0000000000..76c8ef813e --- /dev/null +++ b/layout/reftests/table-bordercollapse/bug1379306-ref.html @@ -0,0 +1,31 @@ + +Table Cell Testcase, bug 1379306 + +

Table Cell Testcase, bug 1379306

+ +
+ + + + +
+
+
+
\ No newline at end of file diff --git a/layout/reftests/table-bordercollapse/bug1379306.html b/layout/reftests/table-bordercollapse/bug1379306.html new file mode 100644 index 0000000000..2d7f4bce42 --- /dev/null +++ b/layout/reftests/table-bordercollapse/bug1379306.html @@ -0,0 +1,30 @@ + +Table Cell Testcase, bug 1379306 + +

Table Cell Testcase, bug 1379306

+ + + + + +
+
+
\ No newline at end of file diff --git a/layout/reftests/table-bordercollapse/reftest.list b/layout/reftests/table-bordercollapse/reftest.list index 2610d202d8..2cd93397e8 100644 --- a/layout/reftests/table-bordercollapse/reftest.list +++ b/layout/reftests/table-bordercollapse/reftest.list @@ -3,6 +3,7 @@ == bug1375518-3.html bug1375518-ref.html == bug1375518-4.html bug1375518-4-ref.html == bug1375518-5.html bug1375518-5-ref.html +== bug1379306.html bug1379306-ref.html == bug1394226.html bug1394226-ref.html != bug1394226.html bug1394226-notref.html == bc_dyn_cell1.html bc_dyn_cell1_ref.html diff --git a/layout/reftests/table-html/bug1379306-2-ref.html b/layout/reftests/table-html/bug1379306-2-ref.html new file mode 100644 index 0000000000..a02d92bb26 --- /dev/null +++ b/layout/reftests/table-html/bug1379306-2-ref.html @@ -0,0 +1,21 @@ + +Table Row Testcase, bug 1379306 + +

Table Row Testcase, bug 1379306

+ + + + + +
+
+
\ No newline at end of file diff --git a/layout/reftests/table-html/bug1379306-2.html b/layout/reftests/table-html/bug1379306-2.html new file mode 100644 index 0000000000..f04d0219f7 --- /dev/null +++ b/layout/reftests/table-html/bug1379306-2.html @@ -0,0 +1,21 @@ + +Testcase, bug 1379306 + +

Table Row Testcase, bug 1379306

+ + + + + +
+
+
\ No newline at end of file diff --git a/layout/reftests/table-html/bug1379306-3-ref.html b/layout/reftests/table-html/bug1379306-3-ref.html new file mode 100644 index 0000000000..ffb70b46e9 --- /dev/null +++ b/layout/reftests/table-html/bug1379306-3-ref.html @@ -0,0 +1,23 @@ + +Testcase, bug 1379306 + +

Table Row Group Testcase, bug 1379306

+ + + + + + + +
+
+
\ No newline at end of file diff --git a/layout/reftests/table-html/bug1379306-3.html b/layout/reftests/table-html/bug1379306-3.html new file mode 100644 index 0000000000..3192902efe --- /dev/null +++ b/layout/reftests/table-html/bug1379306-3.html @@ -0,0 +1,23 @@ + +Testcase, bug 1379306 + +

Table Row Group Testcase, bug 1379306

+ + + + + + + +
+
+
\ No newline at end of file diff --git a/layout/reftests/table-html/reftest.list b/layout/reftests/table-html/reftest.list index 362a96096d..c3a4010ca4 100644 --- a/layout/reftests/table-html/reftest.list +++ b/layout/reftests/table-html/reftest.list @@ -1,2 +1,4 @@ == cell-align-stopped-at-table-1-standards.html cell-align-stopped-at-table-1-standards-ref.html == cell-align-stopped-at-table-1-quirks.html cell-align-stopped-at-table-1-quirks-ref.html +== bug1379306-2.html bug1379306-2-ref.html +== bug1379306-3.html bug1379306-3-ref.html diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index 4b5a19bfdc..8b097fe3d1 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -360,10 +360,6 @@ void *_mmap(void *addr, size_t length, int prot, int flags, #endif #endif -#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN) -#define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */ -#endif - #ifndef __DECONST #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #endif @@ -1945,33 +1941,12 @@ pages_unmap(void *addr, size_t size) } } #else -#ifdef JEMALLOC_USES_MAP_ALIGN -static void * -pages_map_align(size_t size, size_t alignment) -{ - void *ret; - - /* - * We don't use MAP_FIXED here, because it can cause the *replacement* - * of existing mappings, and we only want to create new mappings. - */ - ret = mmap((void *)alignment, size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0); - assert(ret != NULL); - - if (ret == MAP_FAILED) - ret = NULL; - else - MozTagAnonymousMemory(ret, size, "jemalloc"); - return (ret); -} -#endif static void * pages_map(void *addr, size_t size) { void *ret; -#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || (defined(__sun) && defined(__x86_64__)) /* * The JS engine assumes that all allocated pointers have their high 17 bits clear, * which ia64's mmap doesn't support directly. However, we can emulate it by passing @@ -1992,7 +1967,7 @@ pages_map(void *addr, size_t size) } #endif -#if defined(__sparc__) && defined(__arch64__) && defined(__linux__) +#if defined(__sparc__) && defined(__arch64__) && defined(__linux__) || (defined(__sun) && defined(__x86_64__)) const uintptr_t start = 0x0000070000000000ULL; const uintptr_t end = 0x0000800000000000ULL; @@ -2026,7 +2001,7 @@ pages_map(void *addr, size_t size) if (ret == MAP_FAILED) { ret = NULL; } -#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || (defined(__sun) && defined(__x86_64__)) /* * If the allocated memory doesn't have its upper 17 bits clear, consider it * as out of memory. @@ -2059,7 +2034,7 @@ pages_map(void *addr, size_t size) MozTagAnonymousMemory(ret, size, "jemalloc"); } -#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) +#if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || (defined(__sun) && defined(__x86_64__)) assert(ret == NULL || (!check_placement && ret != NULL) || (check_placement && ret == addr)); #else @@ -2310,9 +2285,6 @@ chunk_alloc_mmap_slow(size_t size, size_t alignment) static void * chunk_alloc_mmap(size_t size, size_t alignment) { -#ifdef JEMALLOC_USES_MAP_ALIGN - return pages_map_align(size, alignment); -#else void *ret; size_t offset; @@ -2340,7 +2312,6 @@ chunk_alloc_mmap(size_t size, size_t alignment) assert(ret != NULL); return (ret); -#endif } bool @@ -5346,15 +5317,6 @@ MALLOC_OUT: recycled_size = 0; -#ifdef JEMALLOC_USES_MAP_ALIGN - /* - * When using MAP_ALIGN, the alignment parameter must be a power of two - * multiple of the system pagesize, or mmap will fail. - */ - assert((chunksize % pagesize) == 0); - assert((1 << (ffs(chunksize / pagesize) - 1)) == (chunksize/pagesize)); -#endif - /* Various sanity checks that regard configuration. */ assert(quantum >= sizeof(void *)); assert(quantum <= pagesize); diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep index 5182f75552..590d1bfaee 100644 --- a/security/nss/coreconf/coreconf.dep +++ b/security/nss/coreconf/coreconf.dep @@ -10,3 +10,4 @@ */ #error "Do not include this header file." + diff --git a/security/nss/lib/freebl/dsa.c b/security/nss/lib/freebl/dsa.c index aef353967d..389c9de24f 100644 --- a/security/nss/lib/freebl/dsa.c +++ b/security/nss/lib/freebl/dsa.c @@ -313,13 +313,14 @@ DSA_NewKeyFromSeed(const PQGParams *params, static SECStatus dsa_SignDigest(DSAPrivateKey *key, SECItem *signature, const SECItem *digest, - const unsigned char *kb) + const unsigned char *kbytes) { mp_int p, q, g; /* PQG parameters */ mp_int x, k; /* private key & pseudo-random integer */ mp_int r, s; /* tuple (r, s) is signature) */ mp_int t; /* holding tmp values */ mp_int ar; /* holding blinding values */ + mp_digit fuzz; /* blinding multiplier for q */ mp_err err = MP_OKAY; SECStatus rv = SECSuccess; unsigned int dsa_subprime_len, dsa_signature_len, offset; @@ -373,6 +374,7 @@ dsa_SignDigest(DSAPrivateKey *key, SECItem *signature, const SECItem *digest, CHECK_MPI_OK(mp_init(&s)); CHECK_MPI_OK(mp_init(&t)); CHECK_MPI_OK(mp_init(&ar)); + /* ** Convert stored PQG and private key into MPI integers. */ @@ -380,14 +382,28 @@ dsa_SignDigest(DSAPrivateKey *key, SECItem *signature, const SECItem *digest, SECITEM_TO_MPINT(key->params.subPrime, &q); SECITEM_TO_MPINT(key->params.base, &g); SECITEM_TO_MPINT(key->privateValue, &x); - OCTETS_TO_MPINT(kb, &k, dsa_subprime_len); + OCTETS_TO_MPINT(kbytes, &k, dsa_subprime_len); + + /* k blinding create a single value that has the high bit set in + * the mp_digit*/ + if (RNG_GenerateGlobalRandomBytes(&fuzz, sizeof(mp_digit)) != SECSuccess) { + PORT_SetError(SEC_ERROR_NEED_RANDOM); + rv = SECFailure; + goto cleanup; + } + fuzz |= 1ULL << ((sizeof(mp_digit) * PR_BITS_PER_BYTE - 1)); /* ** FIPS 186-1, Section 5, Step 1 ** ** r = (g**k mod p) mod q */ - CHECK_MPI_OK(mp_exptmod(&g, &k, &p, &r)); /* r = g**k mod p */ - CHECK_MPI_OK(mp_mod(&r, &q, &r)); /* r = r mod q */ + CHECK_MPI_OK(mp_mul_d(&q, fuzz, &t)); /* t = q*fuzz */ + CHECK_MPI_OK(mp_add(&k, &t, &t)); /* t = k+q*fuzz */ + /* length of t is now fixed, bits in k have been blinded */ + CHECK_MPI_OK(mp_exptmod(&g, &t, &p, &r)); /* r = g**t mod p */ + /* r is now g**(k+q*fuzz) == g**k mod p */ + CHECK_MPI_OK(mp_mod(&r, &q, &r)); /* r = r mod q */ + /* ** FIPS 186-1, Section 5, Step 2 ** @@ -411,15 +427,24 @@ dsa_SignDigest(DSAPrivateKey *key, SECItem *signature, const SECItem *digest, /* Using mp_invmod on k directly would leak bits from k. */ CHECK_MPI_OK(mp_mul(&k, &ar, &k)); /* k = k * ar */ CHECK_MPI_OK(mp_mulmod(&k, &t, &q, &k)); /* k = k * t mod q */ - CHECK_MPI_OK(mp_invmod(&k, &q, &k)); /* k = k**-1 mod q */ + /* k is now k*t*ar */ + CHECK_MPI_OK(mp_invmod(&k, &q, &k)); /* k = k**-1 mod q */ + /* k is now (k*t*ar)**-1 */ CHECK_MPI_OK(mp_mulmod(&k, &t, &q, &k)); /* k = k * t mod q */ - SECITEM_TO_MPINT(localDigest, &s); /* s = HASH(M) */ + /* k is now (k*ar)**-1 */ + SECITEM_TO_MPINT(localDigest, &s); /* s = HASH(M) */ /* To avoid leaking secret bits here the addition is blinded. */ - CHECK_MPI_OK(mp_mul(&x, &ar, &x)); /* x = x * ar */ - CHECK_MPI_OK(mp_mulmod(&x, &r, &q, &x)); /* x = x * r mod q */ + CHECK_MPI_OK(mp_mul(&x, &ar, &x)); /* x = x * ar */ + /* x is now x*ar */ + CHECK_MPI_OK(mp_mulmod(&x, &r, &q, &x)); /* x = x * r mod q */ + /* x is now x*r*ar */ CHECK_MPI_OK(mp_mulmod(&s, &ar, &q, &t)); /* t = s * ar mod q */ - CHECK_MPI_OK(mp_add(&t, &x, &s)); /* s = t + x */ - CHECK_MPI_OK(mp_mulmod(&s, &k, &q, &s)); /* s = s * k mod q */ + /* t is now hash(M)*ar */ + CHECK_MPI_OK(mp_add(&t, &x, &s)); /* s = t + x */ + /* s is now (HASH(M)+x*r)*ar */ + CHECK_MPI_OK(mp_mulmod(&s, &k, &q, &s)); /* s = s * k mod q */ + /* s is now (HASH(M)+x*r)*ar*(k*ar)**-1 = (k**-1)*(HASH(M)+x*r) */ + /* ** verify r != 0 and s != 0 ** mentioned as optional in FIPS 186-1. diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h index b8d9da65c4..2701a1ea1a 100644 --- a/security/nss/lib/nss/nss.h +++ b/security/nss/lib/nss/nss.h @@ -22,10 +22,10 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define NSS_VERSION "3.48" _NSS_CUSTOMIZED +#define NSS_VERSION "3.48.2" _NSS_CUSTOMIZED #define NSS_VMAJOR 3 #define NSS_VMINOR 48 -#define NSS_VPATCH 1 +#define NSS_VPATCH 2 #define NSS_VBUILD 0 #define NSS_BETA PR_FALSE diff --git a/security/nss/lib/softoken/softkver.h b/security/nss/lib/softoken/softkver.h index 7238d257f7..a1c8f8c5cd 100644 --- a/security/nss/lib/softoken/softkver.h +++ b/security/nss/lib/softoken/softkver.h @@ -17,10 +17,10 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define SOFTOKEN_VERSION "3.48" SOFTOKEN_ECC_STRING +#define SOFTOKEN_VERSION "3.48.2" SOFTOKEN_ECC_STRING #define SOFTOKEN_VMAJOR 3 #define SOFTOKEN_VMINOR 48 -#define SOFTOKEN_VPATCH 1 +#define SOFTOKEN_VPATCH 2 #define SOFTOKEN_VBUILD 0 #define SOFTOKEN_BETA PR_FALSE diff --git a/security/nss/lib/util/nssutil.h b/security/nss/lib/util/nssutil.h index 4a4dd7a53f..f067465c89 100644 --- a/security/nss/lib/util/nssutil.h +++ b/security/nss/lib/util/nssutil.h @@ -19,10 +19,10 @@ * The format of the version string should be * ".[.[.]][ ]" */ -#define NSSUTIL_VERSION "3.48" +#define NSSUTIL_VERSION "3.48.2" #define NSSUTIL_VMAJOR 3 #define NSSUTIL_VMINOR 48 -#define NSSUTIL_VPATCH 1 +#define NSSUTIL_VPATCH 2 #define NSSUTIL_VBUILD 0 #define NSSUTIL_BETA PR_FALSE diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index a1be1f96e1..f3dec2cb09 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -1168,14 +1168,14 @@ nsDataObj :: GetFileDescriptorInternetShortcutA ( FORMATETC& aFE, STGMEDIUM& aST } // get a valid filename in the following order: 1) from the page title, - // 2) localized string for an untitled page, 3) just use "Untitled.URL" - if (!CreateFilenameFromTextA(title, ".URL", + // 2) localized string for an untitled page, 3) just use "Untitled.url" + if (!CreateFilenameFromTextA(title, ".url", fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) { nsXPIDLString untitled; if (!GetLocalizedString(u"noPageTitle", untitled) || - !CreateFilenameFromTextA(untitled, ".URL", + !CreateFilenameFromTextA(untitled, ".url", fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) { - strcpy(fileGroupDescA->fgd[0].cFileName, "Untitled.URL"); + strcpy(fileGroupDescA->fgd[0].cFileName, "Untitled.url"); } } @@ -1209,14 +1209,14 @@ nsDataObj :: GetFileDescriptorInternetShortcutW ( FORMATETC& aFE, STGMEDIUM& aST } // get a valid filename in the following order: 1) from the page title, - // 2) localized string for an untitled page, 3) just use "Untitled.URL" - if (!CreateFilenameFromTextW(title, L".URL", + // 2) localized string for an untitled page, 3) just use "Untitled.url" + if (!CreateFilenameFromTextW(title, L".url", fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) { nsXPIDLString untitled; if (!GetLocalizedString(u"noPageTitle", untitled) || - !CreateFilenameFromTextW(untitled, L".URL", + !CreateFilenameFromTextW(untitled, L".url", fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) { - wcscpy(fileGroupDescW->fgd[0].cFileName, L"Untitled.URL"); + wcscpy(fileGroupDescW->fgd[0].cFileName, L"Untitled.url"); } }