thc-ipv6: move to trunk and add myself as maintainer
[openwrt.git] / package / network / ipv6 / thc-ipv6 / patches / 100-optional-openssl.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -1,8 +1,8 @@
4  CC=gcc
5  #OPT=-Wall -ggdb
6 -OPT=-O2
7 -LIB=-lpcap -lssl -lcrypto
8 -PROGRAM=parasite6 dos-new-ip6 detect-new-ip6 fake_router6 fake_advertise6 fake_mld6 fake_mipv6 redir6 smurf6 alive6 toobig6 rsmurf6 test_implementation6 sendpees6
9 +OPT=-O2 $(if $(USE_SSL),-DUSE_SSL,)
10 +LIB=-lpcap $(if $(USE_SSL),-lssl -lcrypto,)
11 +PROGRAM=parasite6 dos-new-ip6 detect-new-ip6 fake_router6 fake_advertise6 fake_mld6 fake_mipv6 redir6 smurf6 alive6 toobig6 rsmurf6 test_implementation6 $(if $(USE_SSL),sendpees6,)
12  
13  all:   thc-ipv6-lib.o $(PROGRAM)
14  
15 --- a/thc-ipv6-lib.c
16 +++ b/thc-ipv6-lib.c
17 @@ -37,8 +37,10 @@
18  #include <pcap.h>
19  #include "thc-ipv6.h"
20  /* libssl */
21 +#ifdef USE_SSL
22  #include <openssl/evp.h>
23  #include <openssl/sha.h>
24 +#endif
25  
26  
27  
28 @@ -1507,7 +1509,7 @@
29   * 2006/07
30   */
31  
32 -
33 +#ifdef USE_SSL
34  thc_key_t *thc_generate_key(int key_len)
35  {
36     thc_key_t *key;
37 @@ -1598,6 +1600,7 @@
38                                         
39      return cga_hdr;                                    
40  }
41 +#endif
42  
43  thc_timestamp_hdr *generate_timestamp(void)
44  {
45 @@ -1632,6 +1635,7 @@
46      return nonce;    
47  }
48  
49 +#ifdef USE_SSL
50  thc_rsa_hdr *thc_generate_rsa(char *data2sign, int data2sign_len, thc_cga_hdr *cga_hdr, thc_key_t *key)
51  {
52     thc_rsa_hdr *rsa_hdr;
53 @@ -1827,3 +1831,4 @@
54     
55     return 0; 
56  }
57 +#endif
58 --- a/thc-ipv6.h
59 +++ b/thc-ipv6.h
60 @@ -10,7 +10,9 @@
61  #define _THC_IPV6_H
62  
63  #include <pcap.h>
64 +#ifdef USE_SSL
65  #include <openssl/rsa.h>
66 +#endif
67  
68  #define VERSION        "v0.7"
69  #define AUTHOR                 "van Hauser / THC <vh@thc.org>"
70 @@ -228,10 +230,12 @@
71    char *pad;
72  } thc_rsa_hdr;       
73  
74 +#ifdef USE_SSL
75  typedef struct {
76    RSA *rsa;
77    int len;
78  } thc_key_t;
79 +#endif
80  
81  typedef struct {
82    unsigned char *data;
83 @@ -239,8 +243,10 @@
84    int len;
85  } opt_t;
86  
87 +#ifdef USE_SSL
88  extern thc_key_t *thc_generate_key(int key_len);
89  extern thc_cga_hdr *thc_generate_cga(unsigned char *prefix, thc_key_t *key, unsigned char **cga);
90 +#endif
91  
92  #endif
93