YPC  0.2.0
rijndael128GCM.h
1 #pragma once
2 #include "ypc/corecommon/crypto/aes_gcm_traits.h"
3 #include <cstdint>
4 
5 namespace ypc {
6 namespace crypto {
7 
8 struct rijndael128GCM {
9  static inline uint32_t get_mac_code_size() { return 16; }
10  static uint32_t get_cipher_size(uint32_t data_size);
11  static uint32_t get_data_size(uint32_t cipher_size);
12  static inline uint32_t get_key_size() { return 16; }
13 
14  static uint32_t encrypt_with_prefix(const uint8_t *key, uint32_t key_size,
15  const uint8_t *data, uint32_t data_size,
16  uint32_t prefix, uint8_t *cipher,
17  uint32_t cipher_size, uint8_t *out_mac);
18  static uint32_t decrypt_with_prefix(const uint8_t *key, uint32_t key_size,
19  const uint8_t *cipher,
20  uint32_t cipher_size, uint32_t prefix,
21  uint8_t *data, uint32_t data_size,
22  const uint8_t *in_mac);
23 };
24 
25 template <> struct aes_gcm_traits<rijndael128GCM> {
26  constexpr static bool value = true;
27 };
28 } // namespace crypto
29 } // namespace ypc
30 
ypc::crypto::rijndael128GCM
Definition: rijndael128GCM.h:8
ypc::crypto::aes_gcm_traits
Definition: aes_gcm_traits.h:6