Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / crypto / crypto_accel.h
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 CRYPTO_ACCEL_H
16 #define CRYPTO_ACCEL_H
17 #include <cstddef>
18 #include "include/Context.h"
19
20 class CryptoAccel;
21 typedef ceph::shared_ptr<CryptoAccel> CryptoAccelRef;
22
23 class CryptoAccel {
24  public:
25   CryptoAccel() {}
26   virtual ~CryptoAccel() {}
27
28   static const int AES_256_IVSIZE = 128/8;
29   static const int AES_256_KEYSIZE = 256/8;
30   virtual bool cbc_encrypt(unsigned char* out, const unsigned char* in, size_t size,
31                    const unsigned char (&iv)[AES_256_IVSIZE],
32                    const unsigned char (&key)[AES_256_KEYSIZE]) = 0;
33   virtual bool cbc_decrypt(unsigned char* out, const unsigned char* in, size_t size,
34                    const unsigned char (&iv)[AES_256_IVSIZE],
35                    const unsigned char (&key)[AES_256_KEYSIZE]) = 0;
36 };
37 #endif