LocalAttestationUntrusted.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include <sys/socket.h>
  2. #include <stdlib.h>
  3. #include <netinet/in.h>
  4. #include <string.h>
  5. #include <errno.h>
  6. #include <unistd.h>
  7. #include <stdio.h>
  8. #include "ProtobufLAMessages.pb.h"
  9. #include <google/protobuf/io/coded_stream.h>
  10. #include <google/protobuf/io/zero_copy_stream_impl.h>
  11. using namespace google::protobuf::io;
  12. #include "protobufLAInitiator.h"
  13. #include "../Decryptor/Decryptor_u.h"
  14. #include <iostream>
  15. class LocalAttestationUntrusted {
  16. static uint32_t session_id;
  17. static protobuf_sgx_dh_msg1_t protobuf_msg1;
  18. static int decrypt_client_data(uint32_t own_enclave_id, int apache_fd);
  19. static uint32_t local_attestation_msg2_msg3(uint32_t own_enclave_id, int accept_fd);
  20. // uint32_t LocalAttestationUntrusted::local_attestation_msg2_msg3(uint32_t own_enclave_id, int accept_fd)
  21. static int write_protobuf_msg_to_fd(int accept_fd, google::protobuf::MessageLite& message);
  22. static int read_protobuf_msg_from_fd(int accept_fd, google::protobuf::MessageLite& message);
  23. static int set_up_socket(int port, sockaddr_in* address);
  24. public:
  25. static int setup_socket_for_local_attestation_requests(int port);
  26. static int prepare_local_attestation_as_responder_msg1(uint32_t own_enclave_id);
  27. static int local_attestation_as_responder_msg2_msg3(uint32_t own_enclave_id, int server_fd, int * accept_fd);
  28. static int post_local_attestation_with_verifier(uint32_t own_enclave_id, int apache_fd);
  29. static int post_local_attestation_with_apache(uint32_t own_enclave_id, int apache_fd);
  30. };