Differences From Artifact [4b4455fb4b]:
- File
src/OFSecureData.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: 5297) [annotate] [blame] [check-ins using] [more...]
To Artifact [95d6612ecd]:
- File
src/OFSecureData.h
— part of check-in
[60caadeb5d]
at
2019-12-15 14:42:19
on branch trunk
— Make +[OFSecureData isSecure] per instance
The reason for this change is that whether non-swappable memory can be
allocated or not is something that changes over time, so calling
+[isSecure] always had a potential for a race. The only reliable way is
to allocate the memory and then report whether it's swappable or not.It's also called -[isSwappable] now to be more precise. (user: js, size: 5368) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFData.h" OF_ASSUME_NONNULL_BEGIN /*! * @class OFSecureData OFSecureData.h ObjFW/OFSecureData.h * | | | | | > > > < > > > | < < < < < < < | 18 19 20 21 22 23 24 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 | #import "OFData.h" OF_ASSUME_NONNULL_BEGIN /*! * @class OFSecureData OFSecureData.h ObjFW/OFSecureData.h * * @brief A class for storing arbitrary data in secure (non-swappable) memory, * securely wiping it when it gets deallocated. * * @warning Non-swappable memory might be unavailable, in which case this falls * back to swappable memory, but still wipes the data when it gets * deallocated. Check the @ref swappable property to see whether a * particular OFSecureData was allocated in swappable memory. */ OF_SUBCLASSING_RESTRICTED @interface OFSecureData: OFData { struct page *_page; bool _swappable; } /*! * @brief Whether the OFSecureData is in swappable memory. */ @property (readonly, nonatomic, getter=isSwappable) bool swappable; /*! * @brief All items of the OFSecureData as a C array. * * Modifying the returned array directly is allowed and will change the contents * of the data. */ @property (readonly, nonatomic) void *mutableItems OF_RETURNS_INNER_POINTER; /*! * @brief Preallocates the specified number of bytes. * * This is useful to allocate secure memory before enabling a sandbox that does * not allow it anymore. * * @note This may only be called once per thread! |
︙ | ︙ |