mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-27 13:28:42 +00:00
688c3af674
- Bug 1235021 - Re-emit ChromeManifestEntries from the jar manifest handler code in the FasterMake backend. r=gps (a8d899a6da)
- Bug 1233282 - Make CONFIGURE_DEFINE_FILES considered more as GENERATED_FILES in the emitter. r=gps (d29506fb55)
- Bug 1235021 - Add a RenamedSourcePath helper class. r=gps (62e78b867b)
- Bug 1235021 - Re-emit FinalTarget{,Preprocessed}Files from the jar manifest handler code in the FasterMake backend. r=gps (c37287a5d7)
- Bug 1235021 - Avoid passing defines to FasterMakeBackend._consume_jar_manifest. r=gps (dc0d17c3a6)
- Bug 1235021 - Move FasterMakeBackend._consume_jar_manifest to CommonBackend. r=gps (b9bb6b7d1e)
- Bug 1239217 - Add the notion of Partial and Hybrid build backends. r=gps Make the FasterMake backend a partial build backend. (219c0811e6)
- Bug 1239217 - Stop making the FasterMake build system refresh the backend on its own. r=gps (4f79f966ce)
- Bug 1241398 - Show the diff for created and deleted files in `mach build-backend --diff`. r=gps (d497d3aef8)
- Bug 1214885 - Add a "ChromeUrl" build backend to write out information useful for resolving chrome urls. r=glandium (83ad13d109)
- Bug 1216817 - Part 1: Add install_callback to artifacts. r=gps (95b4860d09)
- Bug 1216817 - Part 2: Narrow distdir to bindir in artifacts. r=gps (e48b531455)
- Bug 1216817 - Part 4: Add --enable-artifact-builds and MOZ_ARTIFACT_BUILDS. r=glandium (8d7ed76621)
- bug 1164816 - Import concurrent.futures into the tree. r=gps (bc83211833)
- bug 1190603 - import PyECC library r=gps,gerv (e0c5afeee0)
- Bug 1216817 - Part 5: Run |mach artifact install| automatically when asked. r=glandium (835c27d9c2)
- Bug 1216817 - Follow-up: Fix "KeyError: uMOZ_ARTIFACT_BUILDS" in config.status. r=bustage (e87e04e23b)
- Bug 1216817 - Follow-up: Fix "KeyError: u'MOZ_ARTIFACT_BUILDS'". r=bustage (797331293b)
- Bug 1207897 - Add a configure option to build multiple build backends. r=gps (35f62c27ca)
- Bug 1241398 - Allow to pass the --verbose flag down to config.status from `mach build-backend`. r=gps (78610c40d0)
- Bug 1236111 - part 1: avoid configure.in Windows-only goop when running with disable-compile-environment, r=gps (d27a7e522a)
- Bug 1236111 - part 2: fix mozbuild to use the file mode modifiers specified for opening when writing a FileAvoidWrite, r=gps,nalexander (e240c613b7)
- Bug 1207890 - Part 1: Add rich ArtifactJob extension point. r=glandium (e402f5fcec)
- Bug 1207890 - Part 2: Stop extracting build ID from artifacts. r=glandium (314d6895c1)
- Bug 1207890 - Part 3: Post-process downloaded artifacts. r=glandium (09d60ac030)
- Bug 1207890 - Part 4: Download and process Mac OS X artifacts. r=glandium (181ba370b1)
- Bug 1207890 - Pre: Make JarWriter handle inputs with read() but not seek(). r=glandium (6ebb5dfe94)
- Bug 1207890 - Post: Hacks to make --disable-compile-environment work on Mac OS X. r=glandium (c5f88b6adf)
- Bug 1207890 - Post: Move |mach artifact| command out of mobile/android. r=glandium (a06f97dfb9)
- Bug 1207890 - Post: Hack to make |mach run| for Mac OS X artifact builds. r=me (4c6d2f6bfe)
- Bug 1207890 - Follow-up: Fix |mach artifact install| for mobile/android. r=me (a2e4347ca9)
- Bug 1236111 - part 3: ensure calls to hg and mach work on Windows, and that we use the right file mode when writing artifacts, r=nalexander,gps (d0090a5a56)
- Bug 1236111 - part 4: actually add Windows support to artifact code, r=nalexander,gps (ab40057ffa)
- Bug 1236111 - part 0: improve logging from process mixin, r=gps (d85265c134)
- Bug 1241398 - Add a dry-run mode to mach build-backend. r=gps (b300169915)
- Bug 1239217 - Make the RecursiveMake build system create backend files generically. r=gps (fba90d6bcb)
- fix minor misspatch of 1240990 (b7d44692bc)
- Bug 1239296 - Use telemetry_handler to store build resource data r=gps (58d7c3a260)
- Bug 1244143 - Record whether or not an artifact build was used in build telemetry data r=gps (d1821d1987)
- Bug 1246264 - Ensure cache directory exists for artifacts installation r=chmanchester (ef5c4a0fba)
- bug 1237619: save resource usage for "what" builds r=gps (6a311c71bc)
- Bug 1239296 - Add telemetry_handler function to mach context r=gps (4a7a67740d)
- Bug 1246402 - Environment variable to disable mercurial setup check. r=gps (d9cf129b6c)
- Bug 1239296 - add post_dispatch_handler hook to mach r=gps (aa55c9a36e)
- Bug 1236110 - Extend mach artifact to handle Linux Desktop builds. r=gps (cb29ca6d1d)
- Bug 1234912 - Check for mozext and pushlog entries after |mach artifact install| hg failure. r=gps (7bfb064c7c)
- Bug 1239096 - Improve English is artifacts.py comments. r=me (38aa5ecb19)
- Bug 1238320 - Part 1 (Linux): Download test binaries necessary to run xpcshell tests and mochitests in artifact builds. r=nalexander (f6407791ae)
- Bug 1238320 - Part 2 (Mac): Download test binaries necessary to run xpcshell tests and mochitests in artifact builds. r=nalexander (4d72cfc6f2)
- Bug 1238320 - Part 3 (Windows): Download test binaries necessary to run xpcshell tests and mochitests in artifact builds. r=nalexander# Please enter the commit message for your changes. Lines starting (40ac9f9f7d)
- Bug 1239678 - fix dll inclusion pattern on Windows and the placement of nested dlls like browsercomps and clearkey, r=nalexander (ad9015c9d9)
- Bug 1239738 - Handle artifact builds with no test binaries cleanly. r=ahunt (ba1593837a)
- Bug 1240323 - Fix installation of binary components in a subdir of dist/bin for linux artifact builds. r=nalexander (2f4b719ea3)
- Bug 1240239 - Install test plugins in artifact based builds. r=nalexander (edc24f4fd2)
- Bug 1240667 - Detect a tree to use for artifact builds based on recent changesets. r=nalexander (947879cb19)
- Bug 1244941 - Don't fill install manifest with artifacts. r=nalexander (8fa9793c53)
- Bug 1237619: Record build objects in resource_usage.json r=gps (c323d21c9f)
- bug 1237619: Add system and command metadata to resouce_usage.json r=gps (c93fb18c37)
- Bug 1240059 - Treat psutil as optional in record_resource_usage. r=gps (c91103ebce)
- Bug 1244160 - Create json-schema for build telemetry data r=gps (d8b3419cfd)
- Bug 1250624 - Overall system resources is displayed twice; r=chmanchester (a115c86902)
- Bug 1144842 (part 1) - Don't use MOZ_PROFILING before all the places it can be set. r=glandium. (3c12a2e29a)
- Bug 1144842 (part 2) - Make --enable-dmd imply --enable-profiling. r=glandium. (85c9ff5c32)
- Bug 1144842 (part 3) - Remove --enable-dmd code from js/src/configure.in. r=glandium. (52cf663bc7)
- Bug 1204260 - Pre: Don't expose ANDROID_{BUILD,PLATFORM}_TOOLS. r=glandium,gbrown (d4f560dd46)
- Bug 1219803 - Support 'mach run' for Android; r=jmaher (5a1a1ab16e)
- Bug 1219807 - Add tooltool manifests for jimdb; r=jmaher (4d7a211569)
- Bug 1221846 - Get Task Tracer building on desktop r=cyu. (5d1a0fabe9)
- Bug 1216681 - Add a fileid utility to extract the breakpad GUID from object files for identification in fix_stack_using_bpsyms. r=ted (e53eb5acc6)
- Bug 1237156 - Only build the fileid utility when MOZ_CRASHREPORTER is set. r=ted.mielczarek (328a80ae18)
- Bug 1239866 - Remove signaling standalone tests. r=bwc (b05b091059)
154 lines
4.3 KiB
Python
154 lines
4.3 KiB
Python
#
|
|
# Elliptic Curve Digital Signature Algorithm (ECDSA)
|
|
#
|
|
# COPYRIGHT (c) 2010 by Toni Mattis <solaris@live.de>
|
|
#
|
|
|
|
from elliptic import inv, mulf, mulp, muladdp, element
|
|
from curves import get_curve, implemented_keys
|
|
from os import urandom
|
|
|
|
import hashlib
|
|
|
|
def randkey(bits, n):
|
|
'''Generate a random number (mod n) having the specified bit length'''
|
|
rb = urandom(bits / 8 + 8) # + 64 bits as recommended in FIPS 186-3
|
|
c = 0
|
|
for r in rb:
|
|
c = (c << 8) | ord(r)
|
|
return (c % (n - 1)) + 1
|
|
|
|
def keypair(bits):
|
|
'''Generate a new keypair (qk, dk) with dk = private and qk = public key'''
|
|
try:
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
except KeyError:
|
|
raise ValueError, "Key size %s not implemented" % bits
|
|
if n > 0:
|
|
d = randkey(bits, n)
|
|
q = mulp(cp, cq, cn, g, d)
|
|
return (bits, q), (bits, d)
|
|
else:
|
|
raise ValueError, "Key size %s not suitable for signing" % bits
|
|
|
|
def supported_keys():
|
|
'''Return a list of all key sizes implemented for signing'''
|
|
return implemented_keys(True)
|
|
|
|
def validate_public_key(qk):
|
|
'''Check whether public key qk is valid'''
|
|
bits, q = qk
|
|
x, y = q
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
return q and 0 < x < cn and 0 < y < cn and \
|
|
element(q, cp, cq, cn) and (mulp(cp, cq, cn, q, n) == None)
|
|
|
|
def validate_private_key(dk):
|
|
'''Check whether private key dk is valid'''
|
|
bits, d = dk
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
return 0 < d < cn
|
|
|
|
def match_keys(qk, dk):
|
|
'''Check whether dk is the private key belonging to qk'''
|
|
bits, d = dk
|
|
bitz, q = qk
|
|
if bits == bitz:
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
return mulp(cp, cq, cn, g, d) == q
|
|
else:
|
|
return False
|
|
|
|
def truncate(h, hmax):
|
|
'''Truncate a hash to the bit size of hmax'''
|
|
while h > hmax:
|
|
h >>= 1
|
|
return h
|
|
|
|
def sign(h, dk):
|
|
'''Sign the numeric value h using private key dk'''
|
|
bits, d = dk
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
h = truncate(h, cn)
|
|
r = s = 0
|
|
while r == 0 or s == 0:
|
|
k = randkey(bits, cn)
|
|
kinv = inv(k, n)
|
|
kg = mulp(cp, cq, cn, g, k)
|
|
r = kg[0] % n
|
|
if r == 0:
|
|
continue
|
|
s = (kinv * (h + r * d)) % n
|
|
return r, s
|
|
|
|
def verify(h, sig, qk):
|
|
'''Verify that 'sig' is a valid signature of h using public key qk'''
|
|
bits, q = qk
|
|
try:
|
|
bits, cn, n, cp, cq, g = get_curve(bits)
|
|
except KeyError:
|
|
return False
|
|
h = truncate(h, cn)
|
|
r, s = sig
|
|
if 0 < r < n and 0 < s < n:
|
|
w = inv(s, n)
|
|
u1 = (h * w) % n
|
|
u2 = (r * w) % n
|
|
x, y = muladdp(cp, cq, cn, g, u1, q, u2)
|
|
return r % n == x % n
|
|
return False
|
|
|
|
def hash_sign(s, dk, hashfunc = 'sha256'):
|
|
h = int(hashlib.new(hashfunc, s).hexdigest(), 16)
|
|
return (hashfunc,) + sign(h, dk)
|
|
|
|
def hash_verify(s, sig, qk):
|
|
h = int(hashlib.new(sig[0], s).hexdigest(), 16)
|
|
return verify(h, sig[1:], qk)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
import time
|
|
|
|
testh1 = 0x0123456789ABCDEF
|
|
testh2 = 0x0123456789ABCDEE
|
|
|
|
for k in supported_keys():
|
|
qk, dk = keypair(k)
|
|
s1 = sign(testh1, dk)
|
|
s2 = sign(testh1, (dk[0], dk[1] ^ 1))
|
|
s3 = (s1[0], s1[1] ^ 1)
|
|
qk2 = (qk[0], (qk[1][0] ^ 1, qk[1][1]))
|
|
|
|
assert verify(testh1, s1, qk) # everything ok -> must succeed
|
|
assert not verify(testh2, s1, qk) # modified hash -> must fail
|
|
assert not verify(testh1, s2, qk) # different priv. key -> must fail
|
|
assert not verify(testh1, s3, qk) # modified signature -> must fail
|
|
assert not verify(testh1, s1, qk2) # different publ. key -> must fail
|
|
|
|
|
|
def test_perf(bits, rounds = 50):
|
|
'''-> (key generations, signatures, verifications) / second'''
|
|
h = 0x0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
|
|
d = get_curve(bits)
|
|
|
|
t = time.time()
|
|
for i in xrange(rounds):
|
|
qk, dk = keypair(bits)
|
|
tgen = time.time() - t
|
|
|
|
t = time.time()
|
|
for i in xrange(rounds):
|
|
s = sign(0, dk)
|
|
tsign = time.time() - t
|
|
|
|
t = time.time()
|
|
for i in xrange(rounds):
|
|
verify(0, s, qk)
|
|
tver = time.time() - t
|
|
|
|
return rounds / tgen, rounds / tsign, rounds / tver
|
|
|
|
|