示例#1
0
文件: io.c 项目: mbeck-/fdm
/* Write a line to the io write buffer from a va_list. */
void
io_vwriteline(struct io *io, const char *fmt, va_list ap)
{
    int	 n;
    va_list	 aq;

    if (io->error != NULL)
        return;

    IO_DEBUG(io, "in: wr: used=%zu, free=%zu",
             BUFFER_USED(io->wr), BUFFER_FREE(io->wr));

    if (fmt != NULL) {
        va_copy(aq, ap);
        n = xvsnprintf(NULL, 0, fmt, aq);
        va_end(aq);

        buffer_ensure(io->wr, n + 1);
        xvsnprintf(BUFFER_IN(io->wr), n + 1, fmt, ap);
        buffer_add(io->wr, n);
    } else
        n = 0;
    io_write(io, io->eol, strlen(io->eol));

    IO_DEBUG(io, "out: %zu bytes, wr: used=%zu, free=%zu",
             n + strlen(io->eol), BUFFER_USED(io->wr), BUFFER_FREE(io->wr));
}
示例#2
0
文件: io.c 项目: mbeck-/fdm
/* Write a block to the io write buffer. */
void
io_write(struct io *io, const void *buf, size_t len)
{
    if (io->error != NULL)
        return;

    IO_DEBUG(io, "in: %zu bytes, wr: used=%zu, free=%zu", len,
             BUFFER_USED(io->wr), BUFFER_FREE(io->wr));

    buffer_write(io->wr, buf, len);

    IO_DEBUG(io, "out: %zu bytes, wr: used=%zu, free=%zu", len,
             BUFFER_USED(io->wr), BUFFER_FREE(io->wr));
}
示例#3
0
/* Fill buffers from socket based on poll results. */
int
buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
{
	ssize_t	n;

	if (pfd->revents & (POLLERR|POLLNVAL|POLLHUP))
		return (-1);
	if (pfd->revents & POLLIN) {
		buffer_ensure(in, BUFSIZ);
		n = read(pfd->fd, BUFFER_IN(in), BUFFER_FREE(in));
		if (n == 0)
			return (-1);
		if (n == -1) {
			if (errno != EINTR && errno != EAGAIN)
				return (-1);
		} else
			buffer_add(in, n);
	}
	if (BUFFER_USED(out) > 0 && pfd->revents & POLLOUT) {
		n = write(pfd->fd, BUFFER_OUT(out), BUFFER_USED(out));
		if (n == -1) {
			if (errno != EINTR && errno != EAGAIN)
				return (-1);
		} else
			buffer_remove(out, n);
	}
	return (0);
}
/*
 * COPS_ExtInt_SHA256_Init
 *
 * Initializes a message digesting with the SHA-256 algorithm.
 *
 * @param [in]  Context_pp          Context pointer pointer *Context_pp has to be NULL
 *
 */
