Unverified Commit a734cd36 authored by Stan Kladko's avatar Stan Kladko Committed by GitHub

Merge pull request #57 from skalenetwork/SKALE-2298

Skale 2298 Added printf
parents 43911195 8694c15e
...@@ -42,6 +42,15 @@ uint64_t oc_realloc (void *optr, size_t osz, size_t nsz) ...@@ -42,6 +42,15 @@ uint64_t oc_realloc (void *optr, size_t osz, size_t nsz)
return (uint64_t) nptr; return (uint64_t) nptr;
} }
void oc_printf (const char *str) {
/* Proxy/Bridge will check the length and null-terminate
* the input string to prevent buffer overflow.
* */
fprintf(stderr, "***ENCLAVE_LOG***: %s", str);
}
void oc_free (void *ptr, size_t sz) void oc_free (void *ptr, size_t sz)
{ {
free(ptr); free(ptr);
......
...@@ -73,6 +73,7 @@ void free_function(void *, size_t); ...@@ -73,6 +73,7 @@ void free_function(void *, size_t);
void tgmp_init() { void tgmp_init() {
oc_printf("Initing tgmp library\n");
oc_realloc_func = &reallocate_function; oc_realloc_func = &reallocate_function;
oc_free_func = &free_function; oc_free_func = &free_function;
......
...@@ -314,7 +314,7 @@ enclave { ...@@ -314,7 +314,7 @@ enclave {
include "gmp.h" include "gmp.h"
uint64_t oc_realloc([user_check] void *optr, size_t osz, size_t nsz); uint64_t oc_realloc([user_check] void *optr, size_t osz, size_t nsz);
void oc_printf([in, string] const char *str);
void oc_free([user_check] void *optr, size_t sz); void oc_free([user_check] void *optr, size_t sz);
}; };
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment