PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
key.c File Reference
#include <kernel/fs/key.h>
#include <kernel/cpu/syscall.h>
#include <kernel/drivers/rand.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/proc/process.h>
#include <kernel/sched/clock.h>
#include <kernel/sched/thread.h>
#include <kernel/sched/timer.h>
#include <kernel/sched/wait.h>
#include <kernel/sync/rwlock.h>
#include <kernel/utils/map.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/list.h>
#include <time.h>
Include dependency graph for key.c:

Go to the source code of this file.

Functions

static void key_base64_encode (const uint8_t *src, size_t len, char *dest)
 
static uint64_t key_generate (char *buffer, uint64_t size)
 
static void key_timer_handler (interrupt_frame_t *frame, cpu_t *self)
 
uint64_t key_share (char *key, uint64_t size, file_t *file, clock_t timeout)
 Generates a key that can be used to retrieve the file within the specified timeout.
 
file_tkey_claim (const char *key)
 Claims a shared file using the provided key.
 
 SYSCALL_DEFINE (SYS_SHARE, uint64_t, char *key, uint64_t size, fd_t fd, clock_t timeout)
 
 SYSCALL_DEFINE (SYS_CLAIM, fd_t, const char *key)
 

Variables

static map_t keyMap = MAP_CREATE()
 
static list_t keyList = LIST_CREATE(keyList)
 
static lock_t keyLock = LOCK_CREATE()
 

Function Documentation

◆ key_base64_encode()

static void key_base64_encode ( const uint8_t src,
size_t  len,
char *  dest 
)
static

Definition at line 25 of file key.c.

Here is the caller graph for this function:

◆ key_generate()

static uint64_t key_generate ( char *  buffer,
uint64_t  size 
)
static

Definition at line 45 of file key.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ key_timer_handler()

static void key_timer_handler ( interrupt_frame_t frame,
cpu_t self 
)
static

Definition at line 62 of file key.c.

Here is the call graph for this function:

◆ SYSCALL_DEFINE() [1/2]

SYSCALL_DEFINE ( SYS_SHARE  ,
uint64_t  ,
char *  key,
uint64_t  size,
fd_t  fd,
clock_t  timeout 
)

Definition at line 173 of file key.c.

Here is the call graph for this function:

◆ SYSCALL_DEFINE() [2/2]

SYSCALL_DEFINE ( SYS_CLAIM  ,
fd_t  ,
const char *  key 
)

Definition at line 199 of file key.c.

Here is the call graph for this function:

Variable Documentation

◆ keyMap

map_t keyMap = MAP_CREATE()
static

Definition at line 21 of file key.c.

◆ keyList

list_t keyList = LIST_CREATE(keyList)
static

Definition at line 22 of file key.c.

◆ keyLock

lock_t keyLock = LOCK_CREATE()
static

Definition at line 23 of file key.c.