1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 
4 /**
5    @file ocb_done_encrypt.c
6    OCB implementation, terminate encryption, by Tom St Denis
7 */
8 #include "tomcrypt_private.h"
9 
10 #ifdef LTC_OCB_MODE
11 
12 /**
13    Terminate an encryption OCB state
14    @param ocb       The OCB state
15    @param pt        Remaining plaintext (if any)
16    @param ptlen     The length of the plaintext (octets)
17    @param ct        [out] The ciphertext (if any)
18    @param tag       [out] The tag for the OCB stream
19    @param taglen    [in/out] The max size and resulting size of the tag
20    @return CRYPT_OK if successful
21 */
ocb_done_encrypt(ocb_state * ocb,const unsigned char * pt,unsigned long ptlen,unsigned char * ct,unsigned char * tag,unsigned long * taglen)22 int ocb_done_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
23                      unsigned char *ct, unsigned char *tag, unsigned long *taglen)
24 {
25    LTC_ARGCHK(ocb    != NULL);
26    LTC_ARGCHK(pt     != NULL);
27    LTC_ARGCHK(ct     != NULL);
28    LTC_ARGCHK(tag    != NULL);
29    LTC_ARGCHK(taglen != NULL);
30    return s_ocb_done(ocb, pt, ptlen, ct, tag, taglen, 0);
31 }
32 
33 #endif
34 
35