Data Structures
Since the LSAPI standard provides for multiple challenge/response protocols, it is necessary to have a basic data structure format along with a tag field which identifies the protocol being used. The Basic Challenge mechanism is tagged as LS_BASIC_PROTOCOL.
LS_CHALLENGE
The LS_CHALLENGE data structure is supported by all protocols. This structure is used for both the challenge and challenge response of LSRequest(), and LSUpdate().
typedef struct {
LS_ULONG Protocol; // Specifies the protocol
LS_ULONG Size; // size of ChallengeData structure
LS_CHALLDATA ChallengeData; // challenge & response
} LS_CHALLENGE;
LS_CHALLDATA
This data structure is passed in the LS_CHALLENGE structure from the application to the license system.
struct { // Challenge for LS_BASIC_PROTOCOL is
LS_ULONG SecretIndex; // index of secret, X,
LS_ULONG Random; // a random 32-bit value, R
LS_MSG_DIGEST MsgDigest; // the message digest h(in,R,S,Sx).
} LS_CHALLDATA;
LS_MSG_DIGEST
The message digest structure is:
typedef struct {
LS_UCHAR MessageDigest[16]; // a 128-bit message digest
} LS_MSG_DIGEST;