Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions android/sync-crypto/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_sodium_arch("x86_64" "x86_64")
set(SODIUM_ARCH "${SODIUM_ARCH_${ANDROID_ABI}}")

add_library(sodium STATIC IMPORTED)
set_property(TARGET sodium PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../../../../../native_lib/third-party/android.${SODIUM_ARCH}/libsodium.so")
set_property(TARGET sodium PROPERTY IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/../../../../../native_lib/third-party/android.${SODIUM_ARCH}/libsodium.a")

add_library( # Sets the name of the library.
ddgcrypto
Expand All @@ -24,7 +24,10 @@ add_library( # Sets the name of the library.
../../../../../native_lib/DDGSyncCrypto.h
)
target_include_directories(ddgcrypto PRIVATE ${CMAKE_SOURCE_DIR}/../../../../../native_lib/third-party/android.${SODIUM_ARCH}/include)
target_link_libraries(ddgcrypto sodium)
target_link_libraries(ddgcrypto
-Wl,--whole-archive sodium -Wl,--no-whole-archive
)


# Make sure ddgcrypto is 16KB compatible
target_link_options(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef crypto_onetimeauth_poly1305_H
#define crypto_onetimeauth_poly1305_H

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
Expand Down
26 changes: 13 additions & 13 deletions native_lib/third-party/android.arm64-v8a/include/sodium/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,33 @@ int sodium_munlock(void * const addr, const size_t len)
* allocation functions.
*
* They return a pointer to a region filled with 0xd0 bytes, immediately
* followed by a guard page.
* As a result, accessing a single byte after the requested allocation size
* will intentionally trigger a segmentation fault.
* followed by a guard page. As a result, accessing a single byte after the
* requested allocation size will intentionally trigger a segmentation fault.
*
* A canary and an additional guard page placed before the beginning of the
* region may also kill the process if a buffer underflow is detected.
*
* The memory layout is:
* [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
* With the layout of the unprotected pages being:
*
* The layout of the unprotected pages is:
* [optional padding][16-bytes canary][user region]
*
* However:
* - These functions are significantly slower than standard functions
* - Each allocation requires 3 or 4 additional pages
* Important limitations:
* - These functions are significantly slower than standard allocation functions.
* - Each allocation requires 3 or 4 additional pages.
* - The returned address will not be aligned if the allocation size is not
* a multiple of the required alignment. For this reason, these functions
* are designed to store data, such as secret keys and messages.
* are designed to store data such as secret keys and messages.
*
* sodium_malloc() can be used to allocate any libsodium data structure.
*
* The crypto_generichash_state structure is packed and its length is
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to
* allocate a crypto_generichash_state structure, padding must be added in
* order to ensure proper alignment. crypto_generichash_statebytes()
* returns the rounded up structure size, and should be preferred to sizeof():
* state = sodium_malloc(crypto_generichash_statebytes());
* either 357 or 361 bytes. When using sodium_malloc() to allocate a
* crypto_generichash_state structure, padding must be added to ensure
* proper alignment. Use crypto_generichash_statebytes() rather than sizeof():
*
* state = sodium_malloc(crypto_generichash_statebytes());
*/

SODIUM_EXPORT
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion native_lib/third-party/android.armeabi-v7a/abi.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"abi":"armeabi-v7a","api":19,"ndk":25,"stl":"none"}
{"abi":"armeabi-v7a","api":21,"ndk":25,"stl":"none"}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef crypto_onetimeauth_poly1305_H
#define crypto_onetimeauth_poly1305_H

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
Expand Down
26 changes: 13 additions & 13 deletions native_lib/third-party/android.armeabi-v7a/include/sodium/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,33 @@ int sodium_munlock(void * const addr, const size_t len)
* allocation functions.
*
* They return a pointer to a region filled with 0xd0 bytes, immediately
* followed by a guard page.
* As a result, accessing a single byte after the requested allocation size
* will intentionally trigger a segmentation fault.
* followed by a guard page. As a result, accessing a single byte after the
* requested allocation size will intentionally trigger a segmentation fault.
*
* A canary and an additional guard page placed before the beginning of the
* region may also kill the process if a buffer underflow is detected.
*
* The memory layout is:
* [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
* With the layout of the unprotected pages being:
*
* The layout of the unprotected pages is:
* [optional padding][16-bytes canary][user region]
*
* However:
* - These functions are significantly slower than standard functions
* - Each allocation requires 3 or 4 additional pages
* Important limitations:
* - These functions are significantly slower than standard allocation functions.
* - Each allocation requires 3 or 4 additional pages.
* - The returned address will not be aligned if the allocation size is not
* a multiple of the required alignment. For this reason, these functions
* are designed to store data, such as secret keys and messages.
* are designed to store data such as secret keys and messages.
*
* sodium_malloc() can be used to allocate any libsodium data structure.
*
* The crypto_generichash_state structure is packed and its length is
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to
* allocate a crypto_generichash_state structure, padding must be added in
* order to ensure proper alignment. crypto_generichash_statebytes()
* returns the rounded up structure size, and should be preferred to sizeof():
* state = sodium_malloc(crypto_generichash_statebytes());
* either 357 or 361 bytes. When using sodium_malloc() to allocate a
* crypto_generichash_state structure, padding must be added to ensure
* proper alignment. Use crypto_generichash_statebytes() rather than sizeof():
*
* state = sodium_malloc(crypto_generichash_statebytes());
*/

SODIUM_EXPORT
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion native_lib/third-party/android.x86/abi.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"abi":"x86","api":19,"ndk":25,"stl":"none"}
{"abi":"x86","api":21,"ndk":25,"stl":"none"}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef crypto_onetimeauth_poly1305_H
#define crypto_onetimeauth_poly1305_H

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
Expand Down
26 changes: 13 additions & 13 deletions native_lib/third-party/android.x86/include/sodium/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,33 @@ int sodium_munlock(void * const addr, const size_t len)
* allocation functions.
*
* They return a pointer to a region filled with 0xd0 bytes, immediately
* followed by a guard page.
* As a result, accessing a single byte after the requested allocation size
* will intentionally trigger a segmentation fault.
* followed by a guard page. As a result, accessing a single byte after the
* requested allocation size will intentionally trigger a segmentation fault.
*
* A canary and an additional guard page placed before the beginning of the
* region may also kill the process if a buffer underflow is detected.
*
* The memory layout is:
* [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
* With the layout of the unprotected pages being:
*
* The layout of the unprotected pages is:
* [optional padding][16-bytes canary][user region]
*
* However:
* - These functions are significantly slower than standard functions
* - Each allocation requires 3 or 4 additional pages
* Important limitations:
* - These functions are significantly slower than standard allocation functions.
* - Each allocation requires 3 or 4 additional pages.
* - The returned address will not be aligned if the allocation size is not
* a multiple of the required alignment. For this reason, these functions
* are designed to store data, such as secret keys and messages.
* are designed to store data such as secret keys and messages.
*
* sodium_malloc() can be used to allocate any libsodium data structure.
*
* The crypto_generichash_state structure is packed and its length is
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to
* allocate a crypto_generichash_state structure, padding must be added in
* order to ensure proper alignment. crypto_generichash_statebytes()
* returns the rounded up structure size, and should be preferred to sizeof():
* state = sodium_malloc(crypto_generichash_statebytes());
* either 357 or 361 bytes. When using sodium_malloc() to allocate a
* crypto_generichash_state structure, padding must be added to ensure
* proper alignment. Use crypto_generichash_statebytes() rather than sizeof():
*
* state = sodium_malloc(crypto_generichash_statebytes());
*/

SODIUM_EXPORT
Expand Down
Binary file added native_lib/third-party/android.x86/libsodium.a
Binary file not shown.
Binary file removed native_lib/third-party/android.x86/libsodium.so
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef crypto_onetimeauth_poly1305_H
#define crypto_onetimeauth_poly1305_H

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
Expand Down
26 changes: 13 additions & 13 deletions native_lib/third-party/android.x86_64/include/sodium/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,33 @@ int sodium_munlock(void * const addr, const size_t len)
* allocation functions.
*
* They return a pointer to a region filled with 0xd0 bytes, immediately
* followed by a guard page.
* As a result, accessing a single byte after the requested allocation size
* will intentionally trigger a segmentation fault.
* followed by a guard page. As a result, accessing a single byte after the
* requested allocation size will intentionally trigger a segmentation fault.
*
* A canary and an additional guard page placed before the beginning of the
* region may also kill the process if a buffer underflow is detected.
*
* The memory layout is:
* [unprotected region size (read only)][guard page (no access)][unprotected pages (read/write)][guard page (no access)]
* With the layout of the unprotected pages being:
*
* The layout of the unprotected pages is:
* [optional padding][16-bytes canary][user region]
*
* However:
* - These functions are significantly slower than standard functions
* - Each allocation requires 3 or 4 additional pages
* Important limitations:
* - These functions are significantly slower than standard allocation functions.
* - Each allocation requires 3 or 4 additional pages.
* - The returned address will not be aligned if the allocation size is not
* a multiple of the required alignment. For this reason, these functions
* are designed to store data, such as secret keys and messages.
* are designed to store data such as secret keys and messages.
*
* sodium_malloc() can be used to allocate any libsodium data structure.
*
* The crypto_generichash_state structure is packed and its length is
* either 357 or 361 bytes. For this reason, when using sodium_malloc() to
* allocate a crypto_generichash_state structure, padding must be added in
* order to ensure proper alignment. crypto_generichash_statebytes()
* returns the rounded up structure size, and should be preferred to sizeof():
* state = sodium_malloc(crypto_generichash_statebytes());
* either 357 or 361 bytes. When using sodium_malloc() to allocate a
* crypto_generichash_state structure, padding must be added to ensure
* proper alignment. Use crypto_generichash_statebytes() rather than sizeof():
*
* state = sodium_malloc(crypto_generichash_statebytes());
*/

SODIUM_EXPORT
Expand Down
Binary file not shown.
Binary file removed native_lib/third-party/android.x86_64/libsodium.so
Binary file not shown.
Loading