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 gboolean _signframe_isvalid (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 SignFrame class 'isvalid' member function - verifies a Glib digital signature More...
 
FSTATIC void _signframe_updatedata (Frame *fself,gpointer tlvptr,gconstpointer pktend,FrameSet *fs)
 Write/update digital signature in packet. More...
 
FSTATIC gpointer _signframe_compute_cksum (GChecksumType, gconstpointer tlvptr, gconstpointer pktend)
 
FSTATIC gpointer _signframe_compute_cksum_glib (GChecksumType cksumtype,gconstpointer tlvptr,gconstpointer pktend)
 Internal helper routine for computing checksum on data in a frame. More...
 
FSTATIC gboolean _signframe_isvalid_glib (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 SignFrame class 'isvalid' member function - verifies a Glib digital signature More...
 
FSTATIC guint16 _signframe_cksum_size (guint8 majortype, guint8 minortype)
 Set default outbound signing key. More...
 
gboolean signframe_setdefault (guint8 majortype, guint8 minortype, const char *keyname, const guint8 *signkey, gsize keylen)
 
WINEXPORT SignFramesignframe_glib_new (GChecksumType sigtype, gsize framesize)
 Construct a new SignFrame - allowing for "derived" frame types... More...
 
Framesignframe_tlvconstructor (gpointer tlvstart, gconstpointer pktend, gpointer *newpkt, gpointer *newpktend)
 Given marshalled data corresponding to a SignFrame (signature frame), return that corresponding Frame In other words, un-marshall the data... More...
 
WINEXPORT SignFramesignframe_new_default (gsize framesize)
 
#define SIGNTYPE_GLIB   1
 
typedef struct _SignFrame SignFrame
 

Detailed Description

Class representing digital signatures - subclass of Frame class.

Macro Definition Documentation

Typedef Documentation

typedef struct _SignFrame SignFrame

Definition at line 40 of file signframe.h.

Function Documentation

FSTATIC guint16 _signframe_cksum_size ( guint8  majortype,
guint8  minortype 
)

Set default outbound signing key.

Definition at line 80 of file signframe.c.

References SIGNTYPE_GLIB.

FSTATIC gpointer _signframe_compute_cksum ( GChecksumType  cksumtype,
gconstpointer  tlvptr,
gconstpointer  pktend 
)
Parameters
[in]cksumtypechecksum type
[in]tlvptrpointer to TLV for checksum
[in]pktendone byte past end of packet

Definition at line 141 of file signframe.c.

References _signframe_compute_cksum_glib().

Referenced by _signframe_updatedata().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC gpointer _signframe_compute_cksum_glib ( 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 151 of file signframe.c.

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

Referenced by _signframe_compute_cksum(), and _signframe_isvalid_glib().

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 a Glib 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 199 of file signframe.c.

References _signframe_isvalid_glib(), CASTTOCONSTCLASS, get_generic_tlv_len(), get_generic_tlv_value(), _SignFrame::majortype, SIGNTYPE_GLIB, and tlv_get_guint8().

Referenced by signframe_glib_new().

Here is the call graph for this function:

Here is the caller graph for this function:

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

SignFrame class 'isvalid' member function - verifies a Glib 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 236 of file signframe.c.

References _signframe_compute_cksum_glib(), CASTTOCONSTCLASS, FREE, get_generic_tlv_len(), get_generic_tlv_value(), _SignFrame::majortype, _SignFrame::minortype, SIGNTYPE_GLIB, and tlv_get_guint8().

Referenced by _signframe_isvalid().

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 293 of file signframe.c.

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

Referenced by signframe_glib_new().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT SignFrame* signframe_glib_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 334 of file signframe.c.

References _signframe_isvalid(), _signframe_updatedata(), CASTTOCLASS, frame_new(), FRAMETYPE_SIG, _Frame::isvalid, _Frame::length, _SignFrame::majortype, _SignFrame::minortype, proj_class_register_subclassed(), SIGNTYPE_GLIB, _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:

WINEXPORT SignFrame* signframe_new_default ( gsize  framesize)
gboolean signframe_setdefault ( guint8  majortype,
guint8  minortype,
const char *  keyname,
const guint8 *  signkey,
gsize  keylen 
)
Parameters
majortypeMajor signature class
minortypeMinor signature type
keynameName of key used by verifier
signkeyPointer to key
keylenKey length

Definition at line 104 of file signframe.c.

References SIGNTYPE_GLIB.

Frame* signframe_tlvconstructor ( gpointer  tlvstart,
gconstpointer  pktend,
gpointer *  newpkt,
gpointer *  newpktend 
)

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
[in,out]newpktreplacement packet
[in,out]newpktendend of replacement packet

Definition at line 368 of file signframe.c.

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

Here is the call graph for this function: