SgxCrypto.cpp 672 B

12345678910111213141516171819
  1. #include "stdlib.h"
  2. //#include "string"
  3. #include "sgx_tcrypto.h"
  4. uint32_t create_rsa_key_pair_for_signing_manifest(/*std::string& priv_key, std::string& pub_key*/)
  5. {
  6. uint32_t ret_sgx;
  7. uint8_t* n=(uint8_t*)malloc(384);
  8. uint8_t* d=(uint8_t*)malloc(384);
  9. uint8_t* p=(uint8_t*)malloc(192);
  10. uint8_t* q=(uint8_t*)malloc(192);
  11. uint8_t* dmp1=(uint8_t*)malloc(192);
  12. uint8_t* dmq1=(uint8_t*)malloc(192);
  13. uint8_t* iqmp=(uint8_t*)malloc(192);
  14. uint8_t e[4];
  15. ret_sgx=sgx_create_rsa_key_pair(384, 4, n, d, e, p, q, dmp1, dmq1, iqmp);
  16. free(n); free(d); free(p); free(q); free(dmp1); free(dmq1); free(iqmp);
  17. return ret_sgx;
  18. }