Path: blob/master/libs/tomcrypt/src/modes/lrw/lrw_encrypt.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_encrypt.c12LRW_MODE implementation, Encrypt blocks, Tom St Denis13*/1415#ifdef LTC_LRW_MODE1617/**18LRW encrypt blocks19@param pt The plaintext20@param ct [out] The ciphertext21@param len The length in octets, must be a multiple of 1622@param lrw The LRW state23*/24int lrw_encrypt(const unsigned char *pt, unsigned char *ct, 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_encrypt != NULL) {37return cipher_descriptor[lrw->cipher].accel_lrw_encrypt(pt, ct, len, lrw->IV, lrw->tweak, &lrw->key);38}3940return lrw_process(pt, ct, len, LRW_ENCRYPT, lrw);41}424344#endif454647