ocb.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Mathias Tausig
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
25 #include "crypto/ciphers.h"
26 #include <stdint.h>
27 #include <stddef.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
41 #define OCB_ERR_INVALID_NONCE_LENGTH (-2)
45 #define OCB_ERR_INVALID_BLOCK_LENGTH (-3)
49 #define OCB_ERR_INVALID_DATA_LENGTH (-3)
53 #define OCB_ERR_INVALID_TAG_LENGTH (-4)
57 #define OCB_ERR_INVALID_TAG (-5)
58 
79 int32_t cipher_encrypt_ocb(const cipher_t *cipher,
80  const uint8_t *auth_data, size_t auth_data_len,
81  uint8_t tag_len,
82  const uint8_t *nonce, size_t nonce_len,
83  const uint8_t *input, size_t input_len,
84  uint8_t *output);
85 
104 int32_t cipher_decrypt_ocb(const cipher_t *cipher,
105  const uint8_t *auth_data, size_t auth_data_len,
106  uint8_t tag_len,
107  const uint8_t *nonce, size_t nonce_len,
108  const uint8_t *input, size_t input_len,
109  uint8_t *output);
110 #ifdef __cplusplus
111 }
112 #endif
113 
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:118