mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-01 00:56:11 +00:00
added logs to pq
This commit is contained in:
@@ -1,9 +1,25 @@
|
||||
#include <openssl/sha.h>
|
||||
#include "sha512.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
void crypto_hash_sha512 (unsigned char *out,
|
||||
const unsigned char *in,
|
||||
unsigned long long inlen)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 10);
|
||||
#else
|
||||
printf("LALAL 10\n");
|
||||
#endif
|
||||
SHA512(in, inlen, out);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 11);
|
||||
#else
|
||||
printf("LALAL 11\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
|
||||
#include "sntrup761.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "sha512.h"
|
||||
|
||||
/* from supercop-20201130/crypto_sort/int32/portable4/int32_minmax.inc */
|
||||
@@ -689,7 +695,17 @@ urandom32 (void *random_ctx, sntrup761_random_func * random)
|
||||
unsigned char c[4];
|
||||
uint32_t out[4];
|
||||
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 4);
|
||||
#else
|
||||
printf("LALAL 4\n");
|
||||
#endif
|
||||
random (random_ctx, 4, c);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 5);
|
||||
#else
|
||||
printf("LALAL 5\n");
|
||||
#endif
|
||||
out[0] = (uint32_t) c[0];
|
||||
out[1] = ((uint32_t) c[1]) << 8;
|
||||
out[2] = ((uint32_t) c[2]) << 16;
|
||||
@@ -888,6 +904,11 @@ static void
|
||||
ZKeyGen (unsigned char *pk, unsigned char *sk, void *random_ctx,
|
||||
sntrup761_random_func * random)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 8);
|
||||
#else
|
||||
printf("LALAL 8\n");
|
||||
#endif
|
||||
Fq h[p];
|
||||
small f[p], v[p];
|
||||
|
||||
@@ -896,6 +917,11 @@ ZKeyGen (unsigned char *pk, unsigned char *sk, void *random_ctx,
|
||||
Small_encode (sk, f);
|
||||
sk += Small_bytes;
|
||||
Small_encode (sk, v);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 9);
|
||||
#else
|
||||
printf("LALAL 9\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* C = ZEncrypt(r,pk) */
|
||||
@@ -966,11 +992,31 @@ sntrup761_keypair (unsigned char *pk, unsigned char *sk, void *random_ctx,
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 0);
|
||||
#else
|
||||
printf("LALAL 0\n");
|
||||
#endif
|
||||
ZKeyGen (pk, sk, random_ctx, random);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 1);
|
||||
#else
|
||||
printf("LALAL 1\n");
|
||||
#endif
|
||||
sk += SecretKeys_bytes;
|
||||
for (i = 0; i < PublicKeys_bytes; ++i)
|
||||
*sk++ = pk[i];
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 2);
|
||||
#else
|
||||
printf("LALAL 2\n");
|
||||
#endif
|
||||
random (random_ctx, Inputs_bytes, sk);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 3);
|
||||
#else
|
||||
printf("LALAL 3\n");
|
||||
#endif
|
||||
sk += Inputs_bytes;
|
||||
Hash_prefix (sk, 4, pk, PublicKeys_bytes);
|
||||
}
|
||||
@@ -991,6 +1037,11 @@ void
|
||||
sntrup761_enc (unsigned char *c, unsigned char *k, const unsigned char *pk,
|
||||
void *random_ctx, sntrup761_random_func * random)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 6);
|
||||
#else
|
||||
printf("LALAL 6\n");
|
||||
#endif
|
||||
Inputs r;
|
||||
unsigned char r_enc[Inputs_bytes];
|
||||
unsigned char cache[Hash_bytes];
|
||||
@@ -999,6 +1050,11 @@ sntrup761_enc (unsigned char *c, unsigned char *k, const unsigned char *pk,
|
||||
Inputs_random (r, random_ctx, random);
|
||||
Hide (c, r_enc, r, pk, cache);
|
||||
HashSession (k, 1, r_enc, c);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_ERROR, "SimpleX", "LALAL %d", 7);
|
||||
#else
|
||||
printf("LALAL 7\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 0 if matching ciphertext+confirm, else -1 */
|
||||
|
||||
Reference in New Issue
Block a user