197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
}
- (OFDataArray*)XMPP_parseServerFirstMessage: (OFDataArray*)data
{
size_t i;
const uint8_t *clientKey, *serverKey, *clientSignature;
intmax_t iterCount = 0;
id <OFHash> hash;
OFDataArray *ret, *authMessage, *tmpArray, *salt = nil, *saltedPassword;
OFString *tmpString, *sNonce = nil;
OFEnumerator *enumerator;
OFString *comp;
enum {
GOT_SNONCE = 0x01,
GOT_SALT = 0x02,
|
|
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
}
- (OFDataArray*)XMPP_parseServerFirstMessage: (OFDataArray*)data
{
size_t i;
const uint8_t *clientKey, *serverKey, *clientSignature;
intmax_t iterCount = 0;
id <OFCryptoHash> hash;
OFDataArray *ret, *authMessage, *tmpArray, *salt = nil, *saltedPassword;
OFString *tmpString, *sNonce = nil;
OFEnumerator *enumerator;
OFString *comp;
enum {
GOT_SNONCE = 0x01,
GOT_SALT = 0x02,
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
- (const uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key
data: (OFDataArray*)data
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDataArray *k = [OFDataArray dataArray];
size_t i, kSize, blockSize = [_hashType blockSize];
uint8_t *kI = NULL, *kO = NULL;
id <OFHash> hashI, hashO;
if ([key itemSize] * [key count] > blockSize) {
hashI = [[[_hashType alloc] init] autorelease];
[hashI updateWithBuffer: [key items]
length: [key itemSize] * [key count]];
[k addItems: [hashI digest]
count: [_hashType digestSize]];
|
|
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
- (const uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key
data: (OFDataArray*)data
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFDataArray *k = [OFDataArray dataArray];
size_t i, kSize, blockSize = [_hashType blockSize];
uint8_t *kI = NULL, *kO = NULL;
id <OFCryptoHash> hashI, hashO;
if ([key itemSize] * [key count] > blockSize) {
hashI = [[[_hashType alloc] init] autorelease];
[hashI updateWithBuffer: [key items]
length: [key itemSize] * [key count]];
[k addItems: [hashI digest]
count: [_hashType digestSize]];
|