source: branches/encryption/libtransmission/crypto.h @ 2985

Last change on this file since 2985 was 2985, checked in by charles, 15 years ago

work on incoming connections, and better deciding of which pieces to request first.

  • Property svn:keywords set to Date Rev Author Id
File size: 2.0 KB
Line 
1/*
2 * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: crypto.h 2985 2007-09-07 20:55:38Z charles $
11 */
12
13#ifndef TR_ENCRYPTION_H
14#define TR_ENCRYPTION_H
15
16#include <inttypes.h>
17
18/**
19***
20**/
21
22struct evbuffer;
23typedef struct tr_crypto tr_crypto;
24
25/**
26***
27**/
28
29tr_crypto*  tr_cryptoNew ( const uint8_t * torrentHash,
30                           int             isIncoming );
31
32void tr_cryptoFree( tr_crypto * crypto );
33
34/**
35***
36**/
37
38void tr_cryptoSetTorrentHash( tr_crypto     * crypto,
39                              const uint8_t * torrentHash );
40
41const uint8_t*  tr_cryptoGetTorrentHash( const tr_crypto * crypto );
42
43int tr_cryptoHasTorrentHash( const tr_crypto * crypto );
44
45/**
46***
47**/
48
49const uint8_t*  tr_cryptoComputeSecret   ( tr_crypto     * crypto,
50                                           const uint8_t * peerPublicKey );
51
52const uint8_t*  tr_cryptoGetMyPublicKey ( const tr_crypto * crypto,
53                                          int             * setme_len );
54
55void            tr_cryptoDecryptInit( tr_crypto   * crypto );
56
57void            tr_cryptoDecrypt    ( tr_crypto   * crypto,
58                                      size_t        buflen,
59                                      const void  * buf_in,
60                                      void        * buf_out );
61
62/**
63***
64**/
65
66void  tr_cryptoEncryptInit ( tr_crypto   * crypto );
67
68void  tr_cryptoEncrypt     ( tr_crypto   * crypto,
69                             size_t        buflen,
70                             const void  * buf_in,
71                             void        * buf_out );
72
73void  tr_sha1              ( uint8_t     * setme,
74                             const void  * content1,
75                             int           content1_len,
76                             ... );
77
78#endif
Note: See TracBrowser for help on using the repository browser.