ObjFW  Check-in [096dd743b5]

Overview
Comment:OF*Hash: Call [self reset] in -[dealloc]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 096dd743b5e233e2c626f66b632bef9d4c16881a6f53b6e56dd9c4c2d5a8abf9
User & Date: js on 2016-07-24 20:05:18
Other Links: manifest | tags
Context
2016-07-24
20:51
OFHMAC: Allow resetting while keeping the key check-in: c55c5dff51 user: js tags: trunk
20:05
OF*Hash: Call [self reset] in -[dealloc] check-in: 096dd743b5 user: js tags: trunk
18:54
OFCryptoHash: Conform to OFCopying check-in: b1cd76a8cd user: js tags: trunk
Changes

Modified src/OFMD5Hash.m from [273d709ad9] to [54019c34aa].

134
135
136
137
138
139
140







141
142
143
144
145
146
147
{
	self = [super init];

	[self OF_resetState];

	return self;
}








- copy
{
	OFMD5Hash *copy = [[OFMD5Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;







>
>
>
>
>
>
>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];

	[super dealloc];
}

- copy
{
	OFMD5Hash *copy = [[OFMD5Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;

Modified src/OFRIPEMD160Hash.m from [d2d42ba8eb] to [4ed4626462].

148
149
150
151
152
153
154







155
156
157
158
159
160
161
{
	self = [super init];

	[self OF_resetState];

	return self;
}








- copy
{
	OFRIPEMD160Hash *copy = [[OFRIPEMD160Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;







>
>
>
>
>
>
>







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];

	[super dealloc];
}

- copy
{
	OFRIPEMD160Hash *copy = [[OFRIPEMD160Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;

Modified src/OFSHA1Hash.m from [32e9d453f3] to [57c3220269].

108
109
110
111
112
113
114







115
116
117
118
119
120
121
{
	self = [super init];

	[self OF_resetState];

	return self;
}








- copy
{
	OFSHA1Hash *copy = [[OFSHA1Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;







>
>
>
>
>
>
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)dealloc
{
	[self reset];

	[super dealloc];
}

- copy
{
	OFSHA1Hash *copy = [[OFSHA1Hash alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;

Modified src/OFSHA224Or256Hash.m from [3f98abf1a7] to [706ddd8337].

140
141
142
143
144
145
146







147
148
149
150
151
152
153
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}








- copy
{
	OFSHA224Or256Hash *copy = [[[self class] alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;







>
>
>
>
>
>
>







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[self reset];

	[super dealloc];
}

- copy
{
	OFSHA224Or256Hash *copy = [[[self class] alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	copy->_bits = _bits;

Modified src/OFSHA384Or512Hash.m from [775711ae59] to [3824d79a3c].

151
152
153
154
155
156
157







158
159
160
161
162
163
164
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}








- copy
{
	OFSHA384Or512Hash *copy = [[[self class] alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	memcpy(copy->_bits, _bits, sizeof(_bits));







>
>
>
>
>
>
>







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[self reset];

	[super dealloc];
}

- copy
{
	OFSHA384Or512Hash *copy = [[[self class] alloc] init];

	memcpy(copy->_state, _state, sizeof(_state));
	memcpy(copy->_bits, _bits, sizeof(_bits));
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241

	return (const uint8_t*)_state;
}

- (void)reset
{
	[self OF_resetState];
	memset(&_bits, 0, sizeof(_bits));
	memset(&_buffer, 0, sizeof(_buffer));
	_bufferLength = 0;
	_calculated = false;
}

- (void)OF_resetState
{
	OF_UNRECOGNIZED_SELECTOR
}
@end







|










231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248

	return (const uint8_t*)_state;
}

- (void)reset
{
	[self OF_resetState];
	memset(_bits, 0, sizeof(_bits));
	memset(&_buffer, 0, sizeof(_buffer));
	_bufferLength = 0;
	_calculated = false;
}

- (void)OF_resetState
{
	OF_UNRECOGNIZED_SELECTOR
}
@end