aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/commoncrypto/commoncrypto.h
blob: 958cbab7d7b41c270b959e5d731b254d899eeab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Utils for calling CommonCrypto
* (C) 2018 Jose Pereira
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_INTERNAL_COMMONCRYPTO_H_
#define BOTAN_INTERNAL_COMMONCRYPTO_H_

#include <botan/pk_ops_fwd.h>
#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <memory>
#include <string>

namespace Botan {

class Cipher_Mode;
class BlockCipher;
class HashFunction;
enum Cipher_Dir : int;
typedef int32_t CCCryptorStatus;

class BOTAN_PUBLIC_API(2, 0) CommonCrypto_Error final : public Exception
   {
      std::string ccryptorstatus_to_string(CCCryptorStatus status);

   public:
      CommonCrypto_Error(const std::string& what) :
         Exception(what + " failed.") {}

      CommonCrypto_Error(const std::string& what, int32_t status) :
         Exception(what + std::string(" failed. Status: ") + ccryptorstatus_to_string(status)) {}
   };

/* Cipher Modes */

Cipher_Mode*
make_commoncrypto_cipher_mode(const std::string& name, Cipher_Dir direction);

/* Block Ciphers */

std::unique_ptr<BlockCipher>
make_commoncrypto_block_cipher(const std::string& name);

/* Hash */

std::unique_ptr<HashFunction> make_commoncrypto_hash(const std::string& name);

}

#endif