mirror of https://git.wownero.com/dsc/mxe.git
commit
4e7f2b570c
|
@ -3,74 +3,54 @@
|
|||
*/
|
||||
|
||||
#include <signal_protocol.h>
|
||||
#include <key_helper.h>
|
||||
#include <session_builder.h>
|
||||
#include <session_cipher.h>
|
||||
#include <protocol.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
// Library initialization
|
||||
printf("Beginning of test...\\n");
|
||||
printf("0\\n");
|
||||
|
||||
signal_context *global_context = NULL;
|
||||
result = signal_context_create(&global_context, NULL);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
// Client install time
|
||||
|
||||
uint32_t registration_id = 0;
|
||||
result = signal_protocol_key_helper_generate_registration_id(®istration_id, 0, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("registration_id = %i\n", registration_id);
|
||||
fflush(stdout);
|
||||
|
||||
ratchet_identity_key_pair *identity_key_pair = NULL;
|
||||
result = signal_protocol_key_helper_generate_identity_key_pair(&identity_key_pair, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
signal_protocol_key_helper_pre_key_list_node *pre_keys_head = NULL;
|
||||
result = signal_protocol_key_helper_generate_pre_keys(&pre_keys_head, 13, 100, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
session_signed_pre_key *signed_pre_key = NULL;
|
||||
result = signal_protocol_key_helper_generate_signed_pre_key(&signed_pre_key, identity_key_pair, 5, 1482458501, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
// Create the data store context, and add all the callbacks to it
|
||||
printf("1\\n");
|
||||
|
||||
signal_protocol_store_context *store_context = NULL;
|
||||
result = signal_protocol_store_context_create(&store_context, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("2\\n");
|
||||
|
||||
signal_protocol_session_store session_store = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
result = signal_protocol_store_context_set_session_store(store_context, &session_store);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("3\\n");
|
||||
|
||||
signal_protocol_pre_key_store pre_key_store = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
result = signal_protocol_store_context_set_pre_key_store(store_context, &pre_key_store);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("4\\n");
|
||||
|
||||
signal_protocol_signed_pre_key_store signed_pre_key_store = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
result = signal_protocol_store_context_set_signed_pre_key_store(store_context, &signed_pre_key_store);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("5\\n");
|
||||
|
||||
signal_protocol_identity_key_store identity_key_store = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
result = signal_protocol_store_context_set_identity_key_store(store_context, &identity_key_store);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
// Instantiate a session_builder for a recipient address
|
||||
printf("6\\n");
|
||||
|
||||
signal_protocol_address address = {
|
||||
"+14159998888", 12, 1
|
||||
|
@ -78,31 +58,17 @@ int main(void)
|
|||
session_builder *builder = NULL;
|
||||
result = session_builder_create(&builder, store_context, &address, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
// Create the session cipher and encrypt the message
|
||||
printf("7\\n");
|
||||
|
||||
session_cipher *cipher = NULL;
|
||||
result = session_cipher_create(&cipher, store_context, &address, global_context);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
printf("8\\n");
|
||||
|
||||
const char *message = "Kill all humans!!!11100...........";
|
||||
const size_t message_len = strlen(message);
|
||||
ciphertext_message *encrypted_message = NULL;
|
||||
result = session_cipher_encrypt(cipher, (uint8_t*)message, message_len, &encrypted_message);
|
||||
if (result != SG_SUCCESS) return 1;
|
||||
|
||||
// Get the serialized content and deliver it
|
||||
|
||||
signal_buffer *serialized = ciphertext_message_get_serialized(encrypted_message);
|
||||
printf("message:\n%.*s\n", (int)signal_buffer_len(serialized), signal_buffer_data(serialized));
|
||||
fflush(stdout);
|
||||
|
||||
// Cleanup
|
||||
|
||||
SIGNAL_UNREF(encrypted_message);
|
||||
session_cipher_free(cipher);
|
||||
session_builder_free(builder);
|
||||
signal_protocol_store_context_destroy(store_context);
|
||||
printf("9\\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ PKG := libsignal-protocol-c
|
|||
$(PKG)_WEBSITE := https://github.com/signalapp/libsignal-protocol-c
|
||||
$(PKG)_DESCR := libsignal-protocol-c
|
||||
$(PKG)_IGNORE :=
|
||||
$(PKG)_VERSION := 9e10362
|
||||
$(PKG)_CHECKSUM := 05a6161cca61e16679fe189039b3cdebe26ed7ee8414d59afdc60363f46fb8fe
|
||||
$(PKG)_GH_CONF := signalapp/libsignal-protocol-c/branches/master
|
||||
$(PKG)_VERSION := 2.3.2
|
||||
$(PKG)_CHECKSUM := f3826f3045352e14027611c95449bfcfe39bfd3d093d578c70f70eee0c85000d
|
||||
$(PKG)_GH_CONF := signalapp/libsignal-protocol-c/tags, v
|
||||
$(PKG)_DEPS := cc pthreads
|
||||
|
||||
define $(PKG)_BUILD
|
||||
|
@ -16,7 +16,7 @@ define $(PKG)_BUILD
|
|||
$(MAKE) -C '$(BUILD_DIR)' -j 1 install VERBOSE=1
|
||||
|
||||
'$(TARGET)-gcc' \
|
||||
-W -Wall -Werror -pedantic -std=c99 \
|
||||
-W -Wall -Werror -pedantic \
|
||||
'$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-libsignal-protocol-c.exe' \
|
||||
`'$(TARGET)-pkg-config' libsignal-protocol-c --cflags --libs`
|
||||
endef
|
||||
|
|
|
@ -4,8 +4,8 @@ PKG := qtkeychain
|
|||
$(PKG)_WEBSITE := https://github.com/frankosterfeld/qtkeychain
|
||||
$(PKG)_DESCR := QtKeychain
|
||||
$(PKG)_IGNORE :=
|
||||
$(PKG)_VERSION := 0.9.0
|
||||
$(PKG)_CHECKSUM := 0935e5eb67fbed0b2db5e74ea8cbd667c6be6eed3767f212eac6ac318ab8a6fc
|
||||
$(PKG)_VERSION := 0.9.1
|
||||
$(PKG)_CHECKSUM := 9c2762d9d0759a65cdb80106d547db83c6e9fdea66f1973c6e9014f867c6f28e
|
||||
$(PKG)_GH_CONF := frankosterfeld/qtkeychain/tags,v
|
||||
$(PKG)_DEPS := cc qttools
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ PKG := tidy-html5
|
|||
$(PKG)_WEBSITE := https://www.html-tidy.org/
|
||||
$(PKG)_DESCR := HTML/XML syntax checker and reformatter
|
||||
$(PKG)_IGNORE :=
|
||||
$(PKG)_VERSION := 5.4.0
|
||||
$(PKG)_CHECKSUM := a2d754b7349982e33f12d798780316c047a3b264240dc6bbd4641542e57a0b7a
|
||||
$(PKG)_VERSION := 5.6.0
|
||||
$(PKG)_CHECKSUM := 08a63bba3d9e7618d1570b4ecd6a7daa83c8e18a41c82455b6308bc11fe34958
|
||||
$(PKG)_GH_CONF := htacg/tidy-html5/tags
|
||||
$(PKG)_DEPS := cc
|
||||
|
||||
|
|
Loading…
Reference in New Issue