Googleã«ããOpenSSLã®forkãBoringSSLã試ãã
1. ã¯ããã«ã
å æ¥ãChrome 㧠「Issue 401153002: Switch to BoringSSL. (Closed)」 ã¨ããå¤æ´ãè¡ããã¾ãããããã¯ãå¾æ¥ã® Androidåã Chrome ã§ã¯ OpenSSL ãå©ç¨ãã¦ããã®ã§ãããä»åãããGoogleãOpenSSLãforkããBoringSSLã«åãæ¿ãããã¨ã«ãªãã¾ãã BoringSSLã®çºè¡¨ããããã1ãæãããã§ãããä½åã Revert ãããæ«ããããåãæ¿ããæåããããã§ãã
ä»å BoringSSL ã試ãã«å°ã使ã£ã¦ã¿ã¾ããã®ã§ããã®ã¬ãã¼ããã¦ã¿ããã¨æãã¾ãã
2. BoringSSLã¨ã¯ä½ã
BoreingSSLãã©ããããã®ã§ããªãOpenSSLãforkãããã¯ãGoogleã®ã»ãã¥ãªãã£Expert agl ããã®ããã°「ImperialViolet - BoringSSL」ã§è©³ããè¨è¼ããã¦ãã¾ãã
ããã¾ã§Googleã¯ãAndroidåã Chrome ã« OpenSSLããã以å¤ã®ãã©ãããã©ã¼ã ã§ã¯ Mozilla ã®éçºãã「NSS(Network Security Services)」ããã¼ã¹ã«Googleç¬èªã®ãããããã¦ã¦å©ç¨ãã¦ãã¾ããã ChromeがNSSに当てているパッチ集 ãè¦ãã¨ãç¾å¨20以ä¸ã®ããããå½ã¦ã¦ããã®ããããã¾ãããªã®ã§ãç°¡åã«è¨ãã¨ã¡ã³ãããã®ã大å¤ã«ãªã£ãã®ã§forkããã¨ãããã¨ãããã§ãã(注ï¼Android以å¤ã®ãã©ãããã©ã¼ã ã§ã¯ã¾ã NSSãç¶ç¶å©ç¨ä¸ã§ããéå»OpenSSLに切り替えるかどうかの議論ãããã¦ãã¾ãããï¼
openssl-1.0.2beta ãã¼ã¹ã fork ãã BoringSSLã¯ã
https://boringssl.googlesource.com/boringssl/
ã§ã½ã¼ã¹ãå
¬éããã¦ãã¾ããã½ã¼ã¹ã®å¤æ´å±¥æ´ããã£ã¨è¦ã¦ãç¾æç¹ã§ã©ãå¤ãã£ãã®ãã*å人çã«*ã¾ã¨ããã¨ã
- BIO/EVPç OpenSSL ã®åºæ¬çãªã¢ã¼ããã¯ãã£ããã¸ãã¯ã¯ã»ã¼ãã®ã¾ã¾
- SSL/cryptoé¢é£ã®APIã¯ã*ä»ã®ã¨ãã*å¤§å¹ ãªå¤æ´ã¯ããã¦ããªã
- Googleç¬èªã«å®æ½ãã¦ãã試é¨çãªTLSæ©è½(False Start/Channel ID/Chacha20+POLY1305ç)ã®è¿½å ãããã¦ããï¼å¾æ¥ã®è¿½å ãããã®åãè¾¼ã¿ï¼
- SSLv2対å¿ãNetware/OS2ç使ããªãã¢ã¼ããã¯ãã£ã½ã¼ã¹ãªã©ãããªãç¡é§ãªæ©è½ã®åé¤
- ãã°ãã£ãã¯ã¹ï¼ãªãã¡ã¯ã¿ãªã³ã°ããã£ã±ã
ãªæãã§ãã(注ï¼ç´°ããè¦ã¦ããªãã®ã§*è¦è½ã¨ãããã*ããããã¾ããã)
ãªãBoringSSLã¨å½åããã®ããaglããã®ããã°ã§ã¯æ確ã«æ¸ãã¦ãªãã£ãã®ã§ãããä¸è¨ã®å¤æ´ä½æ¥ãè¦ã¦ããã¨SSLå¦çãrobustã«ããããã®ãã®ãã»ã¨ãã©ã§ãå°å³ã§å¿èãå¿ è¦ãªä½æ¥ãä¸å¿(=éå±ï¼ã¨ãããã¨ãããªããªãã¨å人çã«æ³åãã¾ãã
3. BoringSSLã試ã
3.1 BoringSSLã®ãã«ã
æ©éãã«ããã¾ããããã½ã¼ã¹ã«ä»éã®BUILDINGãã¡ã¤ã«ã«è©³ç´°ã«è¨è¼ããã¦ãã¾ãããcmakeã¨ninjaãããã°ããã£ã¨ä½ãã¾ãã(以ä¸ãUbuntu14ä¸ã§ãï¼ã
$ cmake -GNinja -- Configuring done -- Generating done -- Build files have been written to: /home/ohtsu/tmp/boringssl $ ninja [392/392] Linking CXX executable tool/bssl $ l -l ssl/libssl.a crypto/libcrypto.a -rw-rw-r-- 1 ohtsu ohtsu 5482204 Jul 29 16:15 crypto/libcrypto.a -rw-rw-r-- 1 ohtsu ohtsu 2762062 Jul 29 16:16 ssl/libssl.a
OpenSSLã¨åãã libssl.a, libcrypto.a ãã§ããã°å®äºã§ãã
3.2 BoringSSLã«ããTLSã¯ã©ã¤ã¢ã³ãæ¥ç¶
OpenSSLã¨éã£ã¦ã³ãã³ãã©ã¤ã³ç¨ã®å®è¡ãã¤ã㪠apps/openssl ã¯ä½ããã¾ããã
æ¿ããã« tool/bssl ãä½ããã¾ãããä»ã®ã¨ããæ©è½ã¨ãã¦ã¯ encyption ã®ãã³ã
bssl speed ã¨TLSã¯ã©ã¤ã¢ã³ã bssl client ã®2ã¤ã®ã¿ã§ãã
Googleã®ãµã¼ãã«æ¥ç¶ãã¦ãæ©éTLSã¯ã©ã¤ã¢ã³ãæ¥ç¶ã試ãã¦ã¿ã¾ãã
$ ./tool/bssl client -connect www.google.co.jp:443 Connecting to 74.125.235.95:443 Connected. Version: TLSv1.2 Cipher: ECDHE-RSA-CHACHA20-POLY1305 Secure renegotiation: yes
ããï¼ ç¾å¨ Google ä¸æ¼ãã®TLSæªå ¬èªCipherSuiteã ChaCha20+POLY1305ã§æ¥ç¶ã§ãã¦ãã¾ãã
3.3 BoringSSLãµã¼ãã«ããChannel IDã試ãã
æè§ã§ãããã BoringSSLåºæã®æ©è½ã® TLS Channel IDã試ãã¦ã¿ã¾ãããã
Transport Layer Security (TLS) Channel IDsã¨ã¯ãGoogleãIETF TLS WGã§æå±ãã¦ããTLSã®æ°æ©è½ã§ãæ¥ç¶ã¯ã©ã¤ã¢ã³ããç¹å®ã»ãã©ããã³ã°ãå®ç¾ã§ãããã®ã§ãï¼ãã©ããã¯æ¨å¹´æ«ã«Expireãã¡ãã£ãã¿ããï¼ã
ããã¯TLSãã³ãã·ã§ã¤ã¯ãæ¡å¼µãããµã¼ãã»ã¯ã©ã¤ã¢ã³ãé㧠Channel IDã®å©ç¨ãåæããã¨ãã¯ã©ã¤ã¢ã³ãããã¼ãã¢ãä½æããå
¬ééµãå«ãChannel IDããµã¼ãå´ã«æ¸¡ãä»çµã¿ã§ãããã® Channel IDã«ãã¤ã³ããã Cookie ã OAuth Token ãå©ç¨ããã¨ãTLSåæ¥ç¶æã«åä¸ã¯ã©ã¤ã¢ã³ãããã®æ¥ç¶ããµã¼ãå´ã§æ¤è¨¼ãã¦ã»ãã·ã§ã³ãã¤ã¸ã£ãã¯ãMITMã®å¯¾çãå¯è½ã«ãªãã¾ãã
OpenSSLã¨APIã¯ã»ã¨ãã©å¤ãã£ã¦ããªãã®ã§ãBoringSSLã使ã£ã¦Channel IDãæå¹åããTLSãµã¼ããä½ã£ã¦ã¿ã¾ããã½ã¼ã¹ã¯ãã¡ãï¼ç°¡åã®ããã¨ã©ã¼å¦çã¯çãã¦ãã¾ãï¼ã
https://gist.github.com/shigeki/a0904e116def85d7e5ff
Channel ID対å¿ã¯ã©ã¤ã¢ã³ãã¯ãæ¢ã« Stableç Chrome ã§ãµãã¼ãããã¦ããã®ã§ãããã使ãã¾ãããã HTTPSãµã¼ããä½ãã®ã¯é¢åãªã®ã§ã¬ã¹ãã³ã¹ã¯è¿ãããTLSæ¥ç¶ããã ãã®ç¨éã§å©ç¨ãã¾ãã
以ä¸ã¯Chromeã§æ¥ç¶ããæã«ãµã¼ãå´ã®ãã°ã§ãã64byteã® Channel ID ãã¯ã©ã¤ã¢ã³ãããåãåã£ã¦ãããã¨ããããã¾ãã
$ ./server channel_id=D8C277B1837B3CA1296C204124C342E06F8C968E14801A575BC1EFAB8103296B6BD51673944961DEED08B06245C3989AE8D8A1FCA293235C7BBB1D39E2F7 GET / HTTP/1.1 Host: demo-int.iijplus.jp:8443 Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8
次ã«ã¯ã©ã¤ã¢ã³ãå´ã® Chrome ã® Channel ID ã®ç¢ºèªã§ãã chrome://settings/cookies ãè¦ã¦ã¿ã¾ãã
ãããã¡ãã㨠Channel IDãçæããã¦ä¿åããã¦ãããã¨ããããã¾ãã
4. ä»å¾ã®è¦è¾¼ã¿
å é±ã«ããã®ããã³ã㧠IETF ã®ç·ä¼ãéå¬ããã¾ãããTLS WG ã interim çéå¬ãã¦ã次æTLSã®ãã¼ã¸ã§ã³ 1.3 ã®è°è«ãé²ãã§ãã¾ããã©ã¹ãã³ã¼ã«ç®åã® HTTP/2 ä»æ§ããã®TLS1.3ã§è°è«ããã¦ããå 容(renegotiationã®ç¦æ¢ãPFS/AEADã®å¿ é åçï¼ãå åãããä»æ§é ç®ãåãè¾¼ãã§ãã¾ãã
ä»å Google ã OpenSSLãforkã㦠BoringSSL ãä½ã£ããã¨ã«ãã£ã¦ Chrome 㨠GFE(Google Front End)éã§ããã¾ã§ä»¥ä¸ã«èªç±ã«TLSã®å®é¨çæ©è½ã®è©¦é¨ãã§ããã§ãããã è¿ãå°æ¥ Chrome㧠Googleã®ãµã¼ãã¹ã使ã£ã¦ããã¨ããã¤ã®éã«ãçãæ°ã¥ããªããã¡ã« TLS1.3 ï¼Î± ã«ãªã£ã¦ããã¨ãããã¨ã«ãªãããããªããã¨æ³åãã¡ããã¾ãã