Example #1
0
/* en/decryption on one block only */
unsigned long _TwoFish_CryptRaw16(const char *in,char *out,unsigned long len,int decrypt,TWOFISH *tfdata)
{  /* qBlockPlain already zero'ed through ResetCBC  */
  memcpy(tfdata->qBlockPlain,in,len);          /* toss the data into it. */
  _TwoFish_BlockCrypt16(tfdata->qBlockPlain,tfdata->qBlockCrypt,decrypt,tfdata); /* encrypt just that block without CBC. */
  memcpy(out,tfdata->qBlockCrypt,TwoFish_BLOCK_SIZE);        /* and return what we got */
  return TwoFish_BLOCK_SIZE;
}
Example #2
0
/* en/decryption on one block only */
uint32_t _TwoFish_CryptRaw16(uint8_t *in, uint8_t *out, uint32_t len, bool decrypt, TWOFISH *tfdata)
{
  /* qBlockPlain already zero'ed through ResetCBC  */
  memcpy(tfdata->qBlockPlain, in, len);       /* toss the data into it. */
  _TwoFish_BlockCrypt16(tfdata->qBlockPlain, tfdata->qBlockCrypt, decrypt, tfdata); /* encrypt just that block without CBC. */
  memcpy(out, tfdata->qBlockCrypt, TwoFish_BLOCK_SIZE);     /* and return what we got */
  return TwoFish_BLOCK_SIZE;
}