+ crypto_core_ed25519_add(), crypto_core_ed25519_sub()

This commit is contained in:
Frank Denis 2017-11-13 14:21:14 +01:00
parent d5a90f8f45
commit 57dac9eb60
20 changed files with 152 additions and 2 deletions

View File

@ -180,6 +180,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -198,6 +199,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -243,6 +245,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -333,6 +333,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>crypto_core\hsalsa20\ref2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>crypto_core\ed25519</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>crypto_core\ed25519\ref10</Filter>
</ClCompile>
@ -383,6 +386,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h">
<Filter>include\sodium</Filter>
</ClInclude>
@ -518,6 +524,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>include\sodium</Filter>
</ClInclude>

View File

@ -180,6 +180,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -198,6 +199,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -243,6 +245,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -333,6 +333,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>crypto_core\hsalsa20\ref2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>crypto_core\ed25519</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>crypto_core\ed25519\ref10</Filter>
</ClCompile>
@ -383,6 +386,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h">
<Filter>include\sodium</Filter>
</ClInclude>
@ -518,6 +524,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>include\sodium</Filter>
</ClInclude>

View File

@ -180,6 +180,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -198,6 +199,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -243,6 +245,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -333,6 +333,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>crypto_core\hsalsa20\ref2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>crypto_core\ed25519</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>crypto_core\ed25519\ref10</Filter>
</ClCompile>
@ -383,6 +386,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h">
<Filter>include\sodium</Filter>
</ClInclude>
@ -518,6 +524,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>include\sodium</Filter>
</ClInclude>

View File

@ -180,6 +180,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -198,6 +199,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -243,6 +245,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -333,6 +333,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>crypto_core\hsalsa20\ref2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>crypto_core\ed25519</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>crypto_core\ed25519\ref10</Filter>
</ClCompile>
@ -383,6 +386,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h">
<Filter>include\sodium</Filter>
</ClInclude>
@ -518,6 +524,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>include\sodium</Filter>
</ClInclude>

View File

@ -180,6 +180,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -198,6 +199,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -243,6 +245,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -333,6 +333,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>crypto_core\hsalsa20\ref2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>crypto_core\ed25519</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>crypto_core\ed25519\ref10</Filter>
</ClCompile>
@ -383,6 +386,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\core.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\version.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\export.h">
<Filter>include\sodium</Filter>
</ClInclude>
@ -518,6 +524,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>include\sodium</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>include\sodium</Filter>
</ClInclude>

View File

@ -143,6 +143,8 @@ _crypto_box_secretkeybytes 1 1
_crypto_box_seed_keypair 1 1
_crypto_box_seedbytes 1 1
_crypto_box_zerobytes 0 1
_crypto_core_ed25519_add 0 1
_crypto_core_ed25519_sub 0 1
_crypto_core_hchacha20 1 1
_crypto_core_hchacha20_constbytes 1 1
_crypto_core_hchacha20_inputbytes 1 1

View File

@ -418,6 +418,7 @@
<ClCompile Include="src\libsodium\crypto_core\hchacha20\core_hchacha20.c" />
<ClCompile Include="src\libsodium\crypto_core\hsalsa20\core_hsalsa20.c" />
<ClCompile Include="src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c" />
<ClCompile Include="src\libsodium\crypto_core\ed25519\core_ed25519.c" />
<ClCompile Include="src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c" />
</ItemGroup>
<ItemGroup>
@ -436,6 +437,7 @@
<ClInclude Include="src\libsodium\include\sodium\crypto_core_hchacha20.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_hash_sha512.h" />
<ClInclude Include="src\libsodium\include\sodium\core.h" />
<ClInclude Include="src\libsodium\include\sodium\version.h" />
<ClInclude Include="src\libsodium\include\sodium\export.h" />
<ClInclude Include="src\libsodium\include\sodium\randombytes_salsa20_random.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_core_salsa20.h" />
@ -481,6 +483,7 @@
<ClInclude Include="src\libsodium\include\sodium\crypto_onetimeauth.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_verify_64.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_core_ed25519.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_pwhash_argon2i.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_generichash.h" />
<ClInclude Include="src\libsodium\include\sodium\crypto_secretbox_xsalsa20poly1305.h" />

View File

