libnds
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
rsa.h File Reference

DSi RSA functions. More...

#include <stddef.h>
#include <nds/ndstypes.h>

Data Structures

struct  swiRSAbuffers
 Struture that holds pointers to the RSA buffers. More...
 
struct  swiRSAHeapContext
 Context that holds information about the RSA heap. More...
 

Typedefs

typedef struct swiRSAbuffers swiRSAbuffers_t
 Struture that holds pointers to the RSA buffers.
 
typedef struct swiRSAHeapContext swiRSAHeapContext_t
 Context that holds information about the RSA heap.
 

Functions

int swiRSADecrypt (swiRSAHeapContext_t *ctx, void *dst, const void *sig, const void *key)
 Decrypt signature and also remove padding.
 
int swiRSADecryptPGP (swiRSAHeapContext_t *ctx, void *dst, const void *sig, const void *key)
 Decrypt signature and extract the SHA1 value from a OpenPGP header.
 
int swiRSADecryptRAW (swiRSAHeapContext_t *ctx, swiRSAbuffers_t *rsabuffers, size_t *lenDst)
 Decrypt signature using the owner's public key and return the hash of the data that the signature belongs to. This function does not remove padding from the output data but leading 0x00 bytes are stripped.
 
int swiRSAInitHeap (swiRSAHeapContext_t *ctx, void *heapStart, size_t heapSize)
 Initialize RSA Heap.
 

Detailed Description

DSi RSA functions.

Function Documentation

◆ swiRSADecrypt()

int swiRSADecrypt ( swiRSAHeapContext_t ctx,
void *  dst,
const void *  sig,
const void *  key 
)

Decrypt signature and also remove padding.

Parameters
ctxRSA Heap context
dstPointer to output buffer (should be 128 bytes).
sigPointer to signature buffer (should be 128 bytes).
keyPointer to key buffer (should be 128 bytes).
Returns
1 if success, 0 if failed

◆ swiRSADecryptPGP()

int swiRSADecryptPGP ( swiRSAHeapContext_t ctx,
void *  dst,
const void *  sig,
const void *  key 
)

Decrypt signature and extract the SHA1 value from a OpenPGP header.

Parameters
ctxRSA Heap context
dstPointer to output buffer.
sigPointer to signature buffer.
keyPointer to key buffer.
Returns
1 if success, 0 if failed

◆ swiRSADecryptRAW()

int swiRSADecryptRAW ( swiRSAHeapContext_t ctx,
swiRSAbuffers_t rsabuffers,
size_t *  lenDst 
)

Decrypt signature using the owner's public key and return the hash of the data that the signature belongs to. This function does not remove padding from the output data but leading 0x00 bytes are stripped.

Parameters
ctxRSA Heap context
rsabuffersStruct containing pointers to destination buffer, signature and public key to use.
lenDstPointer to memory where to store the length of the destination buffer.
Returns
1 if success, 0 if failed.

◆ swiRSAInitHeap()

int swiRSAInitHeap ( swiRSAHeapContext_t ctx,
void *  heapStart,
size_t  heapSize 
)

Initialize RSA Heap.

Parameters
ctx12-byte heap information structure that gets set with heap start, heap end and heap length.
heapStartPointer to the start of the heap.
heapSizeSize of the heap in bytes (should be usually 4096).
Returns
1 if success, 0 if failed.