Non-pageable Memory

Non-pageable Memory — Secure Non-pageable Memory

Description

Normal allocated memory can be paged to disk at the whim of the operating system. This can be a serious problem for sensitive information like passwords, keys and secrets.

GNOME Keyring holds passwords in non-pageable, or locked memory. This happens both in the daemon and in the library. This is only possible if the OS contains support for it.

These functions allow applications to use to hold passwords and other sensitive information.

Details

gnome_keyring_memory_new()

#define             gnome_keyring_memory_new(type, n_objects)

Allocate objects in non-pageable gnome-keyring memory.

type :

The C type of the objects to allocate

n_objects :

The number of objects to allocate.

Returns :

The new block of memory.

gnome_keyring_memory_alloc ()

gpointer            gnome_keyring_memory_alloc          (gulong sz);

Allocate a block of gnome-keyring non-pageable memory.

If non-pageable memory cannot be allocated then normal memory will be returned.

sz :

The new desired size of the memory block.

Returns :

The new memory block which should be freed with gnome_keyring_memory_free(). [transfer full]

gnome_keyring_memory_try_alloc ()

gpointer            gnome_keyring_memory_try_alloc      (gulong sz);

Allocate a block of gnome-keyring non-pageable memory.

If non-pageable memory cannot be allocated, then NULL is returned.

sz :

The new desired size of the memory block.

Returns :

The new block, or NULL if memory cannot be allocated. The memory block should be freed with gnome_keyring_memory_free(). [transfer full]

gnome_keyring_memory_realloc ()

gpointer            gnome_keyring_memory_realloc        (gpointer p,
                                                         gulong sz);

Reallocate a block of gnome-keyring non-pageable memory.

Glib memory is also reallocated correctly. If called with a null pointer, then a new block of memory is allocated. If called with a zero size, then the block of memory is freed.

If non-pageable memory cannot be allocated then normal memory will be returned.

p :

The pointer to reallocate or NULL to allocate a new block. [allow-none]

sz :

The new desired size of the memory block, or 0 to free the memory.

Returns :

The new block, or NULL if the block was freed. The memory block should be freed with gnome_keyring_memory_free(). [transfer full]

gnome_keyring_memory_try_realloc ()

gpointer            gnome_keyring_memory_try_realloc    (gpointer p,
                                                         gulong sz);

Reallocate a block of gnome-keyring non-pageable memory.

Glib memory is also reallocated correctly when passed to this function. If called with a null pointer, then a new block of memory is allocated. If called with a zero size, then the block of memory is freed.

If memory cannot be allocated, NULL is returned and the original block of memory remains intact.

p :

The pointer to reallocate or NULL to allocate a new block. [allow-none]

sz :

The new desired size of the memory block.

Returns :

The new block, or NULL if memory cannot be allocated. The memory block should be freed with gnome_keyring_memory_free(). [transfer full]

gnome_keyring_memory_free ()

void                gnome_keyring_memory_free           (gpointer p);

Free a block of gnome-keyring non-pageable memory.

Glib memory is also freed correctly when passed to this function. If called with a null pointer then no action is taken.

p :

The pointer to the beginning of the block of memory to free.

gnome_keyring_memory_is_secure ()

gboolean            gnome_keyring_memory_is_secure      (gpointer p);

Check if a pointer is in non-pageable memory allocated by gnome-keyring.

p :

The pointer to check

Returns :

Whether the memory is non-pageable or not

gnome_keyring_memory_strdup ()

gchar *             gnome_keyring_memory_strdup         (const gchar *str);

Copy a string into non-pageable memory. If the input string is NULL, then NULL will be returned.

str :

The null terminated string to copy

Returns :

The copied string, should be freed with gnome_keyring_memory_free()