1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

pow-testgiver support

This commit is contained in:
ton 2020-07-06 17:07:20 +03:00
parent dbde9c1c40
commit f064b1047a
257 changed files with 6665 additions and 2608 deletions

View file

@ -20,6 +20,7 @@
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/SharedSlice.h"
#include "td/utils/Slice.h"
#include "td/utils/SharedSlice.h"
#include "td/utils/Status.h"
@ -33,9 +34,50 @@ void init_crypto();
int pq_factorize(Slice pq_str, string *p_str, string *q_str);
class AesState {
public:
AesState();
AesState(const AesState &from) = delete;
AesState &operator=(const AesState &from) = delete;
AesState(AesState &&from);
AesState &operator=(AesState &&from);
~AesState();
void init(Slice key, bool encrypt);
void encrypt(const uint8 *src, uint8 *dst, int size);
void decrypt(const uint8 *src, uint8 *dst, int size);
private:
struct Impl;
unique_ptr<Impl> impl_;
};
void aes_ige_encrypt(Slice aes_key, MutableSlice aes_iv, Slice from, MutableSlice to);
void aes_ige_decrypt(Slice aes_key, MutableSlice aes_iv, Slice from, MutableSlice to);
class AesIgeStateImpl;
class AesIgeState {
public:
AesIgeState();
AesIgeState(const AesIgeState &from) = delete;
AesIgeState &operator=(const AesIgeState &from) = delete;
AesIgeState(AesIgeState &&from);
AesIgeState &operator=(AesIgeState &&from);
~AesIgeState();
void init(Slice key, Slice iv, bool encrypt);
void encrypt(Slice from, MutableSlice to);
void decrypt(Slice from, MutableSlice to);
private:
unique_ptr<AesIgeStateImpl> impl_;
};
void aes_cbc_encrypt(Slice aes_key, MutableSlice aes_iv, Slice from, MutableSlice to);
void aes_cbc_decrypt(Slice aes_key, MutableSlice aes_iv, Slice from, MutableSlice to);
@ -122,6 +164,10 @@ Result<BufferSlice> rsa_encrypt_pkcs1_oaep(Slice public_key, Slice data);
Result<BufferSlice> rsa_decrypt_pkcs1_oaep(Slice private_key, Slice data);
void init_openssl_threads();
Status create_openssl_error(int code, Slice message);
void clear_openssl_errors(Slice source);
#endif
#if TD_HAVE_ZLIB