s3_lib.c 106 KB

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