Path: blob/main/crypto/openssl/providers/implementations/ciphers/cipher_aes_siv.h
48383 views
/*1* Copyright 2019-2021 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 "prov/ciphercommon.h"10#include "crypto/aes_platform.h"11#include "crypto/siv.h"1213typedef struct prov_cipher_hw_aes_siv_st {14int (*initkey)(void *ctx, const uint8_t *key, size_t keylen);15int (*cipher)(void *ctx, unsigned char *out, const unsigned char *in,16size_t len);17void (*setspeed)(void *ctx, int speed);18int (*settag)(void *ctx, const unsigned char *tag, size_t tagl);19void (*cleanup)(void *ctx);20int (*dupctx)(void *src, void *dst);21} PROV_CIPHER_HW_AES_SIV;2223typedef struct prov_siv_ctx_st {24unsigned int mode; /* The mode that we are using */25unsigned int enc : 1; /* Set to 1 if we are encrypting or 0 otherwise */26size_t keylen; /* The input keylength (twice the alg key length) */27size_t taglen; /* the taglen is the same as the sivlen */28SIV128_CONTEXT siv;29EVP_CIPHER *ctr; /* These are fetched - so we need to free them */30EVP_CIPHER *cbc;31const PROV_CIPHER_HW_AES_SIV *hw;32OSSL_LIB_CTX *libctx;33} PROV_AES_SIV_CTX;3435const PROV_CIPHER_HW_AES_SIV *ossl_prov_cipher_hw_aes_siv(size_t keybits);363738