1*f0865ec9SKyle Evans /* 2*f0865ec9SKyle Evans * Copyright (C) 2021 - This file is part of libecc project 3*f0865ec9SKyle Evans * 4*f0865ec9SKyle Evans * Authors: 5*f0865ec9SKyle Evans * Ryad BENADJILA <ryadbenadjila@gmail.com> 6*f0865ec9SKyle Evans * Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr> 7*f0865ec9SKyle Evans * 8*f0865ec9SKyle Evans * This software is licensed under a dual BSD and GPL v2 license. 9*f0865ec9SKyle Evans * See LICENSE file at the root folder of the project. 10*f0865ec9SKyle Evans */ 11*f0865ec9SKyle Evans #include <libecc/utils/print_buf.h> 12*f0865ec9SKyle Evans #include <libecc/external_deps/print.h> 13*f0865ec9SKyle Evans 14*f0865ec9SKyle Evans /* Print the buffer of a given size */ buf_print(const char * msg,const u8 * buf,u16 buflen)15*f0865ec9SKyle Evansvoid buf_print(const char *msg, const u8 *buf, u16 buflen) 16*f0865ec9SKyle Evans { 17*f0865ec9SKyle Evans u32 i; 18*f0865ec9SKyle Evans 19*f0865ec9SKyle Evans if ((buf == NULL) || (msg == NULL)) { 20*f0865ec9SKyle Evans goto err; 21*f0865ec9SKyle Evans } 22*f0865ec9SKyle Evans 23*f0865ec9SKyle Evans ext_printf("%s: ", msg); 24*f0865ec9SKyle Evans for (i = 0; i < (u32)buflen; i++) { 25*f0865ec9SKyle Evans ext_printf("%02x", buf[i]); 26*f0865ec9SKyle Evans } 27*f0865ec9SKyle Evans ext_printf("\n"); 28*f0865ec9SKyle Evans 29*f0865ec9SKyle Evans err: 30*f0865ec9SKyle Evans return; 31*f0865ec9SKyle Evans } 32