20 #define CRYPTO_OPE_PRIVATE
37 #define SAMPLE_INTERVAL 1024
39 #define N_SAMPLES (OPE_INPUT_MAX / SAMPLE_INTERVAL)
52 #ifdef WORDS_BIGENDIAN
62 #define ope_val_from_le(x) (x)
78 memset(iv, 0,
sizeof(iv));
104 memset(buf, 0,
sizeof(buf));
107 for (i = 0; i < BUFSZ; ++i) {
108 total += ope_val_from_le(buf[i]);
116 for (i = 0; i < n; ++i) {
117 total += ope_val_from_le(buf[i]);
121 memset(buf, 0,
sizeof(buf));
143 crypto_cipher_free(cipher);
168 return CRYPTO_OPE_ERROR;
172 const int remaining_values = plaintext - starting_iv;
174 if (sample_idx == 0) {
177 v = ope->
samples[sample_idx - 1];
183 crypto_cipher_free(cipher);
Inline functions for reading and writing multibyte values from the middle of strings,...
static uint32_t tor_htonl(uint32_t a)
void crypto_cipher_crypt_inplace(crypto_cipher_t *env, char *buf, size_t len)
crypto_cipher_t * crypto_cipher_new_with_iv_and_bits(const uint8_t *key, const uint8_t *iv, int bits)
Headers for crypto_cipher.c.
crypto_ope_t * crypto_ope_new(const uint8_t *key)
void crypto_ope_free_(crypto_ope_t *ope)
uint64_t crypto_ope_encrypt(const crypto_ope_t *ope, int plaintext)
STATIC crypto_cipher_t * ope_get_cipher(const crypto_ope_t *ope, uint32_t initial_idx)
STATIC uint64_t sum_values_from_cipher(crypto_cipher_t *c, size_t n)
void memwipe(void *mem, uint8_t byte, size_t sz)
Common functions for cryptographic routines.
Headers for util_malloc.c.
uint64_t samples[N_SAMPLES]
Macros to manage assertions, fatal and non-fatal.