64 lines
2.5 KiB
Diff
64 lines
2.5 KiB
Diff
diff -up ./crypto/CryptoAuth.c.sign ./crypto/CryptoAuth.c
|
|
--- ./crypto/CryptoAuth.c.sign 2020-09-18 14:24:44.000000000 -0400
|
|
+++ ./crypto/CryptoAuth.c 2020-09-29 10:32:39.040375439 -0400
|
|
@@ -85,8 +85,10 @@ static inline void getSharedSecret(uint8
|
|
uint8_t passwordHash[32],
|
|
struct Log* logger)
|
|
{
|
|
+ int keygenfailed;
|
|
if (passwordHash == NULL) {
|
|
- crypto_box_curve25519xsalsa20poly1305_beforenm(outputSecret, herPublicKey, myPrivateKey);
|
|
+ keygenfailed = crypto_box_curve25519xsalsa20poly1305_beforenm(
|
|
+ outputSecret, herPublicKey, myPrivateKey);
|
|
} else {
|
|
union {
|
|
struct {
|
|
@@ -96,7 +98,8 @@ static inline void getSharedSecret(uint8
|
|
uint8_t bytes[64];
|
|
} buff;
|
|
|
|
- crypto_scalarmult_curve25519(buff.components.key, myPrivateKey, herPublicKey);
|
|
+ keygenfailed = crypto_scalarmult_curve25519(
|
|
+ buff.components.key, myPrivateKey, herPublicKey);
|
|
Bits_memcpy(buff.components.passwd, passwordHash, 32);
|
|
crypto_hash_sha256(outputSecret, buff.bytes, 64);
|
|
}
|
|
@@ -114,8 +117,9 @@ static inline void getSharedSecret(uint8
|
|
" myPublicKey=%s\n"
|
|
" herPublicKey=%s\n"
|
|
" passwordHash=%s\n"
|
|
- " outputSecret=%s\n",
|
|
- myPublicKeyHex, herPublicKeyHex, passwordHashHex, outputSecretHex);
|
|
+ " outputSecret=%s\n"
|
|
+ " keygenfailed=%d\n",
|
|
+ myPublicKeyHex, herPublicKeyHex, passwordHashHex, outputSecretHex,keygenfailed);
|
|
}
|
|
}
|
|
|
|
diff -up ./crypto/Sign.c.sign ./crypto/Sign.c
|
|
--- ./crypto/Sign.c.sign 2020-09-18 14:24:44.000000000 -0400
|
|
+++ ./crypto/Sign.c 2020-09-29 10:25:02.503986487 -0400
|
|
@@ -210,3 +210,4 @@ int Sign_publicSigningKeyToCurve25519(ui
|
|
|
|
return 0;
|
|
}
|
|
+#pragma GCC diagnostic ignored "-Wpedantic"
|
|
diff -up ./crypto/test/Sign_test.c.sign ./crypto/test/Sign_test.c
|
|
--- ./crypto/test/Sign_test.c.sign 2020-09-18 14:24:44.000000000 -0400
|
|
+++ ./crypto/test/Sign_test.c 2020-09-29 10:25:02.503986487 -0400
|
|
@@ -23,6 +23,7 @@
|
|
|
|
int main()
|
|
{
|
|
+#ifdef SUBNODE
|
|
struct Allocator* alloc = MallocAllocator_new(1048576);
|
|
struct Log* logger = FileWriterLog_new(stdout, alloc);
|
|
struct Random* rand = Random_new(alloc, logger, NULL);
|
|
@@ -44,5 +45,6 @@ int main()
|
|
Assert_true(!Bits_memcmp(curve25519publicB, curve25519public, 32));
|
|
|
|
Allocator_free(alloc);
|
|
+#endif // SUBNODE
|
|
return 0;
|
|
}
|