Path: blob/main/crypto/openssl/providers/implementations/ciphers/cipher_aes_ccm.h
48383 views
/*1* Copyright 2019-2020 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 "prov/ciphercommon_ccm.h"12#include "crypto/aes_platform.h"1314typedef struct prov_aes_ccm_ctx_st {15PROV_CCM_CTX base; /* Must be first */16union {17OSSL_UNION_ALIGN;18/*-19* Padding is chosen so that s390x.kmac.k overlaps with ks.ks and20* fc with ks.ks.rounds. Remember that on s390x, an AES_KEY's21* rounds field is used to store the function code and that the key22* schedule is not stored (if aes hardware support is detected).23*/24struct {25unsigned char pad[16];26AES_KEY ks;27} ks;28#if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)29struct {30S390X_KMAC_PARAMS kmac;31unsigned long long blocks;32union {33unsigned long long g[2];34unsigned char b[AES_BLOCK_SIZE];35} nonce;36union {37unsigned long long g[2];38unsigned char b[AES_BLOCK_SIZE];39} buf;40unsigned char dummy_pad[168];41unsigned int fc; /* fc has same offset as ks.ks.rounds */42} s390x;43#endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */44} ccm;45} PROV_AES_CCM_CTX;4647const PROV_CCM_HW *ossl_prov_aes_hw_ccm(size_t keylen);484950