tools/header_generation/create_hdr_esbc/taal_api/esbc_hdr_ta_3_x.c
/****************************************************************************
 * API's for Creating HEADER FILES
 ****************************************************************************/
API's for Creating HEADER FILES
API ' s for Creating HEADER FILES
int create_header_ta_3_x(void)
{
	int ret;
	uint8_t *header;
	FILE *fp;
	uint32_t hdrlen = gd.rsa_offset;
	header = malloc(hdrlen);
	if (header == NULL) {
		printf("Error in allocating memory of %d bytes\n", hdrlen);
		return FAILURE;
	}
	memset(header, 0, hdrlen);
	memcpy(header, gd.hdr_struct, gd.hdr_size);
	if (gd.iek_flag == 0)
		memcpy(header + gd.srk_offset, gd.key_table, gd.srk_size);
	fp = fopen(gd.hdr_file_name, "wb");
	if (fp == NULL) {
		printf("Error in opening the file: %s\n", gd.hdr_file_name);
		free(header);
		return FAILURE;
	}
	ret = fwrite(header, 1, hdrlen, fp);
	fclose(fp);
	free(header);
	if (ret == 0) {
		printf("Error in Writing to file");
		return FAILURE;
	}
	return SUCCESS;
}
int create_header_ta_3_x ( void ) { int ret ; uint8_t * header ; FILE * fp ; uint32_t hdrlen = gd . rsa_offset ; header = malloc ( hdrlen ) ; if ( header == NULL ) { printf ( " \n " , hdrlen ) ; return FAILURE ; } memset ( header , 0 , hdrlen ) ; memcpy ( header , gd . hdr_struct , gd . hdr_size ) ; if ( gd . iek_flag == 0 ) memcpy ( header + gd . srk_offset , gd . key_table , gd . srk_size ) ; fp = fopen ( gd . hdr_file_name , " " ) ; if ( fp == NULL ) { printf ( " \n " , gd . hdr_file_name ) ; free ( header ) ; return FAILURE ; } ret = fwrite ( header , 1 , hdrlen , fp ) ; fclose ( fp ) ; free ( header ) ; if ( ret == 0 ) { printf ( " " ) ; return FAILURE ; } return SUCCESS ; }
API's for Creating HEADER FILES
API ' s for Creating HEADER FILES
/* Create the header file */