The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SignFrame class

Class representing digital signatures - subclass of Frame class. More...

Collaboration diagram for SignFrame class:

Functions

FSTATIC gpointer _signframe_compute_cksum (GChecksumType cksumtype,gconstpointer tlvptr,gconstpointer pktend)
 Internal helper routine for computing checksum on data in a frame. More...
 
FSTATIC gboolean _signframe_isvalid (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 SignFrame class 'isvalid' member function - verifies the digital signature. More...
 
FSTATIC void _signframe_updatedata (Frame *fself,gpointer tlvptr,gconstpointer pktend,FrameSet *fs)
 Write/update digital signature in packet. More...
 
SignFramesignframe_new (GChecksumType sigtype, gsize framesize)
 Construct a new SignFrame - allowing for "derived" frame types... More...
 
Framesignframe_tlvconstructor (gconstpointer tlvstart, gconstpointer pktend, gpointer *ignorednewpkt, gpointer *ignoredpktend)
 Given marshalled data corresponding to a SignFrame (signature frame), return that corresponding Frame In other words, un-marshall the data... More...
 
typedef struct _SignFrame SignFrame
 

Detailed Description

Class representing digital signatures - subclass of Frame class.

Typedef Documentation

typedef struct _SignFrame SignFrame

Definition at line 33 of file signframe.h.

Function Documentation

FSTATIC gpointer _signframe_compute_cksum ( GChecksumType  cksumtype,
gconstpointer  tlvptr,
gconstpointer  pktend 
)

Internal helper routine for computing checksum on data in a frame.

It is used both for computing checksums on "new" data and verifying checksums on received packets.

Parameters
[in]cksumtypechecksum type
[in]tlvptrpointer to TLV for checksum
[in]pktendone byte past end of packet

Definition at line 62 of file signframe.c.

References FREE, get_generic_tlv_len(), get_generic_tlv_next(), and MALLOC0.

Referenced by _signframe_isvalid(), and _signframe_updatedata().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC gboolean _signframe_isvalid ( const Frame self,
gconstpointer  tlvptr,
gconstpointer  pktend 
)

SignFrame class 'isvalid' member function - verifies the digital signature.

Parameters
selfSignFrame object ('this')
tlvptrPointer to the TLV for this SignFrame
pktendPointer to one byte past the end of the packet

Definition at line 111 of file signframe.c.

References _signframe_compute_cksum(), CASTTOCONSTCLASS, FREE, get_generic_tlv_len(), get_generic_tlv_value(), _SignFrame::signaturetype, and tlv_get_guint8().

Referenced by signframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _signframe_updatedata ( Frame fself,
gpointer  tlvptr,
gconstpointer  pktend,
FrameSet fs 
)

Write/update digital signature in packet.

This is based on all the data that follows this frame in the packet. Since this is always the first frame in the packet, that means all data past this initial digital signature frame - all the packet except for this signature frame.

Precondition
a properly constructed SignFrame class as the 'fself' object pointer.
Parameters
[in]fselfSignFrame signature Frame
[in,out]tlvptrPointer to our TLV data in the packet
[in]pktendOne byte past end of packet
fs[ignored] FrameSet to update

Definition at line 168 of file signframe.c.

References _signframe_compute_cksum(), CASTTOCLASS, FREE, get_generic_tlv_nonconst_value(), and tlv_set_guint8().

Referenced by signframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

SignFrame* signframe_new ( GChecksumType  sigtype,
gsize  framesize 
)

Construct a new SignFrame - allowing for "derived" frame types...

This can be used directly for creating SignFrame frames, or by derived classes.

Parameters
sigtypesignature type
framesizesize of frame structure (or zero for sizeof(SignFrame))

Definition at line 208 of file signframe.c.

References _signframe_isvalid(), _signframe_updatedata(), CASTTOCLASS, frame_new(), FRAMETYPE_SIG, _Frame::isvalid, _Frame::length, proj_class_register_subclassed(), _SignFrame::signaturetype, _Frame::updatedata, and _Frame::value.

Referenced by cma.AssimCclasses.pySignFrame::__init__(), address_tests(), cast_frameset_tests(), main(), and signframe_tlvconstructor().

Here is the call graph for this function:

Here is the caller graph for this function:

Frame* signframe_tlvconstructor ( gconstpointer  tlvstart,
gconstpointer  pktend,
gpointer *  ignorednewpkt,
gpointer *  ignoredpktend 
)

Given marshalled data corresponding to a SignFrame (signature frame), return that corresponding Frame In other words, un-marshall the data...

Note
when we add more subtypes to signatures (which will surely happen), then this code will have to be updated to deal with that...
Note
we currently ignore the subtype - since we only support one...
Parameters
[in]tlvstartbeginning of the SignFrame in packet
[in]pktendend of packet
ignorednewpkt[ignored] replacement packet
ignoredpktend[ignored] end of replacement packet

Definition at line 241 of file signframe.c.

References _SignFrame::baseclass, CASTTOCLASS, get_generic_tlv_len(), get_generic_tlv_value(), _Frame::length, signframe_new(), and tlv_get_guint8().

Here is the call graph for this function: