tor  0.4.1.0-alpha-dev
crypto_ope.h
1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 #ifndef CRYPTO_OPE_H
5 #define CRYPTO_OPE_H
6 
7 #include "orconfig.h"
8 #include "lib/cc/torint.h"
9 #include "lib/crypt_ops/crypto_ope.h"
11 
13 #define OPE_KEY_LEN 32
14 
26 #define OPE_INPUT_MAX (1<<18)
27 
28 #define CRYPTO_OPE_ERROR UINT64_MAX
29 
30 typedef struct crypto_ope_t crypto_ope_t;
31 
32 crypto_ope_t *crypto_ope_new(const uint8_t *key);
33 void crypto_ope_free_(crypto_ope_t *ope);
34 #define crypto_ope_free(ope) \
35  FREE_AND_NULL(crypto_ope_t, crypto_ope_free_, (ope))
36 
37 uint64_t crypto_ope_encrypt(const crypto_ope_t *ope, int plaintext);
38 
39 #ifdef CRYPTO_OPE_PRIVATE
40 struct aes_cnt_cipher;
41 STATIC struct aes_cnt_cipher *ope_get_cipher(const crypto_ope_t *ope,
42  uint32_t initial_idx);
43 STATIC uint64_t sum_values_from_cipher(struct aes_cnt_cipher *c, size_t n);
44 #endif
45 
46 #endif
uint8_t key[OPE_KEY_LEN]
Definition: crypto_ope.c:42
Integer definitions used throughout Tor.
Macros to implement mocking and selective exposure for the test code.