@@ -14,10 +14,11 @@ * file. */ #include "config.h" +#include #include #import "OFSHA384Or512Hash.h" #import "OFHashAlreadyCalculatedException.h" @@ -129,20 +130,30 @@ + (size_t)blockSize { return 128; } -+ (instancetype)hash ++ (instancetype)cryptoHash { return [[[self alloc] init] autorelease]; } - init { self = [super init]; - [self OF_resetState]; + @try { + if ([self class] == [OFSHA384Or512Hash class]) { + [self doesNotRecognizeSelector: _cmd]; + abort(); + } + + [self OF_resetState]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - (void)updateWithBuffer: (const void*)buffer_ @@ -150,11 +161,11 @@ { const uint8_t *buffer = buffer_; if (_calculated) @throw [OFHashAlreadyCalculatedException - exceptionWithHash: self]; + exceptionWithObject: self]; if (UINT64_MAX - _bits[0] < (length * 8)) _bits[1]++; _bits[0] += (length * 8);