@ -324,6 +324,9 @@
<ClCompile Include="src\libsodium\crypto_core\hsalsa20\ref2\core_hsalsa20_ref2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\libsodium\crypto_core\ed25519\core_ed25519.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\libsodium\crypto_core\ed25519\ref10\ed25519_ref10.c">
<Filter>Source Files</Filter>
</ClCompile>
@ -374,6 +377,9 @@
<ClInclude Include="src\libsodium\include\sodium\core.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\libsodium\include\sodium\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\libsodium\include\sodium\export.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -509,6 +515,9 @@
<ClInclude Include="src\libsodium\include\sodium\crypto_box_curve25519xchacha20poly1305.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\libsodium\include\sodium\crypto_core_ed25519.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\libsodium\include\sodium\crypto_pwhash_argon2i.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -164,6 +164,7 @@ if !MINIMAL
libsodium_la_SOURCES += \
crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c \
crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c \
crypto_core/ed25519/core_ed25519.c \
crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c \
crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h \
crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c \

View File

@ -0,0 +1,44 @@
#include "crypto_core_ed25519.h"
#include "private/common.h"
#include "private/ed25519_ref10.h"
int
crypto_core_ed25519_add(unsigned char *r,
const unsigned char *p, const unsigned char *q)
{
ge25519_p3 p_p3, q_p3, r_p3;
ge25519_p1p1 r_p1p1;
ge25519_cached q_cached;
if (ge25519_frombytes(&p_p3, p) != 0 || ge25519_is_on_curve(&p_p3) == 0 ||
ge25519_frombytes(&q_p3, q) != 0 || ge25519_is_on_curve(&q_p3) == 0) {
return -1;
}
ge25519_p3_to_cached(&q_cached, &q_p3);
ge25519_add(&r_p1p1, &p_p3, &q_cached);
ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
ge25519_p3_tobytes(r, &r_p3);
return 0;
}
int
crypto_core_ed25519_sub(unsigned char *r,
const unsigned char *p, const unsigned char *q)
{
ge25519_p3 p_p3, q_p3, r_p3;
ge25519_p1p1 r_p1p1;
ge25519_cached q_cached;
if (ge25519_frombytes(&p_p3, p) != 0 || ge25519_is_on_curve(&p_p3) == 0 ||
ge25519_frombytes(&q_p3, q) != 0 || ge25519_is_on_curve(&q_p3) == 0) {
return -1;
}
ge25519_p3_to_cached(&q_cached, &q_p3);
ge25519_sub(&r_p1p1, &p_p3, &q_cached);
ge25519_p1p1_to_p3(&r_p3, &r_p1p1);
ge25519_p3_tobytes(r, &r_p3);
return 0;
}

View File

@ -375,7 +375,7 @@ ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
r = p
*/
static void
void
ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p)
{
fe25519_mul(r->X, p->X, p->T);
@ -569,7 +569,7 @@ ge25519_select_base(ge25519_precomp *t, const int pos, const signed char b)
r = p - q
*/
static void
void
ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q)
{
fe25519 t0;

View File

@ -12,6 +12,7 @@ SODIUM_EXPORT = \
sodium/crypto_box.h \
sodium/crypto_box_curve25519xchacha20poly1305.h \
sodium/crypto_box_curve25519xsalsa20poly1305.h \
sodium/crypto_core_ed25519.h \
sodium/crypto_core_hchacha20.h \
sodium/crypto_core_hsalsa20.h \
sodium/crypto_core_salsa20.h \

View File

@ -58,6 +58,7 @@
#ifndef SODIUM_LIBRARY_MINIMAL
# include "sodium/crypto_box_curve25519xchacha20poly1305.h"
# include "sodium/crypto_core_ed25519.h"
# include "sodium/crypto_scalarmult_ed25519.h"
# include "sodium/crypto_secretbox_xchacha20poly1305.h"
# include "sodium/crypto_pwhash_scryptsalsa208sha256.h"

View File

@ -0,0 +1,25 @@
#ifndef crypto_core_ed25519_H
#define crypto_core_ed25519_H
#include <stddef.h>
#include "export.h"
#ifdef __cplusplus
extern "C" {
#endif
SODIUM_EXPORT
int crypto_core_ed25519_add(unsigned char *r,
const unsigned char *p, const unsigned char *q);
SODIUM_EXPORT
int crypto_core_ed25519_sub(unsigned char *r,
const unsigned char *p, const unsigned char *q);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -85,8 +85,12 @@ void ge25519_p3_to_cached(ge25519_cached *r, const ge25519_p3 *p);
void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p);
void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p);
void ge25519_add(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q);
void ge25519_sub(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_cached *q);
void ge25519_scalarmult_base(ge25519_p3 *h, const unsigned char *a);
void ge25519_double_scalarmult_vartime(ge25519_p2 *r, const unsigned char *a,