Ejemplo n.º 1
0
static void dump_hdr_frame(frame_proc_t *frameCtrl, int main_tb)
{
  static int sn_cnt = 0;
  int cnt, i;
  char buf[BUFF_SIZE_32];
  int w, h;

  if (main_tb & 0x01) { /*main*/
    cnt =frameCtrl->input.mctl_info.num_main_img;
    w = frameCtrl->input.mctl_info.picture_dim.width;
    h = frameCtrl->input.mctl_info.picture_dim.height;
    for (i=0; i< cnt; i++) {
      snprintf(buf, sizeof(buf), "/data/%d_%dM%dx%d.yuv", sn_cnt, i, w, h);
      dump_frame(&frameCtrl->input.mctl_info.main_img_frame[i],buf);
    }
  }
  if (main_tb &0x02) { /*tb*/
    cnt =frameCtrl->input.mctl_info.num_thumb_img;
    w = frameCtrl->input.mctl_info.thumbnail_dim.width;
    h = frameCtrl->input.mctl_info.thumbnail_dim.height;

    for (i=0; i< cnt; i++) {
      snprintf(buf, sizeof(buf), "/data/%d_%dT%dx%d.yuv", sn_cnt, i, w, h);
      dump_frame(&frameCtrl->input.mctl_info.thumb_img_frame[i], buf);
    }
  }
  sn_cnt++;
  if (sn_cnt == 100) {
    sn_cnt = 0;
  }
}
Ejemplo n.º 2
0
/**************************************************************************
 * RSA tests 
 *
 * Use the results from openssl to verify PKCS1 etc 
 **************************************************************************/
