Switches to asmcrypto-lite for AES

This commit is contained in:
Mahrud Sayrafi 2018-01-30 05:15:03 -08:00 committed by Sanjana Rajan
parent be2c605e5b
commit aba8a7a647
5 changed files with 14 additions and 1125 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
'use strict'; 'use strict';
import aes from'./aes.js'; import aes from './aes.js';
import desModule from './des.js'; import desModule from './des.js';
import cast5 from './cast5.js'; import cast5 from './cast5.js';
import twofish from './twofish.js'; import twofish from './twofish.js';
@ -16,9 +16,9 @@ import blowfish from './blowfish.js';
export default { export default {
/** @see module:crypto/cipher/aes */ /** @see module:crypto/cipher/aes */
aes128: aes[128], aes128: aes(128),
aes192: aes[192], aes192: aes(192),
aes256: aes[256], aes256: aes(256),
/** @see module:crypto/cipher/des.originalDes */ /** @see module:crypto/cipher/des.originalDes */
des: desModule.originalDes, des: desModule.originalDes,
/** @see module:crypto/cipher/des.des */ /** @see module:crypto/cipher/des.des */
@ -33,4 +33,4 @@ export default {
idea: function() { idea: function() {
throw new Error('IDEA symmetric-key algorithm not implemented'); throw new Error('IDEA symmetric-key algorithm not implemented');
} }
}; };

View File

@ -55,6 +55,7 @@ if(nodeCrypto) { // Use Node native crypto for all hash functions
sha256: asmCrypto.SHA256.bytes, sha256: asmCrypto.SHA256.bytes,
/** @see module:crypto/hash/sha.sha384 */ /** @see module:crypto/hash/sha.sha384 */
sha384: sha.sha384, sha384: sha.sha384,
// TODO: compare sha512 in asmcrypto.js and jsSHA
/** @see module:crypto/hash/sha.sha512 */ /** @see module:crypto/hash/sha.sha512 */
sha512: sha.sha512, sha512: sha.sha512,
/** @see module:crypto/hash/ripe-md */ /** @see module:crypto/hash/ripe-md */

View File

@ -1594,7 +1594,6 @@ export default {
sha384: function(str) { sha384: function(str) {
var shaObj = new jsSHA(str, "TYPED", "UTF8"); var shaObj = new jsSHA(str, "TYPED", "UTF8");
return shaObj.getHash("SHA-384", "TYPED"); return shaObj.getHash("SHA-384", "TYPED");
}, },
/** SHA512 hash */ /** SHA512 hash */
sha512: function(str) { sha512: function(str) {

View File

@ -270,6 +270,7 @@ describe('X25519 Cryptography', function () {
var msg = openpgp.cleartext.readArmored(signed.data); var msg = openpgp.cleartext.readArmored(signed.data);
// Verifying signed message // Verifying signed message
return Promise.all([ return Promise.all([
// FIXME this test sporadically fails
openpgp.verify( openpgp.verify(
{ message: msg, publicKeys: hi.toPublic() } { message: msg, publicKeys: hi.toPublic() }
).then(output => expect(output.signatures[0].valid).to.be.true), ).then(output => expect(output.signatures[0].valid).to.be.true),