void check_impl(int condition, constchar *file, int line, constchar *condition_str)
{ if (!condition) {
fflush(stdout);
fprintf(stderr, "\nerror at %s:%d, %s)\n", file, line, condition_str);
fflush(stderr); exit(1);
}
}
void check_buffer_equal_impl(constchar *buffer1, constchar *buffer2, int buffer_length, constchar *file, int line)
{ for (int i = 0; i < buffer_length; i++) { if (buffer1[i] != buffer2[i]) {
fflush(stdout);
fprintf(stderr, "\nerror at %s:%d, buffer1 != buffer2 at index: %i (%x != " "%x)\n",
file, line, i, buffer1[i], buffer2[i]);
fprintf(stderr, "buffer1 = %s\n",
octet_string_hex_string(buffer1, buffer_length));
fprintf(stderr, "buffer2 = %s\n",
octet_string_hex_string(buffer2, buffer_length));
fflush(stderr); exit(1);
}
}
}
staticinlineint hex_char_to_nibble(uint8_t c)
{ switch (c) { case ('0'): return0x0; case ('1'): return0x1; case ('2'): return0x2; case ('3'): return0x3; case ('4'): return0x4; case ('5'): return0x5; case ('6'): return0x6; case ('7'): return0x7; case ('8'): return0x8; case ('9'): return0x9; case ('a'): return0xa; case ('A'): return0xa; case ('b'): return0xb; case ('B'): return0xb; case ('c'): return0xc; case ('C'): return0xc; case ('d'): return0xd; case ('D'): return0xd; case ('e'): return0xe; case ('E'): return0xe; case ('f'): return0xf; case ('F'): return0xf; default: return -1; /* this flags an error */
}
}
/* *hex_string_to_octet_stringconvertsahexadecimalstring *oflength2*lentoarawoctetstringoflengthlen
*/ int hex_string_to_octet_string(char *raw, char *hex, int len)
{
uint8_t x; int tmp; int hex_len;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.