home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / rc5clnt.zip / common.h < prev    next >
C/C++ Source or Header  |  1997-02-18  |  1KB  |  62 lines

  1. #ifndef COMMON_H
  2. #define COMMON_H
  3.  
  4. #include <netinet/in.h>
  5.  
  6. #define RC5_WORD            unsigned int
  7.  
  8. #define RC5_ROUNDS            12
  9.  
  10. #define RC5_WORDSIZE        32
  11. #define RC5_WORDBYTES        4    /* (RC5_WORDSIZE / 8) */
  12. #define RC5_ROTMASK            31    /* (RC5_WORDSIZE - 1) */
  13. #define RC5_BLOCKSIZE        8    /* ((2 * RC5_WORDSIZE) / 8) */
  14.  
  15. #define RC5_KEYSIZE            56
  16. #define RC5_KEYBYTES        7    /* (RC5_KEYSIZE / 8) */
  17. #define RC5_KEYWORDS        2    /* (8 * RC5_KEYBYTES / RC5_WORDSIZE + 1) */
  18.  
  19. #define RC5_MAXKEYLEN        16
  20. #define RC5_MAXPLAINLEN        72
  21. #define RC5_MAXCIPHERLEN    (RC5_MAXPLAINLEN + RC5_BLOCKSIZE)
  22. #define RC5_MAXROUNDS        20
  23.  
  24. #define P16            0xB7E1
  25. #define Q16            0x9E37
  26. #define P32            0xB7E15163
  27. #define Q32            0x9E3779B9
  28. #define P64            0xB7E151628AED2A6B
  29. #define Q64            0x9E3779B97F4A7C15
  30.  
  31. typedef enum {
  32.     OP_REQUEST,
  33.     OP_DATA,
  34.     OP_SUCCESS,
  35.     OP_DONE,
  36.     OP_FAIL,
  37.     OP_MAX
  38. } Operation;
  39.  
  40. #define PKT_STRLEN 128
  41.  
  42. typedef struct Packet {
  43.     signed int op;            /* operation code */
  44.     RC5_WORD key[2];        /* the Key starting point */
  45.     RC5_WORD iv[2];            /* the IV */
  46.     RC5_WORD pt[2];            /* the Plaintext */
  47.     RC5_WORD ct[2];            /* the Ciphertext */
  48.     RC5_WORD numkeys;        /* number of iterations */
  49.     char id[PKT_STRLEN];    /* identifier */
  50. } Packet;
  51.  
  52. /* common.c */
  53. extern struct in_addr keyserver_addr;
  54. extern unsigned short keyserver_port;
  55.  
  56. extern unsigned int inet_address(const char *);
  57. extern char *inet_name(struct in_addr);
  58. extern int open_server();
  59.  
  60. #endif
  61.  
  62.