2022-09-09 06:47:49 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "debugprint.h"
|
|
|
|
#include "blst/blst.h"
|
|
|
|
|
2022-09-09 08:48:16 +00:00
|
|
|
void print_bytes(const char* label, void *toprint, int length){
|
2022-09-09 06:47:49 +00:00
|
|
|
printf("%s", label);
|
|
|
|
for(int i=0;i<length;i++){
|
2022-09-09 08:48:16 +00:00
|
|
|
printf("%.2x ", ((byte *) toprint)[i]);
|
2022-09-09 06:47:49 +00:00
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
2022-09-09 08:48:16 +00:00
|
|
|
void debug_print_bytes(__attribute__((unused)) const char* label, __attribute__((unused)) void *toprint, __attribute__((unused)) int length){
|
2022-09-09 06:47:49 +00:00
|
|
|
#ifdef INSECURE_CTM_DEBUG_PRINT
|
|
|
|
print_bytes(label, toprint, length);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void print_scalar(const char* label, blst_scalar *toprint){
|
|
|
|
byte temp_buffer[32];
|
|
|
|
blst_bendian_from_scalar(temp_buffer, toprint);
|
|
|
|
|
|
|
|
debug_print_bytes(label, temp_buffer, 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
void debug_print_scalar(__attribute__((unused)) const char* label, __attribute__((unused)) blst_scalar *toprint){
|
|
|
|
#ifdef INSECURE_CTM_DEBUG_PRINT
|
|
|
|
print_scalar(label, toprint);
|
|
|
|
#endif
|
|
|
|
}
|