#include <stdio.h>#include <string.h>#include "api.h"#include "isap.h"intcrypto_aead_decrypt(unsignedchar*m,unsignedlonglong*mlen,unsignedchar*nsec,constunsignedchar*c,unsignedlonglongclen,constunsignedchar*ad,unsignedlonglongadlen,constunsignedchar*npub,constunsignedchar*k){// Plaintext length is clen - tag length*mlen=clen-ISAP_TAG_SZ;// Generate tagunsignedchartag[ISAP_TAG_SZ];isap_mac(k,npub,ad,adlen,c,*mlen,tag);// Compare tagunsignedlongeq_cnt=0;for(size_ti=0;i<ISAP_TAG_SZ;i++){eq_cnt+=(tag[i]==c[(*mlen)+i]);}// Perform decryption if tag is correctif(eq_cnt==(unsignedlong)ISAP_TAG_SZ){isap_enc(k,npub,c,*mlen,m);return0;}else{return-1;}}