LocalAttestationUntrusted.h 1.5 KB

123456789101112131415161718192021222324252627282930313233
  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 uint8_t* output_ciphertext_plus_tag;
  19. static int decrypt_client_data(uint32_t own_enclave_id, int apache_fd, uint8_t* output_ciphertext_plus_tag, uint8_t* input_ciphertext_plus_tag, int time_fd);
  20. static uint32_t 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. };