author | ihse |
Sat, 03 Mar 2018 08:21:47 +0100 | |
branch | ihse-warnings-cflags-branch |
changeset 56230 | 489867818774 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
43100 | 2 |
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#include "net_util.h" |
|
27 |
||
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
28 |
#include "java_net_InetAddress.h" |
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
29 |
|
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
30 |
int IPv6_supported(); |
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
31 |
int reuseport_supported(); |
2 | 32 |
|
33 |
static int IPv6_available; |
|
36115 | 34 |
static int REUSEPORT_available; |
2 | 35 |
|
56230 | 36 |
JNIEXPORT jint JNICALL ipv6_available(void) |
2 | 37 |
{ |
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
38 |
return IPv6_available; |
2 | 39 |
} |
40 |
||
56230 | 41 |
JNIEXPORT jint JNICALL reuseport_available(void) |
36115 | 42 |
{ |
43 |
return REUSEPORT_available; |
|
44 |
} |
|
45 |
||
2 | 46 |
JNIEXPORT jint JNICALL |
33653
c1ee09fe3274
8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents:
25859
diff
changeset
|
47 |
DEF_JNI_OnLoad(JavaVM *vm, void *reserved) |
2 | 48 |
{ |
49 |
JNIEnv *env; |
|
50 |
jclass iCls; |
|
51 |
jmethodID mid; |
|
52 |
jstring s; |
|
53 |
jint preferIPv4Stack; |
|
23015
73b21ab36615
8034174: Remove use of JVM_* functions from java.net code
chegar
parents:
22956
diff
changeset
|
54 |
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_2) != JNI_OK) { |
73b21ab36615
8034174: Remove use of JVM_* functions from java.net code
chegar
parents:
22956
diff
changeset
|
55 |
return JNI_EVERSION; /* JNI version not supported */ |
2 | 56 |
} |
23015
73b21ab36615
8034174: Remove use of JVM_* functions from java.net code
chegar
parents:
22956
diff
changeset
|
57 |
|
2 | 58 |
iCls = (*env)->FindClass(env, "java/lang/Boolean"); |
59 |
CHECK_NULL_RETURN(iCls, JNI_VERSION_1_2); |
|
60 |
mid = (*env)->GetStaticMethodID(env, iCls, "getBoolean", "(Ljava/lang/String;)Z"); |
|
61 |
CHECK_NULL_RETURN(mid, JNI_VERSION_1_2); |
|
62 |
s = (*env)->NewStringUTF(env, "java.net.preferIPv4Stack"); |
|
63 |
CHECK_NULL_RETURN(s, JNI_VERSION_1_2); |
|
64 |
preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s); |
|
65 |
||
66 |
/* |
|
43100 | 67 |
* Since we have initialized and loaded the socket library we will |
68 |
* check now whether we have IPv6 on this platform and if the |
|
69 |
* supporting socket APIs are available |
|
70 |
*/ |
|
2 | 71 |
IPv6_available = IPv6_supported() & (!preferIPv4Stack); |
36115 | 72 |
|
73 |
/* check if SO_REUSEPORT is supported on this platform */ |
|
74 |
REUSEPORT_available = reuseport_supported(); |
|
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
20839
diff
changeset
|
75 |
platformInit(); |
13043
10fa4f21ea0f
7123896: Unexpected behavior due to Solaris using separate IPv4 and IPv6 port spaces
coffeys
parents:
7668
diff
changeset
|
76 |
parseExclusiveBindProperty(env); |
10fa4f21ea0f
7123896: Unexpected behavior due to Solaris using separate IPv4 and IPv6 port spaces
coffeys
parents:
7668
diff
changeset
|
77 |
|
2 | 78 |
return JNI_VERSION_1_2; |
79 |
} |
|
80 |
||
81 |
static int initialized = 0; |
|
82 |
||
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
83 |
JNIEXPORT void JNICALL initInetAddressIDs(JNIEnv *env) { |
2 | 84 |
if (!initialized) { |
85 |
Java_java_net_InetAddress_init(env, 0); |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
86 |
JNU_CHECK_EXCEPTION(env); |
2 | 87 |
Java_java_net_Inet4Address_init(env, 0); |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
88 |
JNU_CHECK_EXCEPTION(env); |
2 | 89 |
Java_java_net_Inet6Address_init(env, 0); |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
90 |
JNU_CHECK_EXCEPTION(env); |
2 | 91 |
initialized = 1; |
92 |
} |
|
93 |
} |
|
94 |
||
16870 | 95 |
/* The address, and family fields used to be in InetAddress |
96 |
* but are now in an implementation object. So, there is an extra |
|
97 |
* level of indirection to access them now. |
|
98 |
*/ |
|
99 |
||
100 |
extern jclass iac_class; |
|
101 |
extern jfieldID ia_holderID; |
|
102 |
extern jfieldID iac_addressID; |
|
103 |
extern jfieldID iac_familyID; |
|
104 |
||
20821 | 105 |
/** |
106 |
* set_ methods return JNI_TRUE on success JNI_FALSE on error |
|
107 |
* get_ methods that return +ve int return -1 on error |
|
108 |
* get_ methods that return objects return NULL on error. |
|
109 |
*/ |
|
110 |
jobject getInet6Address_scopeifname(JNIEnv *env, jobject iaObj) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
111 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
20821 | 112 |
CHECK_NULL_RETURN(holder, NULL); |
113 |
return (*env)->GetObjectField(env, holder, ia6_scopeifnameID); |
|
114 |
} |
|
115 |
||
22956 | 116 |
jboolean setInet6Address_scopeifname(JNIEnv *env, jobject iaObj, jobject scopeifname) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
117 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
20821 | 118 |
CHECK_NULL_RETURN(holder, JNI_FALSE); |
119 |
(*env)->SetObjectField(env, holder, ia6_scopeifnameID, scopeifname); |
|
120 |
return JNI_TRUE; |
|
121 |
} |
|
122 |
||
43100 | 123 |
jboolean getInet6Address_scopeid_set(JNIEnv *env, jobject iaObj) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
124 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
43100 | 125 |
CHECK_NULL_RETURN(holder, JNI_FALSE); |
20821 | 126 |
return (*env)->GetBooleanField(env, holder, ia6_scopeidsetID); |
127 |
} |
|
128 |
||
43100 | 129 |
unsigned int getInet6Address_scopeid(JNIEnv *env, jobject iaObj) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
130 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
43100 | 131 |
CHECK_NULL_RETURN(holder, 0); |
132 |
return (unsigned int)(*env)->GetIntField(env, holder, ia6_scopeidID); |
|
20821 | 133 |
} |
134 |
||
22956 | 135 |
jboolean setInet6Address_scopeid(JNIEnv *env, jobject iaObj, int scopeid) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
136 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
20821 | 137 |
CHECK_NULL_RETURN(holder, JNI_FALSE); |
138 |
(*env)->SetIntField(env, holder, ia6_scopeidID, scopeid); |
|
139 |
if (scopeid > 0) { |
|
22956 | 140 |
(*env)->SetBooleanField(env, holder, ia6_scopeidsetID, JNI_TRUE); |
20821 | 141 |
} |
142 |
return JNI_TRUE; |
|
143 |
} |
|
144 |
||
22956 | 145 |
jboolean getInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *dest) { |
20821 | 146 |
jobject holder, addr; |
147 |
||
148 |
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
|
149 |
CHECK_NULL_RETURN(holder, JNI_FALSE); |
|
150 |
addr = (*env)->GetObjectField(env, holder, ia6_ipaddressID); |
|
151 |
CHECK_NULL_RETURN(addr, JNI_FALSE); |
|
152 |
(*env)->GetByteArrayRegion(env, addr, 0, 16, (jbyte *)dest); |
|
153 |
return JNI_TRUE; |
|
154 |
} |
|
155 |
||
22956 | 156 |
jboolean setInet6Address_ipaddress(JNIEnv *env, jobject iaObj, char *address) { |
20821 | 157 |
jobject holder; |
158 |
jbyteArray addr; |
|
159 |
||
160 |
holder = (*env)->GetObjectField(env, iaObj, ia6_holder6ID); |
|
161 |
CHECK_NULL_RETURN(holder, JNI_FALSE); |
|
162 |
addr = (jbyteArray)(*env)->GetObjectField(env, holder, ia6_ipaddressID); |
|
163 |
if (addr == NULL) { |
|
164 |
addr = (*env)->NewByteArray(env, 16); |
|
165 |
CHECK_NULL_RETURN(addr, JNI_FALSE); |
|
166 |
(*env)->SetObjectField(env, holder, ia6_ipaddressID, addr); |
|
167 |
} |
|
168 |
(*env)->SetByteArrayRegion(env, addr, 0, 16, (jbyte *)address); |
|
169 |
return JNI_TRUE; |
|
170 |
} |
|
171 |
||
16870 | 172 |
void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) { |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
173 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 174 |
(*env)->SetIntField(env, holder, iac_addressID, address); |
175 |
} |
|
176 |
||
177 |
void setInetAddress_family(JNIEnv *env, jobject iaObj, int family) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
178 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 179 |
(*env)->SetIntField(env, holder, iac_familyID, family); |
180 |
} |
|
181 |
||
182 |
void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject host) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
183 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 184 |
(*env)->SetObjectField(env, holder, iac_hostNameID, host); |
33301
9ee33abf5b4c
8133196: HTTPS hostname invalid issue with InetAddress
coffeys
parents:
25859
diff
changeset
|
185 |
(*env)->SetObjectField(env, holder, iac_origHostNameID, host); |
16870 | 186 |
} |
187 |
||
188 |
int getInetAddress_addr(JNIEnv *env, jobject iaObj) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
189 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 190 |
return (*env)->GetIntField(env, holder, iac_addressID); |
191 |
} |
|
192 |
||
193 |
int getInetAddress_family(JNIEnv *env, jobject iaObj) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
194 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 195 |
return (*env)->GetIntField(env, holder, iac_familyID); |
196 |
} |
|
197 |
||
198 |
jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) { |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
199 |
jobject holder = (*env)->GetObjectField(env, iaObj, ia_holderID); |
16870 | 200 |
return (*env)->GetObjectField(env, holder, iac_hostNameID); |
201 |
} |
|
202 |
||
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
203 |
JNIEXPORT jobject JNICALL |
43100 | 204 |
NET_SockaddrToInetAddress(JNIEnv *env, SOCKETADDRESS *sa, int *port) { |
2 | 205 |
jobject iaObj; |
43100 | 206 |
if (sa->sa.sa_family == AF_INET6) { |
207 |
jbyte *caddr = (jbyte *)&sa->sa6.sin6_addr; |
|
2 | 208 |
if (NET_IsIPv4Mapped(caddr)) { |
209 |
int address; |
|
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
210 |
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); |
2 | 211 |
CHECK_NULL_RETURN(iaObj, NULL); |
212 |
address = NET_IPv4MappedToIPv4(caddr); |
|
16870 | 213 |
setInetAddress_addr(env, iaObj, address); |
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
214 |
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4); |
2 | 215 |
} else { |
22956 | 216 |
jboolean ret; |
22646
5fa3669fd35d
8025306: Inet[4|6]Address class and fieldID initialization in networking native code
chegar
parents:
22597
diff
changeset
|
217 |
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID); |
2 | 218 |
CHECK_NULL_RETURN(iaObj, NULL); |
43100 | 219 |
ret = setInet6Address_ipaddress(env, iaObj, (char *)&sa->sa6.sin6_addr); |
22956 | 220 |
if (ret == JNI_FALSE) |
221 |
return NULL; |
|
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
36115
diff
changeset
|
222 |
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv6); |
43100 | 223 |
setInet6Address_scopeid(env, iaObj, sa->sa6.sin6_scope_id); |
2 | 224 |
} |
43100 | 225 |
*port = ntohs(sa->sa6.sin6_port); |
41834
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
226 |
} else { |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
227 |
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
228 |
CHECK_NULL_RETURN(iaObj, NULL); |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
229 |
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4); |
43100 | 230 |
setInetAddress_addr(env, iaObj, ntohl(sa->sa4.sin_addr.s_addr)); |
231 |
*port = ntohs(sa->sa4.sin_port); |
|
41834
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
232 |
} |
2 | 233 |
return iaObj; |
234 |
} |
|
235 |
||
43100 | 236 |
JNIEXPORT jboolean JNICALL |
237 |
NET_SockaddrEqualsInetAddress(JNIEnv *env, SOCKETADDRESS *sa, jobject iaObj) |
|
2 | 238 |
{ |
43100 | 239 |
jint family = getInetAddress_family(env, iaObj) == |
240 |
java_net_InetAddress_IPv4 ? AF_INET : AF_INET6; |
|
241 |
if (sa->sa.sa_family == AF_INET6) { |
|
242 |
jbyte *caddrNew = (jbyte *)&sa->sa6.sin6_addr; |
|
2 | 243 |
if (NET_IsIPv4Mapped(caddrNew)) { |
43100 | 244 |
int addrNew, addrCur; |
2 | 245 |
if (family == AF_INET6) { |
246 |
return JNI_FALSE; |
|
247 |
} |
|
248 |
addrNew = NET_IPv4MappedToIPv4(caddrNew); |
|
16870 | 249 |
addrCur = getInetAddress_addr(env, iaObj); |
2 | 250 |
if (addrNew == addrCur) { |
251 |
return JNI_TRUE; |
|
252 |
} else { |
|
253 |
return JNI_FALSE; |
|
254 |
} |
|
255 |
} else { |
|
256 |
jbyte caddrCur[16]; |
|
257 |
if (family == AF_INET) { |
|
258 |
return JNI_FALSE; |
|
259 |
} |
|
20821 | 260 |
getInet6Address_ipaddress(env, iaObj, (char *)caddrCur); |
43100 | 261 |
if (NET_IsEqual(caddrNew, caddrCur) && |
262 |
sa->sa6.sin6_scope_id == getInet6Address_scopeid(env, iaObj)) |
|
263 |
{ |
|
2 | 264 |
return JNI_TRUE; |
265 |
} else { |
|
266 |
return JNI_FALSE; |
|
267 |
} |
|
268 |
} |
|
41834
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
269 |
} else { |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
270 |
int addrNew, addrCur; |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
271 |
if (family != AF_INET) { |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
272 |
return JNI_FALSE; |
2 | 273 |
} |
43100 | 274 |
addrNew = ntohl(sa->sa4.sin_addr.s_addr); |
41834
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
275 |
addrCur = getInetAddress_addr(env, iaObj); |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
276 |
if (addrNew == addrCur) { |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
277 |
return JNI_TRUE; |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
278 |
} else { |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
279 |
return JNI_FALSE; |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
280 |
} |
99c4f72c0a91
8168771: Remove #ifdef AF_INET6 guards in libnet native coding
clanger
parents:
41771
diff
changeset
|
281 |
} |
2 | 282 |
} |
283 |
||
43100 | 284 |
JNIEXPORT jint JNICALL |
285 |
NET_GetPortFromSockaddr(SOCKETADDRESS *sa) { |
|
286 |
if (sa->sa.sa_family == AF_INET6) { |
|
287 |
return ntohs(sa->sa6.sin6_port); |
|
288 |
} else { |
|
289 |
return ntohs(sa->sa4.sin_port); |
|
290 |
} |
|
291 |
} |
|
292 |
||
2 | 293 |
unsigned short |
294 |
in_cksum(unsigned short *addr, int len) { |
|
295 |
int nleft = len; |
|
296 |
int sum = 0; |
|
297 |
unsigned short *w = addr; |
|
298 |
unsigned short answer = 0; |
|
299 |
while(nleft > 1) { |
|
300 |
sum += *w++; |
|
301 |
nleft -= 2; |
|
302 |
} |
|
303 |
||
304 |
if (nleft == 1) { |
|
305 |
*(unsigned char *) (&answer) = *(unsigned char *)w; |
|
306 |
sum += answer; |
|
307 |
} |
|
308 |
||
309 |
sum = (sum >> 16) + (sum & 0xffff); |
|
310 |
sum += (sum >> 16); |
|
311 |
answer = ~sum; |
|
312 |
return (answer); |
|
313 |
} |