ssl: Refactored for readability
ssl: Refactored for readability

Instance of state variable that are "updated" in a function is called
for example State0 and the last instance, that should be returned, is
called State possible intermidiat versions are suffixed by increasing
numbers.  State0 may be rturned in error cases.

Avoid nesting case statments.

emile/otp,dgud/otp,falkevik/otp,lemenkov/otp,bsmr-erlang/otp,release-project/otp,Teino1978-Corp/otp,lianghaivv/otp,goertzenator/otp,saleyn/otp,lucafavatella/otp,Teino1978-Corp/erlang-otp,RJ/otp,potatosalad/otp,legoscia/otp,haguenau/otp,lantti/otp,NOMORECOFFEE/otp,lightcyphers/otp,gjaldon/otp,dumbbell/otp,mikpe/otp,entropiae/otp,paulcager/otp,benoitc/otp-1,paulcager/otp,RGafiyatullin/otp,Teino1978-Corp/erlang-otp,RJ/otp,mikpe/otp,krishnakumar4a4/otp,massemanet/otp,falkevik/otp,jj1bdx/otp,palas/otp,Teino1978-Corp/otp,getong/otp,falkevik/otp,kvakvs/otp,kvakvs/otp,gjaldon/otp,erlang/otp,basho/otp,RGafiyatullin/otp,vinoski/otp,gjaldon/otp,gjaldon/otp,lantti/otp,weisslj/otp,electricimp/otp,paladim/otp,mikpe/otp,ahmedshafeeq/otp,sitexa/otp,matwey/otp,derek121/otp,platinumthinker/otp,kvakvs/otp,paulcager/otp,saleyn/otp,rlipscombe/otp,legoscia/otp,falkevik/otp,jemsbhai/otp,rlipscombe/otp,schlagert/otp,mujiatong/otp,lrascao/otp,sammoth-wazoku/otp,yangchengjian/otp,krishnakumar4a4/otp,beni55/otp,klarna/otp,RJ/otp,bugs-erlang-org/otp,schlagert/otp,RichMorin/otp,lhslll/otp,tuncer/otp,emacsmirror/erlang,lrascao/otp,enikki/otp,johanclaesson/otp,vladdu/otp,gjaldon/otp,RoadRunnr/otp,ader1990/otp,fenollp/otp,saleyn/otp,aboroska/otp,goertzenator/otp,weisslj/otp,NOMORECOFFEE/otp,benoitc/otp-1,stolen/otp,lantti/otp,emacsmirror/erlang,psyeugenic/otp,potatosalad/otp,electricimp/otp,msantos/otp,lhslll/otp,basho/otp,lucafavatella/otp,RichMorin/otp,Teino1978-Corp/erlang-otp,dumbbell/otp,mujiatong/otp,jinshana/otp,marquisthunder/otp,dgud/otp,matwey/otp,RaimoNiskanen/otp,neeraj9/otp,lightcyphers/otp,weisslj/otp,vic/otp,aboroska/otp,krishnakumar4a4/otp,rlipscombe/otp,bernardd/otp,falkevik/otp,getong/otp,erlang/otp,jemsbhai/otp,uabboli/otp,beni55/otp,lantti/otp,RGafiyatullin/otp,sdebnath/otp,GinjaNinja32/otp,lhslll/otp,sammoth-wazoku/otp,lightcyphers/otp,krishnakumar4a4/otp,weisslj/otp,matwey/otp,hairyhum/otp,jemsbhai/otp,lightcyphers/otp,hairyhum/otp,c-rack/otp,bjorng/otp,emacsmirror/erlang,legoscia/otp,vic/otp,ahmedshafeeq/otp,awetzel/otp,benoitc/otp-1,bernardd/otp,cobusc/otp,aboroska/otp,lhslll/otp,lantti/otp,emile/otp,isvilen/otp,RoadRunnr/otp,basho/otp,jemsbhai/otp,haguenau/otp,paladim/otp,Teino1978-Corp/otp,awetzel/otp,platinumthinker/otp,g-andrade/otp,lemenkov/otp,uabboli/otp,beni55/otp,stolen/otp,rlipscombe/otp,falkevik/otp,jamesruan/otp,lightcyphers/otp,yangchengjian/otp,rlipscombe/otp,neeraj9/otp,RoadRunnr/otp,Teino1978-Corp/otp,bjorng/otp,entropiae/otp,sdebnath/otp,bugs-erlang-org/otp,RaimoNiskanen/otp,yangchengjian/otp,lianghaivv/otp,tuncer/otp,dgud/otp,cnbin/otp,isvilen/otp,basho/otp,paulcager/otp,aboroska/otp,sammoth-wazoku/otp,RaimoNiskanen/otp,hairyhum/otp,schlagert/otp,jamesruan/otp,release-project/otp,Teino1978-Corp/otp,johanclaesson/otp,bsmr-erlang/otp,sammoth-wazoku/otp,ferd/otp,bernardd/otp,saleyn/otp,ahmedshafeeq/otp,dgud/otp,cobusc/otp,sdebnath/otp,msantos/otp,paladim/otp,c-rack/otp,g-andrade/otp,theom/otp,derek121/otp,bsmr-erlang/otp,hairyhum/otp,stolen/otp,jj1bdx/otp,GinjaNinja32/otp,jamesruan/otp,jinshana/otp,klarna/otp,aboroska/otp,goertzenator/otp,jamesruan/otp,RJ/otp,erlang/otp,awetzel/otp,aboroska/otp,derek121/otp,cobusc/otp,psyeugenic/otp,electricimp/otp,potatosalad/otp,krishnakumar4a4/otp,RaimoNiskanen/otp,bsmr-erlang/otp,derek121/otp,bernardd/otp,palas/otp,bjorng/otp,vic/otp,derek121/otp,lrascao/otp,sitexa/otp,rlipscombe/otp,lantti/otp,enikki/otp,vic/otp,lrascao/otp,jamesruan/otp,jinshana/otp,basho/otp,release-project/otp,VincentHHL/otp,Teino1978-Corp/otp,bernardd/otp,RGafiyatullin/otp,hairyhum/otp,massemanet/otp,marquisthunder/otp,lemenkov/otp,rlipscombe/otp,mikpe/otp,potatosalad/otp,derek121/otp,jj1bdx/otp,cnbin/otp,klarna/otp,bjorng/otp,dgud/otp,saleyn/otp,emacsmirror/erlang,msantos/otp,isvilen/otp,fenollp/otp,jamesruan/otp,goertzenator/otp,ahmedshafeeq/otp,fenollp/otp,riverrun/otp,ader1990/otp,platinumthinker/otp,goertzenator/otp,derek121/otp,RaimoNiskanen/otp,bjorng/otp,haguenau/otp,Teino1978-Corp/erlang-otp,paulcager/otp,klarna/otp,bernardd/otp,lucafavatella/otp,klarna/otp,ferd/otp,lrascao/otp,lemenkov/otp,paladim/otp,vladdu/otp,cobusc/otp,neeraj9/otp,RoadRunnr/otp,psyeugenic/otp,lianghaivv/otp,jj1bdx/otp,lrascao/otp,jj1bdx/otp,jj1bdx/otp,jemsbhai/otp,matwey/otp,jinshana/otp,neeraj9/otp,vladdu/otp,sitexa/otp,palas/otp,release-project/otp,msantos/otp,haguenau/otp,beni55/otp,entropiae/otp,cnbin/otp,legoscia/otp,massemanet/otp,saleyn/otp,sitexa/otp,platinumthinker/otp,vinoski/otp,bsmr-erlang/otp,RichMorin/otp,vic/otp,RoadRunnr/otp,massemanet/otp,sitexa/otp,jemsbhai/otp,hairyhum/otp,ahmedshafeeq/otp,lianghaivv/otp,neeraj9/otp,lucafavatella/otp,mikpe/otp,dgud/otp,RGafiyatullin/otp,dumbbell/otp,Teino1978-Corp/otp,johanclaesson/otp,vladdu/otp,lemenkov/otp,paladim/otp,haguenau/otp,lemenkov/otp,uabboli/otp,psyeugenic/otp,lianghaivv/otp,jinshana/otp,emacsmirror/erlang,electricimp/otp,fenollp/otp,massemanet/otp,jj1bdx/otp,potatosalad/otp,VincentHHL/otp,psyeugenic/otp,lianghaivv/otp,emacsmirror/erlang,mikpe/otp,RaimoNiskanen/otp,dumbbell/otp,neeraj9/otp,ader1990/otp,paladim/otp,getong/otp,lucafavatella/otp,krishnakumar4a4/otp,vladdu/otp,ferd/otp,weisslj/otp,lantti/otp,NOMORECOFFEE/otp,tuncer/otp,riverrun/otp,vinoski/otp,awetzel/otp,NOMORECOFFEE/otp,riverrun/otp,weisslj/otp,aboroska/otp,marquisthunder/otp,RaimoNiskanen/otp,lightcyphers/otp,emile/otp,fenollp/otp,bsmr-erlang/otp,marquisthunder/otp,c-rack/otp,haguenau/otp,dumbbell/otp,neeraj9/otp,enikki/otp,benoitc/otp-1,msantos/otp,vinoski/otp,mikpe/otp,entropiae/otp,theom/otp,paulcager/otp,emile/otp,dumbbell/otp,platinumthinker/otp,johanclaesson/otp,aboroska/otp,mujiatong/otp,ader1990/otp,beni55/otp,emile/otp,NOMORECOFFEE/otp,sitexa/otp,c-rack/otp,erlang/otp,kvakvs/otp,gjaldon/otp,dgud/otp,Teino1978-Corp/erlang-otp,rlipscombe/otp,platinumthinker/otp,awetzel/otp,legoscia/otp,g-andrade/otp,lhslll/otp,release-project/otp,enikki/otp,bugs-erlang-org/otp,isvilen/otp,kvakvs/otp,rlipscombe/otp,ader1990/otp,dgud/otp,palas/otp,platinumthinker/otp,awetzel/otp,falkevik/otp,tuncer/otp,aboroska/otp,sammoth-wazoku/otp,sdebnath/otp,vladdu/otp,lightcyphers/otp,paulcager/otp,enikki/otp,jamesruan/otp,klarna/otp,potatosalad/otp,weisslj/otp,sitexa/otp,mujiatong/otp,jinshana/otp,ader1990/otp,lightcyphers/otp,schlagert/otp,entropiae/otp,bsmr-erlang/otp,potatosalad/otp,RoadRunnr/otp,cnbin/otp,lucafavatella/otp,RJ/otp,saleyn/otp,vinoski/otp,mikpe/otp,GinjaNinja32/otp,g-andrade/otp,Teino1978-Corp/erlang-otp,yangchengjian/otp,benoitc/otp-1,GinjaNinja32/otp,getong/otp,dumbbell/otp,tuncer/otp,kvakvs/otp,weisslj/otp,jemsbhai/otp,lhslll/otp,dumbbell/otp,bjorng/otp,schlagert/otp,kvakvs/otp,yangchengjian/otp,potatosalad/otp,yangchengjian/otp,bsmr-erlang/otp,electricimp/otp,lianghaivv/otp,GinjaNinja32/otp,ferd/otp,goertzenator/otp,mujiatong/otp,beni55/otp,psyeugenic/otp,sammoth-wazoku/otp,RoadRunnr/otp,RJ/otp,emile/otp,vinoski/otp,tuncer/otp,marquisthunder/otp,vic/otp,cnbin/otp,massemanet/otp,mikpe/otp,paladim/otp,lrascao/otp,fenollp/otp,stolen/otp,NOMORECOFFEE/otp,isvilen/otp,theom/otp,vladdu/otp,c-rack/otp,stolen/otp,g-andrade/otp,RJ/otp,paladim/otp,electricimp/otp,legoscia/otp,beni55/otp,legoscia/otp,tuncer/otp,lucafavatella/otp,Teino1978-Corp/erlang-otp,ferd/otp,basho/otp,dumbbell/otp,bugs-erlang-org/otp,schlagert/otp,goertzenator/otp,RichMorin/otp,RichMorin/otp,getong/otp,vinoski/otp,mikpe/otp,matwey/otp,enikki/otp,vinoski/otp,uabboli/otp,vic/otp,benoitc/otp-1,bernardd/otp,theom/otp,erlang/otp,electricimp/otp,emacsmirror/erlang,NOMORECOFFEE/otp,emacsmirror/erlang,klarna/otp,goertzenator/otp,haguenau/otp,yangchengjian/otp,GinjaNinja32/otp,c-rack/otp,ader1990/otp,lantti/otp,uabboli/otp,msantos/otp,mujiatong/otp,matwey/otp,ahmedshafeeq/otp,emile/otp,fenollp/otp,isvilen/otp,lianghaivv/otp,riverrun/otp,johanclaesson/otp,ahmedshafeeq/otp,dgud/otp,bjorng/otp,RaimoNiskanen/otp,RichMorin/otp,erlang/otp,palas/otp,matwey/otp,RGafiyatullin/otp,entropiae/otp,bernardd/otp,cnbin/otp,VincentHHL/otp,ferd/otp,release-project/otp,mujiatong/otp,emacsmirror/erlang,marquisthunder/otp,electricimp/otp,schlagert/otp,bjorng/otp,goertzenator/otp,erlang/otp,bugs-erlang-org/otp,potatosalad/otp,vinoski/otp,riverrun/otp,cnbin/otp,g-andrade/otp,uabboli/otp,sammoth-wazoku/otp,lhslll/otp,jinshana/otp,basho/otp,getong/otp,VincentHHL/otp,entropiae/otp,ader1990/otp,RichMorin/otp,vinoski/otp,jj1bdx/otp,tuncer/otp,weisslj/otp,entropiae/otp,sdebnath/otp,RoadRunnr/otp,benoitc/otp-1,lemenkov/otp,yangchengjian/otp,g-andrade/otp,electricimp/otp,jinshana/otp,ferd/otp,theom/otp,kvakvs/otp,cobusc/otp,psyeugenic/otp,enikki/otp,vic/otp,RJ/otp,rlipscombe/otp,getong/otp,falkevik/otp,emile/otp,stolen/otp,dgud/otp,massemanet/otp,vladdu/otp,paulcager/otp,bjorng/otp,uabboli/otp,legoscia/otp,getong/otp,uabboli/otp,isvilen/otp,ferd/otp,kvakvs/otp,theom/otp,fenollp/otp,fenollp/otp,vladdu/otp,enikki/otp,saleyn/otp,bugs-erlang-org/otp,jj1bdx/otp,krishnakumar4a4/otp,msantos/otp,sdebnath/otp,awetzel/otp,isvilen/otp,isvilen/otp,lemenkov/otp,VincentHHL/otp,palas/otp,stolen/otp,matwey/otp,johanclaesson/otp,sitexa/otp,sammoth-wazoku/otp,erlang/otp,gjaldon/otp,basho/otp,bsmr-erlang/otp,Teino1978-Corp/otp,riverrun/otp,sdebnath/otp,RoadRunnr/otp,release-project/otp,gjaldon/otp,isvilen/otp,VincentHHL/otp,uabboli/otp,ahmedshafeeq/otp,bernardd/otp,bugs-erlang-org/otp,g-andrade/otp,klarna/otp,neeraj9/otp,cnbin/otp,beni55/otp,johanclaesson/otp,jj1bdx/otp,saleyn/otp,getong/otp,VincentHHL/otp,sdebnath/otp,VincentHHL/otp,cobusc/otp,lrascao/otp,msantos/otp,cobusc/otp,potatosalad/otp,emacsmirror/erlang,GinjaNinja32/otp,tuncer/otp,NOMORECOFFEE/otp,Teino1978-Corp/erlang-otp,c-rack/otp,ferd/otp,release-project/otp,derek121/otp,RGafiyatullin/otp,psyeugenic/otp,basho/otp,erlang/otp,theom/otp,stolen/otp,marquisthunder/otp,g-andrade/otp,jemsbhai/otp,marquisthunder/otp,GinjaNinja32/otp,massemanet/otp,g-andrade/otp,dumbbell/otp,riverrun/otp,theom/otp,platinumthinker/otp,RGafiyatullin/otp,riverrun/otp,lrascao/otp,palas/otp,hairyhum/otp,legoscia/otp,getong/otp,lucafavatella/otp,palas/otp,bugs-erlang-org/otp,haguenau/otp,RichMorin/otp,massemanet/otp,RaimoNiskanen/otp,ahmedshafeeq/otp,jamesruan/otp,erlang/otp,lhslll/otp,hairyhum/otp,falkevik/otp,c-rack/otp,cobusc/otp,emile/otp,benoitc/otp-1,mujiatong/otp,release-project/otp,krishnakumar4a4/otp,johanclaesson/otp,bjorng/otp,schlagert/otp,awetzel/otp,matwey/otp