Differences From Artifact [c85420d05a]:
- File
src/OFHMAC.h
— part of check-in
[496695d778]
at
2019-09-29 19:35:38
on branch trunk
— Either restrict subclassing or reserve ivar space
This allows ABI stability with the fragile ABI. (user: js, size: 3465) [annotate] [blame] [check-ins using] [more...]
To Artifact [5ff44e63ad]:
- File
src/OFHMAC.h
— part of check-in
[e629dc83a9]
at
2019-12-27 00:41:54
on branch trunk
— OFSecureData: Add allowsSwappableMemory property
With this property, it's possible to specify whether the memory should
be protected from swapping or not. This makes it easier for e.g. the
crypto hash classes: They can now just always use OFSecureData without
wasting unswappable memory if it's not needed. (user: js, size: 3892) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | * * @brief A class which provides methods to calculate an HMAC. */ OF_SUBCLASSING_RESTRICTED @interface OFHMAC: OFObject { Class <OFCryptoHash> _hashClass; id <OFCryptoHash> _Nullable _outerHash, _innerHash; id <OFCryptoHash> _Nullable _outerHashCopy, _innerHashCopy; bool _calculated; } /*! * @brief The class for the cryptographic hash used by the HMAC. */ @property (readonly, nonatomic) Class <OFCryptoHash> hashClass; /*! * @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. */ @property (readonly, nonatomic) const unsigned char *digest OF_RETURNS_INNER_POINTER; /*! * @brief The size of the digest. */ @property (readonly, nonatomic) size_t digestSize; /*! * @brief Returns a new OFHMAC with the specified hashing algorithm. * * @param hashClass The class of the hashing algorithm * @return A new, autoreleased OFHMAC */ | > > > > > > > | > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | * * @brief A class which provides methods to calculate an HMAC. */ OF_SUBCLASSING_RESTRICTED @interface OFHMAC: OFObject { Class <OFCryptoHash> _hashClass; bool _allowsSwappableMemory; id <OFCryptoHash> _Nullable _outerHash, _innerHash; id <OFCryptoHash> _Nullable _outerHashCopy, _innerHashCopy; bool _calculated; } /*! * @brief The class for the cryptographic hash used by the HMAC. */ @property (readonly, nonatomic) Class <OFCryptoHash> 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. */ @property (readonly, nonatomic) const unsigned char *digest OF_RETURNS_INNER_POINTER; /*! * @brief The size of the digest. */ @property (readonly, nonatomic) size_t digestSize; /*! * @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 <OFCryptoHash>)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 <OFCryptoHash>)hashClass allowsSwappableMemory: (bool)allowsSwappableMemory OF_DESIGNATED_INITIALIZER; /*! * @brief Sets the key for the HMAC. * * @note This resets the HMAC! * |
︙ | ︙ |