Debian Codegraph @

src/common/bnetsrp3.cpp

raw symbols SCIP
1 /*
2 * Class that implements the SRP-3 based authentication schema
3 * used by Blizzards WarCraft 3. Implementations is based upon
4 * public information available under
5 * http://www.javaop.com/@ron/documents/SRP.html
6 *
7 * Copyright (C) 2008 - Olaf Freyer
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Affero General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
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 Affero General Public License for more details.
18 */
19
20 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
21 #include "bnetsrp3.h"cxx . . $ `<file>/src/common/bnetsrp3.h`/
22
23 #include <cassert>
24 #include <cctype>
25 #include <cstdint>
26 #include <cstdio>
27 #include <cstdlib>
28 #include <cstring>
29 #include <iostream>
30 #include <sstream>
31 #include <stdexcept>
32
33 #include "common/bigint.h"cxx . . $ `<file>/src/common/bigint.h`/
34 #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/
35 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
36 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
37 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
38 #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/
39
40 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
41
42 namespace pvpgncxx . . $ pvpgn/
43 {
44
45 stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# bnetsrp3_gcxx . . $ pvpgn/bnetsrp3_g. = 0x2F;
46
47 const unsigned char bnetsrp3_Ncxx . . $ pvpgn/bnetsrp3_N.[] = {
48 0xF8, 0xFF, 0x1A, 0x8B, 0x61, 0x99, 0x18, 0x03,
49 0x21, 0x86, 0xB6, 0x8C, 0xA0, 0x92, 0xB5, 0x55,
50 0x7E, 0x97, 0x6C, 0x78, 0xC7, 0x32, 0x12, 0xD9,
51 0x12, 0x16, 0xF6, 0x65, 0x85, 0x23, 0xC7, 0x87
52 };
53
54 const unsigned char bnetsrp3_Icxx . . $ pvpgn/bnetsrp3_I.[] = {
55 0xF8, 0x01, 0x8C, 0xF0, 0xA4, 0x25, 0xBA, 0x8B,
56 0xEB, 0x89, 0x58, 0xB1, 0xAB, 0x6B, 0xF9, 0x0A,
57 0xED, 0x97, 0x0E, 0x6C
58 };
59
60 BigIntcxx . . $ pvpgn/BigInt# BnetSRP3cxx . . $ pvpgn/BnetSRP3#::Ncxx . . $ pvpgn/BnetSRP3#N. = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).(bnetsrp3_Ncxx . . $ pvpgn/bnetsrp3_N., 32);
61 BigIntcxx . . $ pvpgn/BigInt# BnetSRP3cxx . . $ pvpgn/BnetSRP3#::gcxx . . $ pvpgn/BnetSRP3#g. = BigIntcxx . . $ pvpgn/BigInt#(bnetsrp3_gcxx . . $ pvpgn/bnetsrp3_g.);
62 BigIntcxx . . $ pvpgn/BigInt# BnetSRP3cxx . . $ pvpgn/BnetSRP3#::Icxx . . $ pvpgn/BnetSRP3#I. = BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).(bnetsrp3_Icxx . . $ pvpgn/bnetsrp3_I., 32);
63
64 int
65 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(const char* username_, const char* password_, BigIntcxx . . $ pvpgn/BigInt#* salt_)
66 {
67 unsigned int i;
68 const char* source;
69 char* symbol;
70
71 if (!username_) {
72 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL username_");
73 return -1;
74 }
75
76 username_lengthcxx . . $ pvpgn/BnetSRP3#username_length. = stdcxx . . $ std/::strlen(username_);
77 usernamecxx . . $ pvpgn/BnetSRP3#username. = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(username_length + 1);
78 source = username_;
79 symbol = usernamecxx . . $ pvpgn/BnetSRP3#username.;
80 for (i = 0; i < username_lengthcxx . . $ pvpgn/BnetSRP3#username_length.; i++)
81 {
82 *(symbol++) = safe_touppercxx . . $ `src/common/xstring.h:40:10`!(*(source++));
83 }
84
85 if (!((password_ == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) ^ (salt_ == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!))) {
86 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "need to init with EITHER password_ OR salt_");
87 return -1;
88 }
89
90 if (password_ != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
91 password_lengthcxx . . $ pvpgn/BnetSRP3#password_length. = stdcxx . . $ std/::strlen(password_);
92 passwordcxx . . $ pvpgn/BnetSRP3#password. = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(password_length + 1);
93 source = password_;
94 symbol = passwordcxx . . $ pvpgn/BnetSRP3#password.;
95 for (i = 0; i < password_lengthcxx . . $ pvpgn/BnetSRP3#password_length.; i++)
96 {
97 *(symbol++) = safe_touppercxx . . $ `src/common/xstring.h:40:10`!(*(source++));
98 }
99 acxx . . $ pvpgn/BnetSRP3#a. =cxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625). BigIntcxx . . $ pvpgn/BigInt#::randomcxx . . $ pvpgn/BigInt#random(1a9faf48955cd7cf).(32) %cxx . . $ pvpgn/BigInt#`operator%`(aad5a6d0d695e555). Ncxx . . $ pvpgn/BnetSRP3#N.;
100 scxx . . $ pvpgn/BnetSRP3#s. =cxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625). BigIntcxx . . $ pvpgn/BigInt#::randomcxx . . $ pvpgn/BigInt#random(1a9faf48955cd7cf).(32);
101 }
102 else {
103 passwordcxx . . $ pvpgn/BnetSRP3#password. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
104 password_lengthcxx . . $ pvpgn/BnetSRP3#password_length. = 0;
105 bcxx . . $ pvpgn/BnetSRP3#b. =cxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625). BigIntcxx . . $ pvpgn/BigInt#::randomcxx . . $ pvpgn/BigInt#random(1a9faf48955cd7cf).(32) %cxx . . $ pvpgn/BigInt#`operator%`(aad5a6d0d695e555). Ncxx . . $ pvpgn/BnetSRP3#N.;
106 scxx . . $ pvpgn/BnetSRP3#s. =cxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625). *salt_;
107 }
108
109 Bcxx . . $ pvpgn/BnetSRP3#B. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
110
111 scxx . . $ pvpgn/BnetSRP3#s..getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(raw_saltcxx . . $ pvpgn/BnetSRP3#raw_salt., 32);
112
113 return 0;
114 }
115
116
117 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(1adce25d148ffb4c).(const char* username_, BigIntcxx . . $ pvpgn/BigInt#& salt)
118 {
119 initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(username_, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &salt);
120 }
121
122 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(955a996b079cdb58).(const stdcxx . . $ std/::stringcxx . . $ std/string#& username_, BigIntcxx . . $ pvpgn/BigInt#& salt)
123 {
124 initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(username_.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, &salt);
125 }
126
127 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(2fa786934fe80e24).(const char* username_, const char* password_)
128 {
129 initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(username_, password_, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
130 }
131
132 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::BnetSRP3cxx . . $ pvpgn/BnetSRP3#BnetSRP3(c3ca1c130ce09c52).(const stdcxx . . $ std/::stringcxx . . $ std/string#& username_, const stdcxx . . $ std/::stringcxx . . $ std/string#& password_)
133 {
134 initcxx . . $ pvpgn/BnetSRP3#init(9a326b18acc2bb5b).(username_.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), password_.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
135 }
136
137 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::~cxx . . $ pvpgn/BnetSRP3#`~BnetSRP3`(ced63f7c635d850d).BnetSRP3cxx . . $ pvpgn/BnetSRP3#()
138 {
139 if (usernamecxx . . $ pvpgn/BnetSRP3#username.)
140 xfreecxx . . $ `src/common/xalloc.h:51:9`!(username);
141
142 if (passwordcxx . . $ pvpgn/BnetSRP3#password.)
143 xfreecxx . . $ `src/common/xalloc.h:51:9`!(password);
144
145 delete Bcxx . . $ pvpgn/BnetSRP3#B.;
146 }
147
148 BigIntcxx . . $ pvpgn/BigInt#
149 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getClientPrivateKeycxx . . $ pvpgn/BnetSRP3#getClientPrivateKey(386d3f2c8bc32279).() const
150 {
151 char* userpass; // username,':',password
152 t_hashcxx . . $ pvpgn/t_hash# userpass_hash;
153 char private_value[32 + 20]; // s, H(userpass)
154 t_hashcxx . . $ pvpgn/t_hash# private_value_hash;
155
156 userpass = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(username_length + 1 + password_length + 1);
157 stdcxx . . $ std/::memcpy(userpass, usernamecxx . . $ pvpgn/BnetSRP3#username., username_lengthcxx . . $ pvpgn/BnetSRP3#username_length.);
158 userpass[username_lengthcxx . . $ pvpgn/BnetSRP3#username_length.] = ':';
159 stdcxx . . $ std/::memcpy(userpass + username_lengthcxx . . $ pvpgn/BnetSRP3#username_length. + 1, passwordcxx . . $ pvpgn/BnetSRP3#password., password_lengthcxx . . $ pvpgn/BnetSRP3#password_length.);
160 userpass[username_lengthcxx . . $ pvpgn/BnetSRP3#username_length. + 1 + password_lengthcxx . . $ pvpgn/BnetSRP3#password_length.] = '\0';
161 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&userpass_hash, username_lengthcxx . . $ pvpgn/BnetSRP3#username_length. + 1 + password_lengthcxx . . $ pvpgn/BnetSRP3#password_length., userpass);
162 xfreecxx . . $ `src/common/xalloc.h:51:9`!(userpass);
163
164 stdcxx . . $ std/::memcpy(&private_value[0], raw_saltcxx . . $ pvpgn/BnetSRP3#raw_salt., 32);
165 stdcxx . . $ std/::memcpy(&private_value[32], userpass_hash, 20);
166 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&private_value_hash, 52, private_value);
167
168 return BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char const*)private_value_hash, 20, 1, false);
169 }
170
171 BigIntcxx . . $ pvpgn/BigInt#
172 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getScramblercxx . . $ pvpgn/BnetSRP3#getScrambler(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const
173 {
174 unsigned char raw_B[32];
175 stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# scrambler;
176 t_hashcxx . . $ pvpgn/t_hash# hash;
177
178 B.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(raw_B, 32, 4, false);
179 sha1_hashcxx . . $ pvpgn/sha1_hash(2a8392f275be648).(&hash, 32, raw_B);
180 scrambler = *(stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t#*)hash;
181
182 return BigIntcxx . . $ pvpgn/BigInt#(scrambler);
183 }
184
185 BigIntcxx . . $ pvpgn/BigInt#
186 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getClientSecretcxx . . $ pvpgn/BnetSRP3#getClientSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const
187 {
188 BigIntcxx . . $ pvpgn/BigInt# x = getClientPrivateKeycxx . . $ pvpgn/BnetSRP3#getClientPrivateKey(386d3f2c8bc32279).();
189 BigIntcxx . . $ pvpgn/BigInt# u = getScramblercxx . . $ pvpgn/BnetSRP3#getScrambler(59a9847b0f9ae014).(B);
190 return (Ncxx . . $ pvpgn/BnetSRP3#N. +cxx . . $ pvpgn/BigInt#operator+(aad5a6d0d695e555). B -cxx . . $ pvpgn/BigInt#operator-(aad5a6d0d695e555). gcxx . . $ pvpgn/BnetSRP3#g..powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(x, Ncxx . . $ pvpgn/BnetSRP3#N.)).powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).((x*cxx . . $ pvpgn/BigInt#`operator*`(aad5a6d0d695e555).u) +cxx . . $ pvpgn/BigInt#operator+(aad5a6d0d695e555). acxx . . $ pvpgn/BnetSRP3#a., Ncxx . . $ pvpgn/BnetSRP3#N.);
191 }
192
193 BigIntcxx . . $ pvpgn/BigInt#
194 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getServerSecretcxx . . $ pvpgn/BnetSRP3#getServerSecret(804960666f5ec39a).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& v)
195 {
196 BigIntcxx . . $ pvpgn/BigInt# B = getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(v);
197 BigIntcxx . . $ pvpgn/BigInt# u = getScramblercxx . . $ pvpgn/BnetSRP3#getScrambler(59a9847b0f9ae014).(B);
198 return ((A *cxx . . $ pvpgn/BigInt#`operator*`(aad5a6d0d695e555). v.powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(u, Ncxx . . $ pvpgn/BnetSRP3#N.)) %cxx . . $ pvpgn/BigInt#`operator%`(aad5a6d0d695e555). Ncxx . . $ pvpgn/BnetSRP3#N.).powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(bcxx . . $ pvpgn/BnetSRP3#b., Ncxx . . $ pvpgn/BnetSRP3#N.);
199 }
200
201 BigIntcxx . . $ pvpgn/BigInt#
202 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::hashSecretcxx . . $ pvpgn/BnetSRP3#hashSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& secret) const
203 {
204 int i;
205 unsigned char* raw_secret;
206 unsigned char odd[16], even[16], hashedSecret[40];
207 unsigned char* secretPointer;
208 unsigned char* oddPointer;
209 unsigned char* evenPointer;
210 t_hashcxx . . $ pvpgn/t_hash# odd_hash, even_hash;
211
212 raw_secret = secret.getDatacxx . . $ pvpgn/BigInt#getData(7fde0967c2cfd879).(32, 4, false);
213 secretPointer = raw_secret;
214 oddPointer = odd;
215 evenPointer = even;
216
217 for (i = 0; i < 16; i++)
218 {
219 *(oddPointer++) = *(secretPointer++);
220 *(evenPointer++) = *(secretPointer++);
221 }
222
223 xfreecxx . . $ `src/common/xalloc.h:51:9`!(raw_secret);
224 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&odd_hash, 16, odd);
225 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&even_hash, 16, even);
226
227 secretPointer = hashedSecret;
228 oddPointer = (unsigned char*)odd_hash;
229 evenPointer = (unsigned char*)even_hash;
230
231 for (i = 0; i < 20; i++)
232 {
233 *(secretPointer++) = *(oddPointer++);
234 *(secretPointer++) = *(evenPointer++);
235 }
236
237 return BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).(hashedSecret, 40, 1, false);
238 }
239
240 BigIntcxx . . $ pvpgn/BigInt#
241 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getVerifiercxx . . $ pvpgn/BnetSRP3#getVerifier(386d3f2c8bc32279).() const
242 {
243 return gcxx . . $ pvpgn/BnetSRP3#g..powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(getClientPrivateKeycxx . . $ pvpgn/BnetSRP3#getClientPrivateKey(386d3f2c8bc32279).(), Ncxx . . $ pvpgn/BnetSRP3#N.);
244 }
245
246 BigIntcxx . . $ pvpgn/BigInt#
247 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getSaltcxx . . $ pvpgn/BnetSRP3#getSalt(386d3f2c8bc32279).() const
248 {
249 return scxx . . $ pvpgn/BigInt#BigInt(b36b8e5b36868922).;
250 }
251
252 void
253 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::setSaltcxx . . $ pvpgn/BnetSRP3#setSalt(29cbcaec537b00e2).(BigIntcxx . . $ pvpgn/BigInt# salt_)
254 {
255 scxx . . $ pvpgn/BnetSRP3#s. =cxx . . $ pvpgn/BigInt#`operator=`(edfbb244da9a4625). salt_;
256 scxx . . $ pvpgn/BnetSRP3#s..getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(raw_saltcxx . . $ pvpgn/BnetSRP3#raw_salt., 32);
257 }
258
259 BigIntcxx . . $ pvpgn/BigInt#
260 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getClientSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getClientSessionPublicKey(386d3f2c8bc32279).() const
261 {
262 return gcxx . . $ pvpgn/BnetSRP3#g..powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(acxx . . $ pvpgn/BnetSRP3#a., Ncxx . . $ pvpgn/BnetSRP3#N.);
263 }
264
265 BigIntcxx . . $ pvpgn/BigInt#
266 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(BigIntcxx . . $ pvpgn/BigInt#& v)
267 {
268 if (!Bcxx . . $ pvpgn/BnetSRP3#B.)
269 Bcxx . . $ pvpgn/BnetSRP3#B. = new BigIntcxx . . $ pvpgn/BigInt#((v +cxx . . $ pvpgn/BigInt#operator+(aad5a6d0d695e555). gcxx . . $ pvpgn/BnetSRP3#g..powmcxx . . $ pvpgn/BigInt#powm(b174fc4de7f7a52e).(bcxx . . $ pvpgn/BnetSRP3#b., Ncxx . . $ pvpgn/BnetSRP3#N.)) %cxx . . $ pvpgn/BigInt#`operator%`(aad5a6d0d695e555). Ncxx . . $ pvpgn/BnetSRP3#N.);
270
271 return *cxx . . $ pvpgn/BigInt#BigInt(b36b8e5b36868922).Bcxx . . $ pvpgn/BnetSRP3#B.;
272 }
273
274 BigIntcxx . . $ pvpgn/BigInt#
275 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getHashedClientSecretcxx . . $ pvpgn/BnetSRP3#getHashedClientSecret(59a9847b0f9ae014).(BigIntcxx . . $ pvpgn/BigInt#& B) const
276 {
277 BigIntcxx . . $ pvpgn/BigInt# clientSecret = getClientSecretcxx . . $ pvpgn/BnetSRP3#getClientSecret(59a9847b0f9ae014).(B);
278 return hashSecretcxx . . $ pvpgn/BnetSRP3#hashSecret(59a9847b0f9ae014).(clientSecret);
279 }
280
281 BigIntcxx . . $ pvpgn/BigInt#
282 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getHashedServerSecretcxx . . $ pvpgn/BnetSRP3#getHashedServerSecret(804960666f5ec39a).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& v)
283 {
284 BigIntcxx . . $ pvpgn/BigInt# serverSecret = getServerSecretcxx . . $ pvpgn/BnetSRP3#getServerSecret(804960666f5ec39a).(A, v);
285 return hashSecretcxx . . $ pvpgn/BnetSRP3#hashSecret(59a9847b0f9ae014).(serverSecret);
286 }
287
288 BigIntcxx . . $ pvpgn/BigInt#
289 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getClientPasswordProofcxx . . $ pvpgn/BnetSRP3#getClientPasswordProof(f61cf7c7bab94069).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& B, BigIntcxx . . $ pvpgn/BigInt#& K) const
290 {
291 unsigned char proofData[176];
292 t_hashcxx . . $ pvpgn/t_hash# usernameHash, proofHash;
293
294 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&usernameHash, username_lengthcxx . . $ pvpgn/BnetSRP3#username_length., usernamecxx . . $ pvpgn/BnetSRP3#username.);
295
296 Icxx . . $ pvpgn/BnetSRP3#I..getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[0], 20, 4, false);
297 stdcxx . . $ std/::memcpy(&proofData[20], usernameHash, 20);
298 scxx . . $ pvpgn/BnetSRP3#s..getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[40], 32);
299 A.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[72], 32, 4, false);
300 B.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[104], 32, 4, false);
301 K.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[136], 40, 4, false);
302
303 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&proofHash, 176, proofData);
304
305 return BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)proofHash, 20, 1, false);
306 }
307
308 BigIntcxx . . $ pvpgn/BigInt#
309 BnetSRP3cxx . . $ pvpgn/BnetSRP3#::getServerPasswordProofcxx . . $ pvpgn/BnetSRP3#getServerPasswordProof(f61cf7c7bab94069).(BigIntcxx . . $ pvpgn/BigInt#& A, BigIntcxx . . $ pvpgn/BigInt#& M, BigIntcxx . . $ pvpgn/BigInt#& K) const
310 {
311 unsigned char proofData[92];
312 t_hashcxx . . $ pvpgn/t_hash# proofHash;
313
314 A.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[0], 32, 4, false);
315 M.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[32], 20, 4, false);
316 K.getDatacxx . . $ pvpgn/BigInt#getData(e8a9d04a1645988e).(&proofData[52], 40, 4, false);
317
318 little_endian_sha1_hashcxx . . $ pvpgn/little_endian_sha1_hash(2a8392f275be648).(&proofHash, 92, proofData);
319
320 return BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).((unsigned char*)proofHash, 20, 1, false);
321 }
322
323 }