Go to the documentation of this file.
21 #include "../fipsmodule/cipher/internal.h"
24 #define EVP_AEAD_AES_CTR_HMAC_SHA256_TAG_LEN SHA256_DIGEST_LENGTH
25 #define EVP_AEAD_AES_CTR_HMAC_SHA256_NONCE_LEN 12
40 "AEAD state is too small");
41 #if defined(__GNUC__) || defined(__clang__)
44 "AEAD state has insufficient alignment");
49 static const size_t hmac_key_len = 32;
55 for (
i = 0;
i < hmac_key_len;
i++) {
63 for (
i = 0;
i < hmac_key_len;
i++) {
72 size_t key_len,
size_t tag_len) {
75 static const size_t hmac_key_len = 32;
77 if (key_len < hmac_key_len) {
82 const size_t aes_key_len = key_len - hmac_key_len;
83 if (aes_key_len != 16 && aes_key_len != 32) {
99 ctx->tag_len = tag_len;
112 for (
i = 0;
i <
sizeof(
bytes);
i++) {
122 const uint8_t *ad,
size_t ad_len,
124 size_t ciphertext_len) {
133 const unsigned num_padding =
158 unsigned partial_block_offset = 0;
159 OPENSSL_memset(partial_block_buffer, 0,
sizeof(partial_block_buffer));
167 partial_block_buffer, &partial_block_offset,
171 partial_block_buffer, &partial_block_offset,
178 size_t *out_tag_len,
size_t max_out_tag_len,
const uint8_t *nonce,
179 size_t nonce_len,
const uint8_t *
in,
size_t in_len,
const uint8_t *extra_in,
180 size_t extra_in_len,
const uint8_t *ad,
size_t ad_len) {
191 if (max_out_tag_len < ctx->tag_len) {
207 *out_tag_len =
ctx->tag_len;
215 size_t in_tag_len,
const uint8_t *ad,
size_t ad_len) {
219 if (in_tag_len !=
ctx->tag_len) {
static void hmac_init(SHA256_CTX *out_inner, SHA256_CTX *out_outer, const uint8_t hmac_key[32])
const EVP_AEAD * EVP_aead_aes_128_ctr_hmac_sha256(void)
#define OPENSSL_PUT_ERROR(library, reason)
#define EVP_AEAD_AES_CTR_HMAC_SHA256_TAG_LEN
OPENSSL_STATIC_ASSERT(sizeof(((EVP_AEAD_CTX *) NULL) ->state) >=sizeof(struct aead_aes_ctr_hmac_sha256_ctx), "AEAD state is too small")
SHA256_CTX inner_init_state
#define CIPHER_R_BAD_KEY_LENGTH
#define CRYPTO_ctr128_encrypt_ctr32
static void * OPENSSL_memset(void *dst, int c, size_t n)
static int aead_aes_ctr_hmac_sha256_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len)
static int aead_aes_ctr_hmac_sha256_seal_scatter(const EVP_AEAD_CTX *ctx, uint8_t *out, uint8_t *out_tag, size_t *out_tag_len, size_t max_out_tag_len, const uint8_t *nonce, size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *extra_in, size_t extra_in_len, const uint8_t *ad, size_t ad_len)
#define EVP_AEAD_DEFAULT_TAG_LENGTH
static int aead_aes_ctr_hmac_sha256_open_gather(const EVP_AEAD_CTX *ctx, uint8_t *out, const uint8_t *nonce, size_t nonce_len, const uint8_t *in, size_t in_len, const uint8_t *in_tag, size_t in_tag_len, const uint8_t *ad, size_t ad_len)
void(* ctr128_f)(const uint8_t *in, uint8_t *out, size_t blocks, const AES_KEY *key, const uint8_t ivec[16])
#define CIPHER_R_UNSUPPORTED_NONCE_SIZE
#define CIPHER_R_TAG_TOO_LARGE
unsigned __int64 uint64_t
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
#define CIPHER_R_BUFFER_TOO_SMALL
static void hmac_update_uint64(SHA256_CTX *sha256, uint64_t value)
static void hmac_calculate(uint8_t out[SHA256_DIGEST_LENGTH], const SHA256_CTX *inner_init_state, const SHA256_CTX *outer_init_state, const uint8_t *ad, size_t ad_len, const uint8_t *nonce, const uint8_t *ciphertext, size_t ciphertext_len)
#define CRYPTO_ctr128_encrypt
SHA256_CTX outer_init_state
static void aead_aes_ctr_hmac_sha256_crypt(const struct aead_aes_ctr_hmac_sha256_ctx *aes_ctx, uint8_t *out, const uint8_t *in, size_t len, const uint8_t *nonce)
#define SHA256_DIGEST_LENGTH
#define CIPHER_R_TOO_LARGE
static const EVP_AEAD aead_aes_128_ctr_hmac_sha256
#define EVP_AEAD_AES_CTR_HMAC_SHA256_NONCE_LEN
const EVP_AEAD * EVP_aead_aes_256_ctr_hmac_sha256(void)
static const EVP_AEAD aead_aes_256_ctr_hmac_sha256
if(p->owned &&p->wrapped !=NULL)
static void aead_aes_ctr_hmac_sha256_cleanup(EVP_AEAD_CTX *ctx)
void(* block128_f)(const uint8_t in[16], uint8_t out[16], const AES_KEY *key)
#define CIPHER_R_BAD_DECRYPT
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:18