static COPS_RC_t COPS_ExtInt_SHA256_Init
(
    void                    **Context_pp
)
{
    COPS_RC_t ReturnValue = COPS_RC_OK;
    PD_ESB_ReturnValue_t PD_ESB_Return = PD_ESB_RETURN_VALUE_RANDOM_ERROR;
    boolean               Did_Malloc = FALSE;

    VERIFY(NULL != Context_pp, COPS_RC_PARAMETER_ERROR);
    VERIFY(NULL == *Context_pp, COPS_RC_PARAMETER_ERROR);

    *Context_pp = malloc(sizeof(PD_ESB_MAC_SessionContext_t));
    ASSERT(NULL != *Context_pp);
    Did_Malloc = TRUE;

    PD_ESB_Return = R_Do_PD_ESB_MAC_GenerationInitialize(
                        (PD_ESB_MAC_SessionContext_t *) * Context_pp,
                        PD_ESB_MAC_TYPE_SHA256,
                        NULL,
                        0,
                        FALSE);

    VERIFY(PD_ESB_RETURN_VALUE_OK == PD_ESB_Return, COPS_RC_UNDEFINED_ERROR);

ErrorExit:

    if (ReturnValue != COPS_RC_OK && Context_pp != NULL && Did_Malloc) {
        BUFFER_FREE(*Context_pp);
    }

    B_(printf("cops_loader_extint.c (%d): COPS_ExtInt_SHA256_Init ... (%d).\n", __LINE__, ReturnValue);)
    return ReturnValue;
/**
 * This function will test function:
 * Done_System_AuthenticationChallengeImpl
 * Function used in: Test_Done_System_AuthenticationChallengeImpl
 *
 * @param [in] Case_p          Pointer
 * @return void
 */
static void ADbg_Done_System_AuthenticationChallengeImpl(ADbg_Case_t *Case_p)
{
    ErrorCode_e Result = E_GENERAL_FATAL_ERROR;
    uint32 AssertStatus = 1;
    uint16 Session = 0;
    ErrorCode_e Status = E_GENERAL_FATAL_ERROR;
    uint32 UpdatedAuthChallengeBlockLength = 0;
    void *UpdatedAuthChallengeBlock_p = NULL;
    uint8 *Var_p = NULL;

    Var_p = Case_p->Command_p->Data_p;
    Do_ADbg_GetDataVar(sizeof(uint16), &Var_p, &Session);
    Do_ADbg_GetDataVar(sizeof(ErrorCode_e), &Var_p, &Status);
    Do_ADbg_GetDataVar(sizeof(uint32), &Var_p, &UpdatedAuthChallengeBlockLength);

    UpdatedAuthChallengeBlock_p = Do_ADbg_GetDataPointer(UpdatedAuthChallengeBlockLength, (void **)&Var_p);

    Do_ADbg_GetDataVar(sizeof(uint32), &Var_p, &ExpectedResult);

    Result = Done_System_AuthenticationChallengeImpl(Session, Status, UpdatedAuthChallengeBlockLength, UpdatedAuthChallengeBlock_p);

    if (ExpectedResult == Result) {
        AssertStatus = 0;
    }

    ReleaseADbg(AssertStatus);

    BUFFER_FREE(UpdatedAuthChallengeBlock_p);
}
示例#6
0
文件: io.c 项目: mbeck-/fdm
/* Return a specific number of bytes from the read buffer, if available. */
int
io_read2(struct io *io, void *buf, size_t len)
{
    if (io->error != NULL)
        return (-1);

    IO_DEBUG(io, "in: %zu bytes, rd: used=%zu, free=%zu", len,
             BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    if (BUFFER_USED(io->rd) < len)
        return (1);

    buffer_read(io->rd, buf, len);

    IO_DEBUG(io, "out: %zu bytes, rd: used=%zu, free=%zu", len,
             BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    return (0);
}
/**
 * This function will test function:
 * Do_Do_Crypto_AsynchronousHash.
 * Function used in: Test_Do_Crypto_AsynchronousHash.
 *
 * @param [in] Case_p is pointer.
 * @return     void.
 */
static void ADbg_Do_Crypto_AsynchronousHash(ADbg_Case_t *Case_p)
{
    ErrorCode_e Result = E_SUCCESS;
    uint32 ObjectLength = 0;
    void *Object_p = NULL;
    HashType_e Type;
    uint32 DataLength = 0;
    void *Data_p = NULL;
    uint32 Length = 0;
    uint8 *Hash_p = NULL;
    HashCallback_fn Callback;
    uint32 ParamLength = 0;
    void *Param_p = NULL;
    uint8 *Var_p = NULL;

    Var_p = Case_p->Command_p->Data_p;

    ObjectLength = get_uint32_le((void **)&Var_p);
    Object_p = Do_ADbg_GetDataPointer(ObjectLength, (void **)&Var_p);

    Do_ADbg_GetDataVar(sizeof(HashType_e), &Var_p, &Type);

    DataLength = get_uint32_le((void **)&Var_p);
    Data_p = Do_ADbg_GetDataPointer(DataLength, (void **)&Var_p);

    Do_ADbg_GetDataVar(sizeof(uint32), &Var_p, &Length);

    Hash_p = (uint8 *) Do_ADbg_GetDataPointer(sizeof(uint8), (void **)&Var_p);

    Do_ADbg_GetDataVar(sizeof(HashCallback_fn), &Var_p, &Callback);

    ParamLength = get_uint32_le((void **)&Var_p);
    Param_p = Do_ADbg_GetDataPointer(ParamLength, (void **)&Var_p);

    Do_Crypto_AsynchronousHash(Object_p, Type, Data_p, Length, Hash_p, Callback, Param_p);
    Do_ADbg_Assert(E_SUCCESS == Result, Case_p);

    BUFFER_FREE(Object_p);
    BUFFER_FREE(Data_p);
    BUFFER_FREE(Hash_p);
    BUFFER_FREE(Param_p);

}
示例#8
0
文件: io.c 项目: mbeck-/fdm
/* Return a specific number of bytes from the read buffer, if available. */
void *
io_read(struct io *io, size_t len)
{
    void	*buf;

    IO_DEBUG(io, "in: %zu bytes, rd: used=%zu, free=%zu", len,
             BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    if (io->error != NULL)
        return (NULL);

    if (BUFFER_USED(io->rd) < len)
        return (NULL);

    buf = xmalloc(len);
    buffer_read(io->rd, buf, len);

    IO_DEBUG(io, "out: %zu bytes, rd: used=%zu, free=%zu", len,
             BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    return (buf);
}
/**
 * This function will test function:
 * Do_Hash_DeviceShutdown.
 * Function used in: Test_Do_Hash_DeviceShutdown.
 *
 * @param [in] Case_p is pointer.
 * @return     void.
 */
static void ADbg_Do_Hash_DeviceShutdown(ADbg_Case_t *Case_p)
{
    ErrorCode_e Result = E_SUCCESS;
    uint32 ObjectLength = 0;
    void *Object_p = NULL;
    uint32 HashDeviceLength = 0;
    void *HashDevice_pp = NULL;
    uint8 *Var_p = NULL;

    Var_p = Case_p->Command_p->Data_p;

    ObjectLength = get_uint32_le((void **)&Var_p);
    Object_p = Do_ADbg_GetDataPointer(ObjectLength, (void **)&Var_p);

    HashDeviceLength = get_uint32_le((void **)&Var_p);
    HashDevice_pp = Do_ADbg_GetDataPointer(HashDeviceLength, (void **)&Var_p);

    Do_Hash_DeviceShutdown(Object_p, &HashDevice_pp);
    Do_ADbg_Assert(E_SUCCESS == Result, Case_p);

    BUFFER_FREE(Object_p);
    BUFFER_FREE(HashDevice_pp);
}
/*
 * Function for sending packet in PROTROM protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 * @param [in]  InputDataIn_p   Pointer to the input data.
 *
 * @retval E_SUCCESS                        After successful execution.
 * @retval E_FAILED_TO_ALLOCATE_COMM_BUFFER Failed to allocate communication
 *                                          buffer.
 */
ErrorCode_e Protrom_Transport_Send(Communication_t *Communication_p, void *InputDataIn_p)
{
    Protrom_Packet_t *Packet_p = NULL;
    Protrom_SendData_LP_t *InputData_p = (Protrom_SendData_LP_t *)InputDataIn_p;

    Packet_p = (Protrom_Packet_t *) malloc(sizeof(Protrom_Packet_t));

    if (NULL == Packet_p) {
        return E_ALLOCATE_FAILED;
    }

    Packet_p->Header = *InputData_p->Header_p;
    Packet_p->Buffer_p = (uint8 *)malloc(Packet_p->Header.PayloadLength + PROTROM_HEADER_LENGTH + PROTROM_CRC_LENGTH);

    if (NULL == Packet_p->Buffer_p) {
        BUFFER_FREE(Packet_p);
        return E_ALLOCATE_FAILED;
    }

    Protrom_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);

    if (NULL != InputData_p->Payload_p) {
        /* setup payload for calculation */
        memcpy(Packet_p->Buffer_p + PROTROM_HEADER_LENGTH, InputData_p->Payload_p, Packet_p->Header.PayloadLength);

        /* Calculate Payload CRC */
        Packet_p->Communication_p = Communication_p;

        Communication_p->HashDevice_p->Calculate(OBJECT_HASH(Communication_p), Communication_p->CurrentFamilyHash,
                Packet_p->Buffer_p, Packet_p->Header.PayloadLength + PROTROM_HEADER_LENGTH,
                (uint8 *)&Packet_p->CRC, (HashCallback_t)Protrom_Transport_OutHashCallback,
                (void *) Packet_p);
    } else {
        //@todo error no payload
    }

    /* The packet's buffer and the packet resources are
     * freed in the send callback function */

    /* coverity[leaked_storage] */
    return E_SUCCESS;
}
/**
 * This function will test function:
 * Do_Crypto_GetHashLength.
 * Function used in: Test_Do_Crypto_GetHashLength.
 *
 * @param [in] Case_p is pointer.
 * @return     void.
 */
static void ADbg_Do_Crypto_GetHashLength(ADbg_Case_t *Case_p)
{
    uint32 Result = E_SUCCESS;
    uint32 ExpectedResult = 0xFFFFFFFF;
    uint32 ObjectLength = 0;
    void *Object_p = NULL;
    HashType_e Type;
    uint8 *Var_p = NULL;

    Var_p = Case_p->Command_p->Data_p;

    ObjectLength = get_uint32_le((void **)&Var_p);
    Object_p = Do_ADbg_GetDataPointer(ObjectLength, (void **)&Var_p);

    Do_ADbg_GetDataVar(sizeof(HashType_e), &Var_p, &Type);

    Result = Do_Crypto_GetHashLength(Object_p, Type);
    Do_ADbg_Assert(ExpectedResult != Result, Case_p);

    BUFFER_FREE(Object_p);
}
示例#12
0
/* Ensure free space for size in buffer. */
void
buffer_ensure(struct buffer *b, size_t size)
{
	if (size == 0)
		fatalx("zero size");

	if (BUFFER_FREE(b) >= size)
		return;

	if (b->off > 0) {
		if (b->size > 0)
			memmove(b->base, b->base + b->off, b->size);
		b->off = 0;
	}

	if (SIZE_MAX - b->size < size)
		fatalx("size too big");
	while (b->space < b->size + size) {
		b->base = xrealloc(b->base, 2, b->space);
		b->space *= 2;
	}
}
 */

#include "btl_scif.h"
#include "btl_scif_frag.h"

#define BUFFER_FREE(s,e,hbm) (((s) > (e) || ((s) == (e) && !hbm)) ? (s) - (e) : (mca_btl_scif_component.segment_size - (e)))

/* attempt to reserve a contiguous segment from the remote endpoint */
static inline int mca_btl_scif_send_get_buffer (mca_btl_base_endpoint_t *endpoint, size_t size, unsigned char * restrict *dst)
{
    /* the high bit helps determine if the buffer is empty or full */
    bool hbm = (endpoint->send_buffer.start >> 31) == (endpoint->send_buffer.end >> 31);
    const unsigned int segment_size = mca_btl_scif_component.segment_size;
    unsigned int start = endpoint->send_buffer.start & ~ (1 << 31);
    unsigned int end = endpoint->send_buffer.end & ~ (1 << 31);
    unsigned int buffer_free = BUFFER_FREE(start, end, hbm);
#if defined(SCIF_TIMING)
    struct timespec ts;

    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
#endif

    /* need space for the fragment + the header */
    size += sizeof (mca_btl_scif_frag_hdr_t);

    /* check if we need to free up space for this fragment */
    if (OPAL_UNLIKELY(buffer_free < size)) {
        BTL_VERBOSE(("not enough room for a fragment of size %u. in use buffer segment: {start: %x, end: %x, high bit matches: %d}\n",
                     (unsigned) size, start, end, (int) hbm));

        /* read the current start pointer from the remote peer */
示例#14
0
文件: io.c 项目: mbeck-/fdm
/*
 * Return a line from the read buffer. EOL is stripped and the string returned
 * is zero-terminated.
 */
char *
io_readline2(struct io *io, char **buf, size_t *len)
{
    char	*ptr, *base;
    size_t	 size, maxlen, eollen;

    if (io->error != NULL)
        return (NULL);

    maxlen = BUFFER_USED(io->rd);
    if (maxlen > IO_MAXLINELEN)
        maxlen = IO_MAXLINELEN;
    eollen = strlen(io->eol);
    if (BUFFER_USED(io->rd) < eollen)
        return (NULL);

    IO_DEBUG(io, "in: rd: used=%zu, free=%zu",
             BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    base = ptr = BUFFER_OUT(io->rd);
    for (;;) {
        /* Find the first character in the EOL string. */
        ptr = memchr(ptr, *io->eol, maxlen - (ptr - base));

        if (ptr != NULL) {
            /* Found. Is there enough space for the rest? */
            if (ptr - base + eollen > maxlen) {
                /*
                 * No, this isn't it. Set ptr to NULL to handle
                 * as not found.
                 */
                ptr = NULL;
            } else if (strncmp(ptr, io->eol, eollen) == 0) {
                /* This is an EOL. */
                size = ptr - base;
                break;
            }
        }
        if (ptr == NULL) {
            IO_DEBUG(io,
                     "not found (%zu, %d)", maxlen, IO_CLOSED(io));

            /*
             * Not found within the length searched. If that was
             * the maximum length, this is an error.
             */
            if (maxlen == IO_MAXLINELEN) {
                if (io->error != NULL)
                    xfree(io->error);
                io->error =
                    xstrdup("io: maximum line length exceeded");
                return (NULL);
            }

            /*
             * If the socket has closed, just return all the data
             * (the buffer is known to be at least eollen long).
             */
            if (!IO_CLOSED(io))
                return (NULL);
            size = BUFFER_USED(io->rd);

            ENSURE_FOR(*buf, *len, size, 1);
            buffer_read(io->rd, *buf, size);
            (*buf)[size] = '\0';
            return (*buf);
        }

        /* Start again from the next character. */
        ptr++;
    }

    /* Copy the line and remove it from the buffer. */
    ENSURE_FOR(*buf, *len, size, 1);
    if (size != 0)
        buffer_read(io->rd, *buf, size);
    (*buf)[size] = '\0';

    /* Discard the EOL from the buffer. */
    buffer_remove(io->rd, eollen);

    IO_DEBUG(io, "out: %zu bytes, rd: used=%zu, free=%zu",
             size, BUFFER_USED(io->rd), BUFFER_FREE(io->rd));

    return (*buf);
}
示例#15
0
文件: io.c 项目: mbeck-/fdm
/*
 * Fill read buffer. Returns 0 for closed, -1 for error, 1 for success,
 * a la read(2).
 */
int
io_fill(struct io *io)
{
    ssize_t	n;
    int	error;

again:
    /* Ensure there is at least some minimum space in the buffer. */
    buffer_ensure(io->rd, IO_WATERMARK);

    /* Attempt to read as much as the buffer has available. */
    if (io->ssl == NULL) {
        n = read(io->fd, BUFFER_IN(io->rd), BUFFER_FREE(io->rd));
        IO_DEBUG(io, "read returned %zd (errno=%d)", n, errno);
        if (n == 0 || (n == -1 && errno == EPIPE))
            return (0);
        if (n == -1 && errno != EINTR && errno != EAGAIN) {
            if (io->error != NULL)
                xfree(io->error);
            xasprintf(&io->error, "io: read: %s", strerror(errno));
            return (-1);
        }
    } else {
        n = SSL_read(io->ssl, BUFFER_IN(io->rd), BUFFER_FREE(io->rd));
        IO_DEBUG(io, "SSL_read returned %zd", n);
        if (n == 0)
            return (0);
        if (n < 0) {
            switch (error = SSL_get_error(io->ssl, n)) {
            case SSL_ERROR_WANT_READ:
                /*
                 * A repeat is certain (poll on the socket will
                 * still return data ready) so this can be
                 * ignored.
                 */
                break;
            case SSL_ERROR_WANT_WRITE:
                io->flags |= IOF_NEEDFILL;
                break;
            case SSL_ERROR_SYSCALL:
                if (errno == EAGAIN || errno == EINTR)
                    break;
            /* FALLTHROUGH */
            default:
                if (io->error != NULL)
                    xfree(io->error);
                io->error = sslerror2(error, "SSL_read");
                return (-1);
            }
        }
    }

    /* Test for > 0 since SSL_read can return any -ve on error. */
    if (n > 0) {
        IO_DEBUG(io, "read %zd bytes", n);

        /* Copy out the duplicate fd. Errors are just ignored. */
        if (io->dup_fd != -1) {
            write(io->dup_fd, "< ", 2);
            write(io->dup_fd, BUFFER_IN(io->rd), n);
        }

        /* Adjust the buffer size. */
        buffer_add(io->rd, n);

        /* Reset the need flags. */
        io->flags &= ~IOF_NEEDFILL;

        goto again;
    }

    return (1);
}
/**
 * This function will test function:
 * Done_System_GetControlKeysImpl
 * Function used in: Test_Done_System_GetControlKeysImpl
 *
 * @param [in] Case_p          Pointer
 * @return void
 */
static void ADbg_Done_System_GetControlKeysImpl(ADbg_Case_t *Case_p)
{
    ErrorCode_e Result = E_GENERAL_FATAL_ERROR;
    uint32 AssertStatus = 1;
    uint16 Session = 0;
    ErrorCode_e Status = E_GENERAL_FATAL_ERROR;
    char *NLCKLock_p = NULL;
    char *NSLCKLock_p = NULL;
    char *SPLCKLock_p = NULL;
    char *CLCKLock_p = NULL;
    char *PCKLock_p = NULL;
    char *ESLCKLock_p = NULL;
    char *NLCKUnlock_p = NULL;
    char *NSLCKUnlock_p = NULL;
    char *SPLCKUnlock_p = NULL;
    char *CLCKUnlock_p = NULL;
    char *PCKUnlock_p = NULL;
    char *ESLCKUnlock_p = NULL;
    uint32 NLCKLockLength = 0;
    uint32 NSLCKLockLength = 0;
    uint32 SPLCKLockLength = 0;
    uint32 CLCKLockLength = 0;
    uint32 PCKLockLength = 0;
    uint32 ESLCKLockLength = 0;
    uint32 NLCKUnlockLength = 0;
    uint32 NSLCKUnlockLength = 0;
    uint32 SPLCKUnlockLength = 0;
    uint32 CLCKUnlockLength = 0;
    uint32 PCKUnlockLength = 0;
    uint32 ESLCKUnlockLength = 0;
    uint8 *Var_p = NULL;

    Var_p = Case_p->Command_p->Data_p;
    Do_ADbg_GetDataVar(sizeof(uint16), &Var_p, &Session);
    Do_ADbg_GetDataVar(sizeof(ErrorCode_e), &Var_p, &Status);

    NLCKLockLength = get_uint32_string_le((void *)&Var_p);
    NLCKLock_p = (char *)Do_ADbg_GetDataPointer(NLCKLockLength, (void *)&Var_p);

    NSLCKLockLength = get_uint32_string_le((void *)&Var_p);
    NSLCKLock_p = (char *)Do_ADbg_GetDataPointer(NSLCKLockLength, (void *)&Var_p);

    SPLCKLockLength = get_uint32_string_le((void *)&Var_p);
    SPLCKLock_p = (char *)Do_ADbg_GetDataPointer(SPLCKLockLength, (void *)&Var_p);

    CLCKLockLength = get_uint32_string_le((void *)&Var_p);
    CLCKLock_p = (char *)Do_ADbg_GetDataPointer(CLCKLockLength, (void *)&Var_p);

    PCKLockLength = get_uint32_string_le((void *)&Var_p);
    PCKLock_p = (char *)Do_ADbg_GetDataPointer(PCKLockLength, (void *)&Var_p);

    ESLCKLockLength = get_uint32_string_le((void *)&Var_p);
    ESLCKLock_p = (char *)Do_ADbg_GetDataPointer(ESLCKLockLength, (void *)&Var_p);

    NLCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    NLCKUnlock_p = (char *)Do_ADbg_GetDataPointer(NLCKUnlockLength, (void *)&Var_p);

    NSLCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    NSLCKUnlock_p = (char *)Do_ADbg_GetDataPointer(NSLCKUnlockLength, (void *)&Var_p);

    SPLCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    SPLCKUnlock_p = (char *)Do_ADbg_GetDataPointer(SPLCKUnlockLength, (void *)&Var_p);

    CLCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    CLCKUnlock_p = (char *)Do_ADbg_GetDataPointer(CLCKUnlockLength, (void *)&Var_p);

    PCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    PCKUnlock_p = (char *)Do_ADbg_GetDataPointer(PCKUnlockLength, (void *)&Var_p);

    ESLCKUnlockLength = get_uint32_string_le((void *)&Var_p);
    ESLCKUnlock_p = (char *)Do_ADbg_GetDataPointer(ESLCKUnlockLength, (void *)&Var_p);

    Do_ADbg_GetDataVar(sizeof(uint32), &Var_p, &ExpectedResult);

    Result = Done_System_GetControlKeysImpl(Session, Status, NLCKLock_p, NSLCKLock_p,
                                            SPLCKLock_p, CLCKLock_p,
                                            PCKLock_p, ESLCKLock_p,
                                            NLCKUnlock_p, NSLCKUnlock_p,
                                            SPLCKUnlock_p, CLCKUnlock_p,
                                            PCKUnlock_p, ESLCKUnlock_p);

    if (ExpectedResult == Result) {
        AssertStatus = 0;
    }

    ReleaseADbg(AssertStatus);
    BUFFER_FREE(NLCKLock_p);
    BUFFER_FREE(NSLCKLock_p);
    BUFFER_FREE(SPLCKLock_p);
    BUFFER_FREE(CLCKLock_p);
    BUFFER_FREE(PCKLock_p);
    BUFFER_FREE(ESLCKLock_p);
    BUFFER_FREE(NLCKUnlock_p);
    BUFFER_FREE(NSLCKUnlock_p);
    BUFFER_FREE(SPLCKUnlock_p);
    BUFFER_FREE(CLCKUnlock_p);
    BUFFER_FREE(PCKUnlock_p);
    BUFFER_FREE(ESLCKUnlock_p);

}