Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
fc2e9efe
Commit
fc2e9efe
authored
Feb 21, 2017
by
Sylvain Berfini
🎩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved IM encryption engine API doc + added error log when invalid read
parent
29b27b75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
coreapi/chat_file_transfer.c
coreapi/chat_file_transfer.c
+6
-1
include/linphone/im_encryption_engine.h
include/linphone/im_encryption_engine.h
+6
-6
No files found.
coreapi/chat_file_transfer.c
View file @
fc2e9efe
...
...
@@ -134,9 +134,14 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
LinphoneImEncryptionEngineCbs
*
imee_cbs
=
linphone_im_encryption_engine_get_callbacks
(
imee
);
LinphoneImEncryptionEngineCbsUploadingFileCb
cb_process_uploading_file
=
linphone_im_encryption_engine_cbs_get_process_uploading_file
(
imee_cbs
);
if
(
cb_process_uploading_file
)
{
uint8_t
*
encrypted_buffer
=
(
uint8_t
*
)
ms_malloc0
(
*
size
);
size_t
max_size
=
*
size
;
uint8_t
*
encrypted_buffer
=
(
uint8_t
*
)
ms_malloc0
(
max_size
);
retval
=
cb_process_uploading_file
(
imee
,
msg
,
offset
,
(
const
uint8_t
*
)
buffer
,
size
,
encrypted_buffer
);
if
(
retval
==
0
)
{
if
(
*
size
>
max_size
)
{
ms_error
(
"IM encryption engine process upload file callback returned a size bigger than the size of the buffer, so it will be truncated !"
);
*
size
=
max_size
;
}
memcpy
(
buffer
,
encrypted_buffer
,
*
size
);
}
ms_free
(
encrypted_buffer
);
...
...
include/linphone/im_encryption_engine.h
View file @
fc2e9efe
...
...
@@ -67,9 +67,9 @@ typedef void (*LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb)(LinphoneI
* @param engine LinphoneImEncryptionEngine object
* @param msg LinphoneChatMessage object
* @param offset The current offset of the upload
* @param buffer Encrypted data buffer
* @param size Size of the encrypted data buffer
* @param decrypted_buffer Buffer in which to write the decrypted data
* @param
[in]
buffer Encrypted data buffer
* @param
[in]
size Size of the encrypted data buffer
and maximum size of the decrypted data buffer
* @param
[out]
decrypted_buffer Buffer in which to write the decrypted data
which maximum size is size
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
*/
typedef
int
(
*
LinphoneImEncryptionEngineCbsDownloadingFileCb
)(
LinphoneImEncryptionEngine
*
engine
,
LinphoneChatMessage
*
msg
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
size
,
uint8_t
*
decrypted_buffer
);
...
...
@@ -79,9 +79,9 @@ typedef int (*LinphoneImEncryptionEngineCbsDownloadingFileCb)(LinphoneImEncrypti
* @param engine LinphoneImEncryptionEngine object
* @param msg LinphoneChatMessage object
* @param offset The current offset of the upload
* @param buffer Encrypted data buffer
* @param size Size of the plain data buffer and the size of the encrypted data buffer once encryption is done
* @param encrypted_buffer Buffer in which to write the encrypted data
* @param
[in]
buffer Encrypted data buffer
* @param
[in,out]
size Size of the plain data buffer and the size of the encrypted data buffer once encryption is done
* @param
[out]
encrypted_buffer Buffer in which to write the encrypted data
which maxmimum size is size
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
*/
typedef
int
(
*
LinphoneImEncryptionEngineCbsUploadingFileCb
)(
LinphoneImEncryptionEngine
*
engine
,
LinphoneChatMessage
*
msg
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
*
size
,
uint8_t
*
encrypted_buffer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment