261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
data: tmpArray];
/*
* IETF RFC 5802:
* StoredKey := H(ClientKey)
*/
[hash updateWithBuffer: (void*) clientKey
ofSize: [hashType digestSize]];
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
[tmpArray addNItems: [hashType digestSize]
fromCArray: [hash digest]];
/*
* IETF RFC 5802:
* ClientSignature := HMAC(StoredKey, AuthMessage)
|
|
|
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
data: tmpArray];
/*
* IETF RFC 5802:
* StoredKey := H(ClientKey)
*/
[hash updateWithBuffer: (void*) clientKey
length: [hashType digestSize]];
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
[tmpArray addNItems: [hashType digestSize]
fromCArray: [hash digest]];
/*
* IETF RFC 5802:
* ClientSignature := HMAC(StoredKey, AuthMessage)
|
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
size_t i, kSize, blockSize = [hashType blockSize];
uint8_t *kCArray, *kI = NULL, *kO = NULL;
OFHash *hash;
if ([key itemSize] * [key count] > blockSize) {
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [key cArray]
ofSize: [key itemSize] * [key count]];
[k addNItems: [hashType digestSize]
fromCArray: [hash digest]];
} else
[k addNItems: [key itemSize] * [key count]
fromCArray: [key cArray]];
@try {
|
|
|
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
size_t i, kSize, blockSize = [hashType blockSize];
uint8_t *kCArray, *kI = NULL, *kO = NULL;
OFHash *hash;
if ([key itemSize] * [key count] > blockSize) {
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [key cArray]
length: [key itemSize] * [key count]];
[k addNItems: [hashType digestSize]
fromCArray: [hash digest]];
} else
[k addNItems: [key itemSize] * [key count]
fromCArray: [key cArray]];
@try {
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
[k addNItems: blockSize
fromCArray: kI];
[k addNItems: [data itemSize] * [data count]
fromCArray: [data cArray]];
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [k cArray]
ofSize: [k count]];
k = [OFDataArray dataArrayWithItemSize: 1];
[k addNItems: blockSize
fromCArray: kO];
[k addNItems: [hashType digestSize]
fromCArray: [hash digest]];
} @finally {
[self freeMemory: kI];
[self freeMemory: kO];
}
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [k cArray]
ofSize: [k count]];
[hash retain];
[pool release];
return [hash digest];
}
|
|
|
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
[k addNItems: blockSize
fromCArray: kI];
[k addNItems: [data itemSize] * [data count]
fromCArray: [data cArray]];
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [k cArray]
length: [k count]];
k = [OFDataArray dataArrayWithItemSize: 1];
[k addNItems: blockSize
fromCArray: kO];
[k addNItems: [hashType digestSize]
fromCArray: [hash digest]];
} @finally {
[self freeMemory: kI];
[self freeMemory: kO];
}
hash = [[[hashType alloc] init] autorelease];
[hash updateWithBuffer: [k cArray]
length: [k count]];
[hash retain];
[pool release];
return [hash digest];
}
|