@@ -27,10 +27,11 @@ */ OF_SUBCLASSING_RESTRICTED @interface OFHMAC: OFObject { Class _hashClass; + bool _allowsSwappableMemory; id _Nullable _outerHash, _innerHash; id _Nullable _outerHashCopy, _innerHashCopy; bool _calculated; } @@ -37,10 +38,15 @@ /*! * @brief The class for the cryptographic hash used by the HMAC. */ @property (readonly, nonatomic) Class hashClass; +/*! + * @brief Whether data may be stored in swappable memory. + */ +@property (readonly, nonatomic) bool allowsSwappableMemory; + /*! * @brief A buffer containing the HMAC. * * The size of the buffer depends on the hash used. The buffer is part of the * receiver's memory pool. @@ -55,24 +61,28 @@ /*! * @brief Returns a new OFHMAC with the specified hashing algorithm. * * @param hashClass The class of the hashing algorithm + * @param allowsSwappableMemory Whether data may be stored in swappable memory * @return A new, autoreleased OFHMAC */ -+ (instancetype)HMACWithHashClass: (Class )hashClass; ++ (instancetype)HMACWithHashClass: (Class )hashClass + allowsSwappableMemory: (bool)allowsSwappableMemory; - (instancetype)init OF_UNAVAILABLE; /*! * @brief Initialized an already allocated OFHMAC with the specified hashing * algorithm. * * @param hashClass The class of the hashing algorithm + * @param allowsSwappableMemory Whether data may be stored in swappable memory * @return An initialized OFHMAC */ - (instancetype)initWithHashClass: (Class )hashClass + allowsSwappableMemory: (bool)allowsSwappableMemory OF_DESIGNATED_INITIALIZER; /*! * @brief Sets the key for the HMAC. *