refactor: remove poke_public_key() and dc_key_set_from_file() 🔥

This commit is contained in:
Lars-Magnus Skog
2019-05-03 12:47:24 +02:00
parent 95e1cc67b9
commit e65284ff9d
2 changed files with 0 additions and 145 deletions

View File

@@ -146,88 +146,6 @@ pub unsafe fn dc_key_set_from_base64(
mmap_string_unref(result);
return 1i32;
}
pub unsafe fn dc_key_set_from_file(
mut key: *mut dc_key_t,
mut pathNfilename: *const libc::c_char,
mut context: &dc_context_t,
) -> libc::c_int {
let mut current_block: u64;
let mut buf: *mut libc::c_char = 0 as *mut libc::c_char;
// just pointer inside buf, must not be freed
let mut headerline: *const libc::c_char = 0 as *const libc::c_char;
// - " -
let mut base64: *const libc::c_char = 0 as *const libc::c_char;
let mut buf_bytes: size_t = 0i32 as size_t;
let mut type_0: libc::c_int = -1i32;
let mut success: libc::c_int = 0i32;
dc_key_empty(key);
if !(key.is_null() || pathNfilename.is_null()) {
if !(0
== dc_read_file(
context,
pathNfilename,
&mut buf as *mut *mut libc::c_char as *mut *mut libc::c_void,
&mut buf_bytes,
)
|| buf_bytes < 50)
{
/* error is already loged */
if !(0
== dc_split_armored_data(
buf,
&mut headerline,
0 as *mut *const libc::c_char,
0 as *mut *const libc::c_char,
&mut base64,
)
|| headerline.is_null()
|| base64.is_null())
{
if strcmp(
headerline,
b"-----BEGIN PGP PUBLIC KEY BLOCK-----\x00" as *const u8 as *const libc::c_char,
) == 0i32
{
type_0 = 0i32;
current_block = 7149356873433890176;
} else if strcmp(
headerline,
b"-----BEGIN PGP PRIVATE KEY BLOCK-----\x00" as *const u8
as *const libc::c_char,
) == 0i32
{
type_0 = 1i32;
current_block = 7149356873433890176;
} else {
dc_log_warning(
context,
0i32,
b"Header missing for key \"%s\".\x00" as *const u8 as *const libc::c_char,
pathNfilename,
);
current_block = 7704194852291245876;
}
match current_block {
7704194852291245876 => {}
_ => {
if 0 == dc_key_set_from_base64(key, base64, type_0) {
dc_log_warning(
context,
0i32,
b"Bad data in key \"%s\".\x00" as *const u8 as *const libc::c_char,
pathNfilename,
);
} else {
success = 1i32
}
}
}
}
}
}
free(buf as *mut libc::c_void);
return success;
}
pub unsafe fn dc_key_equals(mut key: *const dc_key_t, mut o: *const dc_key_t) -> libc::c_int {
if key.is_null()
|| o.is_null()