Unverified Commit e3f9007c authored by kladko's avatar kladko

SKALE-2298 Printf

parent 7e0e7d99
...@@ -42,13 +42,17 @@ uint64_t oc_realloc (void *optr, size_t osz, size_t nsz) ...@@ -42,13 +42,17 @@ 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);
} }
void oc_printf()
{
fprintf(stderr, "haha\n");
}
\ No newline at end of file
...@@ -73,7 +73,7 @@ void free_function(void *, size_t); ...@@ -73,7 +73,7 @@ void free_function(void *, size_t);
void tgmp_init() { void tgmp_init() {
oc_printf(); 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(); 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