Skip to content

Commit 7e2b47d

Browse files
committed
molch_import: initialize libsodium
1 parent 4fc876f commit 7e2b47d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/molch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,12 @@ return_status molch_import(
14591459
throw(INCORRECT_BUFFER_SIZE, "New backup key has an incorrect length.");
14601460
}
14611461

1462+
if (users == NULL) {
1463+
if (sodium_init() == -1) {
1464+
throw(INIT_ERROR, "Failed to init libsodium.");
1465+
}
1466+
}
1467+
14621468
//unpack the encrypted backup
14631469
encrypted_backup_struct = encrypted_backup__unpack(&protobuf_c_allocators, backup_length, backup);
14641470
if (encrypted_backup_struct == NULL) {

0 commit comments

Comments
 (0)