Example #1
0
/* en/decryption without reset of CBC and output assignment */
uint32_t _TwoFish_CryptRaw(uint8_t *in, uint8_t *out, uint32_t len, bool decrypt, TWOFISH *tfdata)
{
  if (in != NULL && out != NULL && len > 0 && tfdata != NULL) { /* if we have valid data, then... */
    if (len > TwoFish_BLOCK_SIZE)           /* ...check if we have more than one block. */
      return _TwoFish_CryptRawCBC(in, out, len, decrypt, tfdata); /* if so, use the CBC routines... */
    else
      return _TwoFish_CryptRaw16(in, out, len, decrypt, tfdata); /* ...otherwise just do one block. */
  }
  return 0;
}
Example #2
0
/* en/decryption without reset of CBC and output assignment */
unsigned long _TwoFish_CryptRaw(const char *in,char *out,unsigned long len,int decrypt,TWOFISH *tfdata)
{
  if(in!=NULL && out!=NULL && len>0 && tfdata!=NULL)    /* if we have valid data, then... */
  {  if(len>TwoFish_BLOCK_SIZE)              /* ...check if we have more than one block. */
      return _TwoFish_CryptRawCBC(in,out,len,decrypt,tfdata); /* if so, use the CBC routines... */
    else
      return _TwoFish_CryptRaw16(in,out,len,decrypt,tfdata); /* ...otherwise just do one block. */
  }
  return 0;
}