Path: blob/main/crypto/openssl/providers/implementations/ciphers/cipher_aes_ocb.h
48383 views
/*1* Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89#include <openssl/aes.h>10#include "prov/ciphercommon.h"11#include "crypto/aes_platform.h"1213#define OCB_MAX_TAG_LEN AES_BLOCK_SIZE14#define OCB_MAX_DATA_LEN AES_BLOCK_SIZE15#define OCB_MAX_AAD_LEN AES_BLOCK_SIZE1617typedef struct prov_aes_ocb_ctx_st {18PROV_CIPHER_CTX base; /* Must be first */19union {20OSSL_UNION_ALIGN;21AES_KEY ks;22} ksenc; /* AES key schedule to use for encryption/aad */23union {24OSSL_UNION_ALIGN;25AES_KEY ks;26} ksdec; /* AES key schedule to use for decryption */27OCB128_CONTEXT ocb;28unsigned int iv_state; /* set to one of IV_STATE_XXX */29unsigned int key_set : 1;30size_t taglen;31size_t data_buf_len;32size_t aad_buf_len;33unsigned char tag[OCB_MAX_TAG_LEN];34unsigned char data_buf[OCB_MAX_DATA_LEN]; /* Store partial data blocks */35unsigned char aad_buf[OCB_MAX_AAD_LEN]; /* Store partial AAD blocks */36} PROV_AES_OCB_CTX;3738const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ocb(size_t keybits);394041