Path: blob/master/libs/tomcrypt/src/modes/lrw/lrw_decrypt.c
5972 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/8#include "tomcrypt.h"910/**11@file lrw_decrypt.c12LRW_MODE implementation, Decrypt blocks, Tom St Denis13*/1415#ifdef LTC_LRW_MODE1617/**18LRW decrypt blocks19@param ct The ciphertext20@param pt [out] The plaintext21@param len The length in octets, must be a multiple of 1622@param lrw The LRW state23*/24int lrw_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_LRW *lrw)25{26int err;2728LTC_ARGCHK(pt != NULL);29LTC_ARGCHK(ct != NULL);30LTC_ARGCHK(lrw != NULL);3132if ((err = cipher_is_valid(lrw->cipher)) != CRYPT_OK) {33return err;34}3536if (cipher_descriptor[lrw->cipher].accel_lrw_decrypt != NULL) {37return cipher_descriptor[lrw->cipher].accel_lrw_decrypt(ct, pt, len, lrw->IV, lrw->tweak, &lrw->key);38}3940return lrw_process(ct, pt, len, LRW_DECRYPT, lrw);41}424344#endif454647