static int RSA_test(void)
{
    int res = 1;
    const char *plaintext = /* 128 byte hex number */
        "1234567890abbbbbbbbbbbbbbbccccccccccccccdddddddddddddeeeeeeeeee2"
        "1aaaaaaaaaabbbbbbbbbbbbbbbccccccccccccccdddddddddddddeeeeeeeee2\012";
    uint8_t enc_data[128], dec_data[128];
    RSA_CTX *rsa_ctx = NULL;
    BI_CTX *bi_ctx;
    bigint *plaintext_bi;
    bigint *enc_data_bi, *dec_data_bi;
    uint8_t enc_data2[128], dec_data2[128];
    int len; 
    uint8_t *buf;
	
    /* extract the private key elements */
    len = get_file("./axTLS.key_1024", &buf);
    if (asn1_get_private_key(buf, len, &rsa_ctx) < 0)
    {
        goto end;
    }

    free(buf);
    
	dump_frame("original data",(char *)plaintext, strlen(plaintext));
	
    bi_ctx = rsa_ctx->bi_ctx;
    plaintext_bi = bi_import(bi_ctx, 
            (const uint8_t *)plaintext, strlen(plaintext));
    /* basic rsa encrypt */
    enc_data_bi = RSA_public(rsa_ctx, plaintext_bi);
    bi_export(bi_ctx, bi_copy(enc_data_bi), enc_data, sizeof(enc_data));
	dump_frame("encrypt data",(char *)enc_data, sizeof(enc_data));
    /* basic rsa decrypt */
    dec_data_bi = RSA_private(rsa_ctx, enc_data_bi);
    bi_export(bi_ctx, dec_data_bi, dec_data, sizeof(dec_data));
	dump_frame("decrypt data",(char *)dec_data, sizeof(dec_data));
    if (memcmp(dec_data, plaintext, strlen(plaintext)))
    {
        printf("Error: DECRYPT #1 failed\n");
        goto end;
    }

    RSA_encrypt(rsa_ctx, (const uint8_t *)"abc", 3, enc_data2, 0);
    RSA_decrypt(rsa_ctx, enc_data2, dec_data2, 1);
    if (memcmp("abc", dec_data2, 3))
    {
        printf("Error: ENCRYPT/DECRYPT #2 failed\n");
        goto end;
    }

    RSA_free(rsa_ctx);
    res = 0;
    printf("All RSA tests passed\n");

end:
    return res;
}
Ejemplo n.º 3
0
void powerpc_mchk_interrupt(struct trapframe *framep)
{

	printf("powerpc_mchk_interrupt: machine check interrupt!\n");
	dump_frame(framep);
	trap(framep);
}
Ejemplo n.º 4
0
static void busfault(struct arm_cm_exception_frame *frame)
{
	printf("busfault: ");
	dump_frame(frame);

	halt();
}
Ejemplo n.º 5
0
static void busfault(struct arm_cm_exception_frame *frame)
{
	printf("busfault: ");
	dump_frame(frame);

	platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
Ejemplo n.º 6
0
void powerpc_crit_interrupt(struct trapframe *framep)
{

	printf("powerpc_crit_interrupt: critical interrupt!\n");
	dump_frame(framep);
	trap(framep);
}
Ejemplo n.º 7
0
static void usagefault(struct cm3_exception_frame *frame)
{
	printf("usagefault: ");
	dump_frame(frame);

	halt();
}
Ejemplo n.º 8
0
static void			udp_callback(struct tuple4 *addr, u_char *udp_data, int udp_data_len, struct rfc_ip *ip)
{
  struct session		*elt;
  unsigned int			udp_data_offset = IPHDRLEN + UDPHDRLEN;

  if (NULL == (elt = sessions_find(first_session, TYPE_UDP, 0, addr))) {
    if (bonus_time)
      return;
    if (addr->source == 1719 || addr->dest == 1719)
      elt = sessions_add(TYPE_UDP | TYPE_H225_RAS, addr, NULL);
    else
      if (addr->source == 5060 || addr->dest == 5060)
	elt = sessions_add(TYPE_UDP | TYPE_SIP, addr, NULL);
  }
  if (NULL == elt)
    return;
  elt->bytes += udp_data_len;
  elt->lastseen = nids_last_pcap_header->ts;
  if (NULL != elt->callback)
    elt = elt->callback(elt, udp_data, udp_data_len);

  /*
   * We can dump the frame only after the data is processed because
   * a new session object (`elt') might be created by the callback,
   * with a pointer to a different PCAP file.
   */
  if ((ip->ihl > 5) && ((ip->ihl * 4) < (udp_data_offset + udp_data_len)))
    udp_data_offset = ip->ihl * 4 + UDPHDRLEN;
  dump_frame((u_char *)ip, udp_data_offset + udp_data_len, elt->dumper);
}
Ejemplo n.º 9
0
static void
dump_traceback(int fd, PyThreadState *tstate, int write_header)
{
    PyFrameObject *frame;
    unsigned int depth;

    if (write_header)
        PUTS(fd, "Stack (most recent call first):\n");

    frame = _PyThreadState_GetFrame(tstate);
    if (frame == NULL)
        return;

    depth = 0;
    while (frame != NULL) {
        if (MAX_FRAME_DEPTH <= depth) {
            PUTS(fd, "  ...\n");
            break;
        }
        if (!PyFrame_Check(frame))
            break;
        dump_frame(fd, frame);
        frame = frame->f_back;
        depth++;
    }
}
Ejemplo n.º 10
0
static bool change_frame(struct luadebug_debugger *session, const char *option)
{
	const int index = option ? atoi(option) : session->frame_index;

	if (!lua_getstack(session->L, index, &session->frame)) {
		session->user->print(session->user, RED "invalid frame index '%d'\n" CLEAR, index);
	}
	else {
		UNUSED int env_index;

		session->user->print(session->user, "  #%d\t" CYAN, index);
		dump_frame(session->L, &session->frame, session->user);

		session->frame_index = index;

		env_index = capture_env(session->L, index);
		assert(env_index != -1);

		lua_replace(session->L, session->env_index);

		session->list_line = session->frame.currentline - LIST_DEFAULT_LINE/2;
	}

	return false;
}
Ejemplo n.º 11
0
static void memmanage(struct arm_cm_exception_frame *frame)
{
	printf("memmanage: ");
	dump_frame(frame);

	uint32_t mmfsr = SCB->CFSR & 0xff;

	if (mmfsr & (1<<0)) { // IACCVIOL
		printf("instruction fault\n");
	}
	if (mmfsr & (1<<1)) { // DACCVIOL
		printf("data fault\n");
	}
	if (mmfsr & (1<<3)) { // MUNSTKERR
		printf("fault on exception return\n");
	}
	if (mmfsr & (1<<4)) { // MSTKERR
		printf("fault on exception entry\n");
	}
	if (mmfsr & (1<<5)) { // MLSPERR
		printf("fault on lazy fpu preserve\n");
	}
	if (mmfsr & (1<<7)) { // MMARVALID
		printf("fault address 0x%x\n", SCB->MMFAR);
	}

	platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
Ejemplo n.º 12
0
void cyg_hal_report_exception_handler_returned(HAL_SavedRegisters *frame)
{    
    int old;
    HAL_DISABLE_INTERRUPTS(old);
    diag_printf("Exception handler returned!\n");
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 13
0
void cyg_hal_report_abort_data(HAL_SavedRegisters *frame)
{
    int old;
    HAL_DISABLE_INTERRUPTS(old);
    diag_printf("[ABORT DATA] Frame:\n");
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 14
0
void cyg_hal_report_software_interrupt(HAL_SavedRegisters *frame)
{
    int old;
    HAL_DISABLE_INTERRUPTS(old);
    diag_printf("[SOFTWARE INTERRUPT] Frame:\n");
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 15
0
// Debug routines
void cyg_hal_report_undefined_instruction(HAL_SavedRegisters *frame)
{
    int old;
    HAL_DISABLE_INTERRUPTS(old);
    diag_printf("[UNDEFINED INSTRUCTION] Frame:\n");
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 16
0
static void usagefault(struct arm_cm_exception_frame *frame)
{
    inc_critical_section();
    printf("usagefault: ");
    dump_frame(frame);

    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
Ejemplo n.º 17
0
void
show_frame_out(HAL_SavedRegisters *frame)
{
    int old;
    HAL_DISABLE_INTERRUPTS(old);
    diag_printf("[OUT] IRQ Frame:\n");
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 18
0
static void hardfault(struct arm_cm_exception_frame *frame)
{
	printf("hardfault: ");
	dump_frame(frame);

	printf("HFSR 0x%x\n", SCB->HFSR);

	halt();
}
Ejemplo n.º 19
0
static void hardfault(struct arm_cm_exception_frame *frame)
{
	printf("hardfault: ");
	dump_frame(frame);

	printf("HFSR 0x%x\n", SCB->HFSR);

	platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
Ejemplo n.º 20
0
void dump_frame( const frame_t* f )
{
  if ( f ) {
    fprintf( stderr, "FRAME: %p\n", f );
    for ( int i = 0; i < MAX_FRAME_VALUES; i++ ) {
      dump_value( f->values[i] );
    }
    dump_frame( f->parent );
  }
}
Ejemplo n.º 21
0
/* HCI rx data will land here */
static A_STATUS 
app_hci_data_rx(AMP_DEV *dev, A_UINT8 *datap, int len)
{
    PAL_PRINT("recvd data frame = \n");
    dump_frame(datap, len);
    if(dev->pal_data_dispatcher) {
        dev->pal_data_dispatcher(dev, (char *)datap, (short)len);
    }
    return A_OK;
}
Ejemplo n.º 22
0
void
trap_cache_error(unsigned status, unsigned cause, unsigned epc,
		 md_thread_t *frame)
{
	printf("status:%x cause:%x epc:%x\n"
	       "[utlb exception]\n",
	       status, cause, epc);
	dump_frame(frame);
	while(1)
		;
}
Ejemplo n.º 23
0
void
trap_reset(unsigned status, unsigned cause, unsigned epc,
		       md_thread_t *frame)
{
	printf("status:%x cause:%x epc:%x\n"
	       "[reset exception]\n",
	       status, cause, epc);
	dump_frame(frame);
	while(1)
		;
}
Ejemplo n.º 24
0
/*
 * This function is called upon reception of all IPv4 packets, which
 * means some packets will be processed by both ip_callback and
 * {udp,tcp}_callback. It is necessary for TCP packets though because
 * tcp_callback is only called once a connection is established (i.e.
 * after the first SYN, SYN+ACK and ACK packets have passed) and only
 * when data is available (PSH packets).
 * Since we don't want failed TCP connections (portscans etc) to
 * mobilize resources, we give TCP sessions 60 seconds to complete
 * the TCP handshake or else they are considered to be closed.
 */
static void			ip_callback(struct rfc_ip *ip, int len)
{
  struct tuple4			addr;
  struct rfc_tcp		*tcp;
  struct session		*elt;
  struct session		*elt_next;
  unsigned int			ip_data_offset = IPHDRLEN;

  for (elt = first_session; NULL != elt; elt = elt_next) {
    elt_next = elt->next;
    if (elt->timeout && (nids_last_pcap_header->ts.tv_sec >= elt->timeout))
      sessions_del(elt);
  }
  if ((ip->ihl > 5) && ((ip->ihl * 4) <= len))
    ip_data_offset = ip->ihl * 4;
  if ((ip->protocol != 6) || (len < (ip_data_offset + TCPHDRLEN)))
    return; /* not TCP or too short */
  tcp = (struct rfc_tcp *)((char *)ip + ip_data_offset);
  addr.saddr = *((u_int *)&ip->saddr);
  addr.daddr = *((u_int *)&ip->daddr);
  addr.source = ntohs(tcp->sport);
  addr.dest = ntohs(tcp->dport);
  if (NULL != (elt = sessions_find(first_session, TYPE_TCP, 0, &addr))) {
    dump_frame((u_char *)ip, len, elt->dumper);
    if (sessions_expiration_delay)
      elt->timeout = nids_last_pcap_header->ts.tv_sec + sessions_expiration_delay;
    elt->lastseen = nids_last_pcap_header->ts;
    return;
  }
  if (!tcp->syn || bonus_time)
    return;
  if (addr.source == 5060 || addr.dest == 5060)
    elt = sessions_add(TYPE_TCP | TYPE_SIP, &addr, NULL);
  else
    elt = sessions_add(TYPE_TCP, &addr, NULL);
  if (NULL == elt)
    return;
  dump_frame((u_char *)ip, len, elt->dumper);
  elt->timeout = nids_last_pcap_header->ts.tv_sec + 60;
  /* 60 seconds to complete TCP handshake */
}
Ejemplo n.º 25
0
Archivo: debug.c Proyecto: jaehyek/lk
void _panic(void *caller, const char *fmt, ...)
{
	dprintf(ALWAYS, "panic (frame %p): \n", __GET_FRAME());
	dump_frame(__GET_FRAME());
	dprintf(ALWAYS, "panic (caller %p): ", caller);

	va_list ap;
	va_start(ap, fmt);
	_dvprintf(fmt, ap);
	va_end(ap);

	halt();
}
Ejemplo n.º 26
0
void cyg_hal_report_exception_handler_returned(HAL_SavedRegisters *frame)
{    
    int old;
    HAL_DISABLE_INTERRUPTS(old);
#ifdef CYGPKG_HAL_SMP_SUPPORT
    HAL_SMP_CPU_TYPE cpu;
    cpu  = HAL_SMP_CPU_THIS();
    diag_printf("CPU: %d Exception handler returned!\n", cpu);
#else
    diag_printf("Exception handler returned!\n");
#endif
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 27
0
/* HCI events will land here */
static A_STATUS 
app_hci_event_rx(AMP_DEV *dev, A_UINT8 *datap, int len)
{
    WMI_HCI_EVENT *ev;
    
    ev = (WMI_HCI_EVENT *)datap;

    PAL_PRINT("recvd HCI event = \n");
    dump_frame(datap, len);
    pal_decode_event(datap, (A_UINT16)len);
    if(dev->pal_evt_dispatcher) {
        dev->pal_evt_dispatcher(dev, (char *)datap, (short) len);
    }
    return A_OK;
}
Ejemplo n.º 28
0
Archivo: cap.cpp Proyecto: sangk54/mia
int V4LCapture::read_frame(uint8_t **data, struct v4l2_buffer *buf)
{
	if (param.replay_mode) {
		int ret = load_frame(&(buffers->start), &buf_now);
		*data = (uint8_t *) buffers->start;
		*buf = buf_now;
		return ret;
	}

	if( (int)buf_now.index != -1 ) {
		if( -1 == xioctl(fd, VIDIOC_QBUF, &buf_now) ){
			errno_exit("VIDIOC_QBUF");
		}
	}
	
	CLEAR( buf_now );

	buf_now.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	buf_now.memory = V4L2_MEMORY_MMAP;

	if( -1 == xioctl(fd, VIDIOC_DQBUF, &buf_now) ){
		if (EAGAIN == errno) {
			return -1;
			errno_exit("EAGAIN");
		} else if (EINVAL == errno) {
			errno_exit("EINVAL");
		} else if (ENOMEM == errno) {
			errno_exit("ENOMEM");
		} else if (EIO == errno) {
			errno_exit("EIO");
		} else {
			errno_exit("VIDIOC_DQBUF");
		}
	}
	
	struct buffer *pbuf = &buffers[buf_now.index];

	if (param.record_prefix != NULL) {
		dump_frame((uint8_t *)pbuf->start, &buf_now);
	}

	*data = (uint8_t *) pbuf->start;
	*buf = buf_now;

	return buf_now.bytesused;


}
Ejemplo n.º 29
0
void cyg_hal_report_software_interrupt(HAL_SavedRegisters *frame)
{
#ifdef CYGPKG_HAL_SMP_SUPPORT
    HAL_SMP_CPU_TYPE cpu;
    cpu  = HAL_SMP_CPU_THIS();
#endif

    int old;
    HAL_DISABLE_INTERRUPTS(old);
#ifdef CYGPKG_HAL_SMP_SUPPORT
    diag_printf("[SOFTWARE INTERRUPT] CPU: %d Frame:\n", cpu);
#else
    diag_printf("[SOFTWARE INTERRUPT] Frame:\n");
#endif
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}
Ejemplo n.º 30
0
void cyg_hal_report_abort_data(HAL_SavedRegisters *frame)
{
#ifdef CYGPKG_HAL_SMP_SUPPORT
    HAL_SMP_CPU_TYPE cpu;
    cpu  = HAL_SMP_CPU_THIS();
#endif

    int old;
    HAL_DISABLE_INTERRUPTS(old);
#ifdef CYGPKG_HAL_SMP_SUPPORT
    diag_printf("[ABORT DATA] CPU: %d Frame:\n", cpu);
#else
    diag_printf("[ABORT DATA] Frame:\n");
#endif
    dump_frame((unsigned char *)frame);
    HAL_RESTORE_INTERRUPTS(old);
}