/* hexdump.c */
/*
This file is part of the ARM-Crypto-Lib.
Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#include
#include
#include
static
void int_hexdump_line_buffer(FILE* stream, uint8_t* buffer, unsigned width, unsigned fill){
unsigned i;
for(i=0; iwidth){
memcpy(buffer, block, width);
if(print_addr){
fprintf(stream, "%p ", print_addr);
print_addr = (uint8_t*)print_addr + width;
}
fprintf(stream, "<%4.4x>: ", index);
int_hexdump_line_buffer(stream, buffer, width, width);
fputc('\n', stream);
block = (uint8_t*)block + width;
length -= width;
index += width;
}
memcpy(buffer, block, length);
if(print_addr){
fprintf(stream, "%p ", print_addr);
}
fprintf(stream, "<%4.4x>: ", index);
int_hexdump_line_buffer(stream, buffer, width, length);
fputc('\n', stream);
}