Artifact 8525608977bb93145aee296c4f6cf534a4770ea4:
- File wiki/applications.wiki — part of check-in [44ebdb258a] at 2015-05-01 22:49:12 on branch trunk — More conversion to in-source wiki (user: bernd size: 3127)
0000: 3c 68 31 3e 41 70 70 6c 69 63 61 74 69 6f 6e 73 <h1>Applications 0010: 3c 2f 68 31 3e 0a 0a 3c 64 69 76 3e 3c 69 3e 54 </h1>..<div><i>T 0020: 68 69 73 20 69 73 20 61 6c 73 6f 20 79 65 74 20 his is also yet 0030: 76 65 72 79 20 69 6e 63 6f 6d 70 6c 65 74 65 3c very incomplete< 0040: 2f 69 3e 3c 2f 64 69 76 3e 0a 0a 3c 64 69 76 3e /i></div>..<div> 0050: 54 68 65 20 6d 61 69 6e 20 69 64 65 61 20 68 65 The main idea he 0060: 72 65 20 69 73 20 74 68 61 74 20 74 68 65 20 62 re is that the b 0070: 72 6f 77 73 65 72 20 69 73 20 74 68 65 20 4f 53 rowser is the OS 0080: 20 66 6f 72 20 61 70 70 6c 69 63 61 74 69 6f 6e for application 0090: 73 2e 20 26 6e 62 73 70 3b 49 6e 0a 61 20 50 32 s. In.a P2 00a0: 50 20 6e 65 74 77 6f 72 6b 2c 20 79 6f 75 20 64 P network, you d 00b0: 6f 6e 27 74 20 68 61 76 65 20 73 65 72 76 65 72 on't have server 00c0: 73 20 77 68 69 63 68 20 70 65 72 66 6f 72 6d 20 s which perform 00d0: 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 the applications 00e0: 2c 20 61 6e 64 0a 22 6c 69 67 68 74 77 65 69 67 , and."lightweig 00f0: 68 74 22 20 74 65 72 6d 69 6e 61 6c 73 20 77 68 ht" terminals wh 0100: 69 63 68 20 6a 75 73 74 20 64 69 73 70 6c 61 79 ich just display 0110: 20 74 68 65 20 72 65 73 75 6c 74 2e 20 26 6e 62 the result. &nb 0120: 73 70 3b 59 6f 75 20 6e 65 65 64 20 74 6f 0a 64 sp;You need to.d 0130: 69 73 74 72 69 62 75 74 65 20 74 68 65 20 70 72 istribute the pr 0140: 6f 67 72 61 6d 73 20 6a 75 73 74 20 6c 69 6b 65 ograms just like 0150: 20 61 6e 79 20 6f 74 68 65 72 20 6f 62 6a 65 63 any other objec 0160: 74 2e 20 26 6e 62 73 70 3b 54 68 65 20 6d 61 69 t. The mai 0170: 6e 20 70 75 72 70 6f 73 65 20 66 6f 72 0a 61 70 n purpose for.ap 0180: 70 6c 69 63 61 74 69 6f 6e 73 20 69 73 20 74 6f plications is to 0190: 20 64 69 73 70 6c 61 79 20 63 6f 6e 74 65 6e 74 display content 01a0: 2e 3c 2f 64 69 76 3e 0a 0a 3c 64 69 76 3e 43 6f .</div>..<div>Co 01b0: 6e 74 65 6e 74 20 69 73 20 28 73 74 72 75 63 74 ntent is (struct 01c0: 75 72 65 64 29 20 74 65 78 74 2c 20 69 6d 61 67 ured) text, imag 01d0: 65 73 2c 20 76 69 64 65 6f 73 2c 20 6d 75 73 69 es, videos, musi 01e0: 63 2c 20 65 74 63 2e 3c 2f 64 69 76 3e 0a 0a 3c c, etc.</div>..< 01f0: 68 32 3e 54 75 72 69 6e 67 20 63 72 65 65 70 3c h2>Turing creep< 0200: 2f 68 32 3e 0a 0a 3c 64 69 76 3e 54 68 65 72 65 /h2>..<div>There 0210: 27 73 20 61 20 70 68 65 6e 6f 6d 65 6e 6f 6e 20 's a phenomenon 0220: 49 20 63 61 6c 6c 20 22 54 75 72 69 6e 67 20 63 I call "Turing c 0230: 72 65 65 70 22 3a 20 41 6e 79 20 65 6e 76 69 72 reep": Any envir 0240: 6f 6e 6d 65 6e 74 20 73 74 72 69 76 65 73 20 74 onment strives t 0250: 6f 0a 62 65 63 6f 6d 65 20 54 75 72 69 6e 67 20 o.become Turing 0260: 63 6f 6d 70 6c 65 74 65 2c 20 69 2e 65 2e 20 69 complete, i.e. i 0270: 74 20 77 69 6c 6c 20 69 6e 20 74 68 65 20 6c 6f t will in the lo 0280: 6e 67 20 72 75 6e 20 63 6f 6e 74 61 69 6e 20 61 ng run contain a 0290: 20 54 75 72 69 6e 67 20 63 6f 6d 70 6c 65 74 65 Turing complete 02a0: 0a 6c 61 6e 67 75 61 67 65 2c 20 61 63 63 65 73 .language, acces 02b0: 73 69 62 6c 65 20 62 79 20 74 68 65 20 75 73 65 sible by the use 02c0: 72 2e 20 26 6e 62 73 70 3b 45 76 65 6e 20 69 66 r. Even if 02d0: 20 79 6f 75 20 74 72 79 20 74 6f 20 72 65 6d 6f you try to remo 02e0: 76 65 20 74 68 65 20 54 75 72 69 6e 67 0a 63 6f ve the Turing.co 02f0: 6d 70 6c 65 74 65 6e 65 73 73 20 28 6c 69 6b 65 mpleteness (like 0300: 20 69 6e 20 50 44 46 2c 20 74 68 65 20 70 72 65 in PDF, the pre 0310: 64 65 63 65 73 73 6f 72 20 50 6f 73 74 53 63 72 decessor PostScr 0320: 69 70 74 20 77 61 73 20 54 43 29 2c 20 69 74 20 ipt was TC), it 0330: 77 69 6c 6c 20 63 72 65 65 70 20 69 6e 0a 74 68 will creep in.th 0340: 72 6f 75 67 68 20 74 68 65 20 62 61 63 6b 64 6f rough the backdo 0350: 6f 72 20 28 50 44 46 20 68 61 73 20 6e 6f 77 20 or (PDF has now 0360: 4a 61 76 61 53 63 72 69 70 74 20 6d 61 63 72 6f JavaScript macro 0370: 73 29 2e 3c 2f 64 69 76 3e 0a 0a 3c 64 69 76 3e s).</div>..<div> 0380: 54 68 65 72 65 66 6f 72 65 2c 20 79 6f 75 20 62 Therefore, you b 0390: 65 74 74 65 72 20 73 74 61 72 74 20 77 69 74 68 etter start with 03a0: 20 61 20 54 75 72 69 6e 67 20 63 6f 6d 70 6c 65 a Turing comple 03b0: 74 65 20 6c 61 6e 67 75 61 67 65 2e 20 54 6f 20 te language. To 03c0: 62 65 20 6d 6f 72 65 0a 70 72 65 63 69 73 65 3a be more.precise: 03d0: 20 41 6e 20 65 66 66 69 63 69 65 6e 74 20 54 43 An efficient TC 03e0: 20 6c 61 6e 67 75 61 67 65 2e 20 26 6e 62 73 70 language.   03f0: 3b 50 65 6f 70 6c 65 20 77 69 6c 6c 20 6f 74 68 ;People will oth 0400: 65 72 77 69 73 65 20 73 70 65 6e 64 20 61 6e 0a erwise spend an. 0410: 65 6e 6f 72 6d 6f 75 73 20 61 6d 6f 75 6e 74 20 enormous amount 0420: 74 6f 20 6d 61 6b 65 20 74 68 65 20 69 6e 65 66 to make the inef 0430: 66 69 63 69 65 6e 74 20 6c 61 6e 67 75 61 67 65 ficient language 0440: 20 65 66 66 69 63 69 65 6e 74 2c 20 6f 72 20 61 efficient, or a 0450: 64 64 20 61 6e 20 65 66 66 69 63 69 65 6e 74 0a dd an efficient. 0460: 73 75 62 73 65 74 20 28 73 65 65 20 66 6f 72 20 subset (see for 0470: 65 78 61 6d 70 6c 65 20 4a 61 76 61 53 63 72 69 example JavaScri 0480: 70 74 20 61 6e 64 20 61 73 6d 2e 6a 73 29 2e 3c pt and asm.js).< 0490: 2f 64 69 76 3e 0a 0a 3c 64 69 76 3e 54 68 69 73 /div>..<div>This 04a0: 20 6f 66 20 63 6f 75 72 73 65 20 62 65 67 73 20 of course begs 04b0: 74 68 65 20 71 75 65 73 74 69 6f 6e 20 6f 66 20 the question of 04c0: 73 65 63 75 72 69 74 79 3a 20 48 6f 77 20 63 61 security: How ca 04d0: 6e 20 79 6f 75 20 73 65 63 75 72 65 6c 79 20 65 n you securely e 04e0: 78 65 63 75 74 65 0a 63 6f 64 65 20 74 68 61 74 xecute.code that 04f0: 20 63 6f 6d 65 73 20 66 72 6f 6d 20 74 68 65 20 comes from the 0500: 49 6e 74 65 72 6e 65 74 3f 3c 2f 64 69 76 3e 0a Internet?</div>. 0510: 0a 3c 68 32 3e 53 65 63 75 72 65 20 65 78 65 63 .<h2>Secure exec 0520: 75 74 69 6f 6e 3c 2f 68 32 3e 0a 0a 3c 64 69 76 ution</h2>..<div 0530: 3e 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f >The following o 0540: 70 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e ptions have been 0550: 20 74 72 69 65 64 2c 20 61 6e 64 20 73 6f 6d 65 tried, and some 0560: 20 6f 66 20 74 68 65 6d 20 66 61 69 6c 65 64 20 of them failed 0570: 6d 6f 72 65 0a 73 70 65 63 74 61 63 75 6c 61 72 more.spectacular 0580: 6c 79 20 74 68 61 6e 20 6f 74 68 65 72 73 3a 3c ly than others:< 0590: 2f 64 69 76 3e 0a 0a 3c 64 69 76 3e 0a 3c 6f 6c /div>..<div>.<ol 05a0: 3e 0a 3c 6c 69 3e 45 78 65 63 75 74 65 20 63 6f >.<li>Execute co 05b0: 64 65 20 69 6e 20 61 20 63 6f 6e 74 72 6f 6c 6c de in a controll 05c0: 65 64 20 56 4d 20 28 65 2e 67 2e 20 4a 61 76 61 ed VM (e.g. Java 05d0: 29 2e 20 26 6e 62 73 70 3b 54 68 69 73 20 69 73 ). This is 05e0: 20 62 72 6f 6b 65 6e 20 62 79 0a 64 65 73 69 67 broken by.desig 05f0: 6e 2c 20 79 6f 75 20 63 61 6e 27 74 20 73 65 63 n, you can't sec 0600: 75 72 65 20 73 6f 6d 65 74 68 69 6e 67 20 66 72 ure something fr 0610: 6f 6d 20 74 68 65 20 69 6e 73 69 64 65 2e 3c 2f om the inside.</ 0620: 6c 69 3e 0a 3c 6c 69 3e 45 78 65 63 75 74 65 20 li>.<li>Execute 0630: 63 6f 64 65 20 69 6e 20 61 20 73 61 6e 64 62 6f code in a sandbo 0640: 78 2e 20 26 6e 62 73 70 3b 54 68 69 73 20 68 61 x. This ha 0650: 73 20 62 65 65 6e 20 73 68 6f 77 6e 20 74 6f 20 s been shown to 0660: 62 65 20 77 61 79 20 6d 6f 72 65 20 72 6f 62 75 be way more robu 0670: 73 74 3b 0a 69 74 20 69 73 20 6d 75 63 68 20 68 st;.it is much h 0680: 61 72 64 65 72 20 74 6f 20 62 72 65 61 6b 20 6f arder to break o 0690: 75 74 20 6f 66 20 61 20 73 61 6e 64 62 6f 78 2e ut of a sandbox. 06a0: 3c 2f 6c 69 3e 0a 3c 6c 69 3e 50 75 62 6c 69 63 </li>.<li>Public 06b0: 20 69 6e 73 70 65 63 74 69 6f 6e 20 6f 66 20 63 inspection of c 06c0: 6f 64 65 3a 20 54 68 69 73 20 69 73 20 74 68 65 ode: This is the 06d0: 20 66 72 65 65 20 73 6f 66 74 77 61 72 65 20 61 free software a 06e0: 70 70 72 6f 61 63 68 2e 20 26 6e 62 73 70 3b 54 pproach. T 06f0: 68 65 0a 75 6e 64 65 72 68 61 6e 64 65 64 20 43 he.underhanded C 0700: 20 63 6f 6e 74 65 78 74 20 73 68 6f 77 73 20 74 context shows t 0710: 68 61 74 20 70 75 62 6c 69 63 20 69 6e 73 70 65 hat public inspe 0720: 63 74 69 6f 6e 20 69 73 20 74 72 69 63 6b 79 2e ction is tricky. 0730: 20 26 6e 62 73 70 3b 45 73 70 65 63 69 61 6c 6c Especiall 0740: 79 0a 6c 61 72 67 65 20 63 6f 64 65 20 62 61 73 y.large code bas 0750: 65 73 20 61 72 65 20 70 72 6f 62 6c 65 6d 61 74 es are problemat 0760: 69 63 2e 3c 2f 6c 69 3e 0a 3c 6c 69 3e 53 63 61 ic.</li>.<li>Sca 0770: 6e 20 66 6f 72 20 6b 6e 6f 77 6e 20 65 76 69 6c n for known evil 0780: 2e 20 26 6e 62 73 70 3b 54 68 69 73 20 69 73 20 . This is 0790: 74 68 65 20 73 65 63 75 72 69 74 79 20 69 6e 64 the security ind 07a0: 75 73 74 72 79 27 73 20 61 70 70 72 6f 61 63 68 ustry's approach 07b0: 2c 20 61 6e 64 20 69 74 0a 69 73 20 62 72 6f 6b , and it.is brok 07c0: 65 6e 2e 3c 2f 6c 69 3e 0a 3c 6c 69 3e 43 6f 64 en.</li>.<li>Cod 07d0: 65 20 73 69 67 6e 69 6e 67 20 69 73 20 61 6c 73 e signing is als 07e0: 6f 20 61 20 73 63 61 6d 20 2d 20 69 74 20 63 61 o a scam - it ca 07f0: 6e 20 77 6f 72 6b 20 74 6f 67 65 74 68 65 72 20 n work together 0800: 77 69 74 68 20 70 75 62 6c 69 63 20 69 6e 73 70 with public insp 0810: 65 63 74 69 6f 6e 2c 0a 62 75 74 20 75 73 69 6e ection,.but usin 0820: 67 20 69 74 20 66 6f 72 20 61 63 63 6f 75 6e 74 g it for account 0830: 61 62 69 6c 69 74 79 20 64 6f 65 73 6e 27 74 20 ability doesn't 0840: 77 6f 72 6b 2e 3c 2f 6c 69 3e 0a 3c 2f 6f 6c 3e work.</li>.</ol> 0850: 0a 0a 3c 64 69 76 3e 54 68 65 72 65 66 6f 72 65 ..<div>Therefore 0860: 20 74 68 65 20 6d 65 74 68 6f 64 20 6f 66 20 63 the method of c 0870: 68 6f 69 63 65 20 69 73 20 74 6f 20 65 78 65 63 hoice is to exec 0880: 75 74 65 20 70 75 62 6c 69 63 20 69 6e 73 70 65 ute public inspe 0890: 63 74 65 64 20 61 6e 64 20 73 69 67 6e 65 64 0a cted and signed. 08a0: 63 6f 64 65 20 69 6e 20 61 20 73 61 6e 64 62 6f code in a sandbo 08b0: 78 20 28 73 69 67 6e 65 64 20 62 79 20 74 68 65 x (signed by the 08c0: 20 69 6e 73 70 65 63 74 6f 72 73 20 69 73 20 74 inspectors is t 08d0: 68 65 20 69 6d 70 6f 72 74 61 6e 74 20 70 61 72 he important par 08e0: 74 29 2e 3c 2f 64 69 76 3e 3c 2f 64 69 76 3e 0a t).</div></div>. 08f0: 0a 3c 68 32 3e 4f 75 74 70 75 74 20 41 62 73 74 .<h2>Output Abst 0900: 72 61 63 74 69 6f 6e 3c 2f 68 32 3e 0a 0a 3c 64 raction</h2>..<d 0910: 69 76 3e 54 68 65 20 6c 6f 77 2d 6c 65 76 65 6c iv>The low-level 0920: 20 6f 75 74 70 75 74 20 61 62 73 74 72 61 63 74 output abstract 0930: 69 6f 6e 20 28 6c 65 61 73 74 20 63 6f 6d 6d 6f ion (least commo 0940: 6e 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 29 20 61 n denominator) a 0950: 76 61 69 6c 61 62 6c 65 20 6f 6e 0a 74 6f 64 61 vailable on.toda 0960: 79 27 73 20 70 6c 61 74 66 6f 72 6d 73 20 69 73 y's platforms is 0970: 20 4f 70 65 6e 47 4c 20 45 53 20 32 2e 30 2e 20 OpenGL ES 2.0. 0980: 26 6e 62 73 70 3b 59 65 73 2c 20 74 68 65 72 65 Yes, there 0990: 20 69 73 20 57 69 6e 64 6f 77 73 20 50 68 6f 6e is Windows Phon 09a0: 65 2c 20 77 68 69 63 68 0a 68 61 73 20 65 73 73 e, which.has ess 09b0: 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d entially the sam 09c0: 65 20 63 61 70 61 62 69 6c 69 74 69 65 73 2c 20 e capabilities, 09d0: 62 75 74 20 6e 6f 74 20 74 68 65 20 73 61 6d 65 but not the same 09e0: 20 66 72 61 6d 65 77 6f 72 6b 2e 20 26 6e 62 73 framework. &nbs 09f0: 70 3b 41 6c 6c 0a 72 65 6c 65 76 61 6e 74 20 64 p;All.relevant d 0a00: 61 74 61 20 63 61 6e 20 62 65 20 72 65 6e 64 65 ata can be rende 0a10: 72 65 64 20 75 73 69 6e 67 20 4f 70 65 6e 47 4c red using OpenGL 0a20: 3a 20 46 6f 6e 74 73 2c 20 69 6d 61 67 65 73 2c : Fonts, images, 0a30: 20 76 69 64 65 6f 73 20 61 72 65 20 4f 70 65 6e videos are Open 0a40: 47 4c 0a 74 65 78 74 75 72 65 73 2c 20 74 68 65 GL.textures, the 0a50: 20 67 6c 75 65 20 66 6f 72 20 64 69 73 70 6c 61 glue for displa 0a60: 79 69 6e 67 20 74 68 65 73 65 20 74 65 78 74 75 ying these textu 0a70: 72 65 73 20 61 72 65 20 74 72 69 61 6e 67 6c 65 res are triangle 0a80: 73 20 61 6e 64 20 47 4c 20 73 68 61 64 65 72 0a s and GL shader. 0a90: 6c 61 6e 67 75 61 67 65 20 63 6f 64 65 2e 20 26 language code. & 0aa0: 6e 62 73 70 3b 54 68 69 73 20 63 61 6e 20 70 72 nbsp;This can pr 0ab0: 6f 76 61 62 6c 65 20 64 69 73 70 6c 61 79 20 65 ovable display e 0ac0: 76 65 72 79 74 68 69 6e 67 20 77 65 20 77 61 6e verything we wan 0ad0: 74 20 74 6f 20 64 69 73 70 6c 61 79 0a 74 6f 64 t to display.tod 0ae0: 61 79 2e 3c 2f 64 69 76 3e 0a 0a 3c 68 32 3e 46 ay.</div>..<h2>F 0af0: 72 61 6d 65 77 6f 72 6b 73 20 75 73 65 64 3c 2f rameworks used</ 0b00: 68 32 3e 0a 0a 3c 64 69 76 3e 0a 3c 75 6c 3e 0a h2>..<div>.<ul>. 0b10: 3c 6c 69 3e 6c 69 62 73 6f 69 6c 20 66 6f 72 20 <li>libsoil for 0b20: 69 6d 61 67 65 73 20 28 50 4e 47 2b 4a 50 45 47 images (PNG+JPEG 0b30: 29 3c 2f 6c 69 3e 0a 3c 6c 69 3e 66 72 65 65 74 )</li>.<li>freet 0b40: 79 70 65 2d 67 6c 20 66 6f 72 20 66 6f 6e 74 73 ype-gl for fonts 0b50: 20 28 54 72 75 65 54 79 70 65 2f 4f 70 65 6e 54 (TrueType/OpenT 0b60: 79 70 65 29 3c 2f 6c 69 3e 0a 3c 6c 69 3e 4f 70 ype)</li>.<li>Op 0b70: 65 6e 4d 41 58 20 6f 6e 20 41 6e 64 72 6f 69 64 enMAX on Android 0b80: 2c 20 67 73 74 72 65 61 6d 65 72 20 6f 6e 20 4c , gstreamer on L 0b90: 69 6e 75 78 20 66 6f 72 20 72 65 6e 64 65 72 69 inux for renderi 0ba0: 6e 67 20 76 69 64 65 6f 73 3c 2f 6c 69 3e 0a 3c ng videos</li>.< 0bb0: 6c 69 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 70 li><a href="http 0bc0: 73 3a 2f 2f 66 6f 73 73 69 6c 2e 6e 65 74 32 6f s://fossil.net2o 0bd0: 2e 64 65 2f 6d 69 6e 6f 73 32 2f 69 6e 64 65 78 .de/minos2/index 0be0: 22 3e 4d 49 4e 4f ce a3 3c 2f 61 3e 3c 75 3e 32 ">MINOΣ</a><u>2 0bf0: 3c 2f 75 3e 3a 0a 4c 69 67 68 74 77 65 69 67 68 </u>:.Lightweigh 0c00: 74 20 4f 70 65 6e 47 4c 2d 62 61 73 65 64 20 77 t OpenGL-based w 0c10: 69 64 67 65 74 20 6c 69 62 72 61 72 79 20 69 6e idget library in 0c20: 20 46 6f 72 74 68 3c 2f 6c 69 3e 0a 3c 2f 75 6c Forth</li>.</ul 0c30: 3e 3c 2f 64 69 76 3e ></div>