aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/commoncrypto/commoncrypto_utils.h
blob: 61e7e456ea32d24b3995a4d62339046fc593e463 (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
/*
* Utils for calling CommonCrypto
* (C) 2018 Jose Pereira
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_INTERNAL_COMMONCRYPTO_UTILS_H_
#define BOTAN_INTERNAL_COMMONCRYPTO_UTILS_H_

#include <botan/key_spec.h>

#include <CommonCrypto/CommonCrypto.h>

namespace Botan {

struct CommonCryptor_Opts
   {
   CCAlgorithm algo;
   CCMode mode;
   CCPadding padding;
   size_t block_size;
   Key_Length_Specification key_spec{0};
   };

CommonCryptor_Opts commoncrypto_opts_from_algo(const std::string& algo);

void commoncrypto_adjust_key_size(const uint8_t key[], size_t length,
                                  const CommonCryptor_Opts& opts, secure_vector<uint8_t>& full_key);


}

#endif