s3_lib.c 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260
  1. /* ssl/s3_lib.c */
  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. * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
  60. *
  61. * Redistribution and use in source and binary forms, with or without
  62. * modification, are permitted provided that the following conditions
  63. * are met:
  64. *
  65. * 1. Redistributions of source code must retain the above copyright
  66. * notice, this list of conditions and the following disclaimer.
  67. *
  68. * 2. Redistributions in binary form must reproduce the above copyright
  69. * notice, this list of conditions and the following disclaimer in
  70. * the documentation and/or other materials provided with the
  71. * distribution.
  72. *
  73. * 3. All advertising materials mentioning features or use of this
  74. * software must display the following acknowledgment:
  75. * "This product includes software developed by the OpenSSL Project
  76. * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  77. *
  78. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  79. * endorse or promote products derived from this software without
  80. * prior written permission. For written permission, please contact
  81. * openssl-core@openssl.org.
  82. *
  83. * 5. Products derived from this software may not be called "OpenSSL"
  84. * nor may "OpenSSL" appear in their names without prior written
  85. * permission of the OpenSSL Project.
  86. *
  87. * 6. Redistributions of any form whatsoever must retain the following
  88. * acknowledgment:
  89. * "This product includes software developed by the OpenSSL Project
  90. * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  91. *
  92. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  93. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  94. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  95. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  96. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  97. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  98. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  99. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  100. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  101. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  102. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  103. * OF THE POSSIBILITY OF SUCH DAMAGE.
  104. * ====================================================================
  105. *
  106. * This product includes cryptographic software written by Eric Young
  107. * (eay@cryptsoft.com). This product includes software written by Tim
  108. * Hudson (tjh@cryptsoft.com).
  109. *
  110. */
  111. /* ====================================================================
  112. * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  113. *
  114. * Portions of the attached software ("Contribution") are developed by
  115. * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  116. *
  117. * The Contribution is licensed pursuant to the OpenSSL open source
  118. * license provided above.
  119. *
  120. * ECC cipher suite support in OpenSSL originally written by
  121. * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
  122. *
  123. */
  124. /* ====================================================================
  125. * Copyright 2005 Nokia. All rights reserved.
  126. *
  127. * The portions of the attached software ("Contribution") is developed by
  128. * Nokia Corporation and is licensed pursuant to the OpenSSL open source
  129. * license.
  130. *
  131. * The Contribution, originally written by Mika Kousa and Pasi Eronen of
  132. * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
  133. * support (see RFC 4279) to OpenSSL.
  134. *
  135. * No patent licenses or other rights except those expressly stated in
  136. * the OpenSSL open source license shall be deemed granted or received
  137. * expressly, by implication, estoppel, or otherwise.
  138. *
  139. * No assurances are provided by Nokia that the Contribution does not
  140. * infringe the patent or other intellectual property rights of any third
  141. * party or that the license provides you with all the necessary rights
  142. * to make use of the Contribution.
  143. *
  144. * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
  145. * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
  146. * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
  147. * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
  148. * OTHERWISE.
  149. */
  150. #include <stdio.h>
  151. #include <openssl/objects.h>
  152. #include "ssl_locl.h"
  153. #include "kssl_lcl.h"
  154. #ifndef OPENSSL_NO_TLSEXT
  155. #ifndef OPENSSL_NO_EC
  156. #include "../crypto/ec/ec_lcl.h"
  157. #endif /* OPENSSL_NO_EC */
  158. #endif /* OPENSSL_NO_TLSEXT */
  159. #include <openssl/md5.h>
  160. #ifndef OPENSSL_NO_DH
  161. #include <openssl/dh.h>
  162. #endif
  163. const char ssl3_version_str[]="SSLv3" OPENSSL_VERSION_PTEXT;
  164. #define SSL3_NUM_CIPHERS (sizeof(ssl3_ciphers)/sizeof(SSL_CIPHER))
  165. /* list of available SSLv3 ciphers (sorted by id) */
  166. OPENSSL_GLOBAL SSL_CIPHER ssl3_ciphers[]={
  167. /* The RSA ciphers */
  168. /* Cipher 01 */
  169. {
  170. 1,
  171. SSL3_TXT_RSA_NULL_MD5,
  172. SSL3_CK_RSA_NULL_MD5,
  173. SSL_kRSA,
  174. SSL_aRSA,
  175. SSL_eNULL,
  176. SSL_MD5,
  177. SSL_SSLV3,
  178. SSL_NOT_EXP|SSL_STRONG_NONE,
  179. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  180. 0,
  181. 0,
  182. },
  183. /* Cipher 02 */
  184. {
  185. 1,
  186. SSL3_TXT_RSA_NULL_SHA,
  187. SSL3_CK_RSA_NULL_SHA,
  188. SSL_kRSA,
  189. SSL_aRSA,
  190. SSL_eNULL,
  191. SSL_SHA1,
  192. SSL_SSLV3,
  193. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  194. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  195. 0,
  196. 0,
  197. },
  198. /* Cipher 03 */
  199. {
  200. 1,
  201. SSL3_TXT_RSA_RC4_40_MD5,
  202. SSL3_CK_RSA_RC4_40_MD5,
  203. SSL_kRSA,
  204. SSL_aRSA,
  205. SSL_RC4,
  206. SSL_MD5,
  207. SSL_SSLV3,
  208. SSL_EXPORT|SSL_EXP40,
  209. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  210. 40,
  211. 128,
  212. },
  213. /* Cipher 04 */
  214. {
  215. 1,
  216. SSL3_TXT_RSA_RC4_128_MD5,
  217. SSL3_CK_RSA_RC4_128_MD5,
  218. SSL_kRSA,
  219. SSL_aRSA,
  220. SSL_RC4,
  221. SSL_MD5,
  222. SSL_SSLV3,
  223. SSL_NOT_EXP|SSL_MEDIUM,
  224. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  225. 128,
  226. 128,
  227. },
  228. /* Cipher 05 */
  229. {
  230. 1,
  231. SSL3_TXT_RSA_RC4_128_SHA,
  232. SSL3_CK_RSA_RC4_128_SHA,
  233. SSL_kRSA,
  234. SSL_aRSA,
  235. SSL_RC4,
  236. SSL_SHA1,
  237. SSL_SSLV3,
  238. SSL_NOT_EXP|SSL_MEDIUM,
  239. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  240. 128,
  241. 128,
  242. },
  243. /* Cipher 06 */
  244. {
  245. 1,
  246. SSL3_TXT_RSA_RC2_40_MD5,
  247. SSL3_CK_RSA_RC2_40_MD5,
  248. SSL_kRSA,
  249. SSL_aRSA,
  250. SSL_RC2,
  251. SSL_MD5,
  252. SSL_SSLV3,
  253. SSL_EXPORT|SSL_EXP40,
  254. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  255. 40,
  256. 128,
  257. },
  258. /* Cipher 07 */
  259. #ifndef OPENSSL_NO_IDEA
  260. {
  261. 1,
  262. SSL3_TXT_RSA_IDEA_128_SHA,
  263. SSL3_CK_RSA_IDEA_128_SHA,
  264. SSL_kRSA,
  265. SSL_aRSA,
  266. SSL_IDEA,
  267. SSL_SHA1,
  268. SSL_SSLV3,
  269. SSL_NOT_EXP|SSL_MEDIUM,
  270. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  271. 128,
  272. 128,
  273. },
  274. #endif
  275. /* Cipher 08 */
  276. {
  277. 1,
  278. SSL3_TXT_RSA_DES_40_CBC_SHA,
  279. SSL3_CK_RSA_DES_40_CBC_SHA,
  280. SSL_kRSA,
  281. SSL_aRSA,
  282. SSL_DES,
  283. SSL_SHA1,
  284. SSL_SSLV3,
  285. SSL_EXPORT|SSL_EXP40,
  286. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  287. 40,
  288. 56,
  289. },
  290. /* Cipher 09 */
  291. {
  292. 1,
  293. SSL3_TXT_RSA_DES_64_CBC_SHA,
  294. SSL3_CK_RSA_DES_64_CBC_SHA,
  295. SSL_kRSA,
  296. SSL_aRSA,
  297. SSL_DES,
  298. SSL_SHA1,
  299. SSL_SSLV3,
  300. SSL_NOT_EXP|SSL_LOW,
  301. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  302. 56,
  303. 56,
  304. },
  305. /* Cipher 0A */
  306. {
  307. 1,
  308. SSL3_TXT_RSA_DES_192_CBC3_SHA,
  309. SSL3_CK_RSA_DES_192_CBC3_SHA,
  310. SSL_kRSA,
  311. SSL_aRSA,
  312. SSL_3DES,
  313. SSL_SHA1,
  314. SSL_SSLV3,
  315. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  316. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  317. 168,
  318. 168,
  319. },
  320. /* The DH ciphers */
  321. /* Cipher 0B */
  322. {
  323. 0,
  324. SSL3_TXT_DH_DSS_DES_40_CBC_SHA,
  325. SSL3_CK_DH_DSS_DES_40_CBC_SHA,
  326. SSL_kDHd,
  327. SSL_aDH,
  328. SSL_DES,
  329. SSL_SHA1,
  330. SSL_SSLV3,
  331. SSL_EXPORT|SSL_EXP40,
  332. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  333. 40,
  334. 56,
  335. },
  336. /* Cipher 0C */
  337. {
  338. 0, /* not implemented (non-ephemeral DH) */
  339. SSL3_TXT_DH_DSS_DES_64_CBC_SHA,
  340. SSL3_CK_DH_DSS_DES_64_CBC_SHA,
  341. SSL_kDHd,
  342. SSL_aDH,
  343. SSL_DES,
  344. SSL_SHA1,
  345. SSL_SSLV3,
  346. SSL_NOT_EXP|SSL_LOW,
  347. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  348. 56,
  349. 56,
  350. },
  351. /* Cipher 0D */
  352. {
  353. 0, /* not implemented (non-ephemeral DH) */
  354. SSL3_TXT_DH_DSS_DES_192_CBC3_SHA,
  355. SSL3_CK_DH_DSS_DES_192_CBC3_SHA,
  356. SSL_kDHd,
  357. SSL_aDH,
  358. SSL_3DES,
  359. SSL_SHA1,
  360. SSL_SSLV3,
  361. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  362. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  363. 168,
  364. 168,
  365. },
  366. /* Cipher 0E */
  367. {
  368. 0, /* not implemented (non-ephemeral DH) */
  369. SSL3_TXT_DH_RSA_DES_40_CBC_SHA,
  370. SSL3_CK_DH_RSA_DES_40_CBC_SHA,
  371. SSL_kDHr,
  372. SSL_aDH,
  373. SSL_DES,
  374. SSL_SHA1,
  375. SSL_SSLV3,
  376. SSL_EXPORT|SSL_EXP40,
  377. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  378. 40,
  379. 56,
  380. },
  381. /* Cipher 0F */
  382. {
  383. 0, /* not implemented (non-ephemeral DH) */
  384. SSL3_TXT_DH_RSA_DES_64_CBC_SHA,
  385. SSL3_CK_DH_RSA_DES_64_CBC_SHA,
  386. SSL_kDHr,
  387. SSL_aDH,
  388. SSL_DES,
  389. SSL_SHA1,
  390. SSL_SSLV3,
  391. SSL_NOT_EXP|SSL_LOW,
  392. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  393. 56,
  394. 56,
  395. },
  396. /* Cipher 10 */
  397. {
  398. 0, /* not implemented (non-ephemeral DH) */
  399. SSL3_TXT_DH_RSA_DES_192_CBC3_SHA,
  400. SSL3_CK_DH_RSA_DES_192_CBC3_SHA,
  401. SSL_kDHr,
  402. SSL_aDH,
  403. SSL_3DES,
  404. SSL_SHA1,
  405. SSL_SSLV3,
  406. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  407. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  408. 168,
  409. 168,
  410. },
  411. /* The Ephemeral DH ciphers */
  412. /* Cipher 11 */
  413. {
  414. 1,
  415. SSL3_TXT_EDH_DSS_DES_40_CBC_SHA,
  416. SSL3_CK_EDH_DSS_DES_40_CBC_SHA,
  417. SSL_kEDH,
  418. SSL_aDSS,
  419. SSL_DES,
  420. SSL_SHA1,
  421. SSL_SSLV3,
  422. SSL_EXPORT|SSL_EXP40,
  423. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  424. 40,
  425. 56,
  426. },
  427. /* Cipher 12 */
  428. {
  429. 1,
  430. SSL3_TXT_EDH_DSS_DES_64_CBC_SHA,
  431. SSL3_CK_EDH_DSS_DES_64_CBC_SHA,
  432. SSL_kEDH,
  433. SSL_aDSS,
  434. SSL_DES,
  435. SSL_SHA1,
  436. SSL_SSLV3,
  437. SSL_NOT_EXP|SSL_LOW,
  438. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  439. 56,
  440. 56,
  441. },
  442. /* Cipher 13 */
  443. {
  444. 1,
  445. SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA,
  446. SSL3_CK_EDH_DSS_DES_192_CBC3_SHA,
  447. SSL_kEDH,
  448. SSL_aDSS,
  449. SSL_3DES,
  450. SSL_SHA1,
  451. SSL_SSLV3,
  452. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  453. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  454. 168,
  455. 168,
  456. },
  457. /* Cipher 14 */
  458. {
  459. 1,
  460. SSL3_TXT_EDH_RSA_DES_40_CBC_SHA,
  461. SSL3_CK_EDH_RSA_DES_40_CBC_SHA,
  462. SSL_kEDH,
  463. SSL_aRSA,
  464. SSL_DES,
  465. SSL_SHA1,
  466. SSL_SSLV3,
  467. SSL_EXPORT|SSL_EXP40,
  468. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  469. 40,
  470. 56,
  471. },
  472. /* Cipher 15 */
  473. {
  474. 1,
  475. SSL3_TXT_EDH_RSA_DES_64_CBC_SHA,
  476. SSL3_CK_EDH_RSA_DES_64_CBC_SHA,
  477. SSL_kEDH,
  478. SSL_aRSA,
  479. SSL_DES,
  480. SSL_SHA1,
  481. SSL_SSLV3,
  482. SSL_NOT_EXP|SSL_LOW,
  483. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  484. 56,
  485. 56,
  486. },
  487. /* Cipher 16 */
  488. {
  489. 1,
  490. SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA,
  491. SSL3_CK_EDH_RSA_DES_192_CBC3_SHA,
  492. SSL_kEDH,
  493. SSL_aRSA,
  494. SSL_3DES,
  495. SSL_SHA1,
  496. SSL_SSLV3,
  497. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  498. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  499. 168,
  500. 168,
  501. },
  502. /* Cipher 17 */
  503. {
  504. 1,
  505. SSL3_TXT_ADH_RC4_40_MD5,
  506. SSL3_CK_ADH_RC4_40_MD5,
  507. SSL_kEDH,
  508. SSL_aNULL,
  509. SSL_RC4,
  510. SSL_MD5,
  511. SSL_SSLV3,
  512. SSL_EXPORT|SSL_EXP40,
  513. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  514. 40,
  515. 128,
  516. },
  517. /* Cipher 18 */
  518. {
  519. 1,
  520. SSL3_TXT_ADH_RC4_128_MD5,
  521. SSL3_CK_ADH_RC4_128_MD5,
  522. SSL_kEDH,
  523. SSL_aNULL,
  524. SSL_RC4,
  525. SSL_MD5,
  526. SSL_SSLV3,
  527. SSL_NOT_EXP|SSL_MEDIUM,
  528. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  529. 128,
  530. 128,
  531. },
  532. /* Cipher 19 */
  533. {
  534. 1,
  535. SSL3_TXT_ADH_DES_40_CBC_SHA,
  536. SSL3_CK_ADH_DES_40_CBC_SHA,
  537. SSL_kEDH,
  538. SSL_aNULL,
  539. SSL_DES,
  540. SSL_SHA1,
  541. SSL_SSLV3,
  542. SSL_EXPORT|SSL_EXP40,
  543. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  544. 40,
  545. 128,
  546. },
  547. /* Cipher 1A */
  548. {
  549. 1,
  550. SSL3_TXT_ADH_DES_64_CBC_SHA,
  551. SSL3_CK_ADH_DES_64_CBC_SHA,
  552. SSL_kEDH,
  553. SSL_aNULL,
  554. SSL_DES,
  555. SSL_SHA1,
  556. SSL_SSLV3,
  557. SSL_NOT_EXP|SSL_LOW,
  558. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  559. 56,
  560. 56,
  561. },
  562. /* Cipher 1B */
  563. {
  564. 1,
  565. SSL3_TXT_ADH_DES_192_CBC_SHA,
  566. SSL3_CK_ADH_DES_192_CBC_SHA,
  567. SSL_kEDH,
  568. SSL_aNULL,
  569. SSL_3DES,
  570. SSL_SHA1,
  571. SSL_SSLV3,
  572. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  573. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  574. 168,
  575. 168,
  576. },
  577. /* Fortezza ciphersuite from SSL 3.0 spec */
  578. #if 0
  579. /* Cipher 1C */
  580. {
  581. 0,
  582. SSL3_TXT_FZA_DMS_NULL_SHA,
  583. SSL3_CK_FZA_DMS_NULL_SHA,
  584. SSL_kFZA,
  585. SSL_aFZA,
  586. SSL_eNULL,
  587. SSL_SHA1,
  588. SSL_SSLV3,
  589. SSL_NOT_EXP|SSL_STRONG_NONE,
  590. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  591. 0,
  592. 0,
  593. },
  594. /* Cipher 1D */
  595. {
  596. 0,
  597. SSL3_TXT_FZA_DMS_FZA_SHA,
  598. SSL3_CK_FZA_DMS_FZA_SHA,
  599. SSL_kFZA,
  600. SSL_aFZA,
  601. SSL_eFZA,
  602. SSL_SHA1,
  603. SSL_SSLV3,
  604. SSL_NOT_EXP|SSL_STRONG_NONE,
  605. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  606. 0,
  607. 0,
  608. },
  609. /* Cipher 1E */
  610. {
  611. 0,
  612. SSL3_TXT_FZA_DMS_RC4_SHA,
  613. SSL3_CK_FZA_DMS_RC4_SHA,
  614. SSL_kFZA,
  615. SSL_aFZA,
  616. SSL_RC4,
  617. SSL_SHA1,
  618. SSL_SSLV3,
  619. SSL_NOT_EXP|SSL_MEDIUM,
  620. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  621. 128,
  622. 128,
  623. },
  624. #endif
  625. #ifndef OPENSSL_NO_KRB5
  626. /* The Kerberos ciphers*/
  627. /* Cipher 1E */
  628. {
  629. 1,
  630. SSL3_TXT_KRB5_DES_64_CBC_SHA,
  631. SSL3_CK_KRB5_DES_64_CBC_SHA,
  632. SSL_kKRB5,
  633. SSL_aKRB5,
  634. SSL_DES,
  635. SSL_SHA1,
  636. SSL_SSLV3,
  637. SSL_NOT_EXP|SSL_LOW,
  638. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  639. 56,
  640. 56,
  641. },
  642. /* Cipher 1F */
  643. {
  644. 1,
  645. SSL3_TXT_KRB5_DES_192_CBC3_SHA,
  646. SSL3_CK_KRB5_DES_192_CBC3_SHA,
  647. SSL_kKRB5,
  648. SSL_aKRB5,
  649. SSL_3DES,
  650. SSL_SHA1,
  651. SSL_SSLV3,
  652. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  653. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  654. 168,
  655. 168,
  656. },
  657. /* Cipher 20 */
  658. {
  659. 1,
  660. SSL3_TXT_KRB5_RC4_128_SHA,
  661. SSL3_CK_KRB5_RC4_128_SHA,
  662. SSL_kKRB5,
  663. SSL_aKRB5,
  664. SSL_RC4,
  665. SSL_SHA1,
  666. SSL_SSLV3,
  667. SSL_NOT_EXP|SSL_MEDIUM,
  668. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  669. 128,
  670. 128,
  671. },
  672. /* Cipher 21 */
  673. {
  674. 1,
  675. SSL3_TXT_KRB5_IDEA_128_CBC_SHA,
  676. SSL3_CK_KRB5_IDEA_128_CBC_SHA,
  677. SSL_kKRB5,
  678. SSL_aKRB5,
  679. SSL_IDEA,
  680. SSL_SHA1,
  681. SSL_SSLV3,
  682. SSL_NOT_EXP|SSL_MEDIUM,
  683. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  684. 128,
  685. 128,
  686. },
  687. /* Cipher 22 */
  688. {
  689. 1,
  690. SSL3_TXT_KRB5_DES_64_CBC_MD5,
  691. SSL3_CK_KRB5_DES_64_CBC_MD5,
  692. SSL_kKRB5,
  693. SSL_aKRB5,
  694. SSL_DES,
  695. SSL_MD5,
  696. SSL_SSLV3,
  697. SSL_NOT_EXP|SSL_LOW,
  698. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  699. 56,
  700. 56,
  701. },
  702. /* Cipher 23 */
  703. {
  704. 1,
  705. SSL3_TXT_KRB5_DES_192_CBC3_MD5,
  706. SSL3_CK_KRB5_DES_192_CBC3_MD5,
  707. SSL_kKRB5,
  708. SSL_aKRB5,
  709. SSL_3DES,
  710. SSL_MD5,
  711. SSL_SSLV3,
  712. SSL_NOT_EXP|SSL_HIGH,
  713. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  714. 168,
  715. 168,
  716. },
  717. /* Cipher 24 */
  718. {
  719. 1,
  720. SSL3_TXT_KRB5_RC4_128_MD5,
  721. SSL3_CK_KRB5_RC4_128_MD5,
  722. SSL_kKRB5,
  723. SSL_aKRB5,
  724. SSL_RC4,
  725. SSL_MD5,
  726. SSL_SSLV3,
  727. SSL_NOT_EXP|SSL_MEDIUM,
  728. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  729. 128,
  730. 128,
  731. },
  732. /* Cipher 25 */
  733. {
  734. 1,
  735. SSL3_TXT_KRB5_IDEA_128_CBC_MD5,
  736. SSL3_CK_KRB5_IDEA_128_CBC_MD5,
  737. SSL_kKRB5,
  738. SSL_aKRB5,
  739. SSL_IDEA,
  740. SSL_MD5,
  741. SSL_SSLV3,
  742. SSL_NOT_EXP|SSL_MEDIUM,
  743. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  744. 128,
  745. 128,
  746. },
  747. /* Cipher 26 */
  748. {
  749. 1,
  750. SSL3_TXT_KRB5_DES_40_CBC_SHA,
  751. SSL3_CK_KRB5_DES_40_CBC_SHA,
  752. SSL_kKRB5,
  753. SSL_aKRB5,
  754. SSL_DES,
  755. SSL_SHA1,
  756. SSL_SSLV3,
  757. SSL_EXPORT|SSL_EXP40,
  758. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  759. 40,
  760. 56,
  761. },
  762. /* Cipher 27 */
  763. {
  764. 1,
  765. SSL3_TXT_KRB5_RC2_40_CBC_SHA,
  766. SSL3_CK_KRB5_RC2_40_CBC_SHA,
  767. SSL_kKRB5,
  768. SSL_aKRB5,
  769. SSL_RC2,
  770. SSL_SHA1,
  771. SSL_SSLV3,
  772. SSL_EXPORT|SSL_EXP40,
  773. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  774. 40,
  775. 128,
  776. },
  777. /* Cipher 28 */
  778. {
  779. 1,
  780. SSL3_TXT_KRB5_RC4_40_SHA,
  781. SSL3_CK_KRB5_RC4_40_SHA,
  782. SSL_kKRB5,
  783. SSL_aKRB5,
  784. SSL_RC4,
  785. SSL_SHA1,
  786. SSL_SSLV3,
  787. SSL_EXPORT|SSL_EXP40,
  788. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  789. 40,
  790. 128,
  791. },
  792. /* Cipher 29 */
  793. {
  794. 1,
  795. SSL3_TXT_KRB5_DES_40_CBC_MD5,
  796. SSL3_CK_KRB5_DES_40_CBC_MD5,
  797. SSL_kKRB5,
  798. SSL_aKRB5,
  799. SSL_DES,
  800. SSL_MD5,
  801. SSL_SSLV3,
  802. SSL_EXPORT|SSL_EXP40,
  803. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  804. 40,
  805. 56,
  806. },
  807. /* Cipher 2A */
  808. {
  809. 1,
  810. SSL3_TXT_KRB5_RC2_40_CBC_MD5,
  811. SSL3_CK_KRB5_RC2_40_CBC_MD5,
  812. SSL_kKRB5,
  813. SSL_aKRB5,
  814. SSL_RC2,
  815. SSL_MD5,
  816. SSL_SSLV3,
  817. SSL_EXPORT|SSL_EXP40,
  818. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  819. 40,
  820. 128,
  821. },
  822. /* Cipher 2B */
  823. {
  824. 1,
  825. SSL3_TXT_KRB5_RC4_40_MD5,
  826. SSL3_CK_KRB5_RC4_40_MD5,
  827. SSL_kKRB5,
  828. SSL_aKRB5,
  829. SSL_RC4,
  830. SSL_MD5,
  831. SSL_SSLV3,
  832. SSL_EXPORT|SSL_EXP40,
  833. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  834. 40,
  835. 128,
  836. },
  837. #endif /* OPENSSL_NO_KRB5 */
  838. /* New AES ciphersuites */
  839. /* Cipher 2F */
  840. {
  841. 1,
  842. TLS1_TXT_RSA_WITH_AES_128_SHA,
  843. TLS1_CK_RSA_WITH_AES_128_SHA,
  844. SSL_kRSA,
  845. SSL_aRSA,
  846. SSL_AES128,
  847. SSL_SHA1,
  848. SSL_TLSV1,
  849. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  850. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  851. 128,
  852. 128,
  853. },
  854. /* Cipher 30 */
  855. {
  856. 0,
  857. TLS1_TXT_DH_DSS_WITH_AES_128_SHA,
  858. TLS1_CK_DH_DSS_WITH_AES_128_SHA,
  859. SSL_kDHd,
  860. SSL_aDH,
  861. SSL_AES128,
  862. SSL_SHA1,
  863. SSL_TLSV1,
  864. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  865. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  866. 128,
  867. 128,
  868. },
  869. /* Cipher 31 */
  870. {
  871. 0,
  872. TLS1_TXT_DH_RSA_WITH_AES_128_SHA,
  873. TLS1_CK_DH_RSA_WITH_AES_128_SHA,
  874. SSL_kDHr,
  875. SSL_aDH,
  876. SSL_AES128,
  877. SSL_SHA1,
  878. SSL_TLSV1,
  879. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  880. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  881. 128,
  882. 128,
  883. },
  884. /* Cipher 32 */
  885. {
  886. 1,
  887. TLS1_TXT_DHE_DSS_WITH_AES_128_SHA,
  888. TLS1_CK_DHE_DSS_WITH_AES_128_SHA,
  889. SSL_kEDH,
  890. SSL_aDSS,
  891. SSL_AES128,
  892. SSL_SHA1,
  893. SSL_TLSV1,
  894. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  895. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  896. 128,
  897. 128,
  898. },
  899. /* Cipher 33 */
  900. {
  901. 1,
  902. TLS1_TXT_DHE_RSA_WITH_AES_128_SHA,
  903. TLS1_CK_DHE_RSA_WITH_AES_128_SHA,
  904. SSL_kEDH,
  905. SSL_aRSA,
  906. SSL_AES128,
  907. SSL_SHA1,
  908. SSL_TLSV1,
  909. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  910. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  911. 128,
  912. 128,
  913. },
  914. /* Cipher 34 */
  915. {
  916. 1,
  917. TLS1_TXT_ADH_WITH_AES_128_SHA,
  918. TLS1_CK_ADH_WITH_AES_128_SHA,
  919. SSL_kEDH,
  920. SSL_aNULL,
  921. SSL_AES128,
  922. SSL_SHA1,
  923. SSL_TLSV1,
  924. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  925. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  926. 128,
  927. 128,
  928. },
  929. /* Cipher 35 */
  930. {
  931. 1,
  932. TLS1_TXT_RSA_WITH_AES_256_SHA,
  933. TLS1_CK_RSA_WITH_AES_256_SHA,
  934. SSL_kRSA,
  935. SSL_aRSA,
  936. SSL_AES256,
  937. SSL_SHA1,
  938. SSL_TLSV1,
  939. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  940. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  941. 256,
  942. 256,
  943. },
  944. /* Cipher 36 */
  945. {
  946. 0,
  947. TLS1_TXT_DH_DSS_WITH_AES_256_SHA,
  948. TLS1_CK_DH_DSS_WITH_AES_256_SHA,
  949. SSL_kDHd,
  950. SSL_aDH,
  951. SSL_AES256,
  952. SSL_SHA1,
  953. SSL_TLSV1,
  954. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  955. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  956. 256,
  957. 256,
  958. },
  959. /* Cipher 37 */
  960. {
  961. 0, /* not implemented (non-ephemeral DH) */
  962. TLS1_TXT_DH_RSA_WITH_AES_256_SHA,
  963. TLS1_CK_DH_RSA_WITH_AES_256_SHA,
  964. SSL_kDHr,
  965. SSL_aDH,
  966. SSL_AES256,
  967. SSL_SHA1,
  968. SSL_TLSV1,
  969. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  970. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  971. 256,
  972. 256,
  973. },
  974. /* Cipher 38 */
  975. {
  976. 1,
  977. TLS1_TXT_DHE_DSS_WITH_AES_256_SHA,
  978. TLS1_CK_DHE_DSS_WITH_AES_256_SHA,
  979. SSL_kEDH,
  980. SSL_aDSS,
  981. SSL_AES256,
  982. SSL_SHA1,
  983. SSL_TLSV1,
  984. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  985. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  986. 256,
  987. 256,
  988. },
  989. /* Cipher 39 */
  990. {
  991. 1,
  992. TLS1_TXT_DHE_RSA_WITH_AES_256_SHA,
  993. TLS1_CK_DHE_RSA_WITH_AES_256_SHA,
  994. SSL_kEDH,
  995. SSL_aRSA,
  996. SSL_AES256,
  997. SSL_SHA1,
  998. SSL_TLSV1,
  999. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1000. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1001. 256,
  1002. 256,
  1003. },
  1004. /* Cipher 3A */
  1005. {
  1006. 1,
  1007. TLS1_TXT_ADH_WITH_AES_256_SHA,
  1008. TLS1_CK_ADH_WITH_AES_256_SHA,
  1009. SSL_kEDH,
  1010. SSL_aNULL,
  1011. SSL_AES256,
  1012. SSL_SHA1,
  1013. SSL_TLSV1,
  1014. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1015. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1016. 256,
  1017. 256,
  1018. },
  1019. /* TLS v1.2 ciphersuites */
  1020. /* Cipher 3B */
  1021. {
  1022. 1,
  1023. TLS1_TXT_RSA_WITH_NULL_SHA256,
  1024. TLS1_CK_RSA_WITH_NULL_SHA256,
  1025. SSL_kRSA,
  1026. SSL_aRSA,
  1027. SSL_eNULL,
  1028. SSL_SHA256,
  1029. SSL_SSLV3,
  1030. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  1031. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1032. 0,
  1033. 0,
  1034. },
  1035. /* Cipher 3C */
  1036. {
  1037. 1,
  1038. TLS1_TXT_RSA_WITH_AES_128_SHA256,
  1039. TLS1_CK_RSA_WITH_AES_128_SHA256,
  1040. SSL_kRSA,
  1041. SSL_aRSA,
  1042. SSL_AES128,
  1043. SSL_SHA256,
  1044. SSL_TLSV1,
  1045. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1046. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1047. 128,
  1048. 128,
  1049. },
  1050. /* Cipher 3D */
  1051. {
  1052. 1,
  1053. TLS1_TXT_RSA_WITH_AES_256_SHA256,
  1054. TLS1_CK_RSA_WITH_AES_256_SHA256,
  1055. SSL_kRSA,
  1056. SSL_aRSA,
  1057. SSL_AES256,
  1058. SSL_SHA256,
  1059. SSL_TLSV1,
  1060. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1061. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1062. 256,
  1063. 256,
  1064. },
  1065. /* Cipher 3E */
  1066. {
  1067. 0, /* not implemented (non-ephemeral DH) */
  1068. TLS1_TXT_DH_DSS_WITH_AES_128_SHA256,
  1069. TLS1_CK_DH_DSS_WITH_AES_128_SHA256,
  1070. SSL_kDHr,
  1071. SSL_aDH,
  1072. SSL_AES128,
  1073. SSL_SHA256,
  1074. SSL_TLSV1,
  1075. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1076. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1077. 128,
  1078. 128,
  1079. },
  1080. /* Cipher 3F */
  1081. {
  1082. 0, /* not implemented (non-ephemeral DH) */
  1083. TLS1_TXT_DH_RSA_WITH_AES_128_SHA256,
  1084. TLS1_CK_DH_RSA_WITH_AES_128_SHA256,
  1085. SSL_kDHr,
  1086. SSL_aDH,
  1087. SSL_AES128,
  1088. SSL_SHA256,
  1089. SSL_TLSV1,
  1090. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1091. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1092. 128,
  1093. 128,
  1094. },
  1095. /* Cipher 40 */
  1096. {
  1097. 1,
  1098. TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256,
  1099. TLS1_CK_DHE_DSS_WITH_AES_128_SHA256,
  1100. SSL_kEDH,
  1101. SSL_aDSS,
  1102. SSL_AES128,
  1103. SSL_SHA256,
  1104. SSL_TLSV1,
  1105. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1106. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1107. 128,
  1108. 128,
  1109. },
  1110. #ifndef OPENSSL_NO_CAMELLIA
  1111. /* Camellia ciphersuites from RFC4132 (128-bit portion) */
  1112. /* Cipher 41 */
  1113. {
  1114. 1,
  1115. TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1116. TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1117. SSL_kRSA,
  1118. SSL_aRSA,
  1119. SSL_CAMELLIA128,
  1120. SSL_SHA1,
  1121. SSL_TLSV1,
  1122. SSL_NOT_EXP|SSL_HIGH,
  1123. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1124. 128,
  1125. 128,
  1126. },
  1127. /* Cipher 42 */
  1128. {
  1129. 0, /* not implemented (non-ephemeral DH) */
  1130. TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
  1131. TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA,
  1132. SSL_kDHd,
  1133. SSL_aDH,
  1134. SSL_CAMELLIA128,
  1135. SSL_SHA1,
  1136. SSL_TLSV1,
  1137. SSL_NOT_EXP|SSL_HIGH,
  1138. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1139. 128,
  1140. 128,
  1141. },
  1142. /* Cipher 43 */
  1143. {
  1144. 0, /* not implemented (non-ephemeral DH) */
  1145. TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1146. TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1147. SSL_kDHr,
  1148. SSL_aDH,
  1149. SSL_CAMELLIA128,
  1150. SSL_SHA1,
  1151. SSL_TLSV1,
  1152. SSL_NOT_EXP|SSL_HIGH,
  1153. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1154. 128,
  1155. 128,
  1156. },
  1157. /* Cipher 44 */
  1158. {
  1159. 1,
  1160. TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
  1161. TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
  1162. SSL_kEDH,
  1163. SSL_aDSS,
  1164. SSL_CAMELLIA128,
  1165. SSL_SHA1,
  1166. SSL_TLSV1,
  1167. SSL_NOT_EXP|SSL_HIGH,
  1168. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1169. 128,
  1170. 128,
  1171. },
  1172. /* Cipher 45 */
  1173. {
  1174. 1,
  1175. TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1176. TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
  1177. SSL_kEDH,
  1178. SSL_aRSA,
  1179. SSL_CAMELLIA128,
  1180. SSL_SHA1,
  1181. SSL_TLSV1,
  1182. SSL_NOT_EXP|SSL_HIGH,
  1183. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1184. 128,
  1185. 128,
  1186. },
  1187. /* Cipher 46 */
  1188. {
  1189. 1,
  1190. TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA,
  1191. TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA,
  1192. SSL_kEDH,
  1193. SSL_aNULL,
  1194. SSL_CAMELLIA128,
  1195. SSL_SHA1,
  1196. SSL_TLSV1,
  1197. SSL_NOT_EXP|SSL_HIGH,
  1198. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1199. 128,
  1200. 128,
  1201. },
  1202. #endif /* OPENSSL_NO_CAMELLIA */
  1203. #if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES
  1204. /* New TLS Export CipherSuites from expired ID */
  1205. #if 0
  1206. /* Cipher 60 */
  1207. {
  1208. 1,
  1209. TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5,
  1210. TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5,
  1211. SSL_kRSA,
  1212. SSL_aRSA,
  1213. SSL_RC4,
  1214. SSL_MD5,
  1215. SSL_TLSV1,
  1216. SSL_EXPORT|SSL_EXP56,
  1217. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1218. 56,
  1219. 128,
  1220. },
  1221. /* Cipher 61 */
  1222. {
  1223. 1,
  1224. TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
  1225. TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5,
  1226. SSL_kRSA,
  1227. SSL_aRSA,
  1228. SSL_RC2,
  1229. SSL_MD5,
  1230. SSL_TLSV1,
  1231. SSL_EXPORT|SSL_EXP56,
  1232. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1233. 56,
  1234. 128,
  1235. },
  1236. #endif
  1237. /* Cipher 62 */
  1238. {
  1239. 1,
  1240. TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA,
  1241. TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA,
  1242. SSL_kRSA,
  1243. SSL_aRSA,
  1244. SSL_DES,
  1245. SSL_SHA1,
  1246. SSL_TLSV1,
  1247. SSL_EXPORT|SSL_EXP56,
  1248. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1249. 56,
  1250. 56,
  1251. },
  1252. /* Cipher 63 */
  1253. {
  1254. 1,
  1255. TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
  1256. TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA,
  1257. SSL_kEDH,
  1258. SSL_aDSS,
  1259. SSL_DES,
  1260. SSL_SHA1,
  1261. SSL_TLSV1,
  1262. SSL_EXPORT|SSL_EXP56,
  1263. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1264. 56,
  1265. 56,
  1266. },
  1267. /* Cipher 64 */
  1268. {
  1269. 1,
  1270. TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA,
  1271. TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA,
  1272. SSL_kRSA,
  1273. SSL_aRSA,
  1274. SSL_RC4,
  1275. SSL_SHA1,
  1276. SSL_TLSV1,
  1277. SSL_EXPORT|SSL_EXP56,
  1278. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1279. 56,
  1280. 128,
  1281. },
  1282. /* Cipher 65 */
  1283. {
  1284. 1,
  1285. TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
  1286. TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA,
  1287. SSL_kEDH,
  1288. SSL_aDSS,
  1289. SSL_RC4,
  1290. SSL_SHA1,
  1291. SSL_TLSV1,
  1292. SSL_EXPORT|SSL_EXP56,
  1293. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1294. 56,
  1295. 128,
  1296. },
  1297. /* Cipher 66 */
  1298. {
  1299. 1,
  1300. TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA,
  1301. TLS1_CK_DHE_DSS_WITH_RC4_128_SHA,
  1302. SSL_kEDH,
  1303. SSL_aDSS,
  1304. SSL_RC4,
  1305. SSL_SHA1,
  1306. SSL_TLSV1,
  1307. SSL_NOT_EXP|SSL_MEDIUM,
  1308. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1309. 128,
  1310. 128,
  1311. },
  1312. #endif
  1313. /* TLS v1.2 ciphersuites */
  1314. /* Cipher 67 */
  1315. {
  1316. 1,
  1317. TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256,
  1318. TLS1_CK_DHE_RSA_WITH_AES_128_SHA256,
  1319. SSL_kEDH,
  1320. SSL_aRSA,
  1321. SSL_AES128,
  1322. SSL_SHA256,
  1323. SSL_TLSV1,
  1324. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1325. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1326. 128,
  1327. 128,
  1328. },
  1329. /* Cipher 68 */
  1330. {
  1331. 0, /* not implemented (non-ephemeral DH) */
  1332. TLS1_TXT_DH_DSS_WITH_AES_256_SHA256,
  1333. TLS1_CK_DH_DSS_WITH_AES_256_SHA256,
  1334. SSL_kDHr,
  1335. SSL_aDH,
  1336. SSL_AES256,
  1337. SSL_SHA256,
  1338. SSL_TLSV1,
  1339. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1340. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1341. 256,
  1342. 256,
  1343. },
  1344. /* Cipher 69 */
  1345. {
  1346. 0, /* not implemented (non-ephemeral DH) */
  1347. TLS1_TXT_DH_RSA_WITH_AES_256_SHA256,
  1348. TLS1_CK_DH_RSA_WITH_AES_256_SHA256,
  1349. SSL_kDHr,
  1350. SSL_aDH,
  1351. SSL_AES256,
  1352. SSL_SHA256,
  1353. SSL_TLSV1,
  1354. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1355. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1356. 256,
  1357. 256,
  1358. },
  1359. /* Cipher 6A */
  1360. {
  1361. 1,
  1362. TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256,
  1363. TLS1_CK_DHE_DSS_WITH_AES_256_SHA256,
  1364. SSL_kEDH,
  1365. SSL_aDSS,
  1366. SSL_AES256,
  1367. SSL_SHA256,
  1368. SSL_TLSV1,
  1369. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1370. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1371. 256,
  1372. 256,
  1373. },
  1374. /* Cipher 6B */
  1375. {
  1376. 1,
  1377. TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256,
  1378. TLS1_CK_DHE_RSA_WITH_AES_256_SHA256,
  1379. SSL_kEDH,
  1380. SSL_aRSA,
  1381. SSL_AES256,
  1382. SSL_SHA256,
  1383. SSL_TLSV1,
  1384. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1385. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1386. 256,
  1387. 256,
  1388. },
  1389. /* Cipher 6C */
  1390. {
  1391. 1,
  1392. TLS1_TXT_ADH_WITH_AES_128_SHA256,
  1393. TLS1_CK_ADH_WITH_AES_128_SHA256,
  1394. SSL_kEDH,
  1395. SSL_aNULL,
  1396. SSL_AES128,
  1397. SSL_SHA256,
  1398. SSL_TLSV1,
  1399. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1400. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1401. 128,
  1402. 128,
  1403. },
  1404. /* Cipher 6D */
  1405. {
  1406. 1,
  1407. TLS1_TXT_ADH_WITH_AES_256_SHA256,
  1408. TLS1_CK_ADH_WITH_AES_256_SHA256,
  1409. SSL_kEDH,
  1410. SSL_aNULL,
  1411. SSL_AES256,
  1412. SSL_SHA256,
  1413. SSL_TLSV1,
  1414. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1415. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1416. 256,
  1417. 256,
  1418. },
  1419. /* GOST Ciphersuites */
  1420. {
  1421. 1,
  1422. "GOST94-GOST89-GOST89",
  1423. 0x3000080,
  1424. SSL_kGOST,
  1425. SSL_aGOST94,
  1426. SSL_eGOST2814789CNT,
  1427. SSL_GOST89MAC,
  1428. SSL_TLSV1,
  1429. SSL_NOT_EXP|SSL_HIGH,
  1430. SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94|TLS1_STREAM_MAC,
  1431. 256,
  1432. 256
  1433. },
  1434. {
  1435. 1,
  1436. "GOST2001-GOST89-GOST89",
  1437. 0x3000081,
  1438. SSL_kGOST,
  1439. SSL_aGOST01,
  1440. SSL_eGOST2814789CNT,
  1441. SSL_GOST89MAC,
  1442. SSL_TLSV1,
  1443. SSL_NOT_EXP|SSL_HIGH,
  1444. SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94|TLS1_STREAM_MAC,
  1445. 256,
  1446. 256
  1447. },
  1448. {
  1449. 1,
  1450. "GOST94-NULL-GOST94",
  1451. 0x3000082,
  1452. SSL_kGOST,
  1453. SSL_aGOST94,
  1454. SSL_eNULL,
  1455. SSL_GOST94,
  1456. SSL_TLSV1,
  1457. SSL_NOT_EXP|SSL_STRONG_NONE,
  1458. SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94,
  1459. 0,
  1460. 0
  1461. },
  1462. {
  1463. 1,
  1464. "GOST2001-NULL-GOST94",
  1465. 0x3000083,
  1466. SSL_kGOST,
  1467. SSL_aGOST01,
  1468. SSL_eNULL,
  1469. SSL_GOST94,
  1470. SSL_TLSV1,
  1471. SSL_NOT_EXP|SSL_STRONG_NONE,
  1472. SSL_HANDSHAKE_MAC_GOST94|TLS1_PRF_GOST94,
  1473. 0,
  1474. 0
  1475. },
  1476. #ifndef OPENSSL_NO_CAMELLIA
  1477. /* Camellia ciphersuites from RFC4132 (256-bit portion) */
  1478. /* Cipher 84 */
  1479. {
  1480. 1,
  1481. TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1482. TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1483. SSL_kRSA,
  1484. SSL_aRSA,
  1485. SSL_CAMELLIA256,
  1486. SSL_SHA1,
  1487. SSL_TLSV1,
  1488. SSL_NOT_EXP|SSL_HIGH,
  1489. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1490. 256,
  1491. 256,
  1492. },
  1493. /* Cipher 85 */
  1494. {
  1495. 0, /* not implemented (non-ephemeral DH) */
  1496. TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
  1497. TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA,
  1498. SSL_kDHd,
  1499. SSL_aDH,
  1500. SSL_CAMELLIA256,
  1501. SSL_SHA1,
  1502. SSL_TLSV1,
  1503. SSL_NOT_EXP|SSL_HIGH,
  1504. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1505. 256,
  1506. 256,
  1507. },
  1508. /* Cipher 86 */
  1509. {
  1510. 0, /* not implemented (non-ephemeral DH) */
  1511. TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1512. TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1513. SSL_kDHr,
  1514. SSL_aDH,
  1515. SSL_CAMELLIA256,
  1516. SSL_SHA1,
  1517. SSL_TLSV1,
  1518. SSL_NOT_EXP|SSL_HIGH,
  1519. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1520. 256,
  1521. 256,
  1522. },
  1523. /* Cipher 87 */
  1524. {
  1525. 1,
  1526. TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
  1527. TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
  1528. SSL_kEDH,
  1529. SSL_aDSS,
  1530. SSL_CAMELLIA256,
  1531. SSL_SHA1,
  1532. SSL_TLSV1,
  1533. SSL_NOT_EXP|SSL_HIGH,
  1534. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1535. 256,
  1536. 256,
  1537. },
  1538. /* Cipher 88 */
  1539. {
  1540. 1,
  1541. TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1542. TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
  1543. SSL_kEDH,
  1544. SSL_aRSA,
  1545. SSL_CAMELLIA256,
  1546. SSL_SHA1,
  1547. SSL_TLSV1,
  1548. SSL_NOT_EXP|SSL_HIGH,
  1549. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1550. 256,
  1551. 256,
  1552. },
  1553. /* Cipher 89 */
  1554. {
  1555. 1,
  1556. TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA,
  1557. TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA,
  1558. SSL_kEDH,
  1559. SSL_aNULL,
  1560. SSL_CAMELLIA256,
  1561. SSL_SHA1,
  1562. SSL_TLSV1,
  1563. SSL_NOT_EXP|SSL_HIGH,
  1564. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1565. 256,
  1566. 256,
  1567. },
  1568. #endif /* OPENSSL_NO_CAMELLIA */
  1569. #ifndef OPENSSL_NO_PSK
  1570. /* Cipher 8A */
  1571. {
  1572. 1,
  1573. TLS1_TXT_PSK_WITH_RC4_128_SHA,
  1574. TLS1_CK_PSK_WITH_RC4_128_SHA,
  1575. SSL_kPSK,
  1576. SSL_aPSK,
  1577. SSL_RC4,
  1578. SSL_SHA1,
  1579. SSL_TLSV1,
  1580. SSL_NOT_EXP|SSL_MEDIUM,
  1581. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1582. 128,
  1583. 128,
  1584. },
  1585. /* Cipher 8B */
  1586. {
  1587. 1,
  1588. TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA,
  1589. TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA,
  1590. SSL_kPSK,
  1591. SSL_aPSK,
  1592. SSL_3DES,
  1593. SSL_SHA1,
  1594. SSL_TLSV1,
  1595. SSL_NOT_EXP|SSL_HIGH,
  1596. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1597. 168,
  1598. 168,
  1599. },
  1600. /* Cipher 8C */
  1601. {
  1602. 1,
  1603. TLS1_TXT_PSK_WITH_AES_128_CBC_SHA,
  1604. TLS1_CK_PSK_WITH_AES_128_CBC_SHA,
  1605. SSL_kPSK,
  1606. SSL_aPSK,
  1607. SSL_AES128,
  1608. SSL_SHA1,
  1609. SSL_TLSV1,
  1610. SSL_NOT_EXP|SSL_HIGH,
  1611. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1612. 128,
  1613. 128,
  1614. },
  1615. /* Cipher 8D */
  1616. {
  1617. 1,
  1618. TLS1_TXT_PSK_WITH_AES_256_CBC_SHA,
  1619. TLS1_CK_PSK_WITH_AES_256_CBC_SHA,
  1620. SSL_kPSK,
  1621. SSL_aPSK,
  1622. SSL_AES256,
  1623. SSL_SHA1,
  1624. SSL_TLSV1,
  1625. SSL_NOT_EXP|SSL_HIGH,
  1626. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1627. 256,
  1628. 256,
  1629. },
  1630. #endif /* OPENSSL_NO_PSK */
  1631. #ifndef OPENSSL_NO_SEED
  1632. /* SEED ciphersuites from RFC4162 */
  1633. /* Cipher 96 */
  1634. {
  1635. 1,
  1636. TLS1_TXT_RSA_WITH_SEED_SHA,
  1637. TLS1_CK_RSA_WITH_SEED_SHA,
  1638. SSL_kRSA,
  1639. SSL_aRSA,
  1640. SSL_SEED,
  1641. SSL_SHA1,
  1642. SSL_TLSV1,
  1643. SSL_NOT_EXP|SSL_MEDIUM,
  1644. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1645. 128,
  1646. 128,
  1647. },
  1648. /* Cipher 97 */
  1649. {
  1650. 0, /* not implemented (non-ephemeral DH) */
  1651. TLS1_TXT_DH_DSS_WITH_SEED_SHA,
  1652. TLS1_CK_DH_DSS_WITH_SEED_SHA,
  1653. SSL_kDHd,
  1654. SSL_aDH,
  1655. SSL_SEED,
  1656. SSL_SHA1,
  1657. SSL_TLSV1,
  1658. SSL_NOT_EXP|SSL_MEDIUM,
  1659. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1660. 128,
  1661. 128,
  1662. },
  1663. /* Cipher 98 */
  1664. {
  1665. 0, /* not implemented (non-ephemeral DH) */
  1666. TLS1_TXT_DH_RSA_WITH_SEED_SHA,
  1667. TLS1_CK_DH_RSA_WITH_SEED_SHA,
  1668. SSL_kDHr,
  1669. SSL_aDH,
  1670. SSL_SEED,
  1671. SSL_SHA1,
  1672. SSL_TLSV1,
  1673. SSL_NOT_EXP|SSL_MEDIUM,
  1674. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1675. 128,
  1676. 128,
  1677. },
  1678. /* Cipher 99 */
  1679. {
  1680. 1,
  1681. TLS1_TXT_DHE_DSS_WITH_SEED_SHA,
  1682. TLS1_CK_DHE_DSS_WITH_SEED_SHA,
  1683. SSL_kEDH,
  1684. SSL_aDSS,
  1685. SSL_SEED,
  1686. SSL_SHA1,
  1687. SSL_TLSV1,
  1688. SSL_NOT_EXP|SSL_MEDIUM,
  1689. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1690. 128,
  1691. 128,
  1692. },
  1693. /* Cipher 9A */
  1694. {
  1695. 1,
  1696. TLS1_TXT_DHE_RSA_WITH_SEED_SHA,
  1697. TLS1_CK_DHE_RSA_WITH_SEED_SHA,
  1698. SSL_kEDH,
  1699. SSL_aRSA,
  1700. SSL_SEED,
  1701. SSL_SHA1,
  1702. SSL_TLSV1,
  1703. SSL_NOT_EXP|SSL_MEDIUM,
  1704. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1705. 128,
  1706. 128,
  1707. },
  1708. /* Cipher 9B */
  1709. {
  1710. 1,
  1711. TLS1_TXT_ADH_WITH_SEED_SHA,
  1712. TLS1_CK_ADH_WITH_SEED_SHA,
  1713. SSL_kEDH,
  1714. SSL_aNULL,
  1715. SSL_SEED,
  1716. SSL_SHA1,
  1717. SSL_TLSV1,
  1718. SSL_NOT_EXP|SSL_MEDIUM,
  1719. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1720. 128,
  1721. 128,
  1722. },
  1723. #endif /* OPENSSL_NO_SEED */
  1724. /* GCM ciphersuites from RFC5288 */
  1725. /* Cipher 9C */
  1726. {
  1727. 1,
  1728. TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256,
  1729. TLS1_CK_RSA_WITH_AES_128_GCM_SHA256,
  1730. SSL_kRSA,
  1731. SSL_aRSA,
  1732. SSL_AES128GCM,
  1733. SSL_AEAD,
  1734. SSL_TLSV1_2,
  1735. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1736. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1737. 128,
  1738. 128,
  1739. },
  1740. /* Cipher 9D */
  1741. {
  1742. 1,
  1743. TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384,
  1744. TLS1_CK_RSA_WITH_AES_256_GCM_SHA384,
  1745. SSL_kRSA,
  1746. SSL_aRSA,
  1747. SSL_AES256GCM,
  1748. SSL_AEAD,
  1749. SSL_TLSV1_2,
  1750. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1751. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1752. 256,
  1753. 256,
  1754. },
  1755. /* Cipher 9E */
  1756. {
  1757. 1,
  1758. TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256,
  1759. TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256,
  1760. SSL_kEDH,
  1761. SSL_aRSA,
  1762. SSL_AES128GCM,
  1763. SSL_AEAD,
  1764. SSL_TLSV1_2,
  1765. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1766. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1767. 128,
  1768. 128,
  1769. },
  1770. /* Cipher 9F */
  1771. {
  1772. 1,
  1773. TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384,
  1774. TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384,
  1775. SSL_kEDH,
  1776. SSL_aRSA,
  1777. SSL_AES256GCM,
  1778. SSL_AEAD,
  1779. SSL_TLSV1_2,
  1780. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1781. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1782. 256,
  1783. 256,
  1784. },
  1785. /* Cipher A0 */
  1786. {
  1787. 0,
  1788. TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256,
  1789. TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256,
  1790. SSL_kDHr,
  1791. SSL_aDH,
  1792. SSL_AES128GCM,
  1793. SSL_AEAD,
  1794. SSL_TLSV1_2,
  1795. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1796. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1797. 128,
  1798. 128,
  1799. },
  1800. /* Cipher A1 */
  1801. {
  1802. 0,
  1803. TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384,
  1804. TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384,
  1805. SSL_kDHr,
  1806. SSL_aDH,
  1807. SSL_AES256GCM,
  1808. SSL_AEAD,
  1809. SSL_TLSV1_2,
  1810. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1811. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1812. 256,
  1813. 256,
  1814. },
  1815. /* Cipher A2 */
  1816. {
  1817. 1,
  1818. TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256,
  1819. TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256,
  1820. SSL_kEDH,
  1821. SSL_aDSS,
  1822. SSL_AES128GCM,
  1823. SSL_AEAD,
  1824. SSL_TLSV1_2,
  1825. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1826. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1827. 128,
  1828. 128,
  1829. },
  1830. /* Cipher A3 */
  1831. {
  1832. 1,
  1833. TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384,
  1834. TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384,
  1835. SSL_kEDH,
  1836. SSL_aDSS,
  1837. SSL_AES256GCM,
  1838. SSL_AEAD,
  1839. SSL_TLSV1_2,
  1840. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1841. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1842. 256,
  1843. 256,
  1844. },
  1845. /* Cipher A4 */
  1846. {
  1847. 0,
  1848. TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256,
  1849. TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256,
  1850. SSL_kDHr,
  1851. SSL_aDH,
  1852. SSL_AES128GCM,
  1853. SSL_AEAD,
  1854. SSL_TLSV1_2,
  1855. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1856. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1857. 128,
  1858. 128,
  1859. },
  1860. /* Cipher A5 */
  1861. {
  1862. 0,
  1863. TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384,
  1864. TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384,
  1865. SSL_kDHr,
  1866. SSL_aDH,
  1867. SSL_AES256GCM,
  1868. SSL_AEAD,
  1869. SSL_TLSV1_2,
  1870. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1871. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1872. 256,
  1873. 256,
  1874. },
  1875. /* Cipher A6 */
  1876. {
  1877. 1,
  1878. TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256,
  1879. TLS1_CK_ADH_WITH_AES_128_GCM_SHA256,
  1880. SSL_kEDH,
  1881. SSL_aNULL,
  1882. SSL_AES128GCM,
  1883. SSL_AEAD,
  1884. SSL_TLSV1_2,
  1885. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1886. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  1887. 128,
  1888. 128,
  1889. },
  1890. /* Cipher A7 */
  1891. {
  1892. 1,
  1893. TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384,
  1894. TLS1_CK_ADH_WITH_AES_256_GCM_SHA384,
  1895. SSL_kEDH,
  1896. SSL_aNULL,
  1897. SSL_AES256GCM,
  1898. SSL_AEAD,
  1899. SSL_TLSV1_2,
  1900. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1901. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  1902. 256,
  1903. 256,
  1904. },
  1905. #ifndef OPENSSL_NO_ECDH
  1906. /* Cipher C001 */
  1907. {
  1908. 1,
  1909. TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA,
  1910. TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA,
  1911. SSL_kECDHe,
  1912. SSL_aECDH,
  1913. SSL_eNULL,
  1914. SSL_SHA1,
  1915. SSL_TLSV1,
  1916. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  1917. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1918. 0,
  1919. 0,
  1920. },
  1921. /* Cipher C002 */
  1922. {
  1923. 1,
  1924. TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA,
  1925. TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA,
  1926. SSL_kECDHe,
  1927. SSL_aECDH,
  1928. SSL_RC4,
  1929. SSL_SHA1,
  1930. SSL_TLSV1,
  1931. SSL_NOT_EXP|SSL_MEDIUM,
  1932. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1933. 128,
  1934. 128,
  1935. },
  1936. /* Cipher C003 */
  1937. {
  1938. 1,
  1939. TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
  1940. TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA,
  1941. SSL_kECDHe,
  1942. SSL_aECDH,
  1943. SSL_3DES,
  1944. SSL_SHA1,
  1945. SSL_TLSV1,
  1946. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1947. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1948. 168,
  1949. 168,
  1950. },
  1951. /* Cipher C004 */
  1952. {
  1953. 1,
  1954. TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
  1955. TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
  1956. SSL_kECDHe,
  1957. SSL_aECDH,
  1958. SSL_AES128,
  1959. SSL_SHA1,
  1960. SSL_TLSV1,
  1961. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1962. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1963. 128,
  1964. 128,
  1965. },
  1966. /* Cipher C005 */
  1967. {
  1968. 1,
  1969. TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
  1970. TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
  1971. SSL_kECDHe,
  1972. SSL_aECDH,
  1973. SSL_AES256,
  1974. SSL_SHA1,
  1975. SSL_TLSV1,
  1976. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  1977. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1978. 256,
  1979. 256,
  1980. },
  1981. /* Cipher C006 */
  1982. {
  1983. 1,
  1984. TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA,
  1985. TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA,
  1986. SSL_kEECDH,
  1987. SSL_aECDSA,
  1988. SSL_eNULL,
  1989. SSL_SHA1,
  1990. SSL_TLSV1,
  1991. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  1992. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  1993. 0,
  1994. 0,
  1995. },
  1996. /* Cipher C007 */
  1997. {
  1998. 1,
  1999. TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA,
  2000. TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA,
  2001. SSL_kEECDH,
  2002. SSL_aECDSA,
  2003. SSL_RC4,
  2004. SSL_SHA1,
  2005. SSL_TLSV1,
  2006. SSL_NOT_EXP|SSL_MEDIUM,
  2007. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2008. 128,
  2009. 128,
  2010. },
  2011. /* Cipher C008 */
  2012. {
  2013. 1,
  2014. TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
  2015. TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA,
  2016. SSL_kEECDH,
  2017. SSL_aECDSA,
  2018. SSL_3DES,
  2019. SSL_SHA1,
  2020. SSL_TLSV1,
  2021. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2022. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2023. 168,
  2024. 168,
  2025. },
  2026. /* Cipher C009 */
  2027. {
  2028. 1,
  2029. TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
  2030. TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
  2031. SSL_kEECDH,
  2032. SSL_aECDSA,
  2033. SSL_AES128,
  2034. SSL_SHA1,
  2035. SSL_TLSV1,
  2036. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2037. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2038. 128,
  2039. 128,
  2040. },
  2041. /* Cipher C00A */
  2042. {
  2043. 1,
  2044. TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
  2045. TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
  2046. SSL_kEECDH,
  2047. SSL_aECDSA,
  2048. SSL_AES256,
  2049. SSL_SHA1,
  2050. SSL_TLSV1,
  2051. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2052. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2053. 256,
  2054. 256,
  2055. },
  2056. /* Cipher C00B */
  2057. {
  2058. 1,
  2059. TLS1_TXT_ECDH_RSA_WITH_NULL_SHA,
  2060. TLS1_CK_ECDH_RSA_WITH_NULL_SHA,
  2061. SSL_kECDHr,
  2062. SSL_aECDH,
  2063. SSL_eNULL,
  2064. SSL_SHA1,
  2065. SSL_TLSV1,
  2066. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  2067. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2068. 0,
  2069. 0,
  2070. },
  2071. /* Cipher C00C */
  2072. {
  2073. 1,
  2074. TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA,
  2075. TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA,
  2076. SSL_kECDHr,
  2077. SSL_aECDH,
  2078. SSL_RC4,
  2079. SSL_SHA1,
  2080. SSL_TLSV1,
  2081. SSL_NOT_EXP|SSL_MEDIUM,
  2082. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2083. 128,
  2084. 128,
  2085. },
  2086. /* Cipher C00D */
  2087. {
  2088. 1,
  2089. TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA,
  2090. TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA,
  2091. SSL_kECDHr,
  2092. SSL_aECDH,
  2093. SSL_3DES,
  2094. SSL_SHA1,
  2095. SSL_TLSV1,
  2096. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2097. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2098. 168,
  2099. 168,
  2100. },
  2101. /* Cipher C00E */
  2102. {
  2103. 1,
  2104. TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA,
  2105. TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA,
  2106. SSL_kECDHr,
  2107. SSL_aECDH,
  2108. SSL_AES128,
  2109. SSL_SHA1,
  2110. SSL_TLSV1,
  2111. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2112. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2113. 128,
  2114. 128,
  2115. },
  2116. /* Cipher C00F */
  2117. {
  2118. 1,
  2119. TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA,
  2120. TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA,
  2121. SSL_kECDHr,
  2122. SSL_aECDH,
  2123. SSL_AES256,
  2124. SSL_SHA1,
  2125. SSL_TLSV1,
  2126. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2127. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2128. 256,
  2129. 256,
  2130. },
  2131. /* Cipher C010 */
  2132. {
  2133. 1,
  2134. TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA,
  2135. TLS1_CK_ECDHE_RSA_WITH_NULL_SHA,
  2136. SSL_kEECDH,
  2137. SSL_aRSA,
  2138. SSL_eNULL,
  2139. SSL_SHA1,
  2140. SSL_TLSV1,
  2141. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  2142. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2143. 0,
  2144. 0,
  2145. },
  2146. /* Cipher C011 */
  2147. {
  2148. 1,
  2149. TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA,
  2150. TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA,
  2151. SSL_kEECDH,
  2152. SSL_aRSA,
  2153. SSL_RC4,
  2154. SSL_SHA1,
  2155. SSL_TLSV1,
  2156. SSL_NOT_EXP|SSL_MEDIUM,
  2157. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2158. 128,
  2159. 128,
  2160. },
  2161. /* Cipher C012 */
  2162. {
  2163. 1,
  2164. TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
  2165. TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA,
  2166. SSL_kEECDH,
  2167. SSL_aRSA,
  2168. SSL_3DES,
  2169. SSL_SHA1,
  2170. SSL_TLSV1,
  2171. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2172. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2173. 168,
  2174. 168,
  2175. },
  2176. /* Cipher C013 */
  2177. {
  2178. 1,
  2179. TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA,
  2180. TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA,
  2181. SSL_kEECDH,
  2182. SSL_aRSA,
  2183. SSL_AES128,
  2184. SSL_SHA1,
  2185. SSL_TLSV1,
  2186. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2187. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2188. 128,
  2189. 128,
  2190. },
  2191. /* Cipher C014 */
  2192. {
  2193. 1,
  2194. TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA,
  2195. TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA,
  2196. SSL_kEECDH,
  2197. SSL_aRSA,
  2198. SSL_AES256,
  2199. SSL_SHA1,
  2200. SSL_TLSV1,
  2201. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2202. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2203. 256,
  2204. 256,
  2205. },
  2206. /* Cipher C015 */
  2207. {
  2208. 1,
  2209. TLS1_TXT_ECDH_anon_WITH_NULL_SHA,
  2210. TLS1_CK_ECDH_anon_WITH_NULL_SHA,
  2211. SSL_kEECDH,
  2212. SSL_aNULL,
  2213. SSL_eNULL,
  2214. SSL_SHA1,
  2215. SSL_TLSV1,
  2216. SSL_NOT_EXP|SSL_STRONG_NONE|SSL_FIPS,
  2217. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2218. 0,
  2219. 0,
  2220. },
  2221. /* Cipher C016 */
  2222. {
  2223. 1,
  2224. TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA,
  2225. TLS1_CK_ECDH_anon_WITH_RC4_128_SHA,
  2226. SSL_kEECDH,
  2227. SSL_aNULL,
  2228. SSL_RC4,
  2229. SSL_SHA1,
  2230. SSL_TLSV1,
  2231. SSL_NOT_EXP|SSL_MEDIUM,
  2232. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2233. 128,
  2234. 128,
  2235. },
  2236. /* Cipher C017 */
  2237. {
  2238. 1,
  2239. TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA,
  2240. TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA,
  2241. SSL_kEECDH,
  2242. SSL_aNULL,
  2243. SSL_3DES,
  2244. SSL_SHA1,
  2245. SSL_TLSV1,
  2246. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2247. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2248. 168,
  2249. 168,
  2250. },
  2251. /* Cipher C018 */
  2252. {
  2253. 1,
  2254. TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA,
  2255. TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA,
  2256. SSL_kEECDH,
  2257. SSL_aNULL,
  2258. SSL_AES128,
  2259. SSL_SHA1,
  2260. SSL_TLSV1,
  2261. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2262. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2263. 128,
  2264. 128,
  2265. },
  2266. /* Cipher C019 */
  2267. {
  2268. 1,
  2269. TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA,
  2270. TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA,
  2271. SSL_kEECDH,
  2272. SSL_aNULL,
  2273. SSL_AES256,
  2274. SSL_SHA1,
  2275. SSL_TLSV1,
  2276. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2277. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2278. 256,
  2279. 256,
  2280. },
  2281. #endif /* OPENSSL_NO_ECDH */
  2282. #ifndef OPENSSL_NO_SRP
  2283. /* Cipher C01A */
  2284. {
  2285. 1,
  2286. TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
  2287. TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA,
  2288. SSL_kSRP,
  2289. SSL_aNULL,
  2290. SSL_3DES,
  2291. SSL_SHA1,
  2292. SSL_TLSV1,
  2293. SSL_NOT_EXP|SSL_HIGH,
  2294. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2295. 168,
  2296. 168,
  2297. },
  2298. /* Cipher C01B */
  2299. {
  2300. 1,
  2301. TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
  2302. TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA,
  2303. SSL_kSRP,
  2304. SSL_aRSA,
  2305. SSL_3DES,
  2306. SSL_SHA1,
  2307. SSL_TLSV1,
  2308. SSL_NOT_EXP|SSL_HIGH,
  2309. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2310. 168,
  2311. 168,
  2312. },
  2313. /* Cipher C01C */
  2314. {
  2315. 1,
  2316. TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
  2317. TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA,
  2318. SSL_kSRP,
  2319. SSL_aDSS,
  2320. SSL_3DES,
  2321. SSL_SHA1,
  2322. SSL_TLSV1,
  2323. SSL_NOT_EXP|SSL_HIGH,
  2324. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2325. 168,
  2326. 168,
  2327. },
  2328. /* Cipher C01D */
  2329. {
  2330. 1,
  2331. TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA,
  2332. TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA,
  2333. SSL_kSRP,
  2334. SSL_aNULL,
  2335. SSL_AES128,
  2336. SSL_SHA1,
  2337. SSL_TLSV1,
  2338. SSL_NOT_EXP|SSL_HIGH,
  2339. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2340. 128,
  2341. 128,
  2342. },
  2343. /* Cipher C01E */
  2344. {
  2345. 1,
  2346. TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
  2347. TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA,
  2348. SSL_kSRP,
  2349. SSL_aRSA,
  2350. SSL_AES128,
  2351. SSL_SHA1,
  2352. SSL_TLSV1,
  2353. SSL_NOT_EXP|SSL_HIGH,
  2354. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2355. 128,
  2356. 128,
  2357. },
  2358. /* Cipher C01F */
  2359. {
  2360. 1,
  2361. TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
  2362. TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA,
  2363. SSL_kSRP,
  2364. SSL_aDSS,
  2365. SSL_AES128,
  2366. SSL_SHA1,
  2367. SSL_TLSV1,
  2368. SSL_NOT_EXP|SSL_HIGH,
  2369. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2370. 128,
  2371. 128,
  2372. },
  2373. /* Cipher C020 */
  2374. {
  2375. 1,
  2376. TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA,
  2377. TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA,
  2378. SSL_kSRP,
  2379. SSL_aNULL,
  2380. SSL_AES256,
  2381. SSL_SHA1,
  2382. SSL_TLSV1,
  2383. SSL_NOT_EXP|SSL_HIGH,
  2384. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2385. 256,
  2386. 256,
  2387. },
  2388. /* Cipher C021 */
  2389. {
  2390. 1,
  2391. TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
  2392. TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA,
  2393. SSL_kSRP,
  2394. SSL_aRSA,
  2395. SSL_AES256,
  2396. SSL_SHA1,
  2397. SSL_TLSV1,
  2398. SSL_NOT_EXP|SSL_HIGH,
  2399. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2400. 256,
  2401. 256,
  2402. },
  2403. /* Cipher C022 */
  2404. {
  2405. 1,
  2406. TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
  2407. TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA,
  2408. SSL_kSRP,
  2409. SSL_aDSS,
  2410. SSL_AES256,
  2411. SSL_SHA1,
  2412. SSL_TLSV1,
  2413. SSL_NOT_EXP|SSL_HIGH,
  2414. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2415. 256,
  2416. 256,
  2417. },
  2418. #endif /* OPENSSL_NO_SRP */
  2419. #ifndef OPENSSL_NO_ECDH
  2420. /* HMAC based TLS v1.2 ciphersuites from RFC5289 */
  2421. /* Cipher C023 */
  2422. {
  2423. 1,
  2424. TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256,
  2425. TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256,
  2426. SSL_kEECDH,
  2427. SSL_aECDSA,
  2428. SSL_AES128,
  2429. SSL_SHA256,
  2430. SSL_TLSV1_2,
  2431. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2432. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2433. 128,
  2434. 128,
  2435. },
  2436. /* Cipher C024 */
  2437. {
  2438. 1,
  2439. TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384,
  2440. TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384,
  2441. SSL_kEECDH,
  2442. SSL_aECDSA,
  2443. SSL_AES256,
  2444. SSL_SHA384,
  2445. SSL_TLSV1_2,
  2446. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2447. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2448. 256,
  2449. 256,
  2450. },
  2451. /* Cipher C025 */
  2452. {
  2453. 1,
  2454. TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256,
  2455. TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256,
  2456. SSL_kECDHe,
  2457. SSL_aECDH,
  2458. SSL_AES128,
  2459. SSL_SHA256,
  2460. SSL_TLSV1_2,
  2461. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2462. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2463. 128,
  2464. 128,
  2465. },
  2466. /* Cipher C026 */
  2467. {
  2468. 1,
  2469. TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384,
  2470. TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384,
  2471. SSL_kECDHe,
  2472. SSL_aECDH,
  2473. SSL_AES256,
  2474. SSL_SHA384,
  2475. SSL_TLSV1_2,
  2476. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2477. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2478. 256,
  2479. 256,
  2480. },
  2481. /* Cipher C027 */
  2482. {
  2483. 1,
  2484. TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256,
  2485. TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256,
  2486. SSL_kEECDH,
  2487. SSL_aRSA,
  2488. SSL_AES128,
  2489. SSL_SHA256,
  2490. SSL_TLSV1_2,
  2491. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2492. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2493. 128,
  2494. 128,
  2495. },
  2496. /* Cipher C028 */
  2497. {
  2498. 1,
  2499. TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384,
  2500. TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384,
  2501. SSL_kEECDH,
  2502. SSL_aRSA,
  2503. SSL_AES256,
  2504. SSL_SHA384,
  2505. SSL_TLSV1_2,
  2506. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2507. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2508. 256,
  2509. 256,
  2510. },
  2511. /* Cipher C029 */
  2512. {
  2513. 1,
  2514. TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256,
  2515. TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256,
  2516. SSL_kECDHe,
  2517. SSL_aECDH,
  2518. SSL_AES128,
  2519. SSL_SHA256,
  2520. SSL_TLSV1_2,
  2521. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2522. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2523. 128,
  2524. 128,
  2525. },
  2526. /* Cipher C02A */
  2527. {
  2528. 1,
  2529. TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384,
  2530. TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384,
  2531. SSL_kECDHe,
  2532. SSL_aECDH,
  2533. SSL_AES256,
  2534. SSL_SHA384,
  2535. SSL_TLSV1_2,
  2536. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2537. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2538. 256,
  2539. 256,
  2540. },
  2541. /* GCM based TLS v1.2 ciphersuites from RFC5289 */
  2542. /* Cipher C02B */
  2543. {
  2544. 1,
  2545. TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
  2546. TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
  2547. SSL_kEECDH,
  2548. SSL_aECDSA,
  2549. SSL_AES128GCM,
  2550. SSL_AEAD,
  2551. SSL_TLSV1_2,
  2552. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2553. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2554. 128,
  2555. 128,
  2556. },
  2557. /* Cipher C02C */
  2558. {
  2559. 1,
  2560. TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
  2561. TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
  2562. SSL_kEECDH,
  2563. SSL_aECDSA,
  2564. SSL_AES256GCM,
  2565. SSL_AEAD,
  2566. SSL_TLSV1_2,
  2567. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2568. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2569. 256,
  2570. 256,
  2571. },
  2572. /* Cipher C02D */
  2573. {
  2574. 1,
  2575. TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
  2576. TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256,
  2577. SSL_kECDHe,
  2578. SSL_aECDH,
  2579. SSL_AES128GCM,
  2580. SSL_AEAD,
  2581. SSL_TLSV1_2,
  2582. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2583. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2584. 128,
  2585. 128,
  2586. },
  2587. /* Cipher C02E */
  2588. {
  2589. 1,
  2590. TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
  2591. TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384,
  2592. SSL_kECDHe,
  2593. SSL_aECDH,
  2594. SSL_AES256GCM,
  2595. SSL_AEAD,
  2596. SSL_TLSV1_2,
  2597. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2598. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2599. 256,
  2600. 256,
  2601. },
  2602. /* Cipher C02F */
  2603. {
  2604. 1,
  2605. TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
  2606. TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
  2607. SSL_kEECDH,
  2608. SSL_aRSA,
  2609. SSL_AES128GCM,
  2610. SSL_AEAD,
  2611. SSL_TLSV1_2,
  2612. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2613. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2614. 128,
  2615. 128,
  2616. },
  2617. /* Cipher C030 */
  2618. {
  2619. 1,
  2620. TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
  2621. TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
  2622. SSL_kEECDH,
  2623. SSL_aRSA,
  2624. SSL_AES256GCM,
  2625. SSL_AEAD,
  2626. SSL_TLSV1_2,
  2627. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2628. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2629. 256,
  2630. 256,
  2631. },
  2632. /* Cipher C031 */
  2633. {
  2634. 1,
  2635. TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256,
  2636. TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256,
  2637. SSL_kECDHe,
  2638. SSL_aECDH,
  2639. SSL_AES128GCM,
  2640. SSL_AEAD,
  2641. SSL_TLSV1_2,
  2642. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2643. SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
  2644. 128,
  2645. 128,
  2646. },
  2647. /* Cipher C032 */
  2648. {
  2649. 1,
  2650. TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384,
  2651. TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384,
  2652. SSL_kECDHe,
  2653. SSL_aECDH,
  2654. SSL_AES256GCM,
  2655. SSL_AEAD,
  2656. SSL_TLSV1_2,
  2657. SSL_NOT_EXP|SSL_HIGH|SSL_FIPS,
  2658. SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
  2659. 256,
  2660. 256,
  2661. },
  2662. #endif /* OPENSSL_NO_ECDH */
  2663. #ifdef TEMP_GOST_TLS
  2664. /* Cipher FF00 */
  2665. {
  2666. 1,
  2667. "GOST-MD5",
  2668. 0x0300ff00,
  2669. SSL_kRSA,
  2670. SSL_aRSA,
  2671. SSL_eGOST2814789CNT,
  2672. SSL_MD5,
  2673. SSL_TLSV1,
  2674. SSL_NOT_EXP|SSL_HIGH,
  2675. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2676. 256,
  2677. 256,
  2678. },
  2679. {
  2680. 1,
  2681. "GOST-GOST94",
  2682. 0x0300ff01,
  2683. SSL_kRSA,
  2684. SSL_aRSA,
  2685. SSL_eGOST2814789CNT,
  2686. SSL_GOST94,
  2687. SSL_TLSV1,
  2688. SSL_NOT_EXP|SSL_HIGH,
  2689. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2690. 256,
  2691. 256
  2692. },
  2693. {
  2694. 1,
  2695. "GOST-GOST89MAC",
  2696. 0x0300ff02,
  2697. SSL_kRSA,
  2698. SSL_aRSA,
  2699. SSL_eGOST2814789CNT,
  2700. SSL_GOST89MAC,
  2701. SSL_TLSV1,
  2702. SSL_NOT_EXP|SSL_HIGH,
  2703. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
  2704. 256,
  2705. 256
  2706. },
  2707. {
  2708. 1,
  2709. "GOST-GOST89STREAM",
  2710. 0x0300ff03,
  2711. SSL_kRSA,
  2712. SSL_aRSA,
  2713. SSL_eGOST2814789CNT,
  2714. SSL_GOST89MAC,
  2715. SSL_TLSV1,
  2716. SSL_NOT_EXP|SSL_HIGH,
  2717. SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF|TLS1_STREAM_MAC,
  2718. 256,
  2719. 256
  2720. },
  2721. #endif
  2722. /* end of list */
  2723. };
  2724. SSL3_ENC_METHOD SSLv3_enc_data={
  2725. ssl3_enc,
  2726. n_ssl3_mac,
  2727. ssl3_setup_key_block,
  2728. ssl3_generate_master_secret,
  2729. ssl3_change_cipher_state,
  2730. ssl3_final_finish_mac,
  2731. MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH,
  2732. ssl3_cert_verify_mac,
  2733. SSL3_MD_CLIENT_FINISHED_CONST,4,
  2734. SSL3_MD_SERVER_FINISHED_CONST,4,
  2735. ssl3_alert_code,
  2736. };
  2737. long ssl3_default_timeout(void)
  2738. {
  2739. /* 2 hours, the 24 hours mentioned in the SSLv3 spec
  2740. * is way too long for http, the cache would over fill */
  2741. return(60*60*2);
  2742. }
  2743. int ssl3_num_ciphers(void)
  2744. {
  2745. return(SSL3_NUM_CIPHERS);
  2746. }
  2747. const SSL_CIPHER *ssl3_get_cipher(unsigned int u)
  2748. {
  2749. if (u < SSL3_NUM_CIPHERS)
  2750. return(&(ssl3_ciphers[SSL3_NUM_CIPHERS-1-u]));
  2751. else
  2752. return(NULL);
  2753. }
  2754. int ssl3_pending(const SSL *s)
  2755. {
  2756. if (s->rstate == SSL_ST_READ_BODY)
  2757. return 0;
  2758. return (s->s3->rrec.type == SSL3_RT_APPLICATION_DATA) ? s->s3->rrec.length : 0;
  2759. }
  2760. int ssl3_new(SSL *s)
  2761. {
  2762. SSL3_STATE *s3;
  2763. if ((s3=OPENSSL_malloc(sizeof *s3)) == NULL) goto err;
  2764. memset(s3,0,sizeof *s3);
  2765. memset(s3->rrec.seq_num,0,sizeof(s3->rrec.seq_num));
  2766. memset(s3->wrec.seq_num,0,sizeof(s3->wrec.seq_num));
  2767. s->s3=s3;
  2768. #ifndef OPENSSL_NO_SRP
  2769. SSL_SRP_CTX_init(s);
  2770. #endif
  2771. s->method->ssl_clear(s);
  2772. return(1);
  2773. err:
  2774. return(0);
  2775. }
  2776. void ssl3_free(SSL *s)
  2777. {
  2778. if(s == NULL)
  2779. return;
  2780. #ifdef TLSEXT_TYPE_opaque_prf_input
  2781. if (s->s3->client_opaque_prf_input != NULL)
  2782. OPENSSL_free(s->s3->client_opaque_prf_input);
  2783. if (s->s3->server_opaque_prf_input != NULL)
  2784. OPENSSL_free(s->s3->server_opaque_prf_input);
  2785. #endif
  2786. ssl3_cleanup_key_block(s);
  2787. if (s->s3->rbuf.buf != NULL)
  2788. ssl3_release_read_buffer(s);
  2789. if (s->s3->wbuf.buf != NULL)
  2790. ssl3_release_write_buffer(s);
  2791. if (s->s3->rrec.comp != NULL)
  2792. OPENSSL_free(s->s3->rrec.comp);
  2793. #ifndef OPENSSL_NO_DH
  2794. if (s->s3->tmp.dh != NULL)
  2795. DH_free(s->s3->tmp.dh);
  2796. #endif
  2797. #ifndef OPENSSL_NO_ECDH
  2798. if (s->s3->tmp.ecdh != NULL)
  2799. EC_KEY_free(s->s3->tmp.ecdh);
  2800. #endif
  2801. if (s->s3->tmp.ca_names != NULL)
  2802. sk_X509_NAME_pop_free(s->s3->tmp.ca_names,X509_NAME_free);
  2803. if (s->s3->handshake_buffer) {
  2804. BIO_free(s->s3->handshake_buffer);
  2805. }
  2806. if (s->s3->handshake_dgst) ssl3_free_digest_list(s);
  2807. #ifndef OPENSSL_NO_SRP
  2808. SSL_SRP_CTX_free(s);
  2809. #endif
  2810. OPENSSL_cleanse(s->s3,sizeof *s->s3);
  2811. OPENSSL_free(s->s3);
  2812. s->s3=NULL;
  2813. }
  2814. void ssl3_clear(SSL *s)
  2815. {
  2816. unsigned char *rp,*wp;
  2817. size_t rlen, wlen;
  2818. int init_extra;
  2819. #ifdef TLSEXT_TYPE_opaque_prf_input
  2820. if (s->s3->client_opaque_prf_input != NULL)
  2821. OPENSSL_free(s->s3->client_opaque_prf_input);
  2822. s->s3->client_opaque_prf_input = NULL;
  2823. if (s->s3->server_opaque_prf_input != NULL)
  2824. OPENSSL_free(s->s3->server_opaque_prf_input);
  2825. s->s3->server_opaque_prf_input = NULL;
  2826. #endif
  2827. ssl3_cleanup_key_block(s);
  2828. if (s->s3->tmp.ca_names != NULL)
  2829. sk_X509_NAME_pop_free(s->s3->tmp.ca_names,X509_NAME_free);
  2830. if (s->s3->rrec.comp != NULL)
  2831. {
  2832. OPENSSL_free(s->s3->rrec.comp);
  2833. s->s3->rrec.comp=NULL;
  2834. }
  2835. #ifndef OPENSSL_NO_DH
  2836. if (s->s3->tmp.dh != NULL)
  2837. {
  2838. DH_free(s->s3->tmp.dh);
  2839. s->s3->tmp.dh = NULL;
  2840. }
  2841. #endif
  2842. #ifndef OPENSSL_NO_ECDH
  2843. if (s->s3->tmp.ecdh != NULL)
  2844. {
  2845. EC_KEY_free(s->s3->tmp.ecdh);
  2846. s->s3->tmp.ecdh = NULL;
  2847. }
  2848. #endif
  2849. rp = s->s3->rbuf.buf;
  2850. wp = s->s3->wbuf.buf;
  2851. rlen = s->s3->rbuf.len;
  2852. wlen = s->s3->wbuf.len;
  2853. init_extra = s->s3->init_extra;
  2854. if (s->s3->handshake_buffer) {
  2855. BIO_free(s->s3->handshake_buffer);
  2856. s->s3->handshake_buffer = NULL;
  2857. }
  2858. if (s->s3->handshake_dgst) {
  2859. ssl3_free_digest_list(s);
  2860. }
  2861. memset(s->s3,0,sizeof *s->s3);
  2862. s->s3->rbuf.buf = rp;
  2863. s->s3->wbuf.buf = wp;
  2864. s->s3->rbuf.len = rlen;
  2865. s->s3->wbuf.len = wlen;
  2866. s->s3->init_extra = init_extra;
  2867. ssl_free_wbio_buffer(s);
  2868. s->packet_length=0;
  2869. s->s3->renegotiate=0;
  2870. s->s3->total_renegotiations=0;
  2871. s->s3->num_renegotiations=0;
  2872. s->s3->in_read_app_data=0;
  2873. s->version=SSL3_VERSION;
  2874. #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
  2875. if (s->next_proto_negotiated)
  2876. {
  2877. OPENSSL_free(s->next_proto_negotiated);
  2878. s->next_proto_negotiated = NULL;
  2879. s->next_proto_negotiated_len = 0;
  2880. }
  2881. #endif
  2882. }
  2883. #ifndef OPENSSL_NO_SRP
  2884. static char * MS_CALLBACK srp_password_from_info_cb(SSL *s, void *arg)
  2885. {
  2886. return BUF_strdup(s->srp_ctx.info) ;
  2887. }
  2888. #endif
  2889. long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
  2890. {
  2891. int ret=0;
  2892. #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
  2893. if (
  2894. #ifndef OPENSSL_NO_RSA
  2895. cmd == SSL_CTRL_SET_TMP_RSA ||
  2896. cmd == SSL_CTRL_SET_TMP_RSA_CB ||
  2897. #endif
  2898. #ifndef OPENSSL_NO_DSA
  2899. cmd == SSL_CTRL_SET_TMP_DH ||
  2900. cmd == SSL_CTRL_SET_TMP_DH_CB ||
  2901. #endif
  2902. 0)
  2903. {
  2904. if (!ssl_cert_inst(&s->cert))
  2905. {
  2906. SSLerr(SSL_F_SSL3_CTRL, ERR_R_MALLOC_FAILURE);
  2907. return(0);
  2908. }
  2909. }
  2910. #endif
  2911. switch (cmd)
  2912. {
  2913. case SSL_CTRL_GET_SESSION_REUSED:
  2914. ret=s->hit;
  2915. break;
  2916. case SSL_CTRL_GET_CLIENT_CERT_REQUEST:
  2917. break;
  2918. case SSL_CTRL_GET_NUM_RENEGOTIATIONS:
  2919. ret=s->s3->num_renegotiations;
  2920. break;
  2921. case SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS:
  2922. ret=s->s3->num_renegotiations;
  2923. s->s3->num_renegotiations=0;
  2924. break;
  2925. case SSL_CTRL_GET_TOTAL_RENEGOTIATIONS:
  2926. ret=s->s3->total_renegotiations;
  2927. break;
  2928. case SSL_CTRL_GET_FLAGS:
  2929. ret=(int)(s->s3->flags);
  2930. break;
  2931. #ifndef OPENSSL_NO_RSA
  2932. case SSL_CTRL_NEED_TMP_RSA:
  2933. if ((s->cert != NULL) && (s->cert->rsa_tmp == NULL) &&
  2934. ((s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL) ||
  2935. (EVP_PKEY_size(s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey) > (512/8))))
  2936. ret = 1;
  2937. break;
  2938. case SSL_CTRL_SET_TMP_RSA:
  2939. {
  2940. RSA *rsa = (RSA *)parg;
  2941. if (rsa == NULL)
  2942. {
  2943. SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
  2944. return(ret);
  2945. }
  2946. if ((rsa = RSAPrivateKey_dup(rsa)) == NULL)
  2947. {
  2948. SSLerr(SSL_F_SSL3_CTRL, ERR_R_RSA_LIB);
  2949. return(ret);
  2950. }
  2951. if (s->cert->rsa_tmp != NULL)
  2952. RSA_free(s->cert->rsa_tmp);
  2953. s->cert->rsa_tmp = rsa;
  2954. ret = 1;
  2955. }
  2956. break;
  2957. case SSL_CTRL_SET_TMP_RSA_CB:
  2958. {
  2959. SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  2960. return(ret);
  2961. }
  2962. break;
  2963. #endif
  2964. #ifndef OPENSSL_NO_DH
  2965. case SSL_CTRL_SET_TMP_DH:
  2966. {
  2967. DH *dh = (DH *)parg;
  2968. if (dh == NULL)
  2969. {
  2970. SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
  2971. return(ret);
  2972. }
  2973. if ((dh = DHparams_dup(dh)) == NULL)
  2974. {
  2975. SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
  2976. return(ret);
  2977. }
  2978. if (!(s->options & SSL_OP_SINGLE_DH_USE))
  2979. {
  2980. if (!DH_generate_key(dh))
  2981. {
  2982. DH_free(dh);
  2983. SSLerr(SSL_F_SSL3_CTRL, ERR_R_DH_LIB);
  2984. return(ret);
  2985. }
  2986. }
  2987. if (s->cert->dh_tmp != NULL)
  2988. DH_free(s->cert->dh_tmp);
  2989. s->cert->dh_tmp = dh;
  2990. ret = 1;
  2991. }
  2992. break;
  2993. case SSL_CTRL_SET_TMP_DH_CB:
  2994. {
  2995. SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  2996. return(ret);
  2997. }
  2998. break;
  2999. #endif
  3000. #ifndef OPENSSL_NO_ECDH
  3001. case SSL_CTRL_SET_TMP_ECDH:
  3002. {
  3003. EC_KEY *ecdh = NULL;
  3004. if (parg == NULL)
  3005. {
  3006. SSLerr(SSL_F_SSL3_CTRL, ERR_R_PASSED_NULL_PARAMETER);
  3007. return(ret);
  3008. }
  3009. if (!EC_KEY_up_ref((EC_KEY *)parg))
  3010. {
  3011. SSLerr(SSL_F_SSL3_CTRL,ERR_R_ECDH_LIB);
  3012. return(ret);
  3013. }
  3014. ecdh = (EC_KEY *)parg;
  3015. if (!(s->options & SSL_OP_SINGLE_ECDH_USE))
  3016. {
  3017. if (!EC_KEY_generate_key(ecdh))
  3018. {
  3019. EC_KEY_free(ecdh);
  3020. SSLerr(SSL_F_SSL3_CTRL,ERR_R_ECDH_LIB);
  3021. return(ret);
  3022. }
  3023. }
  3024. if (s->cert->ecdh_tmp != NULL)
  3025. EC_KEY_free(s->cert->ecdh_tmp);
  3026. s->cert->ecdh_tmp = ecdh;
  3027. ret = 1;
  3028. }
  3029. break;
  3030. case SSL_CTRL_SET_TMP_ECDH_CB:
  3031. {
  3032. SSLerr(SSL_F_SSL3_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  3033. return(ret);
  3034. }
  3035. break;
  3036. #endif /* !OPENSSL_NO_ECDH */
  3037. #ifndef OPENSSL_NO_TLSEXT
  3038. case SSL_CTRL_SET_TLSEXT_HOSTNAME:
  3039. if (larg == TLSEXT_NAMETYPE_host_name)
  3040. {
  3041. if (s->tlsext_hostname != NULL)
  3042. OPENSSL_free(s->tlsext_hostname);
  3043. s->tlsext_hostname = NULL;
  3044. ret = 1;
  3045. if (parg == NULL)
  3046. break;
  3047. if (strlen((char *)parg) > TLSEXT_MAXLEN_host_name)
  3048. {
  3049. SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME);
  3050. return 0;
  3051. }
  3052. if ((s->tlsext_hostname = BUF_strdup((char *)parg)) == NULL)
  3053. {
  3054. SSLerr(SSL_F_SSL3_CTRL, ERR_R_INTERNAL_ERROR);
  3055. return 0;
  3056. }
  3057. }
  3058. else
  3059. {
  3060. SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE);
  3061. return 0;
  3062. }
  3063. break;
  3064. case SSL_CTRL_SET_TLSEXT_DEBUG_ARG:
  3065. s->tlsext_debug_arg=parg;
  3066. ret = 1;
  3067. break;
  3068. #ifdef TLSEXT_TYPE_opaque_prf_input
  3069. case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT:
  3070. if (larg > 12288) /* actual internal limit is 2^16 for the complete hello message
  3071. * (including the cert chain and everything) */
  3072. {
  3073. SSLerr(SSL_F_SSL3_CTRL, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG);
  3074. break;
  3075. }
  3076. if (s->tlsext_opaque_prf_input != NULL)
  3077. OPENSSL_free(s->tlsext_opaque_prf_input);
  3078. if ((size_t)larg == 0)
  3079. s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
  3080. else
  3081. s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg);
  3082. if (s->tlsext_opaque_prf_input != NULL)
  3083. {
  3084. s->tlsext_opaque_prf_input_len = (size_t)larg;
  3085. ret = 1;
  3086. }
  3087. else
  3088. s->tlsext_opaque_prf_input_len = 0;
  3089. break;
  3090. #endif
  3091. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE:
  3092. s->tlsext_status_type=larg;
  3093. ret = 1;
  3094. break;
  3095. case SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS:
  3096. *(STACK_OF(X509_EXTENSION) **)parg = s->tlsext_ocsp_exts;
  3097. ret = 1;
  3098. break;
  3099. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS:
  3100. s->tlsext_ocsp_exts = parg;
  3101. ret = 1;
  3102. break;
  3103. case SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS:
  3104. *(STACK_OF(OCSP_RESPID) **)parg = s->tlsext_ocsp_ids;
  3105. ret = 1;
  3106. break;
  3107. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS:
  3108. s->tlsext_ocsp_ids = parg;
  3109. ret = 1;
  3110. break;
  3111. case SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP:
  3112. *(unsigned char **)parg = s->tlsext_ocsp_resp;
  3113. return s->tlsext_ocsp_resplen;
  3114. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
  3115. if (s->tlsext_ocsp_resp)
  3116. OPENSSL_free(s->tlsext_ocsp_resp);
  3117. s->tlsext_ocsp_resp = parg;
  3118. s->tlsext_ocsp_resplen = larg;
  3119. ret = 1;
  3120. break;
  3121. #endif /* !OPENSSL_NO_TLSEXT */
  3122. default:
  3123. break;
  3124. }
  3125. return(ret);
  3126. }
  3127. long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void))
  3128. {
  3129. int ret=0;
  3130. #if !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_RSA)
  3131. if (
  3132. #ifndef OPENSSL_NO_RSA
  3133. cmd == SSL_CTRL_SET_TMP_RSA_CB ||
  3134. #endif
  3135. #ifndef OPENSSL_NO_DSA
  3136. cmd == SSL_CTRL_SET_TMP_DH_CB ||
  3137. #endif
  3138. 0)
  3139. {
  3140. if (!ssl_cert_inst(&s->cert))
  3141. {
  3142. SSLerr(SSL_F_SSL3_CALLBACK_CTRL, ERR_R_MALLOC_FAILURE);
  3143. return(0);
  3144. }
  3145. }
  3146. #endif
  3147. switch (cmd)
  3148. {
  3149. #ifndef OPENSSL_NO_RSA
  3150. case SSL_CTRL_SET_TMP_RSA_CB:
  3151. {
  3152. s->cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp;
  3153. }
  3154. break;
  3155. #endif
  3156. #ifndef OPENSSL_NO_DH
  3157. case SSL_CTRL_SET_TMP_DH_CB:
  3158. {
  3159. s->cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
  3160. }
  3161. break;
  3162. #endif
  3163. #ifndef OPENSSL_NO_ECDH
  3164. case SSL_CTRL_SET_TMP_ECDH_CB:
  3165. {
  3166. s->cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp;
  3167. }
  3168. break;
  3169. #endif
  3170. #ifndef OPENSSL_NO_TLSEXT
  3171. case SSL_CTRL_SET_TLSEXT_DEBUG_CB:
  3172. s->tlsext_debug_cb=(void (*)(SSL *,int ,int,
  3173. unsigned char *, int, void *))fp;
  3174. break;
  3175. #endif
  3176. case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
  3177. {
  3178. s->not_resumable_session_cb = (int (*)(SSL *, int))fp;
  3179. }
  3180. break;
  3181. default:
  3182. break;
  3183. }
  3184. return(ret);
  3185. }
  3186. long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
  3187. {
  3188. CERT *cert;
  3189. cert=ctx->cert;
  3190. switch (cmd)
  3191. {
  3192. #ifndef OPENSSL_NO_RSA
  3193. case SSL_CTRL_NEED_TMP_RSA:
  3194. if ( (cert->rsa_tmp == NULL) &&
  3195. ((cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL) ||
  3196. (EVP_PKEY_size(cert->pkeys[SSL_PKEY_RSA_ENC].privatekey) > (512/8)))
  3197. )
  3198. return(1);
  3199. else
  3200. return(0);
  3201. /* break; */
  3202. case SSL_CTRL_SET_TMP_RSA:
  3203. {
  3204. RSA *rsa;
  3205. int i;
  3206. rsa=(RSA *)parg;
  3207. i=1;
  3208. if (rsa == NULL)
  3209. i=0;
  3210. else
  3211. {
  3212. if ((rsa=RSAPrivateKey_dup(rsa)) == NULL)
  3213. i=0;
  3214. }
  3215. if (!i)
  3216. {
  3217. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_RSA_LIB);
  3218. return(0);
  3219. }
  3220. else
  3221. {
  3222. if (cert->rsa_tmp != NULL)
  3223. RSA_free(cert->rsa_tmp);
  3224. cert->rsa_tmp=rsa;
  3225. return(1);
  3226. }
  3227. }
  3228. /* break; */
  3229. case SSL_CTRL_SET_TMP_RSA_CB:
  3230. {
  3231. SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  3232. return(0);
  3233. }
  3234. break;
  3235. #endif
  3236. #ifndef OPENSSL_NO_DH
  3237. case SSL_CTRL_SET_TMP_DH:
  3238. {
  3239. DH *new=NULL,*dh;
  3240. dh=(DH *)parg;
  3241. if ((new=DHparams_dup(dh)) == NULL)
  3242. {
  3243. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_DH_LIB);
  3244. return 0;
  3245. }
  3246. if (!(ctx->options & SSL_OP_SINGLE_DH_USE))
  3247. {
  3248. if (!DH_generate_key(new))
  3249. {
  3250. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_DH_LIB);
  3251. DH_free(new);
  3252. return 0;
  3253. }
  3254. }
  3255. if (cert->dh_tmp != NULL)
  3256. DH_free(cert->dh_tmp);
  3257. cert->dh_tmp=new;
  3258. return 1;
  3259. }
  3260. /*break; */
  3261. case SSL_CTRL_SET_TMP_DH_CB:
  3262. {
  3263. SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  3264. return(0);
  3265. }
  3266. break;
  3267. #endif
  3268. #ifndef OPENSSL_NO_ECDH
  3269. case SSL_CTRL_SET_TMP_ECDH:
  3270. {
  3271. EC_KEY *ecdh = NULL;
  3272. if (parg == NULL)
  3273. {
  3274. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_ECDH_LIB);
  3275. return 0;
  3276. }
  3277. ecdh = EC_KEY_dup((EC_KEY *)parg);
  3278. if (ecdh == NULL)
  3279. {
  3280. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_EC_LIB);
  3281. return 0;
  3282. }
  3283. if (!(ctx->options & SSL_OP_SINGLE_ECDH_USE))
  3284. {
  3285. if (!EC_KEY_generate_key(ecdh))
  3286. {
  3287. EC_KEY_free(ecdh);
  3288. SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_ECDH_LIB);
  3289. return 0;
  3290. }
  3291. }
  3292. if (cert->ecdh_tmp != NULL)
  3293. {
  3294. EC_KEY_free(cert->ecdh_tmp);
  3295. }
  3296. cert->ecdh_tmp = ecdh;
  3297. return 1;
  3298. }
  3299. /* break; */
  3300. case SSL_CTRL_SET_TMP_ECDH_CB:
  3301. {
  3302. SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
  3303. return(0);
  3304. }
  3305. break;
  3306. #endif /* !OPENSSL_NO_ECDH */
  3307. #ifndef OPENSSL_NO_TLSEXT
  3308. case SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG:
  3309. ctx->tlsext_servername_arg=parg;
  3310. break;
  3311. case SSL_CTRL_SET_TLSEXT_TICKET_KEYS:
  3312. case SSL_CTRL_GET_TLSEXT_TICKET_KEYS:
  3313. {
  3314. unsigned char *keys = parg;
  3315. if (!keys)
  3316. return 48;
  3317. if (larg != 48)
  3318. {
  3319. SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_TICKET_KEYS_LENGTH);
  3320. return 0;
  3321. }
  3322. if (cmd == SSL_CTRL_SET_TLSEXT_TICKET_KEYS)
  3323. {
  3324. memcpy(ctx->tlsext_tick_key_name, keys, 16);
  3325. memcpy(ctx->tlsext_tick_hmac_key, keys + 16, 16);
  3326. memcpy(ctx->tlsext_tick_aes_key, keys + 32, 16);
  3327. }
  3328. else
  3329. {
  3330. memcpy(keys, ctx->tlsext_tick_key_name, 16);
  3331. memcpy(keys + 16, ctx->tlsext_tick_hmac_key, 16);
  3332. memcpy(keys + 32, ctx->tlsext_tick_aes_key, 16);
  3333. }
  3334. return 1;
  3335. }
  3336. #ifdef TLSEXT_TYPE_opaque_prf_input
  3337. case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG:
  3338. ctx->tlsext_opaque_prf_input_callback_arg = parg;
  3339. return 1;
  3340. #endif
  3341. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG:
  3342. ctx->tlsext_status_arg=parg;
  3343. return 1;
  3344. break;
  3345. #ifndef OPENSSL_NO_SRP
  3346. case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
  3347. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3348. if (ctx->srp_ctx.login != NULL)
  3349. OPENSSL_free(ctx->srp_ctx.login);
  3350. ctx->srp_ctx.login = NULL;
  3351. if (parg == NULL)
  3352. break;
  3353. if (strlen((char *)parg) > 254)
  3354. {
  3355. SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME);
  3356. return 0;
  3357. }
  3358. if ((ctx->srp_ctx.login = BUF_strdup((char *)parg)) == NULL)
  3359. {
  3360. SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR);
  3361. return 0;
  3362. }
  3363. break;
  3364. case SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD:
  3365. ctx->srp_ctx.SRP_give_srp_client_pwd_callback=srp_password_from_info_cb;
  3366. ctx->srp_ctx.info=parg;
  3367. break;
  3368. case SSL_CTRL_SET_SRP_ARG:
  3369. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3370. ctx->srp_ctx.SRP_cb_arg=parg;
  3371. break;
  3372. case SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH:
  3373. ctx->srp_ctx.strength=larg;
  3374. break;
  3375. #endif
  3376. #endif /* !OPENSSL_NO_TLSEXT */
  3377. /* A Thawte special :-) */
  3378. case SSL_CTRL_EXTRA_CHAIN_CERT:
  3379. if (ctx->extra_certs == NULL)
  3380. {
  3381. if ((ctx->extra_certs=sk_X509_new_null()) == NULL)
  3382. return(0);
  3383. }
  3384. sk_X509_push(ctx->extra_certs,(X509 *)parg);
  3385. break;
  3386. default:
  3387. return(0);
  3388. }
  3389. return(1);
  3390. }
  3391. long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
  3392. {
  3393. CERT *cert;
  3394. cert=ctx->cert;
  3395. switch (cmd)
  3396. {
  3397. #ifndef OPENSSL_NO_RSA
  3398. case SSL_CTRL_SET_TMP_RSA_CB:
  3399. {
  3400. cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp;
  3401. }
  3402. break;
  3403. #endif
  3404. #ifndef OPENSSL_NO_DH
  3405. case SSL_CTRL_SET_TMP_DH_CB:
  3406. {
  3407. cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp;
  3408. }
  3409. break;
  3410. #endif
  3411. #ifndef OPENSSL_NO_ECDH
  3412. case SSL_CTRL_SET_TMP_ECDH_CB:
  3413. {
  3414. cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp;
  3415. }
  3416. break;
  3417. #endif
  3418. #ifndef OPENSSL_NO_TLSEXT
  3419. case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB:
  3420. ctx->tlsext_servername_callback=(int (*)(SSL *,int *,void *))fp;
  3421. break;
  3422. #ifdef TLSEXT_TYPE_opaque_prf_input
  3423. case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB:
  3424. ctx->tlsext_opaque_prf_input_callback = (int (*)(SSL *,void *, size_t, void *))fp;
  3425. break;
  3426. #endif
  3427. case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB:
  3428. ctx->tlsext_status_cb=(int (*)(SSL *,void *))fp;
  3429. break;
  3430. case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB:
  3431. ctx->tlsext_ticket_key_cb=(int (*)(SSL *,unsigned char *,
  3432. unsigned char *,
  3433. EVP_CIPHER_CTX *,
  3434. HMAC_CTX *, int))fp;
  3435. break;
  3436. #ifndef OPENSSL_NO_SRP
  3437. case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB:
  3438. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3439. ctx->srp_ctx.SRP_verify_param_callback=(int (*)(SSL *,void *))fp;
  3440. break;
  3441. case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB:
  3442. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3443. ctx->srp_ctx.TLS_ext_srp_username_callback=(int (*)(SSL *,int *,void *))fp;
  3444. break;
  3445. case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB:
  3446. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3447. ctx->srp_ctx.SRP_give_srp_client_pwd_callback=(char *(*)(SSL *,void *))fp;
  3448. break;
  3449. case SSL_CTRL_SET_TLS_EXT_SRP_MISSING_CLIENT_USERNAME_CB:
  3450. ctx->srp_ctx.srp_Mask|=SSL_kSRP;
  3451. ctx->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback=(char *(*)(SSL *,void *))fp;
  3452. break;
  3453. #endif
  3454. #endif
  3455. case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB:
  3456. {
  3457. ctx->not_resumable_session_cb = (int (*)(SSL *, int))fp;
  3458. }
  3459. break;
  3460. default:
  3461. return(0);
  3462. }
  3463. return(1);
  3464. }
  3465. /* This function needs to check if the ciphers required are actually
  3466. * available */
  3467. const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
  3468. {
  3469. SSL_CIPHER c;
  3470. const SSL_CIPHER *cp;
  3471. unsigned long id;
  3472. id=0x03000000L|((unsigned long)p[0]<<8L)|(unsigned long)p[1];
  3473. c.id=id;
  3474. cp = OBJ_bsearch_ssl_cipher_id(&c, ssl3_ciphers, SSL3_NUM_CIPHERS);
  3475. #ifdef DEBUG_PRINT_UNKNOWN_CIPHERSUITES
  3476. if (cp == NULL) fprintf(stderr, "Unknown cipher ID %x\n", (p[0] << 8) | p[1]);
  3477. #endif
  3478. if (cp == NULL || cp->valid == 0)
  3479. return NULL;
  3480. else
  3481. return cp;
  3482. }
  3483. int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
  3484. {
  3485. long l;
  3486. if (p != NULL)
  3487. {
  3488. l=c->id;
  3489. if ((l & 0xff000000) != 0x03000000) return(0);
  3490. p[0]=((unsigned char)(l>> 8L))&0xFF;
  3491. p[1]=((unsigned char)(l ))&0xFF;
  3492. }
  3493. return(2);
  3494. }
  3495. SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
  3496. STACK_OF(SSL_CIPHER) *srvr)
  3497. {
  3498. SSL_CIPHER *c,*ret=NULL;
  3499. STACK_OF(SSL_CIPHER) *prio, *allow;
  3500. int i,ii,ok;
  3501. #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_EC)
  3502. unsigned int j;
  3503. int ec_ok, ec_nid;
  3504. unsigned char ec_search1 = 0, ec_search2 = 0;
  3505. #endif
  3506. CERT *cert;
  3507. unsigned long alg_k,alg_a,mask_k,mask_a,emask_k,emask_a;
  3508. /* Let's see which ciphers we can support */
  3509. cert=s->cert;
  3510. #if 0
  3511. /* Do not set the compare functions, because this may lead to a
  3512. * reordering by "id". We want to keep the original ordering.
  3513. * We may pay a price in performance during sk_SSL_CIPHER_find(),
  3514. * but would have to pay with the price of sk_SSL_CIPHER_dup().
  3515. */
  3516. sk_SSL_CIPHER_set_cmp_func(srvr, ssl_cipher_ptr_id_cmp);
  3517. sk_SSL_CIPHER_set_cmp_func(clnt, ssl_cipher_ptr_id_cmp);
  3518. #endif
  3519. #ifdef CIPHER_DEBUG
  3520. printf("Server has %d from %p:\n", sk_SSL_CIPHER_num(srvr), (void *)srvr);
  3521. for(i=0 ; i < sk_SSL_CIPHER_num(srvr) ; ++i)
  3522. {
  3523. c=sk_SSL_CIPHER_value(srvr,i);
  3524. printf("%p:%s\n",(void *)c,c->name);
  3525. }
  3526. printf("Client sent %d from %p:\n", sk_SSL_CIPHER_num(clnt), (void *)clnt);
  3527. for(i=0 ; i < sk_SSL_CIPHER_num(clnt) ; ++i)
  3528. {
  3529. c=sk_SSL_CIPHER_value(clnt,i);
  3530. printf("%p:%s\n",(void *)c,c->name);
  3531. }
  3532. #endif
  3533. if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE)
  3534. {
  3535. prio = srvr;
  3536. allow = clnt;
  3537. }
  3538. else
  3539. {
  3540. prio = clnt;
  3541. allow = srvr;
  3542. }
  3543. for (i=0; i<sk_SSL_CIPHER_num(prio); i++)
  3544. {
  3545. c=sk_SSL_CIPHER_value(prio,i);
  3546. /* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
  3547. if ((c->algorithm_ssl & SSL_TLSV1_2) &&
  3548. (TLS1_get_version(s) < TLS1_2_VERSION))
  3549. continue;
  3550. ssl_set_cert_masks(cert,c);
  3551. mask_k = cert->mask_k;
  3552. mask_a = cert->mask_a;
  3553. emask_k = cert->export_mask_k;
  3554. emask_a = cert->export_mask_a;
  3555. #ifndef OPENSSL_NO_SRP
  3556. mask_k=cert->mask_k | s->srp_ctx.srp_Mask;
  3557. emask_k=cert->export_mask_k | s->srp_ctx.srp_Mask;
  3558. #endif
  3559. #ifdef KSSL_DEBUG
  3560. /* printf("ssl3_choose_cipher %d alg= %lx\n", i,c->algorithms);*/
  3561. #endif /* KSSL_DEBUG */
  3562. alg_k=c->algorithm_mkey;
  3563. alg_a=c->algorithm_auth;
  3564. #ifndef OPENSSL_NO_KRB5
  3565. if (alg_k & SSL_kKRB5)
  3566. {
  3567. if ( !kssl_keytab_is_available(s->kssl_ctx) )
  3568. continue;
  3569. }
  3570. #endif /* OPENSSL_NO_KRB5 */
  3571. #ifndef OPENSSL_NO_PSK
  3572. /* with PSK there must be server callback set */
  3573. if ((alg_k & SSL_kPSK) && s->psk_server_callback == NULL)
  3574. continue;
  3575. #endif /* OPENSSL_NO_PSK */
  3576. if (SSL_C_IS_EXPORT(c))
  3577. {
  3578. ok = (alg_k & emask_k) && (alg_a & emask_a);
  3579. #ifdef CIPHER_DEBUG
  3580. printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s (export)\n",ok,alg_k,alg_a,emask_k,emask_a,
  3581. (void *)c,c->name);
  3582. #endif
  3583. }
  3584. else
  3585. {
  3586. ok = (alg_k & mask_k) && (alg_a & mask_a);
  3587. #ifdef CIPHER_DEBUG
  3588. printf("%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n",ok,alg_k,alg_a,mask_k,mask_a,(void *)c,
  3589. c->name);
  3590. #endif
  3591. }
  3592. #ifndef OPENSSL_NO_TLSEXT
  3593. #ifndef OPENSSL_NO_EC
  3594. if (
  3595. /* if we are considering an ECC cipher suite that uses our certificate */
  3596. (alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
  3597. /* and we have an ECC certificate */
  3598. && (s->cert->pkeys[SSL_PKEY_ECC].x509 != NULL)
  3599. /* and the client specified a Supported Point Formats extension */
  3600. && ((s->session->tlsext_ecpointformatlist_length > 0) && (s->session->tlsext_ecpointformatlist != NULL))
  3601. /* and our certificate's point is compressed */
  3602. && (
  3603. (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info != NULL)
  3604. && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key != NULL)
  3605. && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key != NULL)
  3606. && (s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data != NULL)
  3607. && (
  3608. (*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data) == POINT_CONVERSION_COMPRESSED)
  3609. || (*(s->cert->pkeys[SSL_PKEY_ECC].x509->cert_info->key->public_key->data) == POINT_CONVERSION_COMPRESSED + 1)
  3610. )
  3611. )
  3612. )
  3613. {
  3614. ec_ok = 0;
  3615. /* if our certificate's curve is over a field type that the client does not support
  3616. * then do not allow this cipher suite to be negotiated */
  3617. if (
  3618. (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec != NULL)
  3619. && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group != NULL)
  3620. && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth != NULL)
  3621. && (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_prime_field)
  3622. )
  3623. {
  3624. for (j = 0; j < s->session->tlsext_ecpointformatlist_length; j++)
  3625. {
  3626. if (s->session->tlsext_ecpointformatlist[j] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime)
  3627. {
  3628. ec_ok = 1;
  3629. break;
  3630. }
  3631. }
  3632. }
  3633. else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_characteristic_two_field)
  3634. {
  3635. for (j = 0; j < s->session->tlsext_ecpointformatlist_length; j++)
  3636. {
  3637. if (s->session->tlsext_ecpointformatlist[j] == TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2)
  3638. {
  3639. ec_ok = 1;
  3640. break;
  3641. }
  3642. }
  3643. }
  3644. ok = ok && ec_ok;
  3645. }
  3646. if (
  3647. /* if we are considering an ECC cipher suite that uses our certificate */
  3648. (alg_a & SSL_aECDSA || alg_a & SSL_aECDH)
  3649. /* and we have an ECC certificate */
  3650. && (s->cert->pkeys[SSL_PKEY_ECC].x509 != NULL)
  3651. /* and the client specified an EllipticCurves extension */
  3652. && ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->tlsext_ellipticcurvelist != NULL))
  3653. )
  3654. {
  3655. ec_ok = 0;
  3656. if (
  3657. (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec != NULL)
  3658. && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group != NULL)
  3659. )
  3660. {
  3661. ec_nid = EC_GROUP_get_curve_name(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group);
  3662. if ((ec_nid == 0)
  3663. && (s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth != NULL)
  3664. )
  3665. {
  3666. if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_prime_field)
  3667. {
  3668. ec_search1 = 0xFF;
  3669. ec_search2 = 0x01;
  3670. }
  3671. else if (EC_METHOD_get_field_type(s->cert->pkeys[SSL_PKEY_ECC].privatekey->pkey.ec->group->meth) == NID_X9_62_characteristic_two_field)
  3672. {
  3673. ec_search1 = 0xFF;
  3674. ec_search2 = 0x02;
  3675. }
  3676. }
  3677. else
  3678. {
  3679. ec_search1 = 0x00;
  3680. ec_search2 = tls1_ec_nid2curve_id(ec_nid);
  3681. }
  3682. if ((ec_search1 != 0) || (ec_search2 != 0))
  3683. {
  3684. for (j = 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j++)
  3685. {
  3686. if ((s->session->tlsext_ellipticcurvelist[2*j] == ec_search1) && (s->session->tlsext_ellipticcurvelist[2*j+1] == ec_search2))
  3687. {
  3688. ec_ok = 1;
  3689. break;
  3690. }
  3691. }
  3692. }
  3693. }
  3694. ok = ok && ec_ok;
  3695. }
  3696. if (
  3697. /* if we are considering an ECC cipher suite that uses an ephemeral EC key */
  3698. (alg_k & SSL_kEECDH)
  3699. /* and we have an ephemeral EC key */
  3700. && (s->cert->ecdh_tmp != NULL)
  3701. /* and the client specified an EllipticCurves extension */
  3702. && ((s->session->tlsext_ellipticcurvelist_length > 0) && (s->session->tlsext_ellipticcurvelist != NULL))
  3703. )
  3704. {
  3705. ec_ok = 0;
  3706. if (s->cert->ecdh_tmp->group != NULL)
  3707. {
  3708. ec_nid = EC_GROUP_get_curve_name(s->cert->ecdh_tmp->group);
  3709. if ((ec_nid == 0)
  3710. && (s->cert->ecdh_tmp->group->meth != NULL)
  3711. )
  3712. {
  3713. if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) == NID_X9_62_prime_field)
  3714. {
  3715. ec_search1 = 0xFF;
  3716. ec_search2 = 0x01;
  3717. }
  3718. else if (EC_METHOD_get_field_type(s->cert->ecdh_tmp->group->meth) == NID_X9_62_characteristic_two_field)
  3719. {
  3720. ec_search1 = 0xFF;
  3721. ec_search2 = 0x02;
  3722. }
  3723. }
  3724. else
  3725. {
  3726. ec_search1 = 0x00;
  3727. ec_search2 = tls1_ec_nid2curve_id(ec_nid);
  3728. }
  3729. if ((ec_search1 != 0) || (ec_search2 != 0))
  3730. {
  3731. for (j = 0; j < s->session->tlsext_ellipticcurvelist_length / 2; j++)
  3732. {
  3733. if ((s->session->tlsext_ellipticcurvelist[2*j] == ec_search1) && (s->session->tlsext_ellipticcurvelist[2*j+1] == ec_search2))
  3734. {
  3735. ec_ok = 1;
  3736. break;
  3737. }
  3738. }
  3739. }
  3740. }
  3741. ok = ok && ec_ok;
  3742. }
  3743. #endif /* OPENSSL_NO_EC */
  3744. #endif /* OPENSSL_NO_TLSEXT */
  3745. if (!ok) continue;
  3746. ii=sk_SSL_CIPHER_find(allow,c);
  3747. if (ii >= 0)
  3748. {
  3749. ret=sk_SSL_CIPHER_value(allow,ii);
  3750. break;
  3751. }
  3752. }
  3753. return(ret);
  3754. }
  3755. int ssl3_get_req_cert_type(SSL *s, unsigned char *p)
  3756. {
  3757. int ret=0;
  3758. unsigned long alg_k;
  3759. alg_k = s->s3->tmp.new_cipher->algorithm_mkey;
  3760. #ifndef OPENSSL_NO_GOST
  3761. if (s->version >= TLS1_VERSION)
  3762. {
  3763. if (alg_k & SSL_kGOST)
  3764. {
  3765. p[ret++]=TLS_CT_GOST94_SIGN;
  3766. p[ret++]=TLS_CT_GOST01_SIGN;
  3767. return(ret);
  3768. }
  3769. }
  3770. #endif
  3771. #ifndef OPENSSL_NO_DH
  3772. if (alg_k & (SSL_kDHr|SSL_kEDH))
  3773. {
  3774. # ifndef OPENSSL_NO_RSA
  3775. p[ret++]=SSL3_CT_RSA_FIXED_DH;
  3776. # endif
  3777. # ifndef OPENSSL_NO_DSA
  3778. p[ret++]=SSL3_CT_DSS_FIXED_DH;
  3779. # endif
  3780. }
  3781. if ((s->version == SSL3_VERSION) &&
  3782. (alg_k & (SSL_kEDH|SSL_kDHd|SSL_kDHr)))
  3783. {
  3784. # ifndef OPENSSL_NO_RSA
  3785. p[ret++]=SSL3_CT_RSA_EPHEMERAL_DH;
  3786. # endif
  3787. # ifndef OPENSSL_NO_DSA
  3788. p[ret++]=SSL3_CT_DSS_EPHEMERAL_DH;
  3789. # endif
  3790. }
  3791. #endif /* !OPENSSL_NO_DH */
  3792. #ifndef OPENSSL_NO_RSA
  3793. p[ret++]=SSL3_CT_RSA_SIGN;
  3794. #endif
  3795. #ifndef OPENSSL_NO_DSA
  3796. p[ret++]=SSL3_CT_DSS_SIGN;
  3797. #endif
  3798. #ifndef OPENSSL_NO_ECDH
  3799. if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->version >= TLS1_VERSION))
  3800. {
  3801. p[ret++]=TLS_CT_RSA_FIXED_ECDH;
  3802. p[ret++]=TLS_CT_ECDSA_FIXED_ECDH;
  3803. }
  3804. #endif
  3805. #ifndef OPENSSL_NO_ECDSA
  3806. /* ECDSA certs can be used with RSA cipher suites as well
  3807. * so we don't need to check for SSL_kECDH or SSL_kEECDH
  3808. */
  3809. if (s->version >= TLS1_VERSION)
  3810. {
  3811. p[ret++]=TLS_CT_ECDSA_SIGN;
  3812. }
  3813. #endif
  3814. return(ret);
  3815. }
  3816. int ssl3_shutdown(SSL *s)
  3817. {
  3818. int ret;
  3819. /* Don't do anything much if we have not done the handshake or
  3820. * we don't want to send messages :-) */
  3821. if ((s->quiet_shutdown) || (s->state == SSL_ST_BEFORE))
  3822. {
  3823. s->shutdown=(SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
  3824. return(1);
  3825. }
  3826. if (!(s->shutdown & SSL_SENT_SHUTDOWN))
  3827. {
  3828. s->shutdown|=SSL_SENT_SHUTDOWN;
  3829. #if 1
  3830. ssl3_send_alert(s,SSL3_AL_WARNING,SSL_AD_CLOSE_NOTIFY);
  3831. #endif
  3832. /* our shutdown alert has been sent now, and if it still needs
  3833. * to be written, s->s3->alert_dispatch will be true */
  3834. if (s->s3->alert_dispatch)
  3835. return(-1); /* return WANT_WRITE */
  3836. }
  3837. else if (s->s3->alert_dispatch)
  3838. {
  3839. /* resend it if not sent */
  3840. #if 1
  3841. ret=s->method->ssl_dispatch_alert(s);
  3842. if(ret == -1)
  3843. {
  3844. /* we only get to return -1 here the 2nd/Nth
  3845. * invocation, we must have already signalled
  3846. * return 0 upon a previous invoation,
  3847. * return WANT_WRITE */
  3848. return(ret);
  3849. }
  3850. #endif
  3851. }
  3852. else if (!(s->shutdown & SSL_RECEIVED_SHUTDOWN))
  3853. {
  3854. /* If we are waiting for a close from our peer, we are closed */
  3855. s->method->ssl_read_bytes(s,0,NULL,0,0);
  3856. if(!(s->shutdown & SSL_RECEIVED_SHUTDOWN))
  3857. {
  3858. return(-1); /* return WANT_READ */
  3859. }
  3860. }
  3861. if ((s->shutdown == (SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN)) &&
  3862. !s->s3->alert_dispatch)
  3863. return(1);
  3864. else
  3865. return(0);
  3866. }
  3867. int ssl3_write(SSL *s, const void *buf, int len)
  3868. {
  3869. int ret,n;
  3870. #if 0
  3871. if (s->shutdown & SSL_SEND_SHUTDOWN)
  3872. {
  3873. s->rwstate=SSL_NOTHING;
  3874. return(0);
  3875. }
  3876. #endif
  3877. clear_sys_error();
  3878. if (s->s3->renegotiate) ssl3_renegotiate_check(s);
  3879. /* This is an experimental flag that sends the
  3880. * last handshake message in the same packet as the first
  3881. * use data - used to see if it helps the TCP protocol during
  3882. * session-id reuse */
  3883. /* The second test is because the buffer may have been removed */
  3884. if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio))
  3885. {
  3886. /* First time through, we write into the buffer */
  3887. if (s->s3->delay_buf_pop_ret == 0)
  3888. {
  3889. ret=ssl3_write_bytes(s,SSL3_RT_APPLICATION_DATA,
  3890. buf,len);
  3891. if (ret <= 0) return(ret);
  3892. s->s3->delay_buf_pop_ret=ret;
  3893. }
  3894. s->rwstate=SSL_WRITING;
  3895. n=BIO_flush(s->wbio);
  3896. if (n <= 0) return(n);
  3897. s->rwstate=SSL_NOTHING;
  3898. /* We have flushed the buffer, so remove it */
  3899. ssl_free_wbio_buffer(s);
  3900. s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER;
  3901. ret=s->s3->delay_buf_pop_ret;
  3902. s->s3->delay_buf_pop_ret=0;
  3903. }
  3904. else
  3905. {
  3906. ret=s->method->ssl_write_bytes(s,SSL3_RT_APPLICATION_DATA,
  3907. buf,len);
  3908. if (ret <= 0) return(ret);
  3909. }
  3910. return(ret);
  3911. }
  3912. static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
  3913. {
  3914. int ret;
  3915. clear_sys_error();
  3916. if (s->s3->renegotiate) ssl3_renegotiate_check(s);
  3917. s->s3->in_read_app_data=1;
  3918. ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
  3919. if ((ret == -1) && (s->s3->in_read_app_data == 2))
  3920. {
  3921. /* ssl3_read_bytes decided to call s->handshake_func, which
  3922. * called ssl3_read_bytes to read handshake data.
  3923. * However, ssl3_read_bytes actually found application data
  3924. * and thinks that application data makes sense here; so disable
  3925. * handshake processing and try to read application data again. */
  3926. s->in_handshake++;
  3927. ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
  3928. s->in_handshake--;
  3929. }
  3930. else
  3931. s->s3->in_read_app_data=0;
  3932. return(ret);
  3933. }
  3934. int ssl3_read(SSL *s, void *buf, int len)
  3935. {
  3936. return ssl3_read_internal(s, buf, len, 0);
  3937. }
  3938. int ssl3_peek(SSL *s, void *buf, int len)
  3939. {
  3940. return ssl3_read_internal(s, buf, len, 1);
  3941. }
  3942. int ssl3_renegotiate(SSL *s)
  3943. {
  3944. if (s->handshake_func == NULL)
  3945. return(1);
  3946. if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
  3947. return(0);
  3948. s->s3->renegotiate=1;
  3949. return(1);
  3950. }
  3951. int ssl3_renegotiate_check(SSL *s)
  3952. {
  3953. int ret=0;
  3954. if (s->s3->renegotiate)
  3955. {
  3956. if ( (s->s3->rbuf.left == 0) &&
  3957. (s->s3->wbuf.left == 0) &&
  3958. !SSL_in_init(s))
  3959. {
  3960. /*
  3961. if we are the server, and we have sent a 'RENEGOTIATE' message, we
  3962. need to go to SSL_ST_ACCEPT.
  3963. */
  3964. /* SSL_ST_ACCEPT */
  3965. s->state=SSL_ST_RENEGOTIATE;
  3966. s->s3->renegotiate=0;
  3967. s->s3->num_renegotiations++;
  3968. s->s3->total_renegotiations++;
  3969. ret=1;
  3970. }
  3971. }
  3972. return(ret);
  3973. }
  3974. /* If we are using TLS v1.2 or later and default SHA1+MD5 algorithms switch
  3975. * to new SHA256 PRF and handshake macs
  3976. */
  3977. long ssl_get_algorithm2(SSL *s)
  3978. {
  3979. long alg2 = s->s3->tmp.new_cipher->algorithm2;
  3980. if (TLS1_get_version(s) >= TLS1_2_VERSION &&
  3981. alg2 == (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF))
  3982. return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256;
  3983. return alg2;
  3984. }