ocb.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Mathias Tausig
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
22 #include "crypto/ciphers.h"
23 #include <stdint.h>
24 #include <stddef.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
38 #define OCB_ERR_INVALID_NONCE_LENGTH (-2)
42 #define OCB_ERR_INVALID_BLOCK_LENGTH (-3)
46 #define OCB_ERR_INVALID_DATA_LENGTH (-3)
50 #define OCB_ERR_INVALID_TAG_LENGTH (-4)
54 #define OCB_ERR_INVALID_TAG (-5)
55 
76 int32_t cipher_encrypt_ocb(const cipher_t *cipher,
77  const uint8_t *auth_data, size_t auth_data_len,
78  uint8_t tag_len,
79  const uint8_t *nonce, size_t nonce_len,
80  const uint8_t *input, size_t input_len,
81  uint8_t *output);
82 
101 int32_t cipher_decrypt_ocb(const cipher_t *cipher,
102  const uint8_t *auth_data, size_t auth_data_len,
103  uint8_t tag_len,
104  const uint8_t *nonce, size_t nonce_len,
105  const uint8_t *input, size_t input_len,
106  uint8_t *output);
107 #ifdef __cplusplus
108 }
109 #endif
110 
Headers for the packet encryption class.
int32_t cipher_decrypt_ocb(const cipher_t *cipher, const uint8_t *auth_data, size_t auth_data_len, uint8_t tag_len, const uint8_t *nonce, size_t nonce_len, const uint8_t *input, size_t input_len, uint8_t *output)
Decrypt and verify the authentication of OCB encrypted data.
int32_t cipher_encrypt_ocb(const cipher_t *cipher, const uint8_t *auth_data, size_t auth_data_len, uint8_t tag_len, const uint8_t *nonce, size_t nonce_len, const uint8_t *input, size_t input_len, uint8_t *output)
Encrypt and authenticate data of arbitrary length in OCB mode.
basic struct for using block ciphers contains the cipher interface and the context
Definition: ciphers.h:115