Decryptor.edl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in
  12. * the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Intel Corporation nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. enclave {
  32. include "sgx_eid.h"
  33. include "sgx_tcrypto.h"
  34. include "../TrustedInclude/dh_session_protocol.h"
  35. //from "../LocalAttestationCode/LocalAttestationCode.edl" import *;
  36. from "/home/m2mazmud/old_stuff/intel-sgx-ssl/Linux/package/include/sgx_tsgxssl.edl" import * ;
  37. trusted {
  38. public void calculate_sealed_keypair_size_wrapper([out] size_t* output_length);
  39. #define SEALED_SIZE 656 // =0x300 (0x290 is the size of the sealed message when both the public(0x40) and private key(0x20) are included)
  40. public uint32_t create_and_seal_long_term_signing_key_pair_wrapper([out] size_t* sealed_data_length, [out,size=SEALED_SIZE] uint8_t* sealed_data);
  41. public uint32_t unseal_and_restore_long_term_signing_key_pair_wrapper([in, size=SEALED_SIZE] uint8_t* sealed_data, [in] size_t* sgx_sealed_data_length);
  42. public uint32_t create_and_encrypt_mitigator_header_H_wrapper([out, size=200] uint8_t* ciphertext_token_H_plus_tag, [out] uint32_t* length); // would be 188 in length
  43. // Apache mrsigner = 32 bytes + tag on encryption = 16 bytes.
  44. // public uint32_t decrypt_verifiers_message_set_apache_mrsigner_wrapper([in, size=60] uint8_t* ciphertext_plus_tag);
  45. // NEED AT LEAST: 64 bytes for public key of client, plus 64 bytes of signature over it, plus 16 bytes of tag over any encryption = 144 bytes. Msg length = 144 bytes + Length of form field
  46. public uint32_t process_apache_message_generate_response_wrapper(
  47. [in, size=input_ciphertext_length] uint8_t* input_ciphertext,
  48. uint32_t input_ciphertext_length,
  49. [in, size=input_sizes_array_length] uint32_t* input_sizes_array,
  50. uint32_t input_sizes_array_length,
  51. [out, size=input_ciphertext_length] uint8_t* output_ciphertext,
  52. [out, size=input_sizes_array_length] uint32_t* output_sizes_array);
  53. //public uint32_t process_apache_message_generate_response_wrapper([in, size=4100] uint8_t* input_ciphertext, uint32_t input_ciphertext_plus_tag_length, [out, size=4100] uint8_t* output_ciphertext, [out,size=4] uint32_t* output_ciphertext_plus_tag_length);
  54. public uint32_t process_verifiers_message_wrapper([in, size=60] uint8_t* input_ciphertext, uint32_t length);
  55. public void get_verifier_mrenclave_apache_mrsigner_wrapper([out, size=64] uint8_t* output);
  56. public void get_short_term_public_key_wrapper([out, size=64] uint8_t* output);
  57. public void get_long_term_verification_key_wrapper([out, size=64] uint8_t* output);
  58. public void get_apache_iv([out, size=12] uint8_t* output);
  59. public uint32_t session_request_wrapper([out] sgx_dh_msg1_t *dh_msg1, [out] uint32_t *session_id);
  60. public uint32_t exchange_report_wrapper([in] sgx_dh_msg2_t *dh_msg2, [out] sgx_dh_msg3_t *dh_msg3, [in] uint32_t *session_id);
  61. };
  62. };