summaryrefslogtreecommitdiffstats
path: root/crypto/include
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-05-07 12:39:58 +0200
committerRichard Levitte <levitte@openssl.org>2019-08-15 22:12:25 +0200
commite74bd29053a543ab4908ae8545b46f2e38c98bab (patch)
treeee0d540bd5f8319549c1ab0d4b356f8b166d021e /crypto/include
parent3ded2288a45d2cc3a27a1b08d29499cbcec52c0e (diff)
Prepare EVP_MAC infrastructure for moving all MACs to providers
Quite a few adaptations are needed, most prominently the added code to allow provider based MACs. As part of this, all the old information functions are gone, except for EVP_MAC_name(). Some of them will reappear later, for example EVP_MAC_do_all() in some form. MACs by EVP_PKEY was particularly difficult to deal with, as they need to allocate and deallocate EVP_MAC_CTXs "under the hood", and thereby implicitly fetch the corresponding EVP_MAC. This means that EVP_MACs can't be constant in a EVP_MAC_CTX, as their reference count may need to be incremented and decremented as part of the allocation or deallocation of the EVP_MAC_CTX. It may be that other provider based EVP operation types may need to be handled in a similar manner. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8877)
Diffstat (limited to 'crypto/include')
-rw-r--r--crypto/include/internal/evp_int.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h
index ce9b9b8f51..fb443b1484 100644
--- a/crypto/include/internal/evp_int.h
+++ b/crypto/include/internal/evp_int.h
@@ -121,28 +121,26 @@ extern const EVP_PKEY_METHOD siphash_pkey_meth;
/* struct evp_mac_impl_st is defined by the implementation */
typedef struct evp_mac_impl_st EVP_MAC_IMPL;
struct evp_mac_st {
- int type;
- EVP_MAC_IMPL *(*new) (void);
- EVP_MAC_IMPL *(*dup) (const EVP_MAC_IMPL *macsrc);
- void (*free) (EVP_MAC_IMPL *macctx);
- size_t (*size) (EVP_MAC_IMPL *macctx);
- int (*init) (EVP_MAC_IMPL *macctx);
- int (*update) (EVP_MAC_IMPL *macctx, const unsigned char *data,
- size_t datalen);
- int (*final) (EVP_MAC_IMPL *macctx, unsigned char *out);
- int (*ctrl) (EVP_MAC_IMPL *macctx, int cmd, va_list args);
- int (*ctrl_str) (EVP_MAC_IMPL *macctx, const char *type, const char *value);
-};
+ OSSL_PROVIDER *prov;
+ char *name;
-extern const EVP_MAC blake2b_mac_meth;
-extern const EVP_MAC blake2s_mac_meth;
-extern const EVP_MAC cmac_meth;
-extern const EVP_MAC gmac_meth;
-extern const EVP_MAC hmac_meth;
-extern const EVP_MAC kmac128_meth;
-extern const EVP_MAC kmac256_meth;
-extern const EVP_MAC siphash_meth;
-extern const EVP_MAC poly1305_meth;
+ CRYPTO_REF_COUNT refcnt;
+ CRYPTO_RWLOCK *lock;
+
+ OSSL_OP_mac_newctx_fn *newctx;
+ OSSL_OP_mac_dupctx_fn *dupctx;
+ OSSL_OP_mac_freectx_fn *freectx;
+ OSSL_OP_mac_size_fn *size;
+ OSSL_OP_mac_init_fn *init;
+ OSSL_OP_mac_update_fn *update;
+ OSSL_OP_mac_final_fn *final;
+ OSSL_OP_mac_gettable_params_fn *gettable_params;
+ OSSL_OP_mac_gettable_ctx_params_fn *gettable_ctx_params;
+ OSSL_OP_mac_settable_ctx_params_fn *settable_ctx_params;
+ OSSL_OP_mac_get_params_fn *get_params;
+ OSSL_OP_mac_ctx_get_params_fn *ctx_get_params;
+ OSSL_OP_mac_ctx_set_params_fn *ctx_set_params;
+};
/* Internal keccak algorithms used for KMAC */
const EVP_MD *evp_keccak_kmac128(void);