Memclave Artifact Documentation
Loading...
Searching...
No Matches
vud_sk.h File Reference
#include "vud.h"
#include "vud_mem.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Functions

long vud_sk_from_elf (const char *path, size_t sz, uint64_t *out, bool auth_only)
 load an elf file and convert it into subkernel format
 
int vud_enc_auth_sk (uint64_t *sk, const uint8_t *key)
 encrypt the passed in subkernel under key - leave only header as AD
 
vud_error vud_get_symbol (const char *binary, const char *symb, vud_mram_addr *out_addr)
 lookup the location of a symbol in MRAM based on the subkernel ELF file
 

Function Documentation

◆ vud_enc_auth_sk()

int vud_enc_auth_sk ( uint64_t *  sk,
const uint8_t *  key 
)

encrypt the passed in subkernel under key - leave only header as AD

Parameters
sksubkernel to encrypt
keykey to use for encryption
Returns
0 on success or negative value on failure

◆ vud_get_symbol()

vud_error vud_get_symbol ( const char *  binary,
const char *  symb,
vud_mram_addr out_addr 
)

lookup the location of a symbol in MRAM based on the subkernel ELF file

Parameters
binarypath to a subkernel ELF binary
symbsymbol to lookup - must be in MRAM
out_addrlocation to write MRAM address to or NULL
Returns
VUD_OK on success or an appropriate error value on failure

◆ vud_sk_from_elf()

long vud_sk_from_elf ( const char *  path,
size_t  sz,
uint64_t *  out,
bool  auth_only 
)

load an elf file and convert it into subkernel format

This function basically wraps a few llvm-objcopy calls and as such, strongly depends on its presence. GNU's objcopy does not work because it cannot recognise the DPU architecture. Neither does LLVM, but it treats it as being some random 32-bit architecture.

Parameters
pathpath to load elf from
szsize of the output buffer
outlocation to write subkernel to
auth_onlyset the headers up for an auth only subkernel
Returns
size of the subkernel on success or negative value on failure