]> git.proxmox.com Git - ceph.git/blame - ceph/src/crypto/isa-l/isal_crypto_plugin.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / crypto / isa-l / isal_crypto_plugin.h
CommitLineData
7c673cae
FG
1/*
2 * Ceph - scalable distributed file system
3 *
4 * Copyright (C) 2016 Mirantis, Inc.
5 *
6 * Author: Adam Kupczyk <akupczyk@mirantis.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 */
14
15#ifndef ISAL_CRYPTO_PLUGIN_H
16#define ISAL_CRYPTO_PLUGIN_H
17// -----------------------------------------------------------------------------
18#include "crypto/crypto_plugin.h"
19#include "crypto/isa-l/isal_crypto_accel.h"
20#include "arch/intel.h"
21#include "arch/probe.h"
22// -----------------------------------------------------------------------------
23
24
25class ISALCryptoPlugin : public CryptoPlugin {
26
7c673cae
FG
27public:
28
29 explicit ISALCryptoPlugin(CephContext* cct) : CryptoPlugin(cct)
30 {}
31 ~ISALCryptoPlugin()
32 {}
33 virtual int factory(CryptoAccelRef *cs,
34 ostream *ss)
35 {
36 if (cryptoaccel == nullptr)
37 {
38 ceph_arch_probe();
39 if (ceph_arch_intel_aesni && ceph_arch_intel_sse41) {
40 cryptoaccel = CryptoAccelRef(new ISALCryptoAccel);
41 }
42 }
43 *cs = cryptoaccel;
44 return 0;
45 }
46};
47#endif