') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); ecdsa: make SignPrimitive's ephemeral scalar generic by tarcieri · Pull Request #107 · RustCrypto/signatures · GitHub
Skip to content

ecdsa: make SignPrimitive's ephemeral scalar generic - #107

Merged
tarcieri merged 1 commit into
masterfrom
ecdsa/generic-ephemeral-scalar
Jul 28, 2020
Merged

ecdsa: make SignPrimitive's ephemeral scalar generic#107
tarcieri merged 1 commit into
masterfrom
ecdsa/generic-ephemeral-scalar

Conversation

@tarcieri

Copy link
Copy Markdown
Member

...and remove masking_scalar.

This API allows the inversion masking process to be handled outside of the ECDSA implementation itself (potentially generically in a way that can work across elliptic curves).

...and remove masking scalar.
This API allows the inversion masking process to be handled outside of
the ECDSA implementation itself (potentially generically in a way that
can work across elliptic curves).
@tarcieri
tarcieri requested a review from nickrayJuly 28, 2020 17:05
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #107 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@## master #107 +/- ##
=======================================
Coverage 53.59% 53.59% =======================================
Files 3 3 Lines 181 181 =======================================
Hits 97 97 Misses 84 84 

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12b96e3...98e2563. Read the comment docs.

@tarcieri
tarcieri merged commit 58eccf8 into masterJul 28, 2020
@tarcieri
tarcieri deleted the ecdsa/generic-ephemeral-scalar branch July 28, 2020 17:47
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jul 28, 2020
Updates both crates with the `SignPrimitive` changes from
RustCrypto/signatures#107.
These changes removed the `masking_scalar` from the trait, and replaced
it with trait bounds that make it possible to substitute a blinded
scalar.
In the `p256` crate (which is the only one that presently implements a
variable-time inversion) the `masking_scalar` is replaced with a
`BlindedScalar` type that implements the previous blinded inversion.
The implementation it uses (including `Scalar::invert_vartime`) could
potentially be made generic and extracted into the `elliptic-curve`
crate, allowing it to be used with any curve which implements the
arithmetic primitives used in the blinded inversion implementation.
However, for now, this PR leaves it in `p256`, and therefore at least
has feature parity with the old implementation.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jul 28, 2020
Updates both crates with the `SignPrimitive` changes from
RustCrypto/signatures#107.
These changes removed the `masking_scalar` from the trait, and replaced
it with trait bounds that make it possible to substitute a blinded
scalar.
In the `p256` crate (which is the only one that presently implements a
variable-time inversion) the `masking_scalar` is replaced with a
`BlindedScalar` type that implements the previous blinded inversion.
The implementation it uses (including `Scalar::invert_vartime`) could
potentially be made generic and extracted into the `elliptic-curve`
crate, allowing it to be used with any curve which implements the
arithmetic primitives used in the blinded inversion implementation.
However, for now, this PR leaves it in `p256`, and therefore at least
has feature parity with the old implementation.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jul 28, 2020
Updates both crates with the `SignPrimitive` changes from
RustCrypto/signatures#107.
These changes removed the `masking_scalar` from the trait, and replaced
it with trait bounds that make it possible to substitute a blinded
scalar.
In the `p256` crate (which is the only one that presently implements a
variable-time inversion) the `masking_scalar` is replaced with a
`BlindedScalar` type that implements the previous blinded inversion.
The implementation it uses (including `Scalar::invert_vartime`) could
potentially be made generic and extracted into the `elliptic-curve`
crate, allowing it to be used with any curve which implements the
arithmetic primitives used in the blinded inversion implementation.
However, for now, this PR leaves it in `p256`, and therefore at least
has feature parity with the old implementation.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Jul 28, 2020
Updates both crates with the `SignPrimitive` changes from
RustCrypto/signatures#107.
These changes removed the `masking_scalar` from the trait, and replaced
it with trait bounds that make it possible to substitute a blinded
scalar.
In the `p256` crate (which is the only one that presently implements a
variable-time inversion) the `masking_scalar` is replaced with a
`BlindedScalar` type that implements the previous blinded inversion.
The implementation it uses (including `Scalar::invert_vartime`) could
potentially be made generic and extracted into the `elliptic-curve`
crate, allowing it to be used with any curve which implements the
arithmetic primitives used in the blinded inversion implementation.
However, for now, this PR leaves it in `p256`, and therefore at least
has feature parity with the old implementation.
@tarcieritarcieri mentioned this pull request Aug 11, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@tarcieri@codecov-commenter