Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/aitor/16kb compatible #19

Merged
merged 2 commits into from
Jan 14, 2025
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
5 changes: 4 additions & 1 deletion android/sync-crypto/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ 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 sodium)

# Make sure ddgcrypto is 16KB compatible
target_link_options(ddgcrypto PRIVATE "-Wl,-z,max-page-size=16384")
4 changes: 2 additions & 2 deletions native_lib/third-party/android.arm64-v8a/include/sodium.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "sodium/crypto_hash_sha256.h"
#include "sodium/crypto_hash_sha512.h"
#include "sodium/crypto_kdf.h"
#include "sodium/crypto_kdf_hkdf_sha256.h"
#include "sodium/crypto_kdf_hkdf_sha512.h"
#include "sodium/crypto_kdf_blake2b.h"
#include "sodium/crypto_kx.h"
#include "sodium/crypto_onetimeauth.h"
Expand Down Expand Up @@ -59,8 +61,6 @@
# include "sodium/crypto_box_curve25519xchacha20poly1305.h"
# include "sodium/crypto_core_ed25519.h"
# include "sodium/crypto_core_ristretto255.h"
# include "sodium/crypto_kdf_hkdf_sha256.h"
# include "sodium/crypto_kdf_hkdf_sha512.h"
# include "sodium/crypto_scalarmult_ed25519.h"
# include "sodium/crypto_scalarmult_ristretto255.h"
# include "sodium/crypto_secretbox_xchacha20poly1305.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#define crypto_aead_aegis128l_H

#include <stddef.h>

#include "export.h"

#ifdef __cplusplus
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wlong-long"
#endif
extern "C" {
#endif

Expand All @@ -23,68 +24,66 @@ size_t crypto_aead_aegis128l_nsecbytes(void);
SODIUM_EXPORT
size_t crypto_aead_aegis128l_npubbytes(void);

#define crypto_aead_aegis128l_ABYTES 16U
#define crypto_aead_aegis128l_ABYTES 32U
SODIUM_EXPORT
size_t crypto_aead_aegis128l_abytes(void);

#define crypto_aead_aegis128l_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis128l_ABYTES, \
(1ULL << 61) - 1)
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis128l_ABYTES, (1ULL << 61) - 1)
SODIUM_EXPORT
size_t crypto_aead_aegis128l_messagebytes_max(void);

SODIUM_EXPORT
int crypto_aead_aegis128l_encrypt(unsigned char *c,
unsigned long long *clen_p,
int crypto_aead_aegis128l_encrypt(unsigned char *c,
unsigned long long *clen_p,
const unsigned char *m,
unsigned long long mlen,
unsigned long long mlen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((nonnull(1, 8, 9)));
const unsigned char *k) __attribute__((nonnull(1, 8, 9)));

SODIUM_EXPORT
int crypto_aead_aegis128l_decrypt(unsigned char *m,
unsigned long long *mlen_p,
unsigned char *nsec,
int crypto_aead_aegis128l_decrypt(unsigned char *m,
unsigned long long *mlen_p,
unsigned char *nsec,
const unsigned char *c,
unsigned long long clen,
unsigned long long clen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
const unsigned char *k) __attribute__((warn_unused_result))
__attribute__((nonnull(4, 8, 9)));

SODIUM_EXPORT
int crypto_aead_aegis128l_encrypt_detached(unsigned char *c,
unsigned char *mac,
unsigned long long *maclen_p,
int crypto_aead_aegis128l_encrypt_detached(unsigned char *c,
unsigned char *mac,
unsigned long long *maclen_p,
const unsigned char *m,
unsigned long long mlen,
unsigned long long mlen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((nonnull(1, 2, 9, 10)));
__attribute__((nonnull(1, 2, 9, 10)));

SODIUM_EXPORT
int crypto_aead_aegis128l_decrypt_detached(unsigned char *m,
unsigned char *nsec,
int crypto_aead_aegis128l_decrypt_detached(unsigned char *m,
unsigned char *nsec,
const unsigned char *c,
unsigned long long clen,
unsigned long long clen,
const unsigned char *mac,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
__attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));

SODIUM_EXPORT
void crypto_aead_aegis128l_keygen(unsigned char k[crypto_aead_aegis128l_KEYBYTES])
__attribute__ ((nonnull));
__attribute__((nonnull));

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
#define crypto_aead_aegis256_H

#include <stddef.h>

#include "export.h"

#ifdef __cplusplus
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wlong-long"
#endif
extern "C" {
#endif

#define crypto_aead_aegis256_KEYBYTES 32U
#define crypto_aead_aegis256_KEYBYTES 32U
SODIUM_EXPORT
size_t crypto_aead_aegis256_keybytes(void);

Expand All @@ -23,68 +24,66 @@ size_t crypto_aead_aegis256_nsecbytes(void);
SODIUM_EXPORT
size_t crypto_aead_aegis256_npubbytes(void);

#define crypto_aead_aegis256_ABYTES 16U
#define crypto_aead_aegis256_ABYTES 32U
SODIUM_EXPORT
size_t crypto_aead_aegis256_abytes(void);

#define crypto_aead_aegis256_MESSAGEBYTES_MAX \
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis256_ABYTES, \
(1ULL << 61) - 1)
SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aegis256_ABYTES, (1ULL << 61) - 1)
SODIUM_EXPORT
size_t crypto_aead_aegis256_messagebytes_max(void);

SODIUM_EXPORT
int crypto_aead_aegis256_encrypt(unsigned char *c,
unsigned long long *clen_p,
int crypto_aead_aegis256_encrypt(unsigned char *c,
unsigned long long *clen_p,
const unsigned char *m,
unsigned long long mlen,
unsigned long long mlen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((nonnull(1, 8, 9)));
const unsigned char *k) __attribute__((nonnull(1, 8, 9)));

SODIUM_EXPORT
int crypto_aead_aegis256_decrypt(unsigned char *m,
unsigned long long *mlen_p,
unsigned char *nsec,
int crypto_aead_aegis256_decrypt(unsigned char *m,
unsigned long long *mlen_p,
unsigned char *nsec,
const unsigned char *c,
unsigned long long clen,
unsigned long long clen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(4, 8, 9)));
const unsigned char *k) __attribute__((warn_unused_result))
__attribute__((nonnull(4, 8, 9)));

SODIUM_EXPORT
int crypto_aead_aegis256_encrypt_detached(unsigned char *c,
unsigned char *mac,
unsigned long long *maclen_p,
int crypto_aead_aegis256_encrypt_detached(unsigned char *c,
unsigned char *mac,
unsigned long long *maclen_p,
const unsigned char *m,
unsigned long long mlen,
unsigned long long mlen,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *nsec,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((nonnull(1, 2, 9, 10)));
__attribute__((nonnull(1, 2, 9, 10)));

SODIUM_EXPORT
int crypto_aead_aegis256_decrypt_detached(unsigned char *m,
unsigned char *nsec,
int crypto_aead_aegis256_decrypt_detached(unsigned char *m,
unsigned char *nsec,
const unsigned char *c,
unsigned long long clen,
unsigned long long clen,
const unsigned char *mac,
const unsigned char *ad,
unsigned long long adlen,
unsigned long long adlen,
const unsigned char *npub,
const unsigned char *k)
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull(3, 5, 8, 9)));
__attribute__((warn_unused_result)) __attribute__((nonnull(3, 5, 8, 9)));

SODIUM_EXPORT
void crypto_aead_aegis256_keygen(unsigned char k[crypto_aead_aegis256_KEYBYTES])
__attribute__ ((nonnull));
__attribute__((nonnull));

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#ifndef crypto_onetimeauth_poly1305_H
#define crypto_onetimeauth_poly1305_H

#ifdef __cplusplus
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
extern "C" {
#endif

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -16,6 +9,13 @@ extern "C" {

#include "export.h"

#ifdef __cplusplus
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
extern "C" {
#endif

typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
unsigned char opaque[256];
} crypto_onetimeauth_poly1305_state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int crypto_pwhash_str_needs_rehash(const char *str,
unsigned long long opslimit, size_t memlimit)
__attribute__ ((warn_unused_result)) __attribute__ ((nonnull));

#define crypto_pwhash_PRIMITIVE "argon2i"
#define crypto_pwhash_PRIMITIVE "argon2id,argon2i"
SODIUM_EXPORT
const char *crypto_pwhash_primitive(void)
__attribute__ ((warn_unused_result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "export.h"

#define SODIUM_VERSION_STRING "1.0.18"
#define SODIUM_VERSION_STRING "1.0.21"

#define SODIUM_LIBRARY_VERSION_MAJOR 11
#define SODIUM_LIBRARY_VERSION_MAJOR 28
#define SODIUM_LIBRARY_VERSION_MINOR 0


Expand Down
Binary file modified native_lib/third-party/android.arm64-v8a/libsodium.so
Binary file not shown.
4 changes: 2 additions & 2 deletions native_lib/third-party/android.armeabi-v7a/include/sodium.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "sodium/crypto_hash_sha256.h"
#include "sodium/crypto_hash_sha512.h"
#include "sodium/crypto_kdf.h"
#include "sodium/crypto_kdf_hkdf_sha256.h"
#include "sodium/crypto_kdf_hkdf_sha512.h"
#include "sodium/crypto_kdf_blake2b.h"
#include "sodium/crypto_kx.h"
#include "sodium/crypto_onetimeauth.h"
Expand Down Expand Up @@ -59,8 +61,6 @@
# include "sodium/crypto_box_curve25519xchacha20poly1305.h"
# include "sodium/crypto_core_ed25519.h"
# include "sodium/crypto_core_ristretto255.h"
# include "sodium/crypto_kdf_hkdf_sha256.h"
# include "sodium/crypto_kdf_hkdf_sha512.h"
# include "sodium/crypto_scalarmult_ed25519.h"
# include "sodium/crypto_scalarmult_ristretto255.h"
# include "sodium/crypto_secretbox_xchacha20poly1305.h"
Expand Down
Loading
Loading