Skip to content

Commit

Permalink
Merge pull request #69 from 1984not-GmbH/develop
Browse files Browse the repository at this point in the history
Merge develop into master for the first pre-alpha release
  • Loading branch information
FSMaxB authored Jul 3, 2016
2 parents dc3a61e + 1e0b6cd commit f281d01
Show file tree
Hide file tree
Showing 84 changed files with 2,886 additions and 2,219 deletions.
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ISC License

Copyright (C) 2015-2016 1984not Security GmbH
Author: Max Bruckner (FSMaxB)

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
502 changes: 0 additions & 502 deletions LICENSE.txt

This file was deleted.

20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,22 @@ Take a look at the file `CONTRIBUTING`. And look for GitHub Issues with the `hel

license
-------
This library is licensed under the LGPLv2.1.
This library is licensed under the ISC license.

> ISC License
>
> Copyright (C) 2015-2016 1984not Security GmbH
>
> Author: Max Bruckner (FSMaxB)
>
> Permission to use, copy, modify, and/or distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
68 changes: 44 additions & 24 deletions bindings/base64.lua
Original file line number Diff line number Diff line change
@@ -1,38 +1,58 @@
-- Base64-encoding
-- Sourced from http://en.wikipedia.org/wiki/Base64
--
-- Copyright (c) 2012, Daniel Lindsley
-- All rights reserved.
--
-- Modified by: Max Bruckner (FSMaxB)
-- Changes to the original:
-- * remove unnecessary "require"
-- * remove __ attributes
-- * rename "to_base64" -> "encode" and "from_base64" -> "decode"
-- * make it a loadable module via require
-- * fix use of the modulo operator (math.mod -> %)
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- ISC License
--
-- Copyright (C) 2015-2016 1984not Security GmbH
-- Author: Max Bruckner (FSMaxB)
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--
--
-- * Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
-- * Neither the name of the base64 nor the names of its contributors may be
-- used to endorse or promote products derived from this software without
-- specific prior written permission.
-- This file incorporates work covered by the following license notice:
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- | Copyright (c) 2012, Daniel Lindsley
-- | All rights reserved.
-- |
-- | Redistribution and use in source and binary forms, with or without
-- | modification, are permitted provided that the following conditions are met:
-- |
-- | * Redistributions of source code must retain the above copyright notice, this
-- | list of conditions and the following disclaimer.
-- | * Redistributions in binary form must reproduce the above copyright notice,
-- | this list of conditions and the following disclaimer in the documentation
-- | and/or other materials provided with the distribution.
-- | * Neither the name of the base64 nor the names of its contributors may be
-- | used to endorse or promote products derived from this software without
-- | specific prior written permission.
-- |
-- | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-- | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

local base64 = {}

Expand Down
147 changes: 100 additions & 47 deletions bindings/molch.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/*
* Molch, an implementation of the axolotl ratchet based on libsodium
*
* ISC License
*
* Copyright (C) 2015-2016 1984not Security GmbH
* Author: Max Bruckner (FSMaxB)
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

%module molch

%{
Expand Down Expand Up @@ -75,23 +96,30 @@ extern void sodium_free(void *);

extern return_status molch_create_user(
unsigned char *const public_master_key,
const size_t public_master_key_length,
unsigned char **const prekey_list,
size_t *const prekey_list_length,
unsigned char * backup_key,
const size_t backup_key_length,
unsigned char **const backup,
size_t *const backup_length,
const unsigned char *const random_data,
const size_t random_data_length,
unsigned char **const json_export,
size_t *const json_export_length
const size_t random_data_length
);

extern return_status molch_destroy_user(
const unsigned char *const public_signing_key,
unsigned char **const json_export,
size_t *const json_export_length
const unsigned char *const public_master_key,
const size_t public_master_key_length,
unsigned char **const backup,
size_t *const backup_length
);

extern size_t molch_user_count();

extern return_status molch_user_list(unsigned char **const user_list, size_t *count);
extern return_status molch_list_users(
unsigned char **const user_list,
size_t * const user_list_length,
size_t * count);

extern void molch_destroy_all_users();

Expand All @@ -101,87 +129,112 @@ extern molch_message_type molch_get_message_type(
const unsigned char * const packet,
const size_t packet_length);

extern return_status molch_create_send_conversation(
extern return_status molch_start_send_conversation(
unsigned char * const conversation_id,
const size_t conversation_id_length,
unsigned char ** const packet,
size_t *packet_length,
const unsigned char * const message,
const size_t message_length,
const unsigned char * const sender_public_master_key,
const size_t sender_public_master_key_length,
const unsigned char * const receiver_public_master_key,
const size_t receiver_public_master_key_length,
const unsigned char * const prekey_list,
const size_t prekey_list_length,
const unsigned char * const sender_public_signing_key,
const unsigned char * const receiver_public_signing_key,
unsigned char ** const json_export,
size_t * const json_export_length
const unsigned char * const message,
const size_t message_length,
unsigned char ** const backup,
size_t * const backup_length
);

extern return_status molch_create_receive_conversation(
extern return_status molch_start_receive_conversation(
unsigned char * const conversation_id,
const size_t conversation_id_length,
unsigned char ** const message,
size_t * const message_length,
const unsigned char * const packet,
const size_t packet_length,
unsigned char ** const prekey_list,
size_t * const prekey_list_length,
const unsigned char * const sender_public_signing_key,
const unsigned char * const receiver_public_signing_key,
unsigned char ** const json_export,
size_t * const json_export_length
const unsigned char * const receiver_public_master_key,
const size_t receiver_public_master_key_length,
const unsigned char * const sender_public_master_key,
const size_t sender_public_master_key_length,
const unsigned char * const packet,
const size_t packet_length,
unsigned char ** const backup,
size_t * const backup_length
);

extern return_status molch_encrypt_message(
unsigned char ** const packet,
size_t *packet_length,
const unsigned char * const conversation_id,
const size_t conversation_id_length,
const unsigned char * const message,
const size_t message_length,
const unsigned char * const conversation_id,
unsigned char ** const json_export_conversation,
size_t * const json_export_conversation_length
unsigned char ** const backup,
size_t * const backup_length
);

extern return_status molch_decrypt_message(
unsigned char ** const message,
size_t *message_length,
const unsigned char * const packet,
const size_t packet_length,
const unsigned char * const conversation_id,
uint32_t * const receive_message_number,
uint32_t * const previous_receive_message_number,
unsigned char ** const json_export_conversation,
size_t * const json_export_conversation_length
const unsigned char * const conversation_id,
const size_t conversation_id_length,
const unsigned char * const packet,
const size_t packet_length,
unsigned char ** const backup,
size_t * const backup_length
);

extern void molch_end_conversation(
const unsigned char * const conversation_id,
unsigned char ** const json_export,
size_t * const json_export_length
const size_t conversation_id_length,
unsigned char ** const backup,
size_t * const backup_length
);

extern return_status molch_list_conversations(
const unsigned char * const user_public_signing_key,
unsigned char ** const conversation_list,
size_t *number);
size_t * const conversation_list_length,
size_t * const number,
const unsigned char * const user_public_master_key,
const size_t user_public_master_key_length);

extern char *molch_print_status(return_status status, size_t * const output_length);
extern char *molch_print_status(size_t * const output_length, return_status status);

extern const char *molch_print_status_type(status_type type);

extern void molch_destroy_return_status(return_status * const status);

extern return_status molch_conversation_json_export(
unsigned char ** const json,
extern return_status molch_conversation_export(
unsigned char ** const backup,
size_t * const backup_length,
const unsigned char * const conversation_id,
size_t * const length);

extern return_status molch_json_export(
unsigned char ** const json,
size_t *length);

extern return_status molch_conversation_json_import(const unsigned char * const json, const size_t length);

extern return_status molch_json_import(const unsigned char* const json, const size_t length);
const size_t conversation_id_length);

extern return_status molch_export(unsigned char ** const backup, size_t *backup_length);

extern return_status molch_conversation_import(
unsigned char * new_backup_key,
const size_t new_backup_key_length,
const unsigned char * const backup,
const size_t backup_length,
const unsigned char * backup_key,
const size_t backup_key);

return_status molch_import(
unsigned char * const new_backup_key,
const size_t new_backup_key_length,
unsigned char * const backup,
const size_t backup_length,
const unsigned char * const backup_key,
const size_t backup_key_length);

extern return_status molch_get_prekey_list(
unsigned char * const public_signing_key,
unsigned char ** const prekey_list,
size_t * const prekey_list_length);
size_t * const prekey_list_length,
unsigned char * const public_master_key,
const size_t public_master_key_length);

extern return_status molch_update_backup_key(unsigned char * const new_key, const size_t new_key_length);
Loading

0 comments on commit f281d01

Please sign in to comment.