Tor  0.4.7.0-alpha-dev
crypto_format.h
Go to the documentation of this file.
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file crypto_format.h
9  * \brief Header for crypto_format.c
10  **/
11 
12 #ifndef TOR_CRYPTO_FORMAT_H
13 #define TOR_CRYPTO_FORMAT_H
14 
16 #include "lib/cc/torint.h"
17 #include "lib/defs/x25519_sizes.h"
18 
20 struct ed25519_signature_t;
21 
22 int crypto_write_tagged_contents_to_file(const char *fname,
23  const char *typestring,
24  const char *tag,
25  const uint8_t *data,
26  size_t datalen);
27 
28 ssize_t crypto_read_tagged_contents_from_file(const char *fname,
29  const char *typestring,
30  char **tag_out,
31  uint8_t *data_out,
32  ssize_t data_out_len);
33 
35  const char *input);
36 void ed25519_public_to_base64(char *output,
37  const struct ed25519_public_key_t *pkey);
38 const char *ed25519_fmt(const struct ed25519_public_key_t *pkey);
39 
41  const char *input);
42 void ed25519_signature_to_base64(char *output,
43  const struct ed25519_signature_t *sig);
44 
45 void digest_to_base64(char *d64, const char *digest);
46 int digest_from_base64(char *digest, const char *d64);
47 void digest256_to_base64(char *d64, const char *digest);
48 int digest256_from_base64(char *digest, const char *d64);
49 
50 #endif /* !defined(TOR_CRYPTO_FORMAT_H) */
void ed25519_signature_to_base64(char *output, const ed25519_signature_t *sig)
void ed25519_public_to_base64(char *output, const ed25519_public_key_t *pkey)
const char * ed25519_fmt(const ed25519_public_key_t *pkey)
void digest256_to_base64(char *d64, const char *digest)
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)
Definition: crypto_format.c:77
int crypto_write_tagged_contents_to_file(const char *fname, const char *typestring, const char *tag, const uint8_t *data, size_t datalen)
Definition: crypto_format.c:42
int ed25519_signature_from_base64(struct ed25519_signature_t *sig, const char *input)
int ed25519_public_from_base64(struct ed25519_public_key_t *pkey, const char *input)
int digest256_from_base64(char *digest, const char *d64)
void digest_to_base64(char *d64, const char *digest)
int digest_from_base64(char *digest, const char *d64)
Macros to implement mocking and selective exposure for the test code.
Integer definitions used throughout Tor.
Definitions for sizes of x25519 keys and elements.