Make sure there is enough entropy.
This patch will improve key randomness by requiring the user to move the mouse if there is not enough entropy. (cherry picked from commit c6e98045aa833dff824f892eb3392744c03a59f7)
This commit is contained in:
parent
e646729b2d
commit
d9930978ba
1 changed files with 12 additions and 1 deletions
|
@ -161,7 +161,7 @@ function pasteID() {
|
||||||
function setElementText(element, text) {
|
function setElementText(element, text) {
|
||||||
// For IE<10.
|
// For IE<10.
|
||||||
if ($('div#oldienotice').is(":visible")) {
|
if ($('div#oldienotice').is(":visible")) {
|
||||||
// IE<10 do not support white-space:pre-wrap; so we have to do this BIG UGLY STINKING THING.
|
// IE<10 does not support white-space:pre-wrap; so we have to do this BIG UGLY STINKING THING.
|
||||||
element.text(text.replace(/\n/ig,'{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}'));
|
element.text(text.replace(/\n/ig,'{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}'));
|
||||||
element.html(element.text().replace(/{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}/ig,"\n<br />"));
|
element.html(element.text().replace(/{BIG_UGLY_STINKING_THING__OH_GOD_I_HATE_IE}/ig,"\n<br />"));
|
||||||
}
|
}
|
||||||
|
@ -306,6 +306,7 @@ function send_comment(parentid) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a new paste to server
|
* Send a new paste to server
|
||||||
*/
|
*/
|
||||||
|
@ -314,7 +315,17 @@ function send_data() {
|
||||||
if ($('textarea#message').val().length == 0) {
|
if ($('textarea#message').val().length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If sjcl has not collected enough entropy yet, display a message.
|
||||||
|
if (!sjcl.random.isReady())
|
||||||
|
{
|
||||||
|
showStatus('Sending paste (Please move your mouse for more entropy)...', spin=true);
|
||||||
|
sjcl.random.addEventListener('seeded', function(){ send_data(); });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
showStatus('Sending paste...', spin=true);
|
showStatus('Sending paste...', spin=true);
|
||||||
|
|
||||||
var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
||||||
var cipherdata = zeroCipher(randomkey, $('textarea#message').val());
|
var cipherdata = zeroCipher(randomkey, $('textarea#message').val());
|
||||||
var data_to_send = { data: cipherdata,
|
var data_to_send = { data: cipherdata,
|
||||||
|
|
Loading…
Reference in a new issue