and ended up using the following code, where p is an object of options, and where sjcl.codec.bytes is a codec that needs to be configured in the source (./configure --help, then enable the codec, then make and you get your sjcl.js).
function encrypt(password,plaintext) {
var prp = new sjcl.cipher[p.cipher](sjcl.codec.bytes.toBits(new Uint8Array(password)));
var ct = sjcl.mode[p.mode].encrypt(prp, sjcl.codec.bytes.toBits(new Uint8Array(plaintext)), p.iv, p.adata, p.ts);
return (new Uint8Array(sjcl.codec.bytes.fromBits(ct))).buffer;
}
function decrypt(password,ciphertext){
var prp = new sjcl.cipher[p.cipher](sjcl.codec.bytes.toBits(new Uint8Array(password)));
pt = sjcl.mode[p.mode].decrypt(prp, sjcl.codec.bytes.toBits(new Uint8Array(ciphertext)), p.iv, p.adata, p.ts);
return(new Uint8Array(sjcl.codec.bytes.fromBits(pt))).buffer;
}
Vincenzo