Ignore:
Timestamp:
Apr 17, 2011, 5:22:50 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) more heap pruning: use composition rather than aggregation for the tr_crypto object owned by tr_peerIo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/crypto.h

    r12226 r12365  
    2727**/
    2828
    29 typedef struct tr_crypto tr_crypto;
     29#include <openssl/dh.h> /* RC4_KEY */
     30#include <openssl/rc4.h> /* DH */
    3031
    31 /** @brief create a new tr_crypto object */
    32 tr_crypto*  tr_cryptoNew( const uint8_t * torrentHash, int isIncoming );
     32enum
     33{
     34    KEY_LEN = 96
     35};
    3336
    34 /** @brief destroy an existing tr_crypto object */
    35 void           tr_cryptoFree( tr_crypto * crypto );
     37/** @brief Holds state information for encrypted peer communications */
     38typedef struct
     39{
     40    RC4_KEY         dec_key;
     41    RC4_KEY         enc_key;
     42    DH *            dh;
     43    uint8_t         myPublicKey[KEY_LEN];
     44    uint8_t         mySecret[KEY_LEN];
     45    uint8_t         torrentHash[SHA_DIGEST_LENGTH];
     46    bool            isIncoming;
     47    bool            torrentHashIsSet;
     48    bool            mySecretIsSet;
     49}
     50tr_crypto;
     51
     52/** @brief construct a new tr_crypto object */
     53void tr_cryptoConstruct( tr_crypto * crypto, const uint8_t * torrentHash, bool isIncoming );
     54
     55/** @brief destruct an existing tr_crypto object */
     56void tr_cryptoDestruct( tr_crypto * crypto );
    3657
    3758
Note: See TracChangeset for help on using the changeset viewer.