serialize.h File Reference

Definition of de/serialize functionality. More...

#include <stddef.h>
#include <stdint.h>

Functions

void SwapNativeAndPortableLayout (void *dest, size_t dest_size, void const *src, size_t src_size)
 Serialize or deserailize a sequence of math objects. More...
 
void * Uint32Serialize (OctStr32 *dest, uint32_t src)
 Write a uint32_t to a portable buffer. More...
 
void const * Uint32Deserialize (uint32_t *dest, OctStr32 const *src)
 Read a uint32_t from a portable buffer. More...
 
void * VliSerialize (BigNumStr *dest, VeryLargeInt const *src)
 Write a large integer to a portable buffer. More...
 
void const * VliDeserialize (VeryLargeInt *dest, BigNumStr const *src)
 Read a large integer from a portable buffer. More...
 
void * FqSerialize (FqElemStr *dest, FqElem const *src)
 Write an element of Fq to a portable buffer. More...
 
void const * FqDeserialize (FqElem *dest, FqElemStr const *src)
 Read an element of Fq from a portable buffer. More...
 
void * Fq12Serialize (Fq12ElemStr *dest, Fq12Elem const *src)
 Write an element of Fq12 to a portable buffer. More...
 
void const * Fq12Deserialize (Fq12Elem *dest, Fq12ElemStr const *src)
 Read an element of Fq12 from a portable buffer. More...
 
void * FpSerialize (FpElemStr *dest, FpElem const *src)
 Write an element of Fp to a portable buffer. More...
 
void const * FpDeserialize (FpElem *dest, FpElemStr const *src)
 Read an element of Fp from a portable buffer. More...
 
void * EFqSerialize (G1ElemStr *dest, EccPointFq const *src)
 Write a point on EFq to a portable buffer. More...
 
void const * EFqDeserialize (EccPointFq *dest, G1ElemStr const *src)
 Read a point on EFq from a portable buffer. More...
 
void * EFq2Serialize (G2ElemStr *dest, EccPointFq2 const *src)
 Write a point on EFq2 to a portable buffer. More...
 
void const * EFq2Deserialize (EccPointFq2 *dest, G2ElemStr const *src)
 Read a point on EFq2 from a portable buffer. More...
 

Detailed Description

Definition of de/serialize functionality.

Function Documentation

◆ EFq2Deserialize()

void const* EFq2Deserialize ( EccPointFq2 dest,
G2ElemStr const *  src 
)

Read a point on EFq2 from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ EFq2Serialize()

void* EFq2Serialize ( G2ElemStr dest,
EccPointFq2 const *  src 
)

Write a point on EFq2 to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ EFqDeserialize()

void const* EFqDeserialize ( EccPointFq dest,
G1ElemStr const *  src 
)

Read a point on EFq from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ EFqSerialize()

void* EFqSerialize ( G1ElemStr dest,
EccPointFq const *  src 
)

Write a point on EFq to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ FpDeserialize()

void const* FpDeserialize ( FpElem dest,
FpElemStr const *  src 
)

Read an element of Fp from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ FpSerialize()

void* FpSerialize ( FpElemStr dest,
FpElem const *  src 
)

Write an element of Fp to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ Fq12Deserialize()

void const* Fq12Deserialize ( Fq12Elem dest,
Fq12ElemStr const *  src 
)

Read an element of Fq12 from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ Fq12Serialize()

void* Fq12Serialize ( Fq12ElemStr dest,
Fq12Elem const *  src 
)

Write an element of Fq12 to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ FqDeserialize()

void const* FqDeserialize ( FqElem dest,
FqElemStr const *  src 
)

Read an element of Fq from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ FqSerialize()

void* FqSerialize ( FqElemStr dest,
FqElem const *  src 
)

Write an element of Fq to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ SwapNativeAndPortableLayout()

void SwapNativeAndPortableLayout ( void *  dest,
size_t  dest_size,
void const *  src,
size_t  src_size 
)

Serialize or deserailize a sequence of math objects.

Converts layouts between native and portable or between portable and native of the following types: VeryLargeInt and BigNumStr, FqElem and FqElemStr, FpElem and FpElemStr, EccPointFq and G1ElemStr, Fq12Elem and Fq12ElemStr.

If input contain multiple values of supported types all will be converted.

Note
The following types are not supported: VeryLargeIntProduct.
This function have the assumptions that the input structures are packed such that consequent 32 byte fields would have no gap in between.
Parameters
[out]desttarget buffer
[in]dest_sizesize of dest buffer
[in]srcsource data
[in]src_sizesize of src buffer

◆ Uint32Deserialize()

void const* Uint32Deserialize ( uint32_t *  dest,
OctStr32 const *  src 
)

Read a uint32_t from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ Uint32Serialize()

void* Uint32Serialize ( OctStr32 dest,
uint32_t  src 
)

Write a uint32_t to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest

◆ VliDeserialize()

void const* VliDeserialize ( VeryLargeInt dest,
BigNumStr const *  src 
)

Read a large integer from a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data read from to src

◆ VliSerialize()

void* VliSerialize ( BigNumStr dest,
VeryLargeInt const *  src 
)

Write a large integer to a portable buffer.

Parameters
[out]desttarget buffer
[in]srcsource data
Returns
pointer to next byte after final data written to dest