1 // SPDX-License-Identifier: BSD-2-Clause
2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 *
4 * LibTomCrypt is a library that provides various cryptographic
5 * algorithms in a highly modular and flexible manner.
6 *
7 * The library is free for all purposes without any express
8 * guarantee it works.
9 */
10
11 /**
12 @file ocb_done_encrypt.c
13 OCB implementation, terminate encryption, by Tom St Denis
14 */
15 #include "tomcrypt_private.h"
16
17 #ifdef LTC_OCB_MODE
18
19 /**
20 Terminate an encryption OCB state
21 @param ocb The OCB state
22 @param pt Remaining plaintext (if any)
23 @param ptlen The length of the plaintext (octets)
24 @param ct [out] The ciphertext (if any)
25 @param tag [out] The tag for the OCB stream
26 @param taglen [in/out] The max size and resulting size of the tag
27 @return CRYPT_OK if successful
28 */
ocb_done_encrypt(ocb_state * ocb,const unsigned char * pt,unsigned long ptlen,unsigned char * ct,unsigned char * tag,unsigned long * taglen)29 int ocb_done_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned long ptlen,
30 unsigned char *ct, unsigned char *tag, unsigned long *taglen)
31 {
32 LTC_ARGCHK(ocb != NULL);
33 LTC_ARGCHK(pt != NULL);
34 LTC_ARGCHK(ct != NULL);
35 LTC_ARGCHK(tag != NULL);
36 LTC_ARGCHK(taglen != NULL);
37 return s_ocb_done(ocb, pt, ptlen, ct, tag, taglen, 0);
38 }
39
40 #endif
41
42
43 /* ref: $Format:%D$ */
44 /* git commit: $Format:%H$ */
45 /* commit time: $Format:%ai$ */
46