ObjXMPP  Check-in [88dd1b11ee]

Overview
Comment:Fix salt generation code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 88dd1b11ee9ede2e0db8611d2e7364d24cc54e93cf8d46538bca25d89bc55747
User & Date: florob@babelmonkeys.de on 2011-09-16 13:11:54
Other Links: manifest | tags
Context
2011-09-18
19:33
Fix XMPPAuthenticator to support non-optimized message flow check-in: 0aab2fde67 user: florob@babelmonkeys.de tags: trunk
2011-09-16
13:11
Fix salt generation code check-in: 88dd1b11ee user: florob@babelmonkeys.de tags: trunk
2011-09-14
20:09
Make it possible to require TLS. check-in: 44237d2647 user: js tags: trunk
Changes

Modified src/XMPPSCRAMAuth.m from [e3e56c14fb] to [1500596709].

380
381
382
383
384
385
386

387
388

389
390
391
392
393
394
395
396
397
398
399
{
	uint8_t buf[64];
	size_t i;

	assert(RAND_pseudo_bytes(buf, 64) >= 0);

	for (i = 0; i < 64; i++) {

		uint8_t tmp = (buf[i] % ('~' - '!')) + '!';


		while (tmp == ',')
			tmp = ((buf[i] >> 1) % ('~' - '!')) + '!';

		buf[i] = tmp;
	}

	return [OFString stringWithCString: (char*)buf
				  encoding: OF_STRING_ENCODING_ASCII
				    length: 64];
}








>
|

>
|
<
<
|







380
381
382
383
384
385
386
387
388
389
390
391


392
393
394
395
396
397
398
399
{
	uint8_t buf[64];
	size_t i;

	assert(RAND_pseudo_bytes(buf, 64) >= 0);

	for (i = 0; i < 64; i++) {
		// Restrict salt to printable range, but do not include '~'...
		buf[i] = (buf[i] % ('~' - '!')) + '!';

		// ...so we can use it to replace ','
		if (buf[i] == ',')


			buf[i] = '~';
	}

	return [OFString stringWithCString: (char*)buf
				  encoding: OF_STRING_ENCODING_ASCII
				    length: 64];
}