2019-02-08 16:37:02 +00:00
|
|
|
#pragma once
|
2019-02-08 13:28:39 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
2019-02-08 16:37:02 +00:00
|
|
|
#include <string.h>
|
2019-02-08 13:28:39 +00:00
|
|
|
|
2019-02-11 08:53:00 +00:00
|
|
|
struct keypair {
|
|
|
|
char* priv;
|
|
|
|
char* pub;
|
|
|
|
};
|
|
|
|
|
2019-02-08 13:28:39 +00:00
|
|
|
struct tor_os_str {
|
|
|
|
size_t filled;
|
|
|
|
size_t size;
|
2019-02-11 08:53:00 +00:00
|
|
|
char* pub_file;
|
|
|
|
char* priv_file;
|
|
|
|
struct keypair *keys;
|
2019-02-08 13:28:39 +00:00
|
|
|
};
|
|
|
|
|
2019-02-11 08:53:00 +00:00
|
|
|
void tor_os_create(struct tor_os_str* os, char* pub_file, char* priv_file, size_t size);
|
|
|
|
struct keypair* tor_os_append_cursor(struct tor_os_str* os);
|
|
|
|
int tor_os_append(struct tor_os_str* os, char* pub, char* priv);
|
2019-02-08 16:37:02 +00:00
|
|
|
void tor_os_read (struct tor_os_str* os);
|
|
|
|
void tor_os_persist(struct tor_os_str* os);
|
2019-02-08 13:28:39 +00:00
|
|
|
void tor_os_free(struct tor_os_str* os);
|