2015-07-31 11:21:34 -04:00
|
|
|
/* Copyright (c) 2001, Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2018-06-20 08:13:28 -04:00
|
|
|
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
2015-07-31 11:21:34 -04:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
#ifndef TOR_CRYPTO_FORMAT_H
|
|
|
|
#define TOR_CRYPTO_FORMAT_H
|
|
|
|
|
2018-06-21 13:12:23 -04:00
|
|
|
#include "lib/testsupport/testsupport.h"
|
2018-06-21 12:20:52 -04:00
|
|
|
#include "lib/cc/torint.h"
|
2018-07-01 13:04:21 -04:00
|
|
|
#include "lib/defs/x25519_sizes.h"
|
|
|
|
|
|
|
|
struct ed25519_public_key_t;
|
|
|
|
struct ed25519_signature_t;
|
2015-07-31 11:21:34 -04:00
|
|
|
|
|
|
|
int crypto_write_tagged_contents_to_file(const char *fname,
|
|
|
|
const char *typestring,
|
|
|
|
const char *tag,
|
|
|
|
const uint8_t *data,
|
|
|
|
size_t datalen);
|
|
|
|
|
|
|
|
ssize_t crypto_read_tagged_contents_from_file(const char *fname,
|
|
|
|
const char *typestring,
|
|
|
|
char **tag_out,
|
|
|
|
uint8_t *data_out,
|
|
|
|
ssize_t data_out_len);
|
|
|
|
|
2018-07-01 13:04:21 -04:00
|
|
|
int ed25519_public_from_base64(struct ed25519_public_key_t *pkey,
|
2015-07-31 11:21:34 -04:00
|
|
|
const char *input);
|
|
|
|
int ed25519_public_to_base64(char *output,
|
2018-07-01 13:04:21 -04:00
|
|
|
const struct ed25519_public_key_t *pkey);
|
|
|
|
const char *ed25519_fmt(const struct ed25519_public_key_t *pkey);
|
2015-07-31 11:21:34 -04:00
|
|
|
|
2018-07-01 13:04:21 -04:00
|
|
|
int ed25519_signature_from_base64(struct ed25519_signature_t *sig,
|
2015-07-31 11:21:34 -04:00
|
|
|
const char *input);
|
|
|
|
int ed25519_signature_to_base64(char *output,
|
2018-07-01 13:04:21 -04:00
|
|
|
const struct ed25519_signature_t *sig);
|
2015-07-31 11:21:34 -04:00
|
|
|
|
|
|
|
int digest_to_base64(char *d64, const char *digest);
|
|
|
|
int digest_from_base64(char *digest, const char *d64);
|
|
|
|
int digest256_to_base64(char *d64, const char *digest);
|
|
|
|
int digest256_from_base64(char *digest, const char *d64);
|
|
|
|
|
2017-09-15 16:24:44 -04:00
|
|
|
#endif /* !defined(TOR_CRYPTO_FORMAT_H) */
|