Added ChaCha20+Poly1305 support (stand-alone, cipher suites).
[BearSSL] / src / ssl / ssl_hs_common.t0
index da6fc8a..bbd37ac 100644 (file)
@@ -903,8 +903,14 @@ hexb| 0000 | \ List terminator.
                        then
                endof
 
-               \ ChaCha20/Poly1305
-               \ 5 of endof
+               \ ChaCha20+Poly1305
+               5 of drop
+                       for-input if
+                               switch-chapol-in
+                       else
+                               switch-chapol-out
+                       then
+               endof
 
                ERR_BAD_PARAM fail
        endcase
@@ -958,6 +964,22 @@ cc: switch-aesgcm-in ( is_client prf_id cipher_key_len -- ) {
                ENG->iaes_ctr, cipher_key_len);
 }
 
+cc: switch-chapol-out ( is_client prf_id -- ) {
+       int is_client, prf_id;
+
+       prf_id = T0_POP();
+       is_client = T0_POP();
+       br_ssl_engine_switch_chapol_out(ENG, is_client, prf_id);
+}
+
+cc: switch-chapol-in ( is_client prf_id -- ) {
+       int is_client, prf_id;
+
+       prf_id = T0_POP();
+       is_client = T0_POP();
+       br_ssl_engine_switch_chapol_in(ENG, is_client, prf_id);
+}
+
 \ Write Finished message.
 : write-Finished ( from_client -- )
        compute-Finished