ObjFW  Check-in [23dc2c7ff8]

Overview
Comment:OF{MD5,SHA1}Hash: Zero _buffer when done

This way, possibly sensitive information is discarded from memory as
soon as possible.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 23dc2c7ff8826aad4afb3d7dec977496b79efa554778d75343afef967d4eacdf
User & Date: js on 2014-09-01 10:47:15
Other Links: manifest | tags
Context
2014-09-01
11:08
Add OFSHA256Hash check-in: 46af1252a5 user: js tags: trunk
10:47
OF{MD5,SHA1}Hash: Zero _buffer when done check-in: 23dc2c7ff8 user: js tags: trunk
2014-08-31
17:59
Rewrite OFSHA1Hash check-in: d310aeee30 user: js tags: trunk
Changes

Modified src/OFMD5Hash.m from [307a03b74d] to [210a4456e6].

185
186
187
188
189
190
191

192
193
194
195
196
197
198
199
200
201
202
		memset(_buffer.bytes, 0, 64);
	}

	_buffer.words[14] = OF_BSWAP32_IF_BE((uint32_t)(_bits & 0xFFFFFFFF));
	_buffer.words[15] = OF_BSWAP32_IF_BE((uint32_t)(_bits >> 32));

	processBlock(_state, _buffer.words);

	byteSwapVectorIfBE(_state, 4);
	_calculated = true;

	return (const uint8_t*)_state;
}

- (bool)isCalculated
{
	return _calculated;
}
@end







>











185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
		memset(_buffer.bytes, 0, 64);
	}

	_buffer.words[14] = OF_BSWAP32_IF_BE((uint32_t)(_bits & 0xFFFFFFFF));
	_buffer.words[15] = OF_BSWAP32_IF_BE((uint32_t)(_bits >> 32));

	processBlock(_state, _buffer.words);
	memset(&_buffer, 0, sizeof(_buffer));
	byteSwapVectorIfBE(_state, 4);
	_calculated = true;

	return (const uint8_t*)_state;
}

- (bool)isCalculated
{
	return _calculated;
}
@end

Modified src/OFSHA1Hash.m from [61d6c59846] to [20f00e8f54].

158
159
160
161
162
163
164

165
166
167
168
169
170
171
172
173
174
175
		memset(_buffer.bytes, 0, 64);
	}

	_buffer.words[14] = OF_BSWAP32_IF_LE((uint32_t)(_bits >> 32));
	_buffer.words[15] = OF_BSWAP32_IF_LE((uint32_t)(_bits & 0xFFFFFFFF));

	processBlock(_state, _buffer.words);

	byteSwapVectorIfLE(_state, 5);
	_calculated = true;

	return (const uint8_t*)_state;
}

- (bool)isCalculated
{
	return _calculated;
}
@end







>











158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
		memset(_buffer.bytes, 0, 64);
	}

	_buffer.words[14] = OF_BSWAP32_IF_LE((uint32_t)(_bits >> 32));
	_buffer.words[15] = OF_BSWAP32_IF_LE((uint32_t)(_bits & 0xFFFFFFFF));

	processBlock(_state, _buffer.words);
	memset(&_buffer, 0, sizeof(_buffer));
	byteSwapVectorIfLE(_state, 5);
	_calculated = true;

	return (const uint8_t*)_state;
}

- (bool)isCalculated
{
	return _calculated;
}
@end