2 * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "prov/ciphercommon.h"
11 #include "crypto/aes_platform.h"
13 int cipher_capable_aes_cbc_hmac_sha1(void);
14 int cipher_capable_aes_cbc_hmac_sha256(void);
16 #ifdef AES_CBC_HMAC_SHA_CAPABLE
17 # include <openssl/aes.h>
18 # include <openssl/sha.h>
20 typedef struct prov_cipher_hw_aes_hmac_sha_ctx_st
{
21 PROV_CIPHER_HW base
; /* must be first */
22 void (*init_mac_key
)(void *ctx
, const unsigned char *inkey
, size_t inlen
);
23 int (*set_tls1_aad
)(void *ctx
, unsigned char *aad_rec
, int aad_len
);
24 # if !defined(OPENSSL_NO_MULTIBLOCK)
25 int (*tls1_multiblock_max_bufsize
)(void *ctx
);
26 int (*tls1_multiblock_aad
)(
27 void *vctx
, EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM
*param
);
28 int (*tls1_multiblock_encrypt
)(
29 void *ctx
, EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM
*param
);
30 # endif /* OPENSSL_NO_MULTIBLOCK) */
31 } PROV_CIPHER_HW_AES_HMAC_SHA
;
33 typedef struct prov_aes_hmac_sha_ctx_st
{
36 size_t payload_length
; /* AAD length in decrypt case */
39 unsigned char tls_aad
[16]; /* 13 used */
41 const PROV_CIPHER_HW_AES_HMAC_SHA
*hw
;
42 /* some value that are setup by set methods - that can be retrieved */
43 unsigned int multiblock_interleave
;
44 unsigned int multiblock_aad_packlen
;
45 size_t multiblock_max_send_fragment
;
46 size_t multiblock_encrypt_len
;
48 } PROV_AES_HMAC_SHA_CTX
;
50 typedef struct prov_aes_hmac_sha1_ctx_st
{
51 PROV_AES_HMAC_SHA_CTX base_ctx
;
52 SHA_CTX head
, tail
, md
;
53 } PROV_AES_HMAC_SHA1_CTX
;
55 typedef struct prov_aes_hmac_sha256_ctx_st
{
56 PROV_AES_HMAC_SHA_CTX base_ctx
;
57 SHA256_CTX head
, tail
, md
;
58 } PROV_AES_HMAC_SHA256_CTX
;
60 # define NO_PAYLOAD_LENGTH ((size_t)-1)
62 const PROV_CIPHER_HW_AES_HMAC_SHA
*PROV_CIPHER_HW_aes_cbc_hmac_sha1(void);
63 const PROV_CIPHER_HW_AES_HMAC_SHA
*PROV_CIPHER_HW_aes_cbc_hmac_sha256(void);
65 #endif /* AES_CBC_HMAC_SHA_CAPABLE */