Posted to tcl by steveb at Wed Sep 16 15:44:17 GMT 2020view pretty

if (objc > 3) {
        Tcl_WrongNumArgs(interp, 2, objv, "source ?password?");
        return TCL_ERROR;}

bufcrypt=Tcl_GetByteArrayFromObj(objv[1],&length);
if(objc == 3) altkey = Tcl_GetByteArrayFromObj(objv[2],NULL);
else altkey = key;
num = 0;
BF_set_key(&sch,16,altkey);
BF_cfb64_encrypt(bufcrypt,bufcrypt,(long)length,&sch,ivec,&num,BF_DECRYPT);
resultPtr=Tcl_GetObjResult(interp);
Tcl_SetByteArrayObj(resultPtr,bufcrypt,length);
return TCL_OK;

Comments

Posted by steveb at Wed Sep 16 15:48:39 GMT 2020 [text] [code]

Here are the bones of the Tcl interface and calls of the actual encrytion routines.