Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
... | ... |
@@ -1,8 +1,8 @@ |
1 |
-@echo off |
|
2 |
-cd %HOME% |
|
3 |
-rem build a request for a cert that will be valid for ten years |
|
4 |
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
-rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
7 |
-rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
-del /q %KEY_DIR%\*.old |
|
1 |
+@echo off |
|
2 |
+cd %HOME% |
|
3 |
+rem build a request for a cert that will be valid for ten years |
|
4 |
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
+rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
7 |
+rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
+del /q %KEY_DIR%\*.old |
... | ... |
@@ -1,8 +1,8 @@ |
1 |
-@echo off |
|
2 |
-cd %HOME% |
|
3 |
-rem build a request for a cert that will be valid for ten years |
|
4 |
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
-rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
7 |
-rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
-del /q %KEY_DIR%\*.old |
|
1 |
+@echo off |
|
2 |
+cd %HOME% |
|
3 |
+rem build a request for a cert that will be valid for ten years |
|
4 |
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
+rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
7 |
+rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
+del /q %KEY_DIR%\*.old |
... | ... |
@@ -1,8 +1,8 @@ |
1 |
-@echo off |
|
2 |
-cd %HOME% |
|
3 |
-rem build a request for a cert that will be valid for ten years |
|
4 |
-openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
-rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
-openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG% |
|
7 |
-rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
-del /q %KEY_DIR%\*.old |
|
1 |
+@echo off |
|
2 |
+cd %HOME% |
|
3 |
+rem build a request for a cert that will be valid for ten years |
|
4 |
+openssl req -days 3650 -new -keyout %KEY_DIR%\%1.key -out %KEY_DIR%\%1.csr -config %KEY_CONFIG% |
|
5 |
+rem sign the cert request with our ca, creating a cert/key pair |
|
6 |
+openssl ca -days 3650 -out %KEY_DIR%\%1.crt -in %KEY_DIR%\%1.csr -extensions server -config %KEY_CONFIG% |
|
7 |
+rem delete any .old files created in this process, to avoid future file creation errors |
|
8 |
+del /q %KEY_DIR%\*.old |
... | ... |
@@ -1,143 +1,143 @@ |
1 |
-/* |
|
2 |
- * OpenVPN -- An application to securely tunnel IP networks |
|
3 |
- * over a single TCP/UDP port, with support for SSL/TLS-based |
|
4 |
- * session authentication and key exchange, |
|
5 |
- * packet encryption, packet authentication, and |
|
6 |
- * packet compression. |
|
7 |
- * |
|
8 |
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> |
|
9 |
- * |
|
10 |
- * This program is free software; you can redistribute it and/or modify |
|
11 |
- * it under the terms of the GNU General Public License version 2 |
|
12 |
- * as published by the Free Software Foundation. |
|
13 |
- * |
|
14 |
- * This program is distributed in the hope that it will be useful, |
|
15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
- * GNU General Public License for more details. |
|
18 |
- * |
|
19 |
- * You should have received a copy of the GNU General Public License |
|
20 |
- * along with this program (see the file COPYING included with this |
|
21 |
- * distribution); if not, write to the Free Software Foundation, Inc., |
|
22 |
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
- */ |
|
24 |
- |
|
25 |
-#include "syshead.h" |
|
26 |
- |
|
27 |
-#if PROXY_DIGEST_AUTH |
|
28 |
- |
|
29 |
-#include "crypto.h" |
|
30 |
-#include "httpdigest.h" |
|
31 |
- |
|
32 |
-static void |
|
33 |
-CvtHex( |
|
34 |
- IN HASH Bin, |
|
35 |
- OUT HASHHEX Hex |
|
36 |
- ) |
|
37 |
-{ |
|
38 |
- unsigned short i; |
|
39 |
- unsigned char j; |
|
40 |
- |
|
41 |
- for (i = 0; i < HASHLEN; i++) { |
|
42 |
- j = (Bin[i] >> 4) & 0xf; |
|
43 |
- if (j <= 9) |
|
44 |
- Hex[i*2] = (j + '0'); |
|
45 |
- else |
|
46 |
- Hex[i*2] = (j + 'a' - 10); |
|
47 |
- j = Bin[i] & 0xf; |
|
48 |
- if (j <= 9) |
|
49 |
- Hex[i*2+1] = (j + '0'); |
|
50 |
- else |
|
51 |
- Hex[i*2+1] = (j + 'a' - 10); |
|
52 |
- }; |
|
53 |
- Hex[HASHHEXLEN] = '\0'; |
|
54 |
-}; |
|
55 |
- |
|
56 |
-/* calculate H(A1) as per spec */ |
|
57 |
-void |
|
58 |
-DigestCalcHA1( |
|
59 |
- IN char * pszAlg, |
|
60 |
- IN char * pszUserName, |
|
61 |
- IN char * pszRealm, |
|
62 |
- IN char * pszPassword, |
|
63 |
- IN char * pszNonce, |
|
64 |
- IN char * pszCNonce, |
|
65 |
- OUT HASHHEX SessionKey |
|
66 |
- ) |
|
67 |
-{ |
|
68 |
- MD5_CTX Md5Ctx; |
|
69 |
- HASH HA1; |
|
70 |
- |
|
71 |
- MD5_Init(&Md5Ctx); |
|
72 |
- MD5_Update(&Md5Ctx, pszUserName, strlen(pszUserName)); |
|
73 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
74 |
- MD5_Update(&Md5Ctx, pszRealm, strlen(pszRealm)); |
|
75 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
76 |
- MD5_Update(&Md5Ctx, pszPassword, strlen(pszPassword)); |
|
77 |
- MD5_Final(HA1, &Md5Ctx); |
|
78 |
- if (pszAlg && strcasecmp(pszAlg, "md5-sess") == 0) |
|
79 |
- { |
|
80 |
- MD5_Init(&Md5Ctx); |
|
81 |
- MD5_Update(&Md5Ctx, HA1, HASHLEN); |
|
82 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
83 |
- MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce)); |
|
84 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
85 |
- MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); |
|
86 |
- MD5_Final(HA1, &Md5Ctx); |
|
87 |
- }; |
|
88 |
- CvtHex(HA1, SessionKey); |
|
89 |
-} |
|
90 |
- |
|
91 |
-/* calculate request-digest/response-digest as per HTTP Digest spec */ |
|
92 |
-void |
|
93 |
-DigestCalcResponse( |
|
94 |
- IN HASHHEX HA1, /* H(A1) */ |
|
95 |
- IN char * pszNonce, /* nonce from server */ |
|
96 |
- IN char * pszNonceCount, /* 8 hex digits */ |
|
97 |
- IN char * pszCNonce, /* client nonce */ |
|
98 |
- IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ |
|
99 |
- IN char * pszMethod, /* method from the request */ |
|
100 |
- IN char * pszDigestUri, /* requested URL */ |
|
101 |
- IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ |
|
102 |
- OUT HASHHEX Response /* request-digest or response-digest */ |
|
103 |
- ) |
|
104 |
-{ |
|
105 |
- MD5_CTX Md5Ctx; |
|
106 |
- HASH HA2; |
|
107 |
- HASH RespHash; |
|
108 |
- HASHHEX HA2Hex; |
|
109 |
- |
|
110 |
- // calculate H(A2) |
|
111 |
- MD5_Init(&Md5Ctx); |
|
112 |
- MD5_Update(&Md5Ctx, pszMethod, strlen(pszMethod)); |
|
113 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
114 |
- MD5_Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri)); |
|
115 |
- if (strcasecmp(pszQop, "auth-int") == 0) |
|
116 |
- { |
|
117 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
118 |
- MD5_Update(&Md5Ctx, HEntity, HASHHEXLEN); |
|
119 |
- }; |
|
120 |
- MD5_Final(HA2, &Md5Ctx); |
|
121 |
- CvtHex(HA2, HA2Hex); |
|
122 |
- |
|
123 |
- // calculate response |
|
124 |
- MD5_Init(&Md5Ctx); |
|
125 |
- MD5_Update(&Md5Ctx, HA1, HASHHEXLEN); |
|
126 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
127 |
- MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce)); |
|
128 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
129 |
- if (*pszQop) |
|
130 |
- { |
|
131 |
- MD5_Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount)); |
|
132 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
133 |
- MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); |
|
134 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
135 |
- MD5_Update(&Md5Ctx, pszQop, strlen(pszQop)); |
|
136 |
- MD5_Update(&Md5Ctx, ":", 1); |
|
137 |
- }; |
|
138 |
- MD5_Update(&Md5Ctx, HA2Hex, HASHHEXLEN); |
|
139 |
- MD5_Final(RespHash, &Md5Ctx); |
|
140 |
- CvtHex(RespHash, Response); |
|
141 |
-} |
|
142 |
- |
|
143 |
-#endif |
|
1 |
+/* |
|
2 |
+ * OpenVPN -- An application to securely tunnel IP networks |
|
3 |
+ * over a single TCP/UDP port, with support for SSL/TLS-based |
|
4 |
+ * session authentication and key exchange, |
|
5 |
+ * packet encryption, packet authentication, and |
|
6 |
+ * packet compression. |
|
7 |
+ * |
|
8 |
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> |
|
9 |
+ * |
|
10 |
+ * This program is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License version 2 |
|
12 |
+ * as published by the Free Software Foundation. |
|
13 |
+ * |
|
14 |
+ * This program is distributed in the hope that it will be useful, |
|
15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
+ * GNU General Public License for more details. |
|
18 |
+ * |
|
19 |
+ * You should have received a copy of the GNU General Public License |
|
20 |
+ * along with this program (see the file COPYING included with this |
|
21 |
+ * distribution); if not, write to the Free Software Foundation, Inc., |
|
22 |
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#include "syshead.h" |
|
26 |
+ |
|
27 |
+#if PROXY_DIGEST_AUTH |
|
28 |
+ |
|
29 |
+#include "crypto.h" |
|
30 |
+#include "httpdigest.h" |
|
31 |
+ |
|
32 |
+static void |
|
33 |
+CvtHex( |
|
34 |
+ IN HASH Bin, |
|
35 |
+ OUT HASHHEX Hex |
|
36 |
+ ) |
|
37 |
+{ |
|
38 |
+ unsigned short i; |
|
39 |
+ unsigned char j; |
|
40 |
+ |
|
41 |
+ for (i = 0; i < HASHLEN; i++) { |
|
42 |
+ j = (Bin[i] >> 4) & 0xf; |
|
43 |
+ if (j <= 9) |
|
44 |
+ Hex[i*2] = (j + '0'); |
|
45 |
+ else |
|
46 |
+ Hex[i*2] = (j + 'a' - 10); |
|
47 |
+ j = Bin[i] & 0xf; |
|
48 |
+ if (j <= 9) |
|
49 |
+ Hex[i*2+1] = (j + '0'); |
|
50 |
+ else |
|
51 |
+ Hex[i*2+1] = (j + 'a' - 10); |
|
52 |
+ }; |
|
53 |
+ Hex[HASHHEXLEN] = '\0'; |
|
54 |
+}; |
|
55 |
+ |
|
56 |
+/* calculate H(A1) as per spec */ |
|
57 |
+void |
|
58 |
+DigestCalcHA1( |
|
59 |
+ IN char * pszAlg, |
|
60 |
+ IN char * pszUserName, |
|
61 |
+ IN char * pszRealm, |
|
62 |
+ IN char * pszPassword, |
|
63 |
+ IN char * pszNonce, |
|
64 |
+ IN char * pszCNonce, |
|
65 |
+ OUT HASHHEX SessionKey |
|
66 |
+ ) |
|
67 |
+{ |
|
68 |
+ MD5_CTX Md5Ctx; |
|
69 |
+ HASH HA1; |
|
70 |
+ |
|
71 |
+ MD5_Init(&Md5Ctx); |
|
72 |
+ MD5_Update(&Md5Ctx, pszUserName, strlen(pszUserName)); |
|
73 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
74 |
+ MD5_Update(&Md5Ctx, pszRealm, strlen(pszRealm)); |
|
75 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
76 |
+ MD5_Update(&Md5Ctx, pszPassword, strlen(pszPassword)); |
|
77 |
+ MD5_Final(HA1, &Md5Ctx); |
|
78 |
+ if (pszAlg && strcasecmp(pszAlg, "md5-sess") == 0) |
|
79 |
+ { |
|
80 |
+ MD5_Init(&Md5Ctx); |
|
81 |
+ MD5_Update(&Md5Ctx, HA1, HASHLEN); |
|
82 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
83 |
+ MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce)); |
|
84 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
85 |
+ MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); |
|
86 |
+ MD5_Final(HA1, &Md5Ctx); |
|
87 |
+ }; |
|
88 |
+ CvtHex(HA1, SessionKey); |
|
89 |
+} |
|
90 |
+ |
|
91 |
+/* calculate request-digest/response-digest as per HTTP Digest spec */ |
|
92 |
+void |
|
93 |
+DigestCalcResponse( |
|
94 |
+ IN HASHHEX HA1, /* H(A1) */ |
|
95 |
+ IN char * pszNonce, /* nonce from server */ |
|
96 |
+ IN char * pszNonceCount, /* 8 hex digits */ |
|
97 |
+ IN char * pszCNonce, /* client nonce */ |
|
98 |
+ IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ |
|
99 |
+ IN char * pszMethod, /* method from the request */ |
|
100 |
+ IN char * pszDigestUri, /* requested URL */ |
|
101 |
+ IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ |
|
102 |
+ OUT HASHHEX Response /* request-digest or response-digest */ |
|
103 |
+ ) |
|
104 |
+{ |
|
105 |
+ MD5_CTX Md5Ctx; |
|
106 |
+ HASH HA2; |
|
107 |
+ HASH RespHash; |
|
108 |
+ HASHHEX HA2Hex; |
|
109 |
+ |
|
110 |
+ // calculate H(A2) |
|
111 |
+ MD5_Init(&Md5Ctx); |
|
112 |
+ MD5_Update(&Md5Ctx, pszMethod, strlen(pszMethod)); |
|
113 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
114 |
+ MD5_Update(&Md5Ctx, pszDigestUri, strlen(pszDigestUri)); |
|
115 |
+ if (strcasecmp(pszQop, "auth-int") == 0) |
|
116 |
+ { |
|
117 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
118 |
+ MD5_Update(&Md5Ctx, HEntity, HASHHEXLEN); |
|
119 |
+ }; |
|
120 |
+ MD5_Final(HA2, &Md5Ctx); |
|
121 |
+ CvtHex(HA2, HA2Hex); |
|
122 |
+ |
|
123 |
+ // calculate response |
|
124 |
+ MD5_Init(&Md5Ctx); |
|
125 |
+ MD5_Update(&Md5Ctx, HA1, HASHHEXLEN); |
|
126 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
127 |
+ MD5_Update(&Md5Ctx, pszNonce, strlen(pszNonce)); |
|
128 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
129 |
+ if (*pszQop) |
|
130 |
+ { |
|
131 |
+ MD5_Update(&Md5Ctx, pszNonceCount, strlen(pszNonceCount)); |
|
132 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
133 |
+ MD5_Update(&Md5Ctx, pszCNonce, strlen(pszCNonce)); |
|
134 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
135 |
+ MD5_Update(&Md5Ctx, pszQop, strlen(pszQop)); |
|
136 |
+ MD5_Update(&Md5Ctx, ":", 1); |
|
137 |
+ }; |
|
138 |
+ MD5_Update(&Md5Ctx, HA2Hex, HASHHEXLEN); |
|
139 |
+ MD5_Final(RespHash, &Md5Ctx); |
|
140 |
+ CvtHex(RespHash, Response); |
|
141 |
+} |
|
142 |
+ |
|
143 |
+#endif |
... | ... |
@@ -1,60 +1,60 @@ |
1 |
-/* |
|
2 |
- * OpenVPN -- An application to securely tunnel IP networks |
|
3 |
- * over a single TCP/UDP port, with support for SSL/TLS-based |
|
4 |
- * session authentication and key exchange, |
|
5 |
- * packet encryption, packet authentication, and |
|
6 |
- * packet compression. |
|
7 |
- * |
|
8 |
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> |
|
9 |
- * |
|
10 |
- * This program is free software; you can redistribute it and/or modify |
|
11 |
- * it under the terms of the GNU General Public License version 2 |
|
12 |
- * as published by the Free Software Foundation. |
|
13 |
- * |
|
14 |
- * This program is distributed in the hope that it will be useful, |
|
15 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
- * GNU General Public License for more details. |
|
18 |
- * |
|
19 |
- * You should have received a copy of the GNU General Public License |
|
20 |
- * along with this program (see the file COPYING included with this |
|
21 |
- * distribution); if not, write to the Free Software Foundation, Inc., |
|
22 |
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
- */ |
|
24 |
- |
|
25 |
-#if PROXY_DIGEST_AUTH |
|
26 |
- |
|
27 |
-#define HASHLEN 16 |
|
28 |
-typedef unsigned char HASH[HASHLEN]; |
|
29 |
-#define HASHHEXLEN 32 |
|
30 |
-typedef unsigned char HASHHEX[HASHHEXLEN+1]; |
|
31 |
-#undef IN |
|
32 |
-#undef OUT |
|
33 |
-#define IN const |
|
34 |
-#define OUT |
|
35 |
- |
|
36 |
-/* calculate H(A1) as per HTTP Digest spec */ |
|
37 |
-void DigestCalcHA1( |
|
38 |
- IN char * pszAlg, |
|
39 |
- IN char * pszUserName, |
|
40 |
- IN char * pszRealm, |
|
41 |
- IN char * pszPassword, |
|
42 |
- IN char * pszNonce, |
|
43 |
- IN char * pszCNonce, |
|
44 |
- OUT HASHHEX SessionKey |
|
45 |
- ); |
|
46 |
- |
|
47 |
-/* calculate request-digest/response-digest as per HTTP Digest spec */ |
|
48 |
-void DigestCalcResponse( |
|
49 |
- IN HASHHEX HA1, /* H(A1) */ |
|
50 |
- IN char * pszNonce, /* nonce from server */ |
|
51 |
- IN char * pszNonceCount, /* 8 hex digits */ |
|
52 |
- IN char * pszCNonce, /* client nonce */ |
|
53 |
- IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ |
|
54 |
- IN char * pszMethod, /* method from the request */ |
|
55 |
- IN char * pszDigestUri, /* requested URL */ |
|
56 |
- IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ |
|
57 |
- OUT HASHHEX Response /* request-digest or response-digest */ |
|
58 |
- ); |
|
59 |
- |
|
60 |
-#endif |
|
1 |
+/* |
|
2 |
+ * OpenVPN -- An application to securely tunnel IP networks |
|
3 |
+ * over a single TCP/UDP port, with support for SSL/TLS-based |
|
4 |
+ * session authentication and key exchange, |
|
5 |
+ * packet encryption, packet authentication, and |
|
6 |
+ * packet compression. |
|
7 |
+ * |
|
8 |
+ * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> |
|
9 |
+ * |
|
10 |
+ * This program is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License version 2 |
|
12 |
+ * as published by the Free Software Foundation. |
|
13 |
+ * |
|
14 |
+ * This program is distributed in the hope that it will be useful, |
|
15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
+ * GNU General Public License for more details. |
|
18 |
+ * |
|
19 |
+ * You should have received a copy of the GNU General Public License |
|
20 |
+ * along with this program (see the file COPYING included with this |
|
21 |
+ * distribution); if not, write to the Free Software Foundation, Inc., |
|
22 |
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#if PROXY_DIGEST_AUTH |
|
26 |
+ |
|
27 |
+#define HASHLEN 16 |
|
28 |
+typedef unsigned char HASH[HASHLEN]; |
|
29 |
+#define HASHHEXLEN 32 |
|
30 |
+typedef unsigned char HASHHEX[HASHHEXLEN+1]; |
|
31 |
+#undef IN |
|
32 |
+#undef OUT |
|
33 |
+#define IN const |
|
34 |
+#define OUT |
|
35 |
+ |
|
36 |
+/* calculate H(A1) as per HTTP Digest spec */ |
|
37 |
+void DigestCalcHA1( |
|
38 |
+ IN char * pszAlg, |
|
39 |
+ IN char * pszUserName, |
|
40 |
+ IN char * pszRealm, |
|
41 |
+ IN char * pszPassword, |
|
42 |
+ IN char * pszNonce, |
|
43 |
+ IN char * pszCNonce, |
|
44 |
+ OUT HASHHEX SessionKey |
|
45 |
+ ); |
|
46 |
+ |
|
47 |
+/* calculate request-digest/response-digest as per HTTP Digest spec */ |
|
48 |
+void DigestCalcResponse( |
|
49 |
+ IN HASHHEX HA1, /* H(A1) */ |
|
50 |
+ IN char * pszNonce, /* nonce from server */ |
|
51 |
+ IN char * pszNonceCount, /* 8 hex digits */ |
|
52 |
+ IN char * pszCNonce, /* client nonce */ |
|
53 |
+ IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ |
|
54 |
+ IN char * pszMethod, /* method from the request */ |
|
55 |
+ IN char * pszDigestUri, /* requested URL */ |
|
56 |
+ IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ |
|
57 |
+ OUT HASHHEX Response /* request-digest or response-digest */ |
|
58 |
+ ); |
|
59 |
+ |
|
60 |
+#endif |
... | ... |
@@ -10,44 +10,44 @@ diff -wur openssl-0.9.7m.orig/ms/mw.bat openssl-0.9.7m/ms/mw.bat |
10 | 10 |
--- openssl-0.9.7m.orig/ms/mw.bat Sat Feb 22 11:02:46 2003 |
11 | 11 |
+++ openssl-0.9.7m/ms/mw.bat Mon Jan 21 23:12:34 2008 |
12 | 12 |
@@ -1,17 +1,23 @@ |
13 |
- @rem OpenSSL with Mingw32 |
|
14 |
- @rem -------------------- |
|
15 |
- |
|
13 |
+ @rem OpenSSL with Mingw32 |
|
14 |
+ @rem -------------------- |
|
15 |
+ |
|
16 | 16 |
+@rem Include MinGW, MSYS, and ActiveState Perl in path |
17 | 17 |
+set PATH=c:\perl\bin;c:\MinGW\bin;c:\msys\1.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem |
18 | 18 |
+ |
19 |
- @rem Makefile |
|
20 |
- perl util\mkfiles.pl >MINFO |
|
21 |
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak |
|
19 |
+ @rem Makefile |
|
20 |
+ perl util\mkfiles.pl >MINFO |
|
21 |
+-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak |
|
22 | 22 |
+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak |
23 | 23 |
+ |
24 |
- @rem DLL definition files |
|
25 |
--perl util\mkdef.pl 32 libeay >ms\libeay32.def |
|
24 |
+ @rem DLL definition files |
|
25 |
+-perl util\mkdef.pl 32 libeay >ms\libeay32.def |
|
26 | 26 |
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def |
27 |
- if errorlevel 1 goto end |
|
28 |
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def |
|
27 |
+ if errorlevel 1 goto end |
|
28 |
+-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def |
|
29 | 29 |
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def |
30 |
- if errorlevel 1 goto end |
|
31 |
- |
|
32 |
- @rem Build the libraries |
|
33 |
--make -f ms/mingw32.mak |
|
30 |
+ if errorlevel 1 goto end |
|
31 |
+ |
|
32 |
+ @rem Build the libraries |
|
33 |
+-make -f ms/mingw32.mak |
|
34 | 34 |
+ |
35 | 35 |
+@rem JY added --win32 flag |
36 | 36 |
+make --win32 -f ms/mingw32.mak |
37 |
- if errorlevel 1 goto end |
|
38 |
- |
|
39 |
- @rem Generate the DLLs and input libraries |
|
37 |
+ if errorlevel 1 goto end |
|
38 |
+ |
|
39 |
+ @rem Generate the DLLs and input libraries |
|
40 | 40 |
@@ -20,7 +26,9 @@ |
41 |
- dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a |
|
42 |
- if errorlevel 1 goto end |
|
43 |
- |
|
41 |
+ dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a |
|
42 |
+ if errorlevel 1 goto end |
|
43 |
+ |
|
44 | 44 |
+@rem JY added openssl.exe linked to DLL |
45 | 45 |
+gcc -o openssl tmp\verify.o tmp\asn1pars.o tmp\req.o tmp\dgst.o tmp\dh.o tmp\dhparam.o tmp\enc.o tmp\passwd.o tmp\gendh.o tmp\errstr.o tmp\ca.o tmp\pkcs7.o tmp\crl2p7.o tmp\crl.o tmp\rsa.o tmp\rsautl.o tmp\dsa.o tmp\dsaparam.o tmp\x509.o tmp\genrsa.o tmp\gendsa.o tmp\s_server.o tmp\s_client.o tmp\speed.o tmp\s_time.o tmp\apps.o tmp\s_cb.o tmp\s_socket.o tmp\app_rand.o tmp\version.o tmp\sess_id.o tmp\ciphers.o tmp\nseq.o tmp\pkcs12.o tmp\pkcs8.o tmp\spkac.o tmp\smime.o tmp\rand.o tmp\engine.o tmp\ocsp.o tmp\prime.o tmp\openssl.o -leay32 -lssl32 -L. -lwsock32 -lgdi32 |
46 | 46 |
+ |
47 |
- echo Done compiling OpenSSL |
|
48 |
- |
|
49 |
- :end |
|
50 |
-- |
|
47 |
+ echo Done compiling OpenSSL |
|
48 |
+ |
|
49 |
+ :end |
|
50 |
+- |
|
51 | 51 |
diff -wur openssl-0.9.7m.orig/util/pl/Mingw32.pl openssl-0.9.7m/util/pl/Mingw32.pl |
52 | 52 |
--- openssl-0.9.7m.orig/util/pl/Mingw32.pl Sun May 16 23:28:32 2004 |
53 | 53 |
+++ openssl-0.9.7m/util/pl/Mingw32.pl Mon Jan 21 17:52:36 2008 |
... | ... |
@@ -27,30 +27,30 @@ diff -urw tmp/openssl-0.9.8h/ms/mw.bat openssl-0.9.8h/ms/mw.bat |
27 | 27 |
--- tmp/openssl-0.9.8h/ms/mw.bat Sat Feb 22 11:00:10 2003 |
28 | 28 |
+++ openssl-0.9.8h/ms/mw.bat Wed Jun 4 02:56:54 2008 |
29 | 29 |
@@ -1,17 +1,23 @@ |
30 |
- @rem OpenSSL with Mingw32 |
|
31 |
- @rem -------------------- |
|
32 |
- |
|
30 |
+ @rem OpenSSL with Mingw32 |
|
31 |
+ @rem -------------------- |
|
32 |
+ |
|
33 | 33 |
+@rem Include MinGW, MSYS, and ActiveState Perl in path |
34 | 34 |
+set PATH=c:\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MinGW\bin;c:\msys\1.0\bin |
35 | 35 |
+ |
36 |
- @rem Makefile |
|
37 |
- perl util\mkfiles.pl >MINFO |
|
38 |
--perl util\mk1mf.pl Mingw32 >ms\mingw32.mak |
|
36 |
+ @rem Makefile |
|
37 |
+ perl util\mkfiles.pl >MINFO |
|
38 |
+-perl util\mk1mf.pl Mingw32 >ms\mingw32.mak |
|
39 | 39 |
+perl util\mk1mf.pl no-idea no-mdc2 no-rc5 Mingw32 >ms\mingw32.mak |
40 | 40 |
+ |
41 |
- @rem DLL definition files |
|
42 |
--perl util\mkdef.pl 32 libeay >ms\libeay32.def |
|
41 |
+ @rem DLL definition files |
|
42 |
+-perl util\mkdef.pl 32 libeay >ms\libeay32.def |
|
43 | 43 |
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 libeay >ms\libeay32.def |
44 |
- if errorlevel 1 goto end |
|
45 |
--perl util\mkdef.pl 32 ssleay >ms\ssleay32.def |
|
44 |
+ if errorlevel 1 goto end |
|
45 |
+-perl util\mkdef.pl 32 ssleay >ms\ssleay32.def |
|
46 | 46 |
+perl util\mkdef.pl no-idea no-mdc2 no-rc5 32 ssleay >ms\ssleay32.def |
47 |
- if errorlevel 1 goto end |
|
48 |
- |
|
49 |
- @rem Build the libraries |
|
50 |
--make -f ms/mingw32.mak |
|
47 |
+ if errorlevel 1 goto end |
|
48 |
+ |
|
49 |
+ @rem Build the libraries |
|
50 |
+-make -f ms/mingw32.mak |
|
51 | 51 |
+ |
52 | 52 |
+@rem JY added --win32 |
53 | 53 |
+make --win32 -f ms/mingw32.mak |
54 |
- if errorlevel 1 goto end |
|
55 |
- |
|
56 |
- @rem Generate the DLLs and input libraries |
|
54 |
+ if errorlevel 1 goto end |
|
55 |
+ |
|
56 |
+ @rem Generate the DLLs and input libraries |
... | ... |
@@ -1,20 +1,20 @@ |
1 |
-/* |
|
2 |
- * Minimum TAP-Win32 version number expected by userspace |
|
3 |
- * |
|
4 |
- * The TAP-Win32 version number is defined in tap-win32/SOURCES |
|
5 |
- */ |
|
6 |
-#define TAP_ID "@PRODUCT_TAP_ID@" |
|
7 |
-#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ |
|
8 |
-#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ |
|
9 |
- |
|
10 |
-/* Name of package */ |
|
11 |
-#define PACKAGE "@PRODUCT_UNIX_NAME@" |
|
12 |
- |
|
13 |
-/* Define to the full name of this package. */ |
|
14 |
-#define PACKAGE_NAME "@PRODUCT_NAME@" |
|
15 |
- |
|
16 |
-/* Define to the one symbol short name of this package. */ |
|
17 |
-#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" |
|
18 |
- |
|
19 |
-/* Define to the version of this package. */ |
|
20 |
-#define PACKAGE_VERSION "@PRODUCT_VERSION@" |
|
1 |
+/* |
|
2 |
+ * Minimum TAP-Win32 version number expected by userspace |
|
3 |
+ * |
|
4 |
+ * The TAP-Win32 version number is defined in tap-win32/SOURCES |
|
5 |
+ */ |
|
6 |
+#define TAP_ID "@PRODUCT_TAP_ID@" |
|
7 |
+#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ |
|
8 |
+#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ |
|
9 |
+ |
|
10 |
+/* Name of package */ |
|
11 |
+#define PACKAGE "@PRODUCT_UNIX_NAME@" |
|
12 |
+ |
|
13 |
+/* Define to the full name of this package. */ |
|
14 |
+#define PACKAGE_NAME "@PRODUCT_NAME@" |
|
15 |
+ |
|
16 |
+/* Define to the one symbol short name of this package. */ |
|
17 |
+#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" |
|
18 |
+ |
|
19 |
+/* Define to the version of this package. */ |
|
20 |
+#define PACKAGE_VERSION "@PRODUCT_VERSION@" |
... | ... |
@@ -1,93 +1,93 @@ |
1 |
-# build autodefs.h and |
|
2 |
- |
|
3 |
-import re |
|
4 |
- |
|
5 |
-autogen = "Automatically generated by config.py" |
|
6 |
- |
|
7 |
-def parse_version_m4(kv, version_m4): |
|
8 |
- r = re.compile(r'^define\((\w+),\[(.*)\]\)$') |
|
9 |
- f = open(version_m4) |
|
10 |
- for line in f: |
|
11 |
- line = line.rstrip() |
|
12 |
- m = re.match(r, line) |
|
13 |
- if m: |
|
14 |
- g = m.groups() |
|
15 |
- kv[g[0]] = g[1] |
|
16 |
- f.close() |
|
17 |
- |
|
18 |
-def parse_settings_in(kv, settings_in): |
|
19 |
- r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$') |
|
20 |
- f = open(settings_in) |
|
21 |
- for line in f: |
|
22 |
- line = line.rstrip() |
|
23 |
- m = re.match(r, line) |
|
24 |
- if m: |
|
25 |
- g = m.groups() |
|
26 |
- kv[g[0]] = g[1] or '' |
|
27 |
- f.close() |
|
28 |
- |
|
29 |
-def build_autodefs(kv, autodefs_in, autodefs_out): |
|
30 |
- def repfn(m): |
|
31 |
- var, = m.groups() |
|
32 |
- return kv.get(var, '') |
|
33 |
- |
|
34 |
- r = re.compile(r'@(\w+)@') |
|
35 |
- fin = open(autodefs_in) |
|
36 |
- fout = open(autodefs_out, 'w') |
|
37 |
- fout.write("/* %s */\n\n" % autogen) |
|
38 |
- for line in fin: |
|
39 |
- newline = re.sub(r, repfn, line) |
|
40 |
- fout.write(newline) |
|
41 |
- fin.close() |
|
42 |
- fout.close() |
|
43 |
- |
|
44 |
-def print_key_values(kv): |
|
45 |
- for k, v in sorted(kv.items()): |
|
46 |
- print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) |
|
47 |
- |
|
48 |
-def get_sources(makefile_am): |
|
49 |
- c = set() |
|
50 |
- h = set() |
|
51 |
- f = open(makefile_am) |
|
52 |
- state = False |
|
53 |
- for line in f: |
|
54 |
- line = line.rstrip() |
|
55 |
- if line == 'openvpn_SOURCES = \\': |
|
56 |
- state = True |
|
57 |
- elif not line: |
|
58 |
- state = False |
|
59 |
- elif state: |
|
60 |
- for sf in line.split(): |
|
61 |
- if sf.endswith('.c'): |
|
62 |
- c.add(sf[:-2]) |
|
63 |
- elif sf.endswith('.h'): |
|
64 |
- h.add(sf[:-2]) |
|
65 |
- elif sf == '\\': |
|
66 |
- pass |
|
67 |
- else: |
|
68 |
- print >>sys.stderr, "Unrecognized filename:", sf |
|
69 |
- f.close() |
|
70 |
- return [ sorted(list(s)) for s in (c, h) ] |
|
71 |
- |
|
72 |
-def output_mak_list(out, title, srclist, ext): |
|
73 |
- out.write("%s =" % (title,)) |
|
74 |
- for x in srclist: |
|
75 |
- out.write(" \\\n\t%s.%s" % (x, ext)) |
|
76 |
- out.write('\n\n') |
|
77 |
- |
|
78 |
-def output_mak(makefile_am, outfile): |
|
79 |
- c, h = get_sources(makefile_am) |
|
80 |
- out = open(outfile, 'w') |
|
81 |
- out.write("# %s\n\n" % autogen) |
|
82 |
- output_mak_list(out, 'HEADERS', h, 'h') |
|
83 |
- output_mak_list(out, 'OBJS', c, 'obj') |
|
84 |
- out.close() |
|
85 |
- |
|
86 |
-def main(): |
|
87 |
- kv = {} |
|
88 |
- parse_version_m4(kv, 'version.m4') |
|
89 |
- parse_settings_in(kv, 'install-win32/settings.in') |
|
90 |
- build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h') |
|
91 |
- output_mak('Makefile.am', 'head_obj.mak') |
|
92 |
- |
|
93 |
-main() |
|
1 |
+# build autodefs.h and |
|
2 |
+ |
|
3 |
+import re |
|
4 |
+ |
|
5 |
+autogen = "Automatically generated by config.py" |
|
6 |
+ |
|
7 |
+def parse_version_m4(kv, version_m4): |
|
8 |
+ r = re.compile(r'^define\((\w+),\[(.*)\]\)$') |
|
9 |
+ f = open(version_m4) |
|
10 |
+ for line in f: |
|
11 |
+ line = line.rstrip() |
|
12 |
+ m = re.match(r, line) |
|
13 |
+ if m: |
|
14 |
+ g = m.groups() |
|
15 |
+ kv[g[0]] = g[1] |
|
16 |
+ f.close() |
|
17 |
+ |
|
18 |
+def parse_settings_in(kv, settings_in): |
|
19 |
+ r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)$') |
|
20 |
+ f = open(settings_in) |
|
21 |
+ for line in f: |
|
22 |
+ line = line.rstrip() |
|
23 |
+ m = re.match(r, line) |
|
24 |
+ if m: |
|
25 |
+ g = m.groups() |
|
26 |
+ kv[g[0]] = g[1] or '' |
|
27 |
+ f.close() |
|
28 |
+ |
|
29 |
+def build_autodefs(kv, autodefs_in, autodefs_out): |
|
30 |
+ def repfn(m): |
|
31 |
+ var, = m.groups() |
|
32 |
+ return kv.get(var, '') |
|
33 |
+ |
|
34 |
+ r = re.compile(r'@(\w+)@') |
|
35 |
+ fin = open(autodefs_in) |
|
36 |
+ fout = open(autodefs_out, 'w') |
|
37 |
+ fout.write("/* %s */\n\n" % autogen) |
|
38 |
+ for line in fin: |
|
39 |
+ newline = re.sub(r, repfn, line) |
|
40 |
+ fout.write(newline) |
|
41 |
+ fin.close() |
|
42 |
+ fout.close() |
|
43 |
+ |
|
44 |
+def print_key_values(kv): |
|
45 |
+ for k, v in sorted(kv.items()): |
|
46 |
+ print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) |
|
47 |
+ |
|
48 |
+def get_sources(makefile_am): |
|
49 |
+ c = set() |
|
50 |
+ h = set() |
|
51 |
+ f = open(makefile_am) |
|
52 |
+ state = False |
|
53 |
+ for line in f: |
|
54 |
+ line = line.rstrip() |
|
55 |
+ if line == 'openvpn_SOURCES = \\': |
|
56 |
+ state = True |
|
57 |
+ elif not line: |
|
58 |
+ state = False |
|
59 |
+ elif state: |
|
60 |
+ for sf in line.split(): |
|
61 |
+ if sf.endswith('.c'): |
|
62 |
+ c.add(sf[:-2]) |
|
63 |
+ elif sf.endswith('.h'): |
|
64 |
+ h.add(sf[:-2]) |
|
65 |
+ elif sf == '\\': |
|
66 |
+ pass |
|
67 |
+ else: |
|
68 |
+ print >>sys.stderr, "Unrecognized filename:", sf |
|
69 |
+ f.close() |
|
70 |
+ return [ sorted(list(s)) for s in (c, h) ] |
|
71 |
+ |
|
72 |
+def output_mak_list(out, title, srclist, ext): |
|
73 |
+ out.write("%s =" % (title,)) |
|
74 |
+ for x in srclist: |
|
75 |
+ out.write(" \\\n\t%s.%s" % (x, ext)) |
|
76 |
+ out.write('\n\n') |
|
77 |
+ |
|
78 |
+def output_mak(makefile_am, outfile): |
|
79 |
+ c, h = get_sources(makefile_am) |
|
80 |
+ out = open(outfile, 'w') |
|
81 |
+ out.write("# %s\n\n" % autogen) |
|
82 |
+ output_mak_list(out, 'HEADERS', h, 'h') |
|
83 |
+ output_mak_list(out, 'OBJS', c, 'obj') |
|
84 |
+ out.close() |
|
85 |
+ |
|
86 |
+def main(): |
|
87 |
+ kv = {} |
|
88 |
+ parse_version_m4(kv, 'version.m4') |
|
89 |
+ parse_settings_in(kv, 'install-win32/settings.in') |
|
90 |
+ build_autodefs(kv, 'msvc/autodefs.h.in', 'autodefs.h') |
|
91 |
+ output_mak('Makefile.am', 'head_obj.mak') |
|
92 |
+ |
|
93 |
+main() |
... | ... |
@@ -1,52 +1,52 @@ |
1 |
-# This makefile builds the user-mode component |
|
2 |
-# of OpenVPN for Windows in the Visual Studio 2008 environment. |
|
3 |
- |
|
4 |
-# To build: |
|
5 |
-# python msvc\config.py |
|
6 |
-# nmake /f msvc\msvc.mak |
|
7 |
- |
|
8 |
-# Each of the OPENSSL and LZO dirs should have 'lib' and 'include' |
|
9 |
-# directories under them. |
|
10 |
- |
|
11 |
-OPENSSL = \src\openssl |
|
12 |
-OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib |
|
13 |
- |
|
14 |
-LZO = \src\lzo |
|
15 |
-LZO_DYNAMIC = lzo2.lib |
|
16 |
- |
|
17 |
-INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include |
|
18 |
- |
|
19 |
-LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib |
|
20 |
- |
|
21 |
-LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib |
|
22 |
- |
|
23 |
-EXE = openvpn.exe |
|
24 |
- |
|
25 |
-CPP=cl.exe |
|
26 |
-CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c |
|
27 |
-# release: |
|
28 |
-CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG |
|
29 |
-# debug: |
|
30 |
-#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG |
|
31 |
- |
|
32 |
-LINK32=link.exe |
|
33 |
-# release: |
|
34 |
-LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)" |
|
35 |
-# debug: |
|
36 |
-#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)" |
|
37 |
- |
|
38 |
-# HEADERS and OBJS definitions, automatically generated |
|
39 |
-!INCLUDE head_obj.mak |
|
40 |
- |
|
41 |
-openvpn : $(OBJS) |
|
42 |
- $(LINK32) @<< |
|
43 |
- $(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS) |
|
44 |
-<< |
|
45 |
- |
|
46 |
-clean : |
|
47 |
- del /Q $(OBJS) $(EXE) *.idb *.pdb |
|
48 |
- |
|
49 |
-.c.obj:: |
|
50 |
- $(CPP) @<< |
|
51 |
- $(CPP_PROJ) $< |
|
52 |
-<< |
|
1 |
+# This makefile builds the user-mode component |
|
2 |
+# of OpenVPN for Windows in the Visual Studio 2008 environment. |
|
3 |
+ |
|
4 |
+# To build: |
|
5 |
+# python msvc\config.py |
|
6 |
+# nmake /f msvc\msvc.mak |
|
7 |
+ |
|
8 |
+# Each of the OPENSSL and LZO dirs should have 'lib' and 'include' |
|
9 |
+# directories under them. |
|
10 |
+ |
|
11 |
+OPENSSL = \src\openssl |
|
12 |
+OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib |
|
13 |
+ |
|
14 |
+LZO = \src\lzo |
|
15 |
+LZO_DYNAMIC = lzo2.lib |
|
16 |
+ |
|
17 |
+INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include |
|
18 |
+ |
|
19 |
+LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib |
|
20 |
+ |
|
21 |
+LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib |
|
22 |
+ |
|
23 |
+EXE = openvpn.exe |
|
24 |
+ |
|
25 |
+CPP=cl.exe |
|
26 |
+CPP_ARG_COMMON=/nologo /W3 /O2 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c |
|
27 |
+# release: |
|
28 |
+CPP_PROJ=$(CPP_ARG_COMMON) /MD -DNDEBUG |
|
29 |
+# debug: |
|
30 |
+#CPP_PROJ=$(CPP_ARG_COMMON) /MDd /Zi /Od -D_DEBUG |
|
31 |
+ |
|
32 |
+LINK32=link.exe |
|
33 |
+# release: |
|
34 |
+LINK32_FLAGS=/nologo /subsystem:console /incremental:no /out:"$(EXE)" |
|
35 |
+# debug: |
|
36 |
+#LINK32_FLAGS=/nologo /subsystem:console /incremental:no /debug /out:"$(EXE)" |
|
37 |
+ |
|
38 |
+# HEADERS and OBJS definitions, automatically generated |
|
39 |
+!INCLUDE head_obj.mak |
|
40 |
+ |
|
41 |
+openvpn : $(OBJS) |
|
42 |
+ $(LINK32) @<< |
|
43 |
+ $(LINK32_FLAGS) $(LIB_DIRS) $(LIBS) $(OBJS) |
|
44 |
+<< |
|
45 |
+ |
|
46 |
+clean : |
|
47 |
+ del /Q $(OBJS) $(EXE) *.idb *.pdb |
|
48 |
+ |
|
49 |
+.c.obj:: |
|
50 |
+ $(CPP) @<< |
|
51 |
+ $(CPP_PROJ) $< |
|
52 |
+<< |
... | ... |
@@ -1,31 +1,31 @@ |
1 |
-#ifndef AUTODEFS_H |
|
2 |
-#define AUTODEFS_H |
|
3 |
- |
|
4 |
-/* |
|
5 |
- * Minimum TAP-Win32 version number expected by userspace |
|
6 |
- * |
|
7 |
- * The TAP-Win32 version number is defined in tap-win32/SOURCES |
|
8 |
- */ |
|
9 |
-#define TAP_ID "@PRODUCT_TAP_ID@" |
|
10 |
-#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ |
|
11 |
-#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ |
|
12 |
- |
|
13 |
-/* Friendly name for TAP driver */ |
|
14 |
-#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@" |
|
15 |
- |
|
16 |
-/* Version number of DDK/WDK used to build TAP driver */ |
|
17 |
-#define DDKVER_MAJOR @DDKVER_MAJOR@ |
|
18 |
- |
|
19 |
-/* Name of package */ |
|
20 |
-#define PACKAGE "@PRODUCT_UNIX_NAME@" |
|
21 |
- |
|
22 |
-/* Define to the full name of this package. */ |
|
23 |
-#define PACKAGE_NAME "@PRODUCT_NAME@" |
|
24 |
- |
|
25 |
-/* Define to the one symbol short name of this package. */ |
|
26 |
-#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" |
|
27 |
- |
|
28 |
-/* Define to the version of this package. */ |
|
29 |
-#define PACKAGE_VERSION "@PRODUCT_VERSION@" |
|
30 |
- |
|
31 |
-#endif |
|
1 |
+#ifndef AUTODEFS_H |
|
2 |
+#define AUTODEFS_H |
|
3 |
+ |
|
4 |
+/* |
|
5 |
+ * Minimum TAP-Win32 version number expected by userspace |
|
6 |
+ * |
|
7 |
+ * The TAP-Win32 version number is defined in tap-win32/SOURCES |
|
8 |
+ */ |
|
9 |
+#define TAP_ID "@PRODUCT_TAP_ID@" |
|
10 |
+#define TAP_WIN32_MIN_MAJOR @PRODUCT_TAP_WIN32_MIN_MAJOR@ |
|
11 |
+#define TAP_WIN32_MIN_MINOR @PRODUCT_TAP_WIN32_MIN_MINOR@ |
|
12 |
+ |
|
13 |
+/* Friendly name for TAP driver */ |
|
14 |
+#define PRODUCT_TAP_DEVICE_DESCRIPTION "@PRODUCT_TAP_DEVICE_DESCRIPTION@" |
|
15 |
+ |
|
16 |
+/* Version number of DDK/WDK used to build TAP driver */ |
|
17 |
+#define DDKVER_MAJOR @DDKVER_MAJOR@ |
|
18 |
+ |
|
19 |
+/* Name of package */ |
|
20 |
+#define PACKAGE "@PRODUCT_UNIX_NAME@" |
|
21 |
+ |
|
22 |
+/* Define to the full name of this package. */ |
|
23 |
+#define PACKAGE_NAME "@PRODUCT_NAME@" |
|
24 |
+ |
|
25 |
+/* Define to the one symbol short name of this package. */ |
|
26 |
+#define PACKAGE_TARNAME "@PRODUCT_UNIX_NAME@" |
|
27 |
+ |
|
28 |
+/* Define to the version of this package. */ |
|
29 |
+#define PACKAGE_VERSION "@PRODUCT_VERSION@" |
|
30 |
+ |
|
31 |
+#endif |
... | ... |
@@ -17,7 +17,7 @@ def clean(): |
17 | 17 |
|
18 | 18 |
# if we are run directly, and not loaded as a module |
19 | 19 |
if __name__ == "__main__": |
20 |
- if len(sys.argv) == 2 and sys.argv[1] == 'clean': |
|
21 |
- clean() |
|
22 |
- else: |
|
23 |
- main() |
|
20 |
+ if len(sys.argv) == 2 and sys.argv[1] == 'clean': |
|
21 |
+ clean() |
|
22 |
+ else: |
|
23 |
+ main() |
... | ... |
@@ -1,55 +1,55 @@ |
1 |
-import os |
|
2 |
-from wb import system, home_fn, choose_arch |
|
3 |
- |
|
4 |
-def build_ddk(config, dir, x64): |
|
5 |
- ddk_path = config['DDK_PATH'] |
|
6 |
- ddk_major = int(config['DDKVER_MAJOR']) |
|
7 |
- debug = 'PRODUCT_TAP_DEBUG' in config |
|
8 |
- return build_tap(ddk_path, ddk_major, debug, dir, x64) |
|
9 |
- |
|
10 |
-def build_tap(ddk_path, ddk_major, debug, dir, x64): |
|
1 |
+import os |
|
2 |
+from wb import system, home_fn, choose_arch |
|
3 |
+ |
|
4 |
+def build_ddk(config, dir, x64): |
|
5 |
+ ddk_path = config['DDK_PATH'] |
|
6 |
+ ddk_major = int(config['DDKVER_MAJOR']) |
|
7 |
+ debug = 'PRODUCT_TAP_DEBUG' in config |
|
8 |
+ return build_tap(ddk_path, ddk_major, debug, dir, x64) |
|
9 |
+ |
|
10 |
+def build_tap(ddk_path, ddk_major, debug, dir, x64): |
|
11 | 11 |
"""Build drivers using WinDDK tools""" |
12 |
- setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat')) |
|
13 |
- target = 'chk' if debug else 'fre' |
|
14 |
- if x64: |
|
15 |
- target += ' x64' |
|
16 |
- else: |
|
17 |
- target += ' x86' |
|
18 |
- if ddk_major >= 7600: |
|
19 |
- if x64: |
|
20 |
- target += ' wlh' # vista |
|
21 |
- else: |
|
22 |
- target += ' wnet' # server 2003 |
|
23 |
- else: |
|
24 |
- if x64: |
|
25 |
- target += ' wnet' # server 2003 |
|
26 |
- else: |
|
27 |
- target += ' w2k' # 2000 |
|
28 |
- |
|
29 |
- system('cmd /c "%s %s %s && cd %s && build -cef"' % ( |
|
30 |
- setenv_bat, |
|
31 |
- os.path.realpath(ddk_path), |
|
32 |
- target, |
|
33 |
- dir |
|
34 |
- )) |
|
35 |
- |
|
36 |
-def main(config, proj, arch): |
|
37 |
- if proj == 'tap': |
|
38 |
- dir = home_fn('tap-win32') |
|
39 |
- elif proj == 'tapinstall': |
|
40 |
- dir = home_fn('tapinstall') |
|
41 |
- else: |
|
42 |
- raise ValueError("unknown project: %s" % (proj,)) |
|
43 |
- |
|
44 |
- for x64 in choose_arch(arch): |
|
45 |
- build_ddk(config, dir, x64) |
|
46 |
- |
|
47 |
-# if we are run directly, and not loaded as a module |
|
48 |
-if __name__ == "__main__": |
|
49 |
- import sys |
|
50 |
- from wb import config |
|
51 |
- if len(sys.argv) >= 3: |
|
52 |
- main(config, sys.argv[1], sys.argv[2]) |
|
53 |
- else: |
|
54 |
- print "usage: build <tap|tapinstall> <x64|x86|all>" |
|
55 |
- sys.exit(2) |
|
12 |
+ setenv_bat = os.path.realpath(os.path.join(ddk_path, 'bin/setenv.bat')) |
|
13 |
+ target = 'chk' if debug else 'fre' |
|
14 |
+ if x64: |
|
15 |
+ target += ' x64' |
|
16 |
+ else: |
|
17 |
+ target += ' x86' |
|
18 |
+ if ddk_major >= 7600: |
|
19 |
+ if x64: |
|
20 |
+ target += ' wlh' # vista |
|
21 |
+ else: |
|
22 |
+ target += ' wnet' # server 2003 |
|
23 |
+ else: |
|
24 |
+ if x64: |
|
25 |
+ target += ' wnet' # server 2003 |
|
26 |
+ else: |
|
27 |
+ target += ' w2k' # 2000 |
|
28 |
+ |
|
29 |
+ system('cmd /c "%s %s %s && cd %s && build -cef"' % ( |
|
30 |
+ setenv_bat, |
|
31 |
+ os.path.realpath(ddk_path), |
|
32 |
+ target, |
|
33 |
+ dir |
|
34 |
+ )) |
|
35 |
+ |
|
36 |
+def main(config, proj, arch): |
|
37 |
+ if proj == 'tap': |
|
38 |
+ dir = home_fn('tap-win32') |
|
39 |
+ elif proj == 'tapinstall': |
|
40 |
+ dir = home_fn('tapinstall') |
|
41 |
+ else: |
|
42 |
+ raise ValueError("unknown project: %s" % (proj,)) |
|
43 |
+ |
|
44 |
+ for x64 in choose_arch(arch): |
|
45 |
+ build_ddk(config, dir, x64) |
|
46 |
+ |
|
47 |
+# if we are run directly, and not loaded as a module |
|
48 |
+if __name__ == "__main__": |
|
49 |
+ import sys |
|
50 |
+ from wb import config |
|
51 |
+ if len(sys.argv) >= 3: |
|
52 |
+ main(config, sys.argv[1], sys.argv[2]) |
|
53 |
+ else: |
|
54 |
+ print "usage: build <tap|tapinstall> <x64|x86|all>" |
|
55 |
+ sys.exit(2) |
... | ... |
@@ -1,15 +1,15 @@ |
1 |
-from config import main as config_main |
|
2 |
-from build import main as build_openvpn |
|
3 |
-from build_ddk import main as build_ddk |
|
4 |
-from sign import main as sign |
|
5 |
-from make_dist import main as make_dist |
|
6 |
- |
|
7 |
-def main(config): |
|
8 |
- config_main(config) |
|
9 |
- build_openvpn() |
|
10 |
- make_dist(config, tap=False) |
|
11 |
- |
|
12 |
-# if we are run directly, and not loaded as a module |
|
13 |
-if __name__ == "__main__": |
|
14 |
- from wb import config |
|
15 |
- main(config) |
|
1 |
+from config import main as config_main |
|
2 |
+from build import main as build_openvpn |
|
3 |
+from build_ddk import main as build_ddk |
|
4 |
+from sign import main as sign |
|
5 |
+from make_dist import main as make_dist |
|
6 |
+ |
|
7 |
+def main(config): |
|
8 |
+ config_main(config) |
|
9 |
+ build_openvpn() |
|
10 |
+ make_dist(config, tap=False) |
|
11 |
+ |
|
12 |
+# if we are run directly, and not loaded as a module |
|
13 |
+if __name__ == "__main__": |
|
14 |
+ from wb import config |
|
15 |
+ main(config) |
... | ... |
@@ -1,13 +1,13 @@ |
1 |
-from config import main as config_main |
|
2 |
-from config_tap import main as config_tap |
|
3 |
-from config_ti import main as config_ti |
|
4 |
- |
|
5 |
-def main(config): |
|
6 |
- config_main(config) |
|
7 |
- config_tap(config) |
|
8 |
- config_ti(config) |
|
9 |
- |
|
10 |
-# if we are run directly, and not loaded as a module |
|
11 |
-if __name__ == "__main__": |
|
12 |
- from wb import config |
|
13 |
- main(config) |
|
1 |
+from config import main as config_main |
|
2 |
+from config_tap import main as config_tap |
|
3 |
+from config_ti import main as config_ti |
|
4 |
+ |
|
5 |
+def main(config): |
|
6 |
+ config_main(config) |
|
7 |
+ config_tap(config) |
|
8 |
+ config_ti(config) |
|
9 |
+ |
|
10 |
+# if we are run directly, and not loaded as a module |
|
11 |
+if __name__ == "__main__": |
|
12 |
+ from wb import config |
|
13 |
+ main(config) |
... | ... |
@@ -1,35 +1,35 @@ |
1 |
-import os |
|
2 |
-from wb import preprocess, home_fn, autogen, dict_def |
|
3 |
- |
|
4 |
-def main(config): |
|
5 |
- preprocess(config, |
|
6 |
- in_fn=home_fn('tap-win32/SOURCES.in'), |
|
7 |
- out_fn=home_fn('tap-win32/SOURCES'), |
|
8 |
- quote_begin='@@', |
|
9 |
- quote_end='@@', |
|
10 |
- head_comment='# %s\n\n' % autogen) |
|
11 |
- |
|
12 |
- preprocess(config, |
|
13 |
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), |
|
14 |
- out_fn=home_fn('tap-win32/i386/OemWin2k.inf'), |
|
15 |
- quote_begin='@@', |
|
16 |
- quote_end='@@', |
|
17 |
- if_prefix='!', |
|
18 |
- head_comment='; %s\n\n' % autogen) |
|
19 |
- |
|
20 |
- try: |
|
21 |
- os.mkdir(home_fn('tap-win32/amd64')) |
|
22 |
- except: |
|
23 |
- pass |
|
24 |
- preprocess(dict_def(config, [('AMD64', '1')]), |
|
25 |
- in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), |
|
26 |
- out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'), |
|
27 |
- quote_begin='@@', |
|
28 |
- quote_end='@@', |
|
29 |
- if_prefix='!', |
|
30 |
- head_comment='; %s\n\n' % autogen) |
|
31 |
- |
|
32 |
-# if we are run directly, and not loaded as a module |
|
33 |
-if __name__ == "__main__": |
|
34 |
- from wb import config |
|
35 |
- main(config) |
|
1 |
+import os |
|
2 |
+from wb import preprocess, home_fn, autogen, dict_def |
|
3 |
+ |
|
4 |
+def main(config): |
|
5 |
+ preprocess(config, |
|
6 |
+ in_fn=home_fn('tap-win32/SOURCES.in'), |
|
7 |
+ out_fn=home_fn('tap-win32/SOURCES'), |
|
8 |
+ quote_begin='@@', |
|
9 |
+ quote_end='@@', |
|
10 |
+ head_comment='# %s\n\n' % autogen) |
|
11 |
+ |
|
12 |
+ preprocess(config, |
|
13 |
+ in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), |
|
14 |
+ out_fn=home_fn('tap-win32/i386/OemWin2k.inf'), |
|
15 |
+ quote_begin='@@', |
|
16 |
+ quote_end='@@', |
|
17 |
+ if_prefix='!', |
|
18 |
+ head_comment='; %s\n\n' % autogen) |
|
19 |
+ |
|
20 |
+ try: |
|
21 |
+ os.mkdir(home_fn('tap-win32/amd64')) |
|
22 |
+ except: |
|
23 |
+ pass |
|
24 |
+ preprocess(dict_def(config, [('AMD64', '1')]), |
|
25 |
+ in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), |
|
26 |
+ out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'), |
|
27 |
+ quote_begin='@@', |
|
28 |
+ quote_end='@@', |
|
29 |
+ if_prefix='!', |
|
30 |
+ head_comment='; %s\n\n' % autogen) |
|
31 |
+ |
|
32 |
+# if we are run directly, and not loaded as a module |
|
33 |
+if __name__ == "__main__": |
|
34 |
+ from wb import config |
|
35 |
+ main(config) |
... | ... |
@@ -1,18 +1,18 @@ |
1 |
-import os, shutil |
|
2 |
-from wb import preprocess, home_fn, autogen |
|
3 |
- |
|
4 |
-def main(config): |
|
5 |
- src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR']) |
|
6 |
- dest = home_fn('tapinstall') |
|
7 |
- shutil.rmtree(dest, ignore_errors=True) |
|
8 |
- shutil.copytree(src, dest) |
|
9 |
- preprocess(config, |
|
10 |
- in_fn=os.path.join(dest, 'sources.in'), |
|
11 |
- out_fn=os.path.join(dest, 'sources'), |
|
12 |
- if_prefix='!', |
|
13 |
- head_comment='# %s\n\n' % autogen) |
|
14 |
- |
|
15 |
-# if we are run directly, and not loaded as a module |
|
16 |
-if __name__ == "__main__": |
|
17 |
- from wb import config |
|
18 |
- main(config) |
|
1 |
+import os, shutil |
|
2 |
+from wb import preprocess, home_fn, autogen |
|
3 |
+ |
|
4 |
+def main(config): |
|
5 |
+ src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR']) |
|
6 |
+ dest = home_fn('tapinstall') |
|
7 |
+ shutil.rmtree(dest, ignore_errors=True) |
|
8 |
+ shutil.copytree(src, dest) |
|
9 |
+ preprocess(config, |
|
10 |
+ in_fn=os.path.join(dest, 'sources.in'), |
|
11 |
+ out_fn=os.path.join(dest, 'sources'), |
|
12 |
+ if_prefix='!', |
|
13 |
+ head_comment='# %s\n\n' % autogen) |
|
14 |
+ |
|
15 |
+# if we are run directly, and not loaded as a module |
|
16 |
+if __name__ == "__main__": |
|
17 |
+ from wb import config |
|
18 |
+ main(config) |
... | ... |
@@ -1,10 +1,10 @@ |
1 |
-import json |
|
2 |
- |
|
3 |
-# usage: |
|
4 |
-# print JSON().encode(kv) |
|
5 |
- |
|
6 |
-class JSON(json.JSONEncoder): |
|
7 |
- def __init__(self, **kwargs): |
|
8 |
- args = dict(sort_keys=True, indent=2) |
|
9 |
- args.update(kwargs) |
|
10 |
- json.JSONEncoder.__init__(self, **args) |
|
1 |
+import json |
|
2 |
+ |
|
3 |
+# usage: |
|
4 |
+# print JSON().encode(kv) |
|
5 |
+ |
|
6 |
+class JSON(json.JSONEncoder): |
|
7 |
+ def __init__(self, **kwargs): |
|
8 |
+ args = dict(sort_keys=True, indent=2) |
|
9 |
+ args.update(kwargs) |
|
10 |
+ json.JSONEncoder.__init__(self, **args) |
... | ... |
@@ -3,14 +3,14 @@ from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell |
3 | 3 |
|
4 | 4 |
def main(config, tap=True): |
5 | 5 |
dist = config['DIST'] |
6 |
- assert dist |
|
7 |
- dist = home_fn(dist) |
|
8 |
- bin = os.path.join(dist, 'bin') |
|
9 |
- i386 = os.path.join(dist, 'i386') |
|
10 |
- amd64 = os.path.join(dist, 'amd64') |
|
6 |
+ assert dist |
|
7 |
+ dist = home_fn(dist) |
|
8 |
+ bin = os.path.join(dist, 'bin') |
|
9 |
+ i386 = os.path.join(dist, 'i386') |
|
10 |
+ amd64 = os.path.join(dist, 'amd64') |
|
11 | 11 |
samples = os.path.join(dist, 'samples') |
12 |
- |
|
13 |
- # build dist and subdirectories |
|
12 |
+ |
|
13 |
+ # build dist and subdirectories |
|
14 | 14 |
rm_rf(dist) |
15 | 15 |
mkdir(dist) |
16 | 16 |
mkdir(bin) |
... | ... |
@@ -19,19 +19,19 @@ def main(config, tap=True): |
19 | 19 |
mkdir(samples) |
20 | 20 |
|
21 | 21 |
# copy openvpn.exe, openvpnserv.exe and their manifests |
22 |
- cp(home_fn('openvpn.exe'), bin) |
|
23 |
- cp(home_fn('openvpn.exe.manifest'), bin) |
|
22 |
+ cp(home_fn('openvpn.exe'), bin) |
|
23 |
+ cp(home_fn('openvpn.exe.manifest'), bin) |
|
24 | 24 |
cp(home_fn('service-win32/openvpnserv.exe'), bin) |
25 | 25 |
cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin) |
26 | 26 |
|
27 | 27 |
# copy openvpn-gui |
28 | 28 |
cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin) |
29 |
- |
|
30 |
- # copy DLL dependencies |
|
31 |
- cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin) |
|
29 |
+ |
|
30 |
+ # copy DLL dependencies |
|
31 |
+ cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin) |
|
32 | 32 |
cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin) |
33 |
- cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin) |
|
34 |
- cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin) |
|
33 |
+ cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin) |
|
34 |
+ cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin) |
|
35 | 35 |
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin) |
36 | 36 |
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin) |
37 | 37 |
|
... | ... |
@@ -103,5 +103,5 @@ def main(config, tap=True): |
103 | 103 |
|
104 | 104 |
# if we are run directly, and not loaded as a module |
105 | 105 |
if __name__ == "__main__": |
106 |
- from wb import config |
|
107 |
- main(config) |
|
106 |
+ from wb import config |
|
107 |
+ main(config) |
... | ... |
@@ -7,51 +7,51 @@ |
7 | 7 |
# |
8 | 8 |
# - Everything between @<< and << is inserted into a s.c. "in-line file". This |
9 | 9 |
# file drives the linker (link.exe). |
10 |
-# - HEADERS_OBJS is expanded to all all header and source files listed in |
|
10 |
+# - HEADERS_OBJS is expanded to all all header and source files listed in |
|
11 | 11 |
# ..\Makefile.am |
12 | 12 |
# - OPENSSL_DIR and LZO_DIR are dynamically created from settings.in |
13 |
- |
|
14 |
-OPENSSL = @OPENSSL_DIR@ |
|
15 |
-OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib |
|
16 |
- |
|
17 |
-LZO = @LZO_DIR@ |
|
18 |
-LZO_DYNAMIC = lzo2.lib |
|
19 |
- |
|
20 |
-INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include |
|
21 |
- |
|
22 |
-LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib |
|
23 |
- |
|
24 |
-LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib |
|
25 |
- |
|
26 |
-EXE = openvpn.exe |
|
27 |
- |
|
28 |
-CPP=cl.exe |
|
29 |
-CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c |
|
30 |
- |
|
31 |
-LINK32=link.exe |
|
32 |
- |
|
33 |
-!ifdef PRODUCT_OPENVPN_DEBUG |
|
34 |
-# debug: |
|
35 |
-CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7 |
|
13 |
+ |
|
14 |
+OPENSSL = @OPENSSL_DIR@ |
|
15 |
+OPENSSL_DYNAMIC = libeay32.lib ssleay32.lib |
|
16 |
+ |
|
17 |
+LZO = @LZO_DIR@ |
|
18 |
+LZO_DYNAMIC = lzo2.lib |
|
19 |
+ |
|
20 |
+INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include |
|
21 |
+ |
|
22 |
+LIBS = $(OPENSSL_DYNAMIC) $(LZO_DYNAMIC) ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib |
|
23 |
+ |
|
24 |
+LIB_DIRS = -LIBPATH:$(OPENSSL)\lib -LIBPATH:$(LZO)\lib |
|
25 |
+ |
|
26 |
+EXE = openvpn.exe |
|
27 |
+ |
|
28 |
+CPP=cl.exe |
|
29 |
+CPP_ARG_COMMON=/nologo /W3 -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CONSOLE -D_MBCS -D_CRT_SECURE_NO_DEPRECATE $(INCLUDE_DIRS) /FD /c |
|
30 |
+ |
|
31 |
+LINK32=link.exe |
|
32 |
+ |
|
33 |
+!ifdef PRODUCT_OPENVPN_DEBUG |
|
34 |
+# debug: |
|
35 |
+CPP_PROJ=$(CPP_ARG_COMMON) /MD /Z7 |
|
36 | 36 |
LINK32_FLAGS=/nologo /subsystem:console /incremental:no /opt:ref /opt:icf /debug |
37 |
-!else |
|
38 |
-# release: |
|
39 |
-CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG |
|
37 |
+!else |
|
38 |
+# release: |
|
39 |
+CPP_PROJ=$(CPP_ARG_COMMON) /O2 /MD -DNDEBUG |
|
40 | 40 |
LINK32_FLAGS=/nologo /subsystem:console /incremental:no |
41 |
-!endif |
|
42 |
- |
|
41 |
+!endif |
|
42 |
+ |
|
43 | 43 |
# HEADERS and OBJS definitions, automatically generated from ../Makefile.am |
44 |
-@HEADERS_OBJS@ |
|
45 |
- |
|
46 |
-openvpn : $(OBJS) |
|
47 |
- $(LINK32) @<< |
|
44 |
+@HEADERS_OBJS@ |
|
45 |
+ |
|
46 |
+openvpn : $(OBJS) |
|
47 |
+ $(LINK32) @<< |
|
48 | 48 |
$(LINK32_FLAGS) "/out:$(EXE)" $(LIB_DIRS) $(LIBS) $(OBJS) |
49 |
-<< |
|
50 |
- |
|
51 |
-clean : |
|
52 |
- del /Q $(OBJS) $(EXE) *.idb *.pdb |
|
53 |
- |
|
54 |
-.c.obj:: |
|
55 |
- $(CPP) @<< |
|
56 |
- $(CPP_PROJ) $< |
|
57 |
-<< |
|
49 |
+<< |
|
50 |
+ |
|
51 |
+clean : |
|
52 |
+ del /Q $(OBJS) $(EXE) *.idb *.pdb |
|
53 |
+ |
|
54 |
+.c.obj:: |
|
55 |
+ $(CPP) @<< |
|
56 |
+ $(CPP_PROJ) $< |
|
57 |
+<< |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
from wb import get_config |
2 |
-from js import JSON |
|
3 |
- |
|
4 |
-def main(): |
|
2 |
+from js import JSON |
|
3 |
+ |
|
4 |
+def main(): |
|
5 | 5 |
print JSON().encode(get_config()) |
6 |
- |
|
7 |
-# if we are run directly, and not loaded as a module |
|
8 |
-if __name__ == "__main__": |
|
9 |
- main() |
|
6 |
+ |
|
7 |
+# if we are run directly, and not loaded as a module |
|
8 |
+if __name__ == "__main__": |
|
9 |
+ main() |
... | ... |
@@ -1,19 +1,19 @@ |
1 |
-import sys |
|
2 |
-from wb import config, choose_arch, home_fn |
|
3 |
- |
|
4 |
-if 'SIGNTOOL' in config: |
|
5 |
- sys.path.append(home_fn(config['SIGNTOOL'])) |
|
6 |
- |
|
7 |
-def main(conf, arch): |
|
8 |
- from signtool import SignTool |
|
9 |
- st = SignTool(conf) |
|
10 |
- for x64 in choose_arch(arch): |
|
11 |
- st.sign_verify(x64=x64) |
|
12 |
- |
|
13 |
-# if we are run directly, and not loaded as a module |
|
14 |
-if __name__ == "__main__": |
|
15 |
- if len(sys.argv) >= 2: |
|
16 |
- main(config, sys.argv[1]) |
|
17 |
- else: |
|
18 |
- print "usage: sign <x64|x86|all>" |
|
19 |
- sys.exit(2) |
|
1 |
+import sys |
|
2 |
+from wb import config, choose_arch, home_fn |
|
3 |
+ |
|
4 |
+if 'SIGNTOOL' in config: |
|
5 |
+ sys.path.append(home_fn(config['SIGNTOOL'])) |
|
6 |
+ |
|
7 |
+def main(conf, arch): |
|
8 |
+ from signtool import SignTool |
|
9 |
+ st = SignTool(conf) |
|
10 |
+ for x64 in choose_arch(arch): |
|
11 |
+ st.sign_verify(x64=x64) |
|
12 |
+ |
|
13 |
+# if we are run directly, and not loaded as a module |
|
14 |
+if __name__ == "__main__": |
|
15 |
+ if len(sys.argv) >= 2: |
|
16 |
+ main(config, sys.argv[1]) |
|
17 |
+ else: |
|
18 |
+ print "usage: sign <x64|x86|all>" |
|
19 |
+ sys.exit(2) |
... | ... |
@@ -1,28 +1,28 @@ |
1 |
-import sys, os, shutil |
|
2 |
-from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp |
|
3 |
-if 'SIGNTOOL' in config: |
|
4 |
- sys.path.append(home_fn(config['SIGNTOOL'])) |
|
5 |
-from signtool import SignTool |
|
6 |
-from build_ddk import build_tap |
|
7 |
- |
|
8 |
-ti_dir = "c:/src/tapinstall" |
|
9 |
-hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64")) |
|
10 |
-low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",)) |
|
11 |
-dest_top = home_fn('tap_build') |
|
12 |
-dist = home_fn(config['TAP_DIST']) |
|
13 |
- |
|
14 |
-def copy_tap(src, dest, x64): |
|
15 |
- dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64]) |
|
16 |
- mkdir_silent(dest) |
|
17 |
- for dirpath, dirnames, filenames in os.walk(dir): |
|
18 |
- for f in filenames: |
|
19 |
- root, ext = os.path.splitext(f) |
|
20 |
- if ext in ('.inf', '.cat', '.sys'): |
|
21 |
- cp(os.path.join(dir, f), dest) |
|
22 |
- break |
|
23 |
- |
|
24 |
-def copy_tapinstall(src, dest, x64): |
|
25 |
- base = { False : 'i386', True: 'amd64' }[x64] |
|
1 |
+import sys, os, shutil |
|
2 |
+from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp |
|
3 |
+if 'SIGNTOOL' in config: |
|
4 |
+ sys.path.append(home_fn(config['SIGNTOOL'])) |
|
5 |
+from signtool import SignTool |
|
6 |
+from build_ddk import build_tap |
|
7 |
+ |
|
8 |
+ti_dir = "c:/src/tapinstall" |
|
9 |
+hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64")) |
|
10 |
+low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",)) |
|
11 |
+dest_top = home_fn('tap_build') |
|
12 |
+dist = home_fn(config['TAP_DIST']) |
|
13 |
+ |
|
14 |
+def copy_tap(src, dest, x64): |
|
15 |
+ dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64]) |
|
16 |
+ mkdir_silent(dest) |
|
17 |
+ for dirpath, dirnames, filenames in os.walk(dir): |
|
18 |
+ for f in filenames: |
|
19 |
+ root, ext = os.path.splitext(f) |
|
20 |
+ if ext in ('.inf', '.cat', '.sys'): |
|
21 |
+ cp(os.path.join(dir, f), dest) |
|
22 |
+ break |
|
23 |
+ |
|
24 |
+def copy_tapinstall(src, dest, x64): |
|
25 |
+ base = { False : 'i386', True: 'amd64' }[x64] |
|
26 | 26 |
mkdir_silent(dest) |
27 | 27 |
for dirpath, dirnames, filenames in os.walk(home_fn(src)): |
28 | 28 |
for f in filenames: |
... | ... |
@@ -30,100 +30,100 @@ def copy_tapinstall(src, dest, x64): |
30 | 30 |
dir_name = os.path.basename(dirpath) |
31 | 31 |
s = os.path.join(dirpath, f) |
32 | 32 |
if dir_name == base: |
33 |
- cp(s, dest) |
|
34 |
- |
|
35 |
-def main(): |
|
36 |
- rm_rf(dest_top) |
|
37 |
- os.mkdir(dest_top) |
|
38 |
- |
|
39 |
- rm_rf(dist) |
|
40 |
- os.mkdir(dist) |
|
41 |
- |
|
42 |
- for ver in hi, low: |
|
43 |
- top = os.path.join(dest_top, str(ver[1])) |
|
44 |
- os.mkdir(top) |
|
45 |
- tap_dest = os.path.join(top, "tap-win32") |
|
46 |
- ti_dest = os.path.join(top, "tapinstall") |
|
47 |
- ti_src = os.path.join(ti_dir, str(ver[2])) |
|
48 |
- shutil.copytree(home_fn("tap-win32"), tap_dest) |
|
49 |
- shutil.copytree(ti_src, ti_dest) |
|
50 |
- |
|
51 |
- i386 = os.path.join(tap_dest, "i386") |
|
52 |
- amd64 = os.path.join(tap_dest, "amd64") |
|
53 |
- |
|
54 |
- build_amd64 = (len(ver[3]) >= 2) |
|
55 |
- |
|
56 |
- build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h')) |
|
57 |
- |
|
58 |
- st = SignTool(config, tap_dest) |
|
59 |
- |
|
60 |
- preprocess(config, |
|
61 |
- in_fn=os.path.join(tap_dest, 'SOURCES.in'), |
|
62 |
- out_fn=os.path.join(tap_dest, 'SOURCES'), |
|
63 |
- quote_begin='@@', |
|
64 |
- quote_end='@@', |
|
65 |
- head_comment='# %s\n\n' % autogen) |
|
66 |
- |
|
67 |
- preprocess(config, |
|
68 |
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
69 |
- out_fn=os.path.join(i386, 'OemWin2k.inf'), |
|
70 |
- quote_begin='@@', |
|
71 |
- quote_end='@@', |
|
72 |
- if_prefix='!', |
|
73 |
- head_comment='; %s\n\n' % autogen) |
|
74 |
- |
|
75 |
- preprocess(config, |
|
76 |
- in_fn=os.path.join(ti_dest, 'sources.in'), |
|
77 |
- out_fn=os.path.join(ti_dest, 'sources'), |
|
78 |
- if_prefix='!', |
|
79 |
- head_comment='# %s\n\n' % autogen) |
|
80 |
- |
|
81 |
- build_tap(ddk_path=ver[0], |
|
82 |
- ddk_major=ver[1], |
|
83 |
- debug=False, |
|
84 |
- dir=tap_dest, |
|
85 |
- x64=False) |
|
86 |
- |
|
87 |
- st.sign_verify(x64=False) |
|
88 |
- |
|
89 |
- build_tap(ddk_path=ver[0], |
|
90 |
- ddk_major=ver[1], |
|
91 |
- debug=False, |
|
92 |
- dir=ti_dest, |
|
93 |
- x64=False) |
|
94 |
- |
|
95 |
- tap_dist = os.path.join(dist, ver[3][0]) |
|
96 |
- |
|
97 |
- copy_tap(tap_dest, tap_dist, x64=False) |
|
98 |
- copy_tapinstall(ti_dest, tap_dist, x64=False) |
|
99 |
- |
|
100 |
- if build_amd64: |
|
101 |
- os.mkdir(amd64) |
|
102 |
- preprocess(dict_def(config, [('AMD64', '1')]), |
|
103 |
- in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
104 |
- out_fn=os.path.join(amd64, 'OemWin2k.inf'), |
|
105 |
- quote_begin='@@', |
|
106 |
- quote_end='@@', |
|
107 |
- if_prefix='!', |
|
108 |
- head_comment='; %s\n\n' % autogen) |
|
109 |
- |
|
110 |
- build_tap(ddk_path=ver[0], |
|
111 |
- ddk_major=ver[1], |
|
112 |
- debug=False, |
|
113 |
- dir=tap_dest, |
|
114 |
- x64=True) |
|
115 |
- |
|
116 |
- build_tap(ddk_path=ver[0], |
|
117 |
- ddk_major=ver[1], |
|
118 |
- debug=False, |
|
119 |
- dir=ti_dest, |
|
120 |
- x64=True) |
|
121 |
- |
|
122 |
- st.sign_verify(x64=True) |
|
123 |
- |
|
124 |
- tap_dist_x64 = os.path.join(dist, ver[3][1]) |
|
125 |
- |
|
126 |
- copy_tap(tap_dest, tap_dist_x64, x64=True) |
|
127 |
- copy_tapinstall(ti_dest, tap_dist_x64, x64=True) |
|
128 |
- |
|
129 |
-main() |
|
33 |
+ cp(s, dest) |
|
34 |
+ |
|
35 |
+def main(): |
|
36 |
+ rm_rf(dest_top) |
|
37 |
+ os.mkdir(dest_top) |
|
38 |
+ |
|
39 |
+ rm_rf(dist) |
|
40 |
+ os.mkdir(dist) |
|
41 |
+ |
|
42 |
+ for ver in hi, low: |
|
43 |
+ top = os.path.join(dest_top, str(ver[1])) |
|
44 |
+ os.mkdir(top) |
|
45 |
+ tap_dest = os.path.join(top, "tap-win32") |
|
46 |
+ ti_dest = os.path.join(top, "tapinstall") |
|
47 |
+ ti_src = os.path.join(ti_dir, str(ver[2])) |
|
48 |
+ shutil.copytree(home_fn("tap-win32"), tap_dest) |
|
49 |
+ shutil.copytree(ti_src, ti_dest) |
|
50 |
+ |
|
51 |
+ i386 = os.path.join(tap_dest, "i386") |
|
52 |
+ amd64 = os.path.join(tap_dest, "amd64") |
|
53 |
+ |
|
54 |
+ build_amd64 = (len(ver[3]) >= 2) |
|
55 |
+ |
|
56 |
+ build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h')) |
|
57 |
+ |
|
58 |
+ st = SignTool(config, tap_dest) |
|
59 |
+ |
|
60 |
+ preprocess(config, |
|
61 |
+ in_fn=os.path.join(tap_dest, 'SOURCES.in'), |
|
62 |
+ out_fn=os.path.join(tap_dest, 'SOURCES'), |
|
63 |
+ quote_begin='@@', |
|
64 |
+ quote_end='@@', |
|
65 |
+ head_comment='# %s\n\n' % autogen) |
|
66 |
+ |
|
67 |
+ preprocess(config, |
|
68 |
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
69 |
+ out_fn=os.path.join(i386, 'OemWin2k.inf'), |
|
70 |
+ quote_begin='@@', |
|
71 |
+ quote_end='@@', |
|
72 |
+ if_prefix='!', |
|
73 |
+ head_comment='; %s\n\n' % autogen) |
|
74 |
+ |
|
75 |
+ preprocess(config, |
|
76 |
+ in_fn=os.path.join(ti_dest, 'sources.in'), |
|
77 |
+ out_fn=os.path.join(ti_dest, 'sources'), |
|
78 |
+ if_prefix='!', |
|
79 |
+ head_comment='# %s\n\n' % autogen) |
|
80 |
+ |
|
81 |
+ build_tap(ddk_path=ver[0], |
|
82 |
+ ddk_major=ver[1], |
|
83 |
+ debug=False, |
|
84 |
+ dir=tap_dest, |
|
85 |
+ x64=False) |
|
86 |
+ |
|
87 |
+ st.sign_verify(x64=False) |
|
88 |
+ |
|
89 |
+ build_tap(ddk_path=ver[0], |
|
90 |
+ ddk_major=ver[1], |
|
91 |
+ debug=False, |
|
92 |
+ dir=ti_dest, |
|
93 |
+ x64=False) |
|
94 |
+ |
|
95 |
+ tap_dist = os.path.join(dist, ver[3][0]) |
|
96 |
+ |
|
97 |
+ copy_tap(tap_dest, tap_dist, x64=False) |
|
98 |
+ copy_tapinstall(ti_dest, tap_dist, x64=False) |
|
99 |
+ |
|
100 |
+ if build_amd64: |
|
101 |
+ os.mkdir(amd64) |
|
102 |
+ preprocess(dict_def(config, [('AMD64', '1')]), |
|
103 |
+ in_fn=os.path.join(i386, 'OemWin2k.inf.in'), |
|
104 |
+ out_fn=os.path.join(amd64, 'OemWin2k.inf'), |
|
105 |
+ quote_begin='@@', |
|
106 |
+ quote_end='@@', |
|
107 |
+ if_prefix='!', |
|
108 |
+ head_comment='; %s\n\n' % autogen) |
|
109 |
+ |
|
110 |
+ build_tap(ddk_path=ver[0], |
|
111 |
+ ddk_major=ver[1], |
|
112 |
+ debug=False, |
|
113 |
+ dir=tap_dest, |
|
114 |
+ x64=True) |
|
115 |
+ |
|
116 |
+ build_tap(ddk_path=ver[0], |
|
117 |
+ ddk_major=ver[1], |
|
118 |
+ debug=False, |
|
119 |
+ dir=ti_dest, |
|
120 |
+ x64=True) |
|
121 |
+ |
|
122 |
+ st.sign_verify(x64=True) |
|
123 |
+ |
|
124 |
+ tap_dist_x64 = os.path.join(dist, ver[3][1]) |
|
125 |
+ |
|
126 |
+ copy_tap(tap_dest, tap_dist_x64, x64=True) |
|
127 |
+ copy_tapinstall(ti_dest, tap_dist_x64, x64=True) |
|
128 |
+ |
|
129 |
+main() |
... | ... |
@@ -1,46 +1,46 @@ |
1 |
-# Python module containing general build functions |
|
2 |
-# for OpenVPN on Windows |
|
3 |
- |
|
4 |
-import os, re, shutil, stat |
|
5 |
- |
|
6 |
-autogen = "Automatically generated by OpenVPN Windows build system" |
|
7 |
- |
|
8 |
-def get_config(): |
|
9 |
- kv = {} |
|
10 |
- parse_version_m4(kv, home_fn('version.m4')) |
|
11 |
- parse_settings_in(kv, mod_fn('settings.in')) |
|
12 |
- |
|
13 |
- # config fixups |
|
14 |
- kv['DDKVER'] = os.path.basename(kv['DDK_PATH']) |
|
15 |
- kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0] |
|
16 |
- |
|
17 |
- if 'VERSION_SUFFIX' in kv: |
|
18 |
- kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX'] |
|
19 |
- |
|
20 |
- return kv |
|
21 |
- |
|
1 |
+# Python module containing general build functions |
|
2 |
+# for OpenVPN on Windows |
|
3 |
+ |
|
4 |
+import os, re, shutil, stat |
|
5 |
+ |
|
6 |
+autogen = "Automatically generated by OpenVPN Windows build system" |
|
7 |
+ |
|
8 |
+def get_config(): |
|
9 |
+ kv = {} |
|
10 |
+ parse_version_m4(kv, home_fn('version.m4')) |
|
11 |
+ parse_settings_in(kv, mod_fn('settings.in')) |
|
12 |
+ |
|
13 |
+ # config fixups |
|
14 |
+ kv['DDKVER'] = os.path.basename(kv['DDK_PATH']) |
|
15 |
+ kv['DDKVER_MAJOR'] = re.match(r'^(\d+)\.', kv['DDKVER']).groups()[0] |
|
16 |
+ |
|
17 |
+ if 'VERSION_SUFFIX' in kv: |
|
18 |
+ kv['PRODUCT_VERSION'] += kv['VERSION_SUFFIX'] |
|
19 |
+ |
|
20 |
+ return kv |
|
21 |
+ |
|
22 | 22 |
def get_build_params(): |
23 | 23 |
kv = {} |
24 | 24 |
parse_build_params(kv,mod_fn('settings.in')) |
25 | 25 |
|
26 | 26 |
return kv |
27 | 27 |
|
28 |
-def mod_fn(fn, src=__file__, real=True): |
|
29 |
- p = os.path.join(os.path.dirname(src), os.path.normpath(fn)) |
|
30 |
- if real: |
|
31 |
- p = os.path.realpath(p) |
|
32 |
- return p |
|
33 |
- |
|
34 |
-def home_fn(fn, real=True): |
|
35 |
- return mod_fn(os.path.join('..', fn), real=real) |
|
36 |
- |
|
37 |
-def cd_home(): |
|
38 |
- os.chdir(os.path.join(os.path.dirname(__file__), '..')) |
|
39 |
- |
|
28 |
+def mod_fn(fn, src=__file__, real=True): |
|
29 |
+ p = os.path.join(os.path.dirname(src), os.path.normpath(fn)) |
|
30 |
+ if real: |
|
31 |
+ p = os.path.realpath(p) |
|
32 |
+ return p |
|
33 |
+ |
|
34 |
+def home_fn(fn, real=True): |
|
35 |
+ return mod_fn(os.path.join('..', fn), real=real) |
|
36 |
+ |
|
37 |
+def cd_home(): |
|
38 |
+ os.chdir(os.path.join(os.path.dirname(__file__), '..')) |
|
39 |
+ |
|
40 | 40 |
def cd_service_win32(): |
41 | 41 |
os.chdir(os.path.join(os.path.dirname(__file__), '../service-win32')) |
42 | 42 |
|
43 |
-def system(cmd): |
|
43 |
+def system(cmd): |
|
44 | 44 |
print "RUN:", cmd |
45 | 45 |
os.system(cmd) |
46 | 46 |
|
... | ... |
@@ -52,16 +52,16 @@ def run_in_vs_shell(cmd): |
52 | 52 |
def parse_version_m4(kv, version_m4): |
53 | 53 |
'''Parse define lines in version.m4''' |
54 | 54 |
r = re.compile(r'^define\((\w+),\[(.*)\]\)$') |
55 |
- f = open(version_m4) |
|
56 |
- for line in f: |
|
57 |
- line = line.rstrip() |
|
58 |
- m = re.match(r, line) |
|
55 |
+ f = open(version_m4) |
|
56 |
+ for line in f: |
|
57 |
+ line = line.rstrip() |
|
58 |
+ m = re.match(r, line) |
|
59 | 59 |
|
60 |
- if m: |
|
61 |
- g = m.groups() |
|
60 |
+ if m: |
|
61 |
+ g = m.groups() |
|
62 | 62 |
|
63 |
- # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or |
|
64 |
- # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra |
|
63 |
+ # If we encounter PRODUCT_TAP_WIN32_MIN_MAJOR or |
|
64 |
+ # PRODUCT_TAP_WIN32_MIN_MAJOR then we need to generate extra |
|
65 | 65 |
# variables, PRODUCT_TAP_MAJOR_VER and PRODUCT_TAP_MINOR_VER with |
66 | 66 |
# the same contents. This is necessary because tap-win32/tapdrv.c |
67 | 67 |
# build depends on those. |
... | ... |
@@ -71,20 +71,20 @@ def parse_version_m4(kv, version_m4): |
71 | 71 |
kv['PRODUCT_TAP_MINOR_VER'] = g[1] |
72 | 72 |
|
73 | 73 |
# Add the variable to build configuration |
74 |
- kv[g[0]] = g[1] |
|
75 |
- f.close() |
|
76 |
- |
|
77 |
-def parse_settings_in(kv, settings_in): |
|
78 |
- r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)?$') |
|
79 |
- f = open(settings_in) |
|
80 |
- for line in f: |
|
81 |
- line = line.rstrip() |
|
82 |
- m = re.match(r, line) |
|
83 |
- if m: |
|
84 |
- g = m.groups() |
|
85 |
- kv[g[0]] = g[1] or '' |
|
86 |
- f.close() |
|
87 |
- |
|
74 |
+ kv[g[0]] = g[1] |
|
75 |
+ f.close() |
|
76 |
+ |
|
77 |
+def parse_settings_in(kv, settings_in): |
|
78 |
+ r = re.compile(r'^!define\s+(\w+)(?:\s+"?(.*?)"?)?$') |
|
79 |
+ f = open(settings_in) |
|
80 |
+ for line in f: |
|
81 |
+ line = line.rstrip() |
|
82 |
+ m = re.match(r, line) |
|
83 |
+ if m: |
|
84 |
+ g = m.groups() |
|
85 |
+ kv[g[0]] = g[1] or '' |
|
86 |
+ f.close() |
|
87 |
+ |
|
88 | 88 |
def parse_build_params(kv, settings_in): |
89 | 89 |
r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)') |
90 | 90 |
|
... | ... |
@@ -107,7 +107,7 @@ def dict_def(dict, newdefs): |
107 | 107 |
return ret |
108 | 108 |
|
109 | 109 |
def build_autodefs(kv, autodefs_in, autodefs_out): |
110 |
- preprocess(kv, |
|
110 |
+ preprocess(kv, |
|
111 | 111 |
in_fn=autodefs_in, |
112 | 112 |
out_fn=autodefs_out, |
113 | 113 |
quote_begin='@', |
... | ... |
@@ -177,146 +177,146 @@ def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=No |
177 | 177 |
return kv.get(var, '') |
178 | 178 |
|
179 | 179 |
re_macro = re_ifdef = None |
180 |
- |
|
181 |
- if quote_begin and quote_end: |
|
182 |
- re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end))) |
|
183 |
- |
|
184 |
- if if_prefix: |
|
185 |
- re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),)) |
|
186 |
- re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),)) |
|
187 |
- re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),)) |
|
188 |
- |
|
189 |
- if_stack = [] |
|
190 |
- fin = open(in_fn) |
|
191 |
- fout = open(out_fn, 'w') |
|
192 |
- if head_comment: |
|
193 |
- fout.write(head_comment) |
|
194 |
- for line in fin: |
|
195 |
- if re_ifdef: |
|
196 |
- m = re.match(re_ifdef, line) |
|
197 |
- if m: |
|
198 |
- var, = m.groups() |
|
199 |
- if_stack.append(int(var in kv)) |
|
200 |
- continue |
|
201 |
- elif re.match(re_else, line): |
|
202 |
- if_stack[-1] ^= 1 |
|
203 |
- continue |
|
204 |
- elif re.match(re_endif, line): |
|
205 |
- if_stack.pop() |
|
206 |
- continue |
|
207 |
- if not if_stack or min(if_stack): |
|
208 |
- if re_macro: |
|
209 |
- line = re.sub(re_macro, repfn, line) |
|
210 |
- fout.write(line) |
|
211 |
- assert not if_stack |
|
212 |
- fin.close() |
|
213 |
- fout.close() |
|
214 |
- |
|
215 |
-def print_key_values(kv): |
|
216 |
- for k, v in sorted(kv.items()): |
|
217 |
- print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) |
|
218 |
- |
|
219 |
-def get_sources(makefile_am): |
|
180 |
+ |
|
181 |
+ if quote_begin and quote_end: |
|
182 |
+ re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end))) |
|
183 |
+ |
|
184 |
+ if if_prefix: |
|
185 |
+ re_ifdef = re.compile(r'^\s*%sifdef\s+(\w+)\b' % (re.escape(if_prefix),)) |
|
186 |
+ re_else = re.compile(r'^\s*%selse\b' % (re.escape(if_prefix),)) |
|
187 |
+ re_endif = re.compile(r'^\s*%sendif\b' % (re.escape(if_prefix),)) |
|
188 |
+ |
|
189 |
+ if_stack = [] |
|
190 |
+ fin = open(in_fn) |
|
191 |
+ fout = open(out_fn, 'w') |
|
192 |
+ if head_comment: |
|
193 |
+ fout.write(head_comment) |
|
194 |
+ for line in fin: |
|
195 |
+ if re_ifdef: |
|
196 |
+ m = re.match(re_ifdef, line) |
|
197 |
+ if m: |
|
198 |
+ var, = m.groups() |
|
199 |
+ if_stack.append(int(var in kv)) |
|
200 |
+ continue |
|
201 |
+ elif re.match(re_else, line): |
|
202 |
+ if_stack[-1] ^= 1 |
|
203 |
+ continue |
|
204 |
+ elif re.match(re_endif, line): |
|
205 |
+ if_stack.pop() |
|
206 |
+ continue |
|
207 |
+ if not if_stack or min(if_stack): |
|
208 |
+ if re_macro: |
|
209 |
+ line = re.sub(re_macro, repfn, line) |
|
210 |
+ fout.write(line) |
|
211 |
+ assert not if_stack |
|
212 |
+ fin.close() |
|
213 |
+ fout.close() |
|
214 |
+ |
|
215 |
+def print_key_values(kv): |
|
216 |
+ for k, v in sorted(kv.items()): |
|
217 |
+ print "%s%s%s" % (k, ' '*(32-len(k)), repr(v)) |
|
218 |
+ |
|
219 |
+def get_sources(makefile_am): |
|
220 | 220 |
"""Parse ../Makefile.am to obtain a list of .h and .c files""" |
221 |
- c = set() |
|
222 |
- h = set() |
|
223 |
- f = open(makefile_am) |
|
224 |
- state = False |
|
225 |
- for line in f: |
|
226 |
- line = line.rstrip() |
|
227 |
- if line == 'openvpn_SOURCES = \\': |
|
228 |
- state = True |
|
229 |
- elif not line: |
|
230 |
- state = False |
|
231 |
- elif state: |
|
232 |
- for sf in line.split(): |
|
233 |
- if sf.endswith('.c'): |
|
234 |
- c.add(sf[:-2]) |
|
235 |
- elif sf.endswith('.h'): |
|
236 |
- h.add(sf[:-2]) |
|
237 |
- elif sf == '\\': |
|
238 |
- pass |
|
239 |
- else: |
|
240 |
- print >>sys.stderr, "Unrecognized filename:", sf |
|
241 |
- f.close() |
|
242 |
- return [ sorted(list(s)) for s in (c, h) ] |
|
243 |
- |
|
244 |
-def output_mak_list(title, srclist, ext): |
|
245 |
- ret = "%s =" % (title,) |
|
246 |
- for x in srclist: |
|
247 |
- ret += " \\\n\t%s.%s" % (x, ext) |
|
248 |
- ret += '\n\n' |
|
249 |
- return ret |
|
250 |
- |
|
251 |
-def make_headers_objs(makefile_am): |
|
221 |
+ c = set() |
|
222 |
+ h = set() |
|
223 |
+ f = open(makefile_am) |
|
224 |
+ state = False |
|
225 |
+ for line in f: |
|
226 |
+ line = line.rstrip() |
|
227 |
+ if line == 'openvpn_SOURCES = \\': |
|
228 |
+ state = True |
|
229 |
+ elif not line: |
|
230 |
+ state = False |
|
231 |
+ elif state: |
|
232 |
+ for sf in line.split(): |
|
233 |
+ if sf.endswith('.c'): |
|
234 |
+ c.add(sf[:-2]) |
|
235 |
+ elif sf.endswith('.h'): |
|
236 |
+ h.add(sf[:-2]) |
|
237 |
+ elif sf == '\\': |
|
238 |
+ pass |
|
239 |
+ else: |
|
240 |
+ print >>sys.stderr, "Unrecognized filename:", sf |
|
241 |
+ f.close() |
|
242 |
+ return [ sorted(list(s)) for s in (c, h) ] |
|
243 |
+ |
|
244 |
+def output_mak_list(title, srclist, ext): |
|
245 |
+ ret = "%s =" % (title,) |
|
246 |
+ for x in srclist: |
|
247 |
+ ret += " \\\n\t%s.%s" % (x, ext) |
|
248 |
+ ret += '\n\n' |
|
249 |
+ return ret |
|
250 |
+ |
|
251 |
+def make_headers_objs(makefile_am): |
|
252 | 252 |
"""Generate HEADER and OBJS entries dynamically from ../Makefile.am""" |
253 |
- c, h = get_sources(makefile_am) |
|
254 |
- ret = output_mak_list('HEADERS', h, 'h') |
|
255 |
- ret += output_mak_list('OBJS', c, 'obj') |
|
256 |
- return ret |
|
257 |
- |
|
258 |
-def choose_arch(arch_name): |
|
259 |
- if arch_name == 'x64': |
|
260 |
- return (True,) |
|
261 |
- elif arch_name == 'x86': |
|
262 |
- return (False,) |
|
263 |
- elif arch_name == 'all': |
|
264 |
- return (True, False) |
|
265 |
- else: |
|
266 |
- raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,)) |
|
267 |
- |
|
268 |
-def rm_rf(dir): |
|
269 |
- print "REMOVE", dir |
|
270 |
- shutil.rmtree(dir, ignore_errors=True) |
|
271 |
- |
|
272 |
-def mkdir(dir): |
|
273 |
- print "MKDIR", dir |
|
274 |
- os.mkdir(dir) |
|
275 |
- |
|
276 |
-def cp_a(src, dest, dest_is_dir=True): |
|
277 |
- if dest_is_dir: |
|
278 |
- dest = os.path.join(dest, os.path.basename(src)) |
|
279 |
- print "COPY_DIR %s %s" % (src, dest) |
|
280 |
- shutil.copytree(src, dest) |
|
281 |
- |
|
282 |
-def cp(src, dest, dest_is_dir=True): |
|
283 |
- if dest_is_dir: |
|
284 |
- dest = os.path.join(dest, os.path.basename(src)) |
|
285 |
- print "COPY %s %s" % (src, dest) |
|
286 |
- shutil.copyfile(src, dest) |
|
287 |
- |
|
253 |
+ c, h = get_sources(makefile_am) |
|
254 |
+ ret = output_mak_list('HEADERS', h, 'h') |
|
255 |
+ ret += output_mak_list('OBJS', c, 'obj') |
|
256 |
+ return ret |
|
257 |
+ |
|
258 |
+def choose_arch(arch_name): |
|
259 |
+ if arch_name == 'x64': |
|
260 |
+ return (True,) |
|
261 |
+ elif arch_name == 'x86': |
|
262 |
+ return (False,) |
|
263 |
+ elif arch_name == 'all': |
|
264 |
+ return (True, False) |
|
265 |
+ else: |
|
266 |
+ raise ValueError("architecture ('%s') must be x86, x64, or all" % (arch_name,)) |
|
267 |
+ |
|
268 |
+def rm_rf(dir): |
|
269 |
+ print "REMOVE", dir |
|
270 |
+ shutil.rmtree(dir, ignore_errors=True) |
|
271 |
+ |
|
272 |
+def mkdir(dir): |
|
273 |
+ print "MKDIR", dir |
|
274 |
+ os.mkdir(dir) |
|
275 |
+ |
|
276 |
+def cp_a(src, dest, dest_is_dir=True): |
|
277 |
+ if dest_is_dir: |
|
278 |
+ dest = os.path.join(dest, os.path.basename(src)) |
|
279 |
+ print "COPY_DIR %s %s" % (src, dest) |
|
280 |
+ shutil.copytree(src, dest) |
|
281 |
+ |
|
282 |
+def cp(src, dest, dest_is_dir=True): |
|
283 |
+ if dest_is_dir: |
|
284 |
+ dest = os.path.join(dest, os.path.basename(src)) |
|
285 |
+ print "COPY %s %s" % (src, dest) |
|
286 |
+ shutil.copyfile(src, dest) |
|
287 |
+ |
|
288 | 288 |
def rename(src, dest): |
289 | 289 |
print "RENAME %s %s" % (src, dest) |
290 | 290 |
shutil.move(src, dest) |
291 | 291 |
|
292 |
-def rm_rf(path): |
|
293 |
- try: |
|
294 |
- shutil.rmtree(path, onerror=onerror) |
|
295 |
- except: |
|
296 |
- pass |
|
297 |
- |
|
298 |
-def onerror(func, path, exc_info): |
|
299 |
- """ |
|
300 |
- Error handler for ``shutil.rmtree``. |
|
301 |
- |
|
302 |
- If the error is due to an access error (read only file) |
|
303 |
- it attempts to add write permission and then retries. |
|
304 |
- |
|
305 |
- If the error is for another reason it re-raises the error. |
|
306 |
- |
|
307 |
- Usage : ``shutil.rmtree(path, onerror=onerror)`` |
|
308 |
- """ |
|
309 |
- if not os.access(path, os.W_OK): |
|
310 |
- # Is the error an access error ? |
|
311 |
- os.chmod(path, stat.S_IWUSR) |
|
312 |
- func(path) |
|
313 |
- else: |
|
314 |
- raise |
|
315 |
- |
|
316 |
-def mkdir_silent(dir): |
|
317 |
- try: |
|
318 |
- os.mkdir(dir) |
|
319 |
- except: |
|
320 |
- pass |
|
321 |
- |
|
322 |
-config = get_config() |
|
292 |
+def rm_rf(path): |
|
293 |
+ try: |
|
294 |
+ shutil.rmtree(path, onerror=onerror) |
|
295 |
+ except: |
|
296 |
+ pass |
|
297 |
+ |
|
298 |
+def onerror(func, path, exc_info): |
|
299 |
+ """ |
|
300 |
+ Error handler for ``shutil.rmtree``. |
|
301 |
+ |
|
302 |
+ If the error is due to an access error (read only file) |
|
303 |
+ it attempts to add write permission and then retries. |
|
304 |
+ |
|
305 |
+ If the error is for another reason it re-raises the error. |
|
306 |
+ |
|
307 |
+ Usage : ``shutil.rmtree(path, onerror=onerror)`` |
|
308 |
+ """ |
|
309 |
+ if not os.access(path, os.W_OK): |
|
310 |
+ # Is the error an access error ? |
|
311 |
+ os.chmod(path, stat.S_IWUSR) |
|
312 |
+ func(path) |
|
313 |
+ else: |
|
314 |
+ raise |
|
315 |
+ |
|
316 |
+def mkdir_silent(dir): |
|
317 |
+ try: |
|
318 |
+ os.mkdir(dir) |
|
319 |
+ except: |
|
320 |
+ pass |
|
321 |
+ |
|
322 |
+config = get_config() |