Path: blob/main/crypto/openssl/providers/implementations/ciphers/cipher_aes_xts.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 <openssl/aes.h>10#include "prov/ciphercommon.h"11#include "crypto/aes_platform.h"1213/*14* Available in cipher_fips.c, and compiled with different values depending15* on we're in the FIPS module or not.16*/17extern const int ossl_aes_xts_allow_insecure_decrypt;1819PROV_CIPHER_FUNC(void, xts_stream,20(const unsigned char *in, unsigned char *out, size_t len,21const AES_KEY *key1, const AES_KEY *key2,22const unsigned char iv[16]));2324#if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)25typedef struct S390X_km_xts_params_st {26unsigned char key[64];27unsigned char tweak[16];28unsigned char nap[16];29} S390X_KM_XTS_PARAMS;30#endif3132typedef struct prov_aes_xts_ctx_st {33PROV_CIPHER_CTX base; /* Must be first */34union {35OSSL_UNION_ALIGN;36AES_KEY ks;37} ks1, ks2; /* AES key schedules to use */38XTS128_CONTEXT xts;39OSSL_xts_stream_fn stream;4041/* Platform specific data */42union {43int dummy;44#if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)45struct {46union {47OSSL_UNION_ALIGN;48S390X_KM_XTS_PARAMS km;49} param;50size_t offset;51unsigned int fc;52unsigned int iv_set : 1;53unsigned int key_set : 1;54} s390x;55#endif56} plat;57} PROV_AES_XTS_CTX;5859const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_xts(size_t keybits);606162