Path: blob/master/libs/tomcrypt/src/encauth/eax/eax_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*/89/**10@file eax_decrypt.c11EAX implementation, decrypt block, by Tom St Denis12*/13#include "tomcrypt.h"1415#ifdef LTC_EAX_MODE1617/**18Decrypt data with the EAX protocol19@param eax The EAX state20@param ct The ciphertext21@param pt [out] The plaintext22@param length The length (octets) of the ciphertext23@return CRYPT_OK if successful24*/25int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt,26unsigned long length)27{28int err;2930LTC_ARGCHK(eax != NULL);31LTC_ARGCHK(pt != NULL);32LTC_ARGCHK(ct != NULL);3334/* omac ciphertext */35if ((err = omac_process(&eax->ctomac, ct, length)) != CRYPT_OK) {36return err;37}3839/* decrypt */40return ctr_decrypt(ct, pt, length, &eax->ctr);41}4243#endif444546