diff --git a/core/cbc.js b/core/cbc.js index ac588cc..9a98ed8 100644 --- a/core/cbc.js +++ b/core/cbc.js @@ -104,7 +104,6 @@ sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity. throw new sjcl.exception.corrupt("pkcs#5 padding corrupt"); } bo = bi * 0x1010101; - FOOOO = output; if (!w.equal(w.bitSlice([bo,bo,bo,bo], 0, bi*8), w.bitSlice(output, output.length*32 - bi*8, output.length*32))) { throw new sjcl.exception.corrupt("pkcs#5 padding corrupt"); diff --git a/sjcl.js b/sjcl.js index e1f78fd..47c1e2d 100644 --- a/sjcl.js +++ b/sjcl.js @@ -20,7 +20,7 @@ f=[h.partial(8,(d.length?64:0)|e-2<<2|f-1)];f=h.concat(f,c);f[3]|=h.bitLength(b) 0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!i)return{tag:d,data:[]};for(g=0;g>3&15))*0x1010101;c=a.encrypt(f(c,e.concat(b,[g,g,g,g]).slice(d,d+4)));i.splice(d,0,c[0],c[1],c[2],c[3]);return i},decrypt:function(a,b,c,d){if(d&&d.length)throw new sjcl.exception.invalid("cbc can't authenticate data");if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("cbc iv must be 128 bits");if(sjcl.bitArray.bitLength(b)&127||!b.length)throw new sjcl.exception.corrupt("cbc ciphertext must be a positive multiple of the block size"); -var e=sjcl.bitArray,f=e.i,g,h=[];for(d=0;d16)throw new sjcl.exception.corrupt("pkcs#5 padding corrupt");c=g*0x1010101;FOOOO=h;if(!e.equal(e.bitSlice([c,c,c,c],0,g*8),e.bitSlice(h,h.length*32-g*8,h.length*32)))throw new sjcl.exception.corrupt("pkcs#5 padding corrupt");return e.bitSlice(h,0,h.length*32-g*8)}}}; +var e=sjcl.bitArray,f=e.i,g,h=[];for(d=0;d16)throw new sjcl.exception.corrupt("pkcs#5 padding corrupt");c=g*0x1010101;if(!e.equal(e.bitSlice([c,c,c,c],0,g*8),e.bitSlice(h,h.length*32-g*8,h.length*32)))throw new sjcl.exception.corrupt("pkcs#5 padding corrupt");return e.bitSlice(h,0,h.length*32-g*8)}}}; sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(sjcl.bitArray.bitLength(c)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.I,i=sjcl.bitArray,j=i.i,k=[0,0,0,0];c=h(a.encrypt(c));var l,m=[];d=d||[];e=e||64;for(g=0;g+4