ObjFW  Check-in [edbb1ff5f4]

Overview
Comment:Add +[OFSecureData isSecure]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: edbb1ff5f4bf505757def20e2473ac9a34c43c1589f9ead5f3442966b0795572
User & Date: js on 2018-04-07 20:48:23
Other Links: manifest | tags
Context
2018-04-08
10:46
OFHMAC: Fix a missing rethrow check-in: 2c80eb12b9 user: js tags: trunk
2018-04-07
20:48
Add +[OFSecureData isSecure] check-in: edbb1ff5f4 user: js tags: trunk
20:18
OFHMAC: Make use of the new OFSecureData check-in: 0e57691b22 user: js tags: trunk
Changes

Modified src/OFSecureData.h from [67148514e7] to [531e4cada4].

28
29
30
31
32
33
34










35
36
37
38
39
40
41
 * @note Secure memory might be unavailable on the platform, in which case this
 *	 falls back to insecure (potentially swappable) memory.
 */
@interface OFSecureData: OFData
{
	size_t _mappingSize;
}











/*!
 * @brief Creates a new, autoreleased OFSecureData with count items of item
 *	  size 1, all set to zero.
 *
 * @param count The number of zero items the OFSecureData should contain
 * @return A new, autoreleased OFSecureData







>
>
>
>
>
>
>
>
>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * @note Secure memory might be unavailable on the platform, in which case this
 *	 falls back to insecure (potentially swappable) memory.
 */
@interface OFSecureData: OFData
{
	size_t _mappingSize;
}

#ifdef OF_HAVE_CLASS_PROPERTIES
@property (class, readonly, nonatomic, getter=isSecure) bool secure;
#endif

/*!
 * @brief Whether OFSecureData is secure, meaning preventing the data from
 *	  being swapped out is supported.
 */
+ (bool)isSecure;

/*!
 * @brief Creates a new, autoreleased OFSecureData with count items of item
 *	  size 1, all set to zero.
 *
 * @param count The number of zero items the OFSecureData should contain
 * @return A new, autoreleased OFSecureData

Modified src/OFSecureData.m from [6ea795ac32] to [5b69d2d183].

28
29
30
31
32
33
34









35
36
37
38
39
40
41
#import "OFSystemInfo.h"

#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

@implementation OFSecureData









+ (instancetype)dataWithCount: (size_t)count
{
	return [[[self alloc] initWithCount: count] autorelease];
}

+ (instancetype)dataWithItemSize: (size_t)itemSize
			   count: (size_t)count







>
>
>
>
>
>
>
>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#import "OFSystemInfo.h"

#import "OFInvalidArgumentException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

@implementation OFSecureData
+ (bool)isSecure
{
#if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON)
	return true;
#else
	return false;
#endif
}

+ (instancetype)dataWithCount: (size_t)count
{
	return [[[self alloc] initWithCount: count] autorelease];
}

+ (instancetype)dataWithItemSize: (size_t)itemSize
			   count: (size_t)count