ssl.h.in 119 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693
  1. /*
  2. * {- join("\n * ", @autowarntext) -}
  3. *
  4. * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
  5. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  6. * Copyright 2005 Nokia. All rights reserved.
  7. *
  8. * Licensed under the Apache License 2.0 (the "License"). You may not use
  9. * this file except in compliance with the License. You can obtain a copy
  10. * in the file LICENSE in the source distribution or at
  11. * https://www.openssl.org/source/license.html
  12. */
  13. {-
  14. use OpenSSL::stackhash qw(generate_stack_macros generate_const_stack_macros);
  15. -}
  16. #ifndef OPENSSL_SSL_H
  17. # define OPENSSL_SSL_H
  18. # pragma once
  19. # include <openssl/macros.h>
  20. # ifndef OPENSSL_NO_DEPRECATED_3_0
  21. # define HEADER_SSL_H
  22. # endif
  23. # include <openssl/e_os2.h>
  24. # include <openssl/e_ostime.h>
  25. # include <openssl/opensslconf.h>
  26. # include <openssl/comp.h>
  27. # include <openssl/bio.h>
  28. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  29. # include <openssl/x509.h>
  30. # include <openssl/crypto.h>
  31. # include <openssl/buffer.h>
  32. # endif
  33. # include <openssl/lhash.h>
  34. # include <openssl/pem.h>
  35. # include <openssl/hmac.h>
  36. # include <openssl/async.h>
  37. # include <openssl/safestack.h>
  38. # include <openssl/symhacks.h>
  39. # include <openssl/ct.h>
  40. # include <openssl/sslerr.h>
  41. # include <openssl/prov_ssl.h>
  42. # ifndef OPENSSL_NO_STDIO
  43. # include <stdio.h>
  44. # endif
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. /* OpenSSL version number for ASN.1 encoding of the session information */
  49. /*-
  50. * Version 0 - initial version
  51. * Version 1 - added the optional peer certificate
  52. */
  53. # define SSL_SESSION_ASN1_VERSION 0x0001
  54. # define SSL_MAX_SSL_SESSION_ID_LENGTH 32
  55. # define SSL_MAX_SID_CTX_LENGTH 32
  56. # define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8)
  57. # define SSL_MAX_KEY_ARG_LENGTH 8
  58. /* SSL_MAX_MASTER_KEY_LENGTH is defined in prov_ssl.h */
  59. /* The maximum number of encrypt/decrypt pipelines we can support */
  60. # define SSL_MAX_PIPELINES 32
  61. /* text strings for the ciphers */
  62. /* These are used to specify which ciphers to use and not to use */
  63. # define SSL_TXT_LOW "LOW"
  64. # define SSL_TXT_MEDIUM "MEDIUM"
  65. # define SSL_TXT_HIGH "HIGH"
  66. # define SSL_TXT_FIPS "FIPS"
  67. # define SSL_TXT_aNULL "aNULL"
  68. # define SSL_TXT_eNULL "eNULL"
  69. # define SSL_TXT_NULL "NULL"
  70. # define SSL_TXT_kRSA "kRSA"
  71. # define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */
  72. # define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */
  73. # define SSL_TXT_kDH "kDH"/* this cipher class has been removed */
  74. # define SSL_TXT_kEDH "kEDH"/* alias for kDHE */
  75. # define SSL_TXT_kDHE "kDHE"
  76. # define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */
  77. # define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */
  78. # define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */
  79. # define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */
  80. # define SSL_TXT_kECDHE "kECDHE"
  81. # define SSL_TXT_kPSK "kPSK"
  82. # define SSL_TXT_kRSAPSK "kRSAPSK"
  83. # define SSL_TXT_kECDHEPSK "kECDHEPSK"
  84. # define SSL_TXT_kDHEPSK "kDHEPSK"
  85. # define SSL_TXT_kGOST "kGOST"
  86. # define SSL_TXT_kGOST18 "kGOST18"
  87. # define SSL_TXT_kSRP "kSRP"
  88. # define SSL_TXT_aRSA "aRSA"
  89. # define SSL_TXT_aDSS "aDSS"
  90. # define SSL_TXT_aDH "aDH"/* this cipher class has been removed */
  91. # define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */
  92. # define SSL_TXT_aECDSA "aECDSA"
  93. # define SSL_TXT_aPSK "aPSK"
  94. # define SSL_TXT_aGOST94 "aGOST94"
  95. # define SSL_TXT_aGOST01 "aGOST01"
  96. # define SSL_TXT_aGOST12 "aGOST12"
  97. # define SSL_TXT_aGOST "aGOST"
  98. # define SSL_TXT_aSRP "aSRP"
  99. # define SSL_TXT_DSS "DSS"
  100. # define SSL_TXT_DH "DH"
  101. # define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */
  102. # define SSL_TXT_EDH "EDH"/* alias for DHE */
  103. # define SSL_TXT_ADH "ADH"
  104. # define SSL_TXT_RSA "RSA"
  105. # define SSL_TXT_ECDH "ECDH"
  106. # define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */
  107. # define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */
  108. # define SSL_TXT_AECDH "AECDH"
  109. # define SSL_TXT_ECDSA "ECDSA"
  110. # define SSL_TXT_PSK "PSK"
  111. # define SSL_TXT_SRP "SRP"
  112. # define SSL_TXT_DES "DES"
  113. # define SSL_TXT_3DES "3DES"
  114. # define SSL_TXT_RC4 "RC4"
  115. # define SSL_TXT_RC2 "RC2"
  116. # define SSL_TXT_IDEA "IDEA"
  117. # define SSL_TXT_SEED "SEED"
  118. # define SSL_TXT_AES128 "AES128"
  119. # define SSL_TXT_AES256 "AES256"
  120. # define SSL_TXT_AES "AES"
  121. # define SSL_TXT_AES_GCM "AESGCM"
  122. # define SSL_TXT_AES_CCM "AESCCM"
  123. # define SSL_TXT_AES_CCM_8 "AESCCM8"
  124. # define SSL_TXT_CAMELLIA128 "CAMELLIA128"
  125. # define SSL_TXT_CAMELLIA256 "CAMELLIA256"
  126. # define SSL_TXT_CAMELLIA "CAMELLIA"
  127. # define SSL_TXT_CHACHA20 "CHACHA20"
  128. # define SSL_TXT_GOST "GOST89"
  129. # define SSL_TXT_ARIA "ARIA"
  130. # define SSL_TXT_ARIA_GCM "ARIAGCM"
  131. # define SSL_TXT_ARIA128 "ARIA128"
  132. # define SSL_TXT_ARIA256 "ARIA256"
  133. # define SSL_TXT_GOST2012_GOST8912_GOST8912 "GOST2012-GOST8912-GOST8912"
  134. # define SSL_TXT_CBC "CBC"
  135. # define SSL_TXT_MD5 "MD5"
  136. # define SSL_TXT_SHA1 "SHA1"
  137. # define SSL_TXT_SHA "SHA"/* same as "SHA1" */
  138. # define SSL_TXT_GOST94 "GOST94"
  139. # define SSL_TXT_GOST89MAC "GOST89MAC"
  140. # define SSL_TXT_GOST12 "GOST12"
  141. # define SSL_TXT_GOST89MAC12 "GOST89MAC12"
  142. # define SSL_TXT_SHA256 "SHA256"
  143. # define SSL_TXT_SHA384 "SHA384"
  144. # define SSL_TXT_SSLV3 "SSLv3"
  145. # define SSL_TXT_TLSV1 "TLSv1"
  146. # define SSL_TXT_TLSV1_1 "TLSv1.1"
  147. # define SSL_TXT_TLSV1_2 "TLSv1.2"
  148. # define SSL_TXT_ALL "ALL"
  149. /*-
  150. * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
  151. * ciphers normally not being used.
  152. * Example: "RC4" will activate all ciphers using RC4 including ciphers
  153. * without authentication, which would normally disabled by DEFAULT (due
  154. * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT"
  155. * will make sure that it is also disabled in the specific selection.
  156. * COMPLEMENTOF* identifiers are portable between version, as adjustments
  157. * to the default cipher setup will also be included here.
  158. *
  159. * COMPLEMENTOFDEFAULT does not experience the same special treatment that
  160. * DEFAULT gets, as only selection is being done and no sorting as needed
  161. * for DEFAULT.
  162. */
  163. # define SSL_TXT_CMPALL "COMPLEMENTOFALL"
  164. # define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT"
  165. /*
  166. * The following cipher list is used by default. It also is substituted when
  167. * an application-defined cipher list string starts with 'DEFAULT'.
  168. * This applies to ciphersuites for TLSv1.2 and below.
  169. * DEPRECATED IN 3.0.0, in favor of OSSL_default_cipher_list()
  170. * Update both macro and function simultaneously
  171. */
  172. # ifndef OPENSSL_NO_DEPRECATED_3_0
  173. # define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL"
  174. /*
  175. * This is the default set of TLSv1.3 ciphersuites
  176. * DEPRECATED IN 3.0.0, in favor of OSSL_default_ciphersuites()
  177. * Update both macro and function simultaneously
  178. */
  179. # define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \
  180. "TLS_CHACHA20_POLY1305_SHA256:" \
  181. "TLS_AES_128_GCM_SHA256"
  182. # endif
  183. /*
  184. * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always
  185. * starts with a reasonable order, and all we have to do for DEFAULT is
  186. * throwing out anonymous and unencrypted ciphersuites! (The latter are not
  187. * actually enabled by ALL, but "ALL:RSA" would enable some of them.)
  188. */
  189. /* Used in SSL_set_shutdown()/SSL_get_shutdown(); */
  190. # define SSL_SENT_SHUTDOWN 1
  191. # define SSL_RECEIVED_SHUTDOWN 2
  192. #ifdef __cplusplus
  193. }
  194. #endif
  195. #ifdef __cplusplus
  196. extern "C" {
  197. #endif
  198. # define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1
  199. # define SSL_FILETYPE_PEM X509_FILETYPE_PEM
  200. /*
  201. * This is needed to stop compilers complaining about the 'struct ssl_st *'
  202. * function parameters used to prototype callbacks in SSL_CTX.
  203. */
  204. typedef struct ssl_st *ssl_crock_st;
  205. typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT;
  206. typedef struct ssl_method_st SSL_METHOD;
  207. typedef struct ssl_cipher_st SSL_CIPHER;
  208. typedef struct ssl_session_st SSL_SESSION;
  209. typedef struct tls_sigalgs_st TLS_SIGALGS;
  210. typedef struct ssl_conf_ctx_st SSL_CONF_CTX;
  211. typedef struct ssl_comp_st SSL_COMP;
  212. STACK_OF(SSL_CIPHER);
  213. STACK_OF(SSL_COMP);
  214. /* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/
  215. typedef struct srtp_protection_profile_st {
  216. const char *name;
  217. unsigned long id;
  218. } SRTP_PROTECTION_PROFILE;
  219. {-
  220. generate_stack_macros("SRTP_PROTECTION_PROFILE");
  221. -}
  222. typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data,
  223. int len, void *arg);
  224. typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len,
  225. STACK_OF(SSL_CIPHER) *peer_ciphers,
  226. const SSL_CIPHER **cipher, void *arg);
  227. /* Extension context codes */
  228. /* This extension is only allowed in TLS */
  229. #define SSL_EXT_TLS_ONLY 0x00001
  230. /* This extension is only allowed in DTLS */
  231. #define SSL_EXT_DTLS_ONLY 0x00002
  232. /* Some extensions may be allowed in DTLS but we don't implement them for it */
  233. #define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x00004
  234. /* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */
  235. #define SSL_EXT_SSL3_ALLOWED 0x00008
  236. /* Extension is only defined for TLS1.2 and below */
  237. #define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x00010
  238. /* Extension is only defined for TLS1.3 and above */
  239. #define SSL_EXT_TLS1_3_ONLY 0x00020
  240. /* Ignore this extension during parsing if we are resuming */
  241. #define SSL_EXT_IGNORE_ON_RESUMPTION 0x00040
  242. #define SSL_EXT_CLIENT_HELLO 0x00080
  243. /* Really means TLS1.2 or below */
  244. #define SSL_EXT_TLS1_2_SERVER_HELLO 0x00100
  245. #define SSL_EXT_TLS1_3_SERVER_HELLO 0x00200
  246. #define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x00400
  247. #define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x00800
  248. #define SSL_EXT_TLS1_3_CERTIFICATE 0x01000
  249. #define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x02000
  250. #define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x04000
  251. #define SSL_EXT_TLS1_3_CERTIFICATE_COMPRESSION 0x08000
  252. /* When sending a raw public key in a certificate message */
  253. #define SSL_EXT_TLS1_3_RAW_PUBLIC_KEY 0x10000
  254. /* Typedefs for handling custom extensions */
  255. typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type,
  256. const unsigned char **out, size_t *outlen,
  257. int *al, void *add_arg);
  258. typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type,
  259. const unsigned char *out, void *add_arg);
  260. typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type,
  261. const unsigned char *in, size_t inlen,
  262. int *al, void *parse_arg);
  263. typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type,
  264. unsigned int context,
  265. const unsigned char **out,
  266. size_t *outlen, X509 *x,
  267. size_t chainidx,
  268. int *al, void *add_arg);
  269. typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type,
  270. unsigned int context,
  271. const unsigned char *out,
  272. void *add_arg);
  273. typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type,
  274. unsigned int context,
  275. const unsigned char *in,
  276. size_t inlen, X509 *x,
  277. size_t chainidx,
  278. int *al, void *parse_arg);
  279. /* Typedef for verification callback */
  280. typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx);
  281. /* Typedef for SSL async callback */
  282. typedef int (*SSL_async_callback_fn)(SSL *s, void *arg);
  283. #define SSL_OP_BIT(n) ((uint64_t)1 << (uint64_t)n)
  284. /*
  285. * SSL/TLS connection options.
  286. */
  287. /* Disable Extended master secret */
  288. # define SSL_OP_NO_EXTENDED_MASTER_SECRET SSL_OP_BIT(0)
  289. /* Cleanse plaintext copies of data delivered to the application */
  290. # define SSL_OP_CLEANSE_PLAINTEXT SSL_OP_BIT(1)
  291. /* Allow initial connection to servers that don't support RI */
  292. # define SSL_OP_LEGACY_SERVER_CONNECT SSL_OP_BIT(2)
  293. /* Enable support for Kernel TLS */
  294. # define SSL_OP_ENABLE_KTLS SSL_OP_BIT(3)
  295. # define SSL_OP_TLSEXT_PADDING SSL_OP_BIT(4)
  296. # define SSL_OP_SAFARI_ECDHE_ECDSA_BUG SSL_OP_BIT(6)
  297. # define SSL_OP_IGNORE_UNEXPECTED_EOF SSL_OP_BIT(7)
  298. # define SSL_OP_ALLOW_CLIENT_RENEGOTIATION SSL_OP_BIT(8)
  299. # define SSL_OP_DISABLE_TLSEXT_CA_NAMES SSL_OP_BIT(9)
  300. /* In TLSv1.3 allow a non-(ec)dhe based kex_mode */
  301. # define SSL_OP_ALLOW_NO_DHE_KEX SSL_OP_BIT(10)
  302. /*
  303. * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added
  304. * in OpenSSL 0.9.6d. Usually (depending on the application protocol)
  305. * the workaround is not needed. Unfortunately some broken SSL/TLS
  306. * implementations cannot handle it at all, which is why we include it
  307. * in SSL_OP_ALL. Added in 0.9.6e
  308. */
  309. # define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS SSL_OP_BIT(11)
  310. /* DTLS options */
  311. # define SSL_OP_NO_QUERY_MTU SSL_OP_BIT(12)
  312. /* Turn on Cookie Exchange (on relevant for servers) */
  313. # define SSL_OP_COOKIE_EXCHANGE SSL_OP_BIT(13)
  314. /* Don't use RFC4507 ticket extension */
  315. # define SSL_OP_NO_TICKET SSL_OP_BIT(14)
  316. # ifndef OPENSSL_NO_DTLS1_METHOD
  317. /*
  318. * Use Cisco's version identifier of DTLS_BAD_VER
  319. * (only with deprecated DTLSv1_client_method())
  320. */
  321. # define SSL_OP_CISCO_ANYCONNECT SSL_OP_BIT(15)
  322. # endif
  323. /* As server, disallow session resumption on renegotiation */
  324. # define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION SSL_OP_BIT(16)
  325. /* Don't use compression even if supported */
  326. # define SSL_OP_NO_COMPRESSION SSL_OP_BIT(17)
  327. /* Permit unsafe legacy renegotiation */
  328. # define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION SSL_OP_BIT(18)
  329. /* Disable encrypt-then-mac */
  330. # define SSL_OP_NO_ENCRYPT_THEN_MAC SSL_OP_BIT(19)
  331. /*
  332. * Enable TLSv1.3 Compatibility mode. This is on by default. A future
  333. * version of OpenSSL may have this disabled by default.
  334. */
  335. # define SSL_OP_ENABLE_MIDDLEBOX_COMPAT SSL_OP_BIT(20)
  336. /*
  337. * Prioritize Chacha20Poly1305 when client does.
  338. * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE
  339. */
  340. # define SSL_OP_PRIORITIZE_CHACHA SSL_OP_BIT(21)
  341. /*
  342. * Set on servers to choose the cipher according to server's preferences.
  343. */
  344. # define SSL_OP_CIPHER_SERVER_PREFERENCE SSL_OP_BIT(22)
  345. /*
  346. * If set, a server will allow a client to issue a SSLv3.0 version
  347. * number as latest version supported in the premaster secret, even when
  348. * TLSv1.0 (version 3.1) was announced in the client hello. Normally
  349. * this is forbidden to prevent version rollback attacks.
  350. */
  351. # define SSL_OP_TLS_ROLLBACK_BUG SSL_OP_BIT(23)
  352. /*
  353. * Switches off automatic TLSv1.3 anti-replay protection for early data.
  354. * This is a server-side option only (no effect on the client).
  355. */
  356. # define SSL_OP_NO_ANTI_REPLAY SSL_OP_BIT(24)
  357. # define SSL_OP_NO_SSLv3 SSL_OP_BIT(25)
  358. # define SSL_OP_NO_TLSv1 SSL_OP_BIT(26)
  359. # define SSL_OP_NO_TLSv1_2 SSL_OP_BIT(27)
  360. # define SSL_OP_NO_TLSv1_1 SSL_OP_BIT(28)
  361. # define SSL_OP_NO_TLSv1_3 SSL_OP_BIT(29)
  362. # define SSL_OP_NO_DTLSv1 SSL_OP_BIT(26)
  363. # define SSL_OP_NO_DTLSv1_2 SSL_OP_BIT(27)
  364. /* Disallow all renegotiation */
  365. # define SSL_OP_NO_RENEGOTIATION SSL_OP_BIT(30)
  366. /*
  367. * Make server add server-hello extension from early version of
  368. * cryptopro draft, when GOST ciphersuite is negotiated. Required for
  369. * interoperability with CryptoPro CSP 3.x
  370. */
  371. # define SSL_OP_CRYPTOPRO_TLSEXT_BUG SSL_OP_BIT(31)
  372. /*
  373. * Disable RFC8879 certificate compression
  374. * SSL_OP_NO_TX_CERTIFICATE_COMPRESSION: don't send compressed certificates,
  375. * and ignore the extension when received.
  376. * SSL_OP_NO_RX_CERTIFICATE_COMPRESSION: don't send the extension, and
  377. * subsequently indicating that receiving is not supported
  378. */
  379. # define SSL_OP_NO_TX_CERTIFICATE_COMPRESSION SSL_OP_BIT(32)
  380. # define SSL_OP_NO_RX_CERTIFICATE_COMPRESSION SSL_OP_BIT(33)
  381. /* Enable KTLS TX zerocopy on Linux */
  382. # define SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE SSL_OP_BIT(34)
  383. /*
  384. * Option "collections."
  385. */
  386. # define SSL_OP_NO_SSL_MASK \
  387. ( SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1 \
  388. | SSL_OP_NO_TLSv1_2 | SSL_OP_NO_TLSv1_3 )
  389. # define SSL_OP_NO_DTLS_MASK \
  390. ( SSL_OP_NO_DTLSv1 | SSL_OP_NO_DTLSv1_2 )
  391. /* Various bug workarounds that should be rather harmless. */
  392. # define SSL_OP_ALL \
  393. ( SSL_OP_CRYPTOPRO_TLSEXT_BUG | SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS \
  394. | SSL_OP_TLSEXT_PADDING | SSL_OP_SAFARI_ECDHE_ECDSA_BUG )
  395. /*
  396. * OBSOLETE OPTIONS retained for compatibility
  397. */
  398. # define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0
  399. # define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0
  400. # define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0
  401. # define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0
  402. # define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0
  403. # define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0
  404. # define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0
  405. # define SSL_OP_TLS_D5_BUG 0x0
  406. # define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0
  407. # define SSL_OP_SINGLE_ECDH_USE 0x0
  408. # define SSL_OP_SINGLE_DH_USE 0x0
  409. # define SSL_OP_EPHEMERAL_RSA 0x0
  410. # define SSL_OP_NO_SSLv2 0x0
  411. # define SSL_OP_PKCS1_CHECK_1 0x0
  412. # define SSL_OP_PKCS1_CHECK_2 0x0
  413. # define SSL_OP_NETSCAPE_CA_DN_BUG 0x0
  414. # define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0
  415. /*
  416. * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success
  417. * when just a single record has been written):
  418. */
  419. # define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U
  420. /*
  421. * Make it possible to retry SSL_write() with changed buffer location (buffer
  422. * contents must stay the same!); this is not the default to avoid the
  423. * misconception that non-blocking SSL_write() behaves like non-blocking
  424. * write():
  425. */
  426. # define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U
  427. /*
  428. * Never bother the application with retries if the transport is blocking:
  429. */
  430. # define SSL_MODE_AUTO_RETRY 0x00000004U
  431. /* Don't attempt to automatically build certificate chain */
  432. # define SSL_MODE_NO_AUTO_CHAIN 0x00000008U
  433. /*
  434. * Save RAM by releasing read and write buffers when they're empty. (SSL3 and
  435. * TLS only.) Released buffers are freed.
  436. */
  437. # define SSL_MODE_RELEASE_BUFFERS 0x00000010U
  438. /*
  439. * Send the current time in the Random fields of the ClientHello and
  440. * ServerHello records for compatibility with hypothetical implementations
  441. * that require it.
  442. */
  443. # define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U
  444. # define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U
  445. /*
  446. * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications
  447. * that reconnect with a downgraded protocol version; see
  448. * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your
  449. * application attempts a normal handshake. Only use this in explicit
  450. * fallback retries, following the guidance in
  451. * draft-ietf-tls-downgrade-scsv-00.
  452. */
  453. # define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U
  454. /*
  455. * Support Asynchronous operation
  456. */
  457. # define SSL_MODE_ASYNC 0x00000100U
  458. /*
  459. * When using DTLS/SCTP, include the terminating zero in the label
  460. * used for computing the endpoint-pair shared secret. Required for
  461. * interoperability with implementations having this bug like these
  462. * older version of OpenSSL:
  463. * - OpenSSL 1.0.0 series
  464. * - OpenSSL 1.0.1 series
  465. * - OpenSSL 1.0.2 series
  466. * - OpenSSL 1.1.0 series
  467. * - OpenSSL 1.1.1 and 1.1.1a
  468. */
  469. # define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U
  470. /* Cert related flags */
  471. /*
  472. * Many implementations ignore some aspects of the TLS standards such as
  473. * enforcing certificate chain algorithms. When this is set we enforce them.
  474. */
  475. # define SSL_CERT_FLAG_TLS_STRICT 0x00000001U
  476. /* Suite B modes, takes same values as certificate verify flags */
  477. # define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000
  478. /* Suite B 192 bit only mode */
  479. # define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000
  480. /* Suite B 128 bit mode allowing 192 bit algorithms */
  481. # define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000
  482. /* Perform all sorts of protocol violations for testing purposes */
  483. # define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000
  484. /* Flags for building certificate chains */
  485. /* Treat any existing certificates as untrusted CAs */
  486. # define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1
  487. /* Don't include root CA in chain */
  488. # define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2
  489. /* Just check certificates already there */
  490. # define SSL_BUILD_CHAIN_FLAG_CHECK 0x4
  491. /* Ignore verification errors */
  492. # define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8
  493. /* Clear verification errors from queue */
  494. # define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10
  495. /* Flags returned by SSL_check_chain */
  496. /* Certificate can be used with this session */
  497. # define CERT_PKEY_VALID 0x1
  498. /* Certificate can also be used for signing */
  499. # define CERT_PKEY_SIGN 0x2
  500. /* EE certificate signing algorithm OK */
  501. # define CERT_PKEY_EE_SIGNATURE 0x10
  502. /* CA signature algorithms OK */
  503. # define CERT_PKEY_CA_SIGNATURE 0x20
  504. /* EE certificate parameters OK */
  505. # define CERT_PKEY_EE_PARAM 0x40
  506. /* CA certificate parameters OK */
  507. # define CERT_PKEY_CA_PARAM 0x80
  508. /* Signing explicitly allowed as opposed to SHA1 fallback */
  509. # define CERT_PKEY_EXPLICIT_SIGN 0x100
  510. /* Client CA issuer names match (always set for server cert) */
  511. # define CERT_PKEY_ISSUER_NAME 0x200
  512. /* Cert type matches client types (always set for server cert) */
  513. # define CERT_PKEY_CERT_TYPE 0x400
  514. /* Cert chain suitable to Suite B */
  515. # define CERT_PKEY_SUITEB 0x800
  516. /* Cert pkey valid for raw public key use */
  517. # define CERT_PKEY_RPK 0x1000
  518. # define SSL_CONF_FLAG_CMDLINE 0x1
  519. # define SSL_CONF_FLAG_FILE 0x2
  520. # define SSL_CONF_FLAG_CLIENT 0x4
  521. # define SSL_CONF_FLAG_SERVER 0x8
  522. # define SSL_CONF_FLAG_SHOW_ERRORS 0x10
  523. # define SSL_CONF_FLAG_CERTIFICATE 0x20
  524. # define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40
  525. /* Configuration value types */
  526. # define SSL_CONF_TYPE_UNKNOWN 0x0
  527. # define SSL_CONF_TYPE_STRING 0x1
  528. # define SSL_CONF_TYPE_FILE 0x2
  529. # define SSL_CONF_TYPE_DIR 0x3
  530. # define SSL_CONF_TYPE_NONE 0x4
  531. # define SSL_CONF_TYPE_STORE 0x5
  532. /* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */
  533. # define SSL_COOKIE_LENGTH 4096
  534. /*
  535. * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they
  536. * cannot be used to clear bits.
  537. */
  538. uint64_t SSL_CTX_get_options(const SSL_CTX *ctx);
  539. uint64_t SSL_get_options(const SSL *s);
  540. uint64_t SSL_CTX_clear_options(SSL_CTX *ctx, uint64_t op);
  541. uint64_t SSL_clear_options(SSL *s, uint64_t op);
  542. uint64_t SSL_CTX_set_options(SSL_CTX *ctx, uint64_t op);
  543. uint64_t SSL_set_options(SSL *s, uint64_t op);
  544. # define SSL_CTX_set_mode(ctx,op) \
  545. SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
  546. # define SSL_CTX_clear_mode(ctx,op) \
  547. SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
  548. # define SSL_CTX_get_mode(ctx) \
  549. SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
  550. # define SSL_clear_mode(ssl,op) \
  551. SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
  552. # define SSL_set_mode(ssl,op) \
  553. SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
  554. # define SSL_get_mode(ssl) \
  555. SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
  556. # define SSL_set_mtu(ssl, mtu) \
  557. SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL)
  558. # define DTLS_set_link_mtu(ssl, mtu) \
  559. SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL)
  560. # define DTLS_get_link_min_mtu(ssl) \
  561. SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL)
  562. # define SSL_get_secure_renegotiation_support(ssl) \
  563. SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)
  564. # define SSL_CTX_set_cert_flags(ctx,op) \
  565. SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL)
  566. # define SSL_set_cert_flags(s,op) \
  567. SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL)
  568. # define SSL_CTX_clear_cert_flags(ctx,op) \
  569. SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL)
  570. # define SSL_clear_cert_flags(s,op) \
  571. SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL)
  572. void SSL_CTX_set_msg_callback(SSL_CTX *ctx,
  573. void (*cb) (int write_p, int version,
  574. int content_type, const void *buf,
  575. size_t len, SSL *ssl, void *arg));
  576. void SSL_set_msg_callback(SSL *ssl,
  577. void (*cb) (int write_p, int version,
  578. int content_type, const void *buf,
  579. size_t len, SSL *ssl, void *arg));
  580. # define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
  581. # define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))
  582. # define SSL_get_extms_support(s) \
  583. SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL)
  584. # ifndef OPENSSL_NO_SRP
  585. /* see tls_srp.c */
  586. # ifndef OPENSSL_NO_DEPRECATED_3_0
  587. OSSL_DEPRECATEDIN_3_0 __owur int SSL_SRP_CTX_init(SSL *s);
  588. OSSL_DEPRECATEDIN_3_0 __owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx);
  589. OSSL_DEPRECATEDIN_3_0 int SSL_SRP_CTX_free(SSL *ctx);
  590. OSSL_DEPRECATEDIN_3_0 int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx);
  591. OSSL_DEPRECATEDIN_3_0 __owur int SSL_srp_server_param_with_username(SSL *s,
  592. int *ad);
  593. OSSL_DEPRECATEDIN_3_0 __owur int SRP_Calc_A_param(SSL *s);
  594. # endif
  595. # endif
  596. /* 100k max cert list */
  597. # define SSL_MAX_CERT_LIST_DEFAULT (1024*100)
  598. # define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20)
  599. /*
  600. * This callback type is used inside SSL_CTX, SSL, and in the functions that
  601. * set them. It is used to override the generation of SSL/TLS session IDs in
  602. * a server. Return value should be zero on an error, non-zero to proceed.
  603. * Also, callbacks should themselves check if the id they generate is unique
  604. * otherwise the SSL handshake will fail with an error - callbacks can do
  605. * this using the 'ssl' value they're passed by;
  606. * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in
  607. * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32
  608. * bytes. The callback can alter this length to be less if desired. It is
  609. * also an error for the callback to set the size to zero.
  610. */
  611. typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id,
  612. unsigned int *id_len);
  613. # define SSL_SESS_CACHE_OFF 0x0000
  614. # define SSL_SESS_CACHE_CLIENT 0x0001
  615. # define SSL_SESS_CACHE_SERVER 0x0002
  616. # define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)
  617. # define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080
  618. /* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */
  619. # define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100
  620. # define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200
  621. # define SSL_SESS_CACHE_NO_INTERNAL \
  622. (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)
  623. # define SSL_SESS_CACHE_UPDATE_TIME 0x0400
  624. LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);
  625. # define SSL_CTX_sess_number(ctx) \
  626. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)
  627. # define SSL_CTX_sess_connect(ctx) \
  628. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)
  629. # define SSL_CTX_sess_connect_good(ctx) \
  630. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)
  631. # define SSL_CTX_sess_connect_renegotiate(ctx) \
  632. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)
  633. # define SSL_CTX_sess_accept(ctx) \
  634. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)
  635. # define SSL_CTX_sess_accept_renegotiate(ctx) \
  636. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)
  637. # define SSL_CTX_sess_accept_good(ctx) \
  638. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)
  639. # define SSL_CTX_sess_hits(ctx) \
  640. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)
  641. # define SSL_CTX_sess_cb_hits(ctx) \
  642. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)
  643. # define SSL_CTX_sess_misses(ctx) \
  644. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)
  645. # define SSL_CTX_sess_timeouts(ctx) \
  646. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)
  647. # define SSL_CTX_sess_cache_full(ctx) \
  648. SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)
  649. void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
  650. int (*new_session_cb) (struct ssl_st *ssl,
  651. SSL_SESSION *sess));
  652. int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl,
  653. SSL_SESSION *sess);
  654. void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
  655. void (*remove_session_cb) (struct ssl_ctx_st
  656. *ctx,
  657. SSL_SESSION *sess));
  658. void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx,
  659. SSL_SESSION *sess);
  660. void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
  661. SSL_SESSION *(*get_session_cb) (struct ssl_st
  662. *ssl,
  663. const unsigned char
  664. *data, int len,
  665. int *copy));
  666. SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl,
  667. const unsigned char *data,
  668. int len, int *copy);
  669. void SSL_CTX_set_info_callback(SSL_CTX *ctx,
  670. void (*cb) (const SSL *ssl, int type, int val));
  671. void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type,
  672. int val);
  673. void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,
  674. int (*client_cert_cb) (SSL *ssl, X509 **x509,
  675. EVP_PKEY **pkey));
  676. int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509,
  677. EVP_PKEY **pkey);
  678. # ifndef OPENSSL_NO_ENGINE
  679. __owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);
  680. # endif
  681. void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,
  682. int (*app_gen_cookie_cb) (SSL *ssl,
  683. unsigned char
  684. *cookie,
  685. unsigned int
  686. *cookie_len));
  687. void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
  688. int (*app_verify_cookie_cb) (SSL *ssl,
  689. const unsigned
  690. char *cookie,
  691. unsigned int
  692. cookie_len));
  693. void SSL_CTX_set_stateless_cookie_generate_cb(
  694. SSL_CTX *ctx,
  695. int (*gen_stateless_cookie_cb) (SSL *ssl,
  696. unsigned char *cookie,
  697. size_t *cookie_len));
  698. void SSL_CTX_set_stateless_cookie_verify_cb(
  699. SSL_CTX *ctx,
  700. int (*verify_stateless_cookie_cb) (SSL *ssl,
  701. const unsigned char *cookie,
  702. size_t cookie_len));
  703. # ifndef OPENSSL_NO_NEXTPROTONEG
  704. typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl,
  705. const unsigned char **out,
  706. unsigned int *outlen,
  707. void *arg);
  708. void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s,
  709. SSL_CTX_npn_advertised_cb_func cb,
  710. void *arg);
  711. # define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb
  712. typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s,
  713. unsigned char **out,
  714. unsigned char *outlen,
  715. const unsigned char *in,
  716. unsigned int inlen,
  717. void *arg);
  718. void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
  719. SSL_CTX_npn_select_cb_func cb,
  720. void *arg);
  721. # define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb
  722. void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
  723. unsigned *len);
  724. # define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated
  725. # endif
  726. __owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen,
  727. const unsigned char *in, unsigned int inlen,
  728. const unsigned char *client,
  729. unsigned int client_len);
  730. # define OPENSSL_NPN_UNSUPPORTED 0
  731. # define OPENSSL_NPN_NEGOTIATED 1
  732. # define OPENSSL_NPN_NO_OVERLAP 2
  733. __owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,
  734. unsigned int protos_len);
  735. __owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
  736. unsigned int protos_len);
  737. typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl,
  738. const unsigned char **out,
  739. unsigned char *outlen,
  740. const unsigned char *in,
  741. unsigned int inlen,
  742. void *arg);
  743. void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
  744. SSL_CTX_alpn_select_cb_func cb,
  745. void *arg);
  746. void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
  747. unsigned int *len);
  748. # ifndef OPENSSL_NO_PSK
  749. /*
  750. * the maximum length of the buffer given to callbacks containing the
  751. * resulting identity/psk
  752. */
  753. # define PSK_MAX_IDENTITY_LEN 256
  754. # define PSK_MAX_PSK_LEN 512
  755. typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl,
  756. const char *hint,
  757. char *identity,
  758. unsigned int max_identity_len,
  759. unsigned char *psk,
  760. unsigned int max_psk_len);
  761. void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb);
  762. void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb);
  763. typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl,
  764. const char *identity,
  765. unsigned char *psk,
  766. unsigned int max_psk_len);
  767. void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb);
  768. void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb);
  769. __owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint);
  770. __owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint);
  771. const char *SSL_get_psk_identity_hint(const SSL *s);
  772. const char *SSL_get_psk_identity(const SSL *s);
  773. # endif
  774. typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl,
  775. const unsigned char *identity,
  776. size_t identity_len,
  777. SSL_SESSION **sess);
  778. typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md,
  779. const unsigned char **id,
  780. size_t *idlen,
  781. SSL_SESSION **sess);
  782. void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb);
  783. void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx,
  784. SSL_psk_find_session_cb_func cb);
  785. void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb);
  786. void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx,
  787. SSL_psk_use_session_cb_func cb);
  788. /* Register callbacks to handle custom TLS Extensions for client or server. */
  789. __owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx,
  790. unsigned int ext_type);
  791. __owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx,
  792. unsigned int ext_type,
  793. custom_ext_add_cb add_cb,
  794. custom_ext_free_cb free_cb,
  795. void *add_arg,
  796. custom_ext_parse_cb parse_cb,
  797. void *parse_arg);
  798. __owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx,
  799. unsigned int ext_type,
  800. custom_ext_add_cb add_cb,
  801. custom_ext_free_cb free_cb,
  802. void *add_arg,
  803. custom_ext_parse_cb parse_cb,
  804. void *parse_arg);
  805. __owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type,
  806. unsigned int context,
  807. SSL_custom_ext_add_cb_ex add_cb,
  808. SSL_custom_ext_free_cb_ex free_cb,
  809. void *add_arg,
  810. SSL_custom_ext_parse_cb_ex parse_cb,
  811. void *parse_arg);
  812. __owur int SSL_extension_supported(unsigned int ext_type);
  813. # define SSL_NOTHING 1
  814. # define SSL_WRITING 2
  815. # define SSL_READING 3
  816. # define SSL_X509_LOOKUP 4
  817. # define SSL_ASYNC_PAUSED 5
  818. # define SSL_ASYNC_NO_JOBS 6
  819. # define SSL_CLIENT_HELLO_CB 7
  820. # define SSL_RETRY_VERIFY 8
  821. /* These will only be used when doing non-blocking IO */
  822. # define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING)
  823. # define SSL_want_read(s) (SSL_want(s) == SSL_READING)
  824. # define SSL_want_write(s) (SSL_want(s) == SSL_WRITING)
  825. # define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)
  826. # define SSL_want_retry_verify(s) (SSL_want(s) == SSL_RETRY_VERIFY)
  827. # define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED)
  828. # define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS)
  829. # define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB)
  830. # define SSL_MAC_FLAG_READ_MAC_STREAM 1
  831. # define SSL_MAC_FLAG_WRITE_MAC_STREAM 2
  832. # define SSL_MAC_FLAG_READ_MAC_TLSTREE 4
  833. # define SSL_MAC_FLAG_WRITE_MAC_TLSTREE 8
  834. /*
  835. * A callback for logging out TLS key material. This callback should log out
  836. * |line| followed by a newline.
  837. */
  838. typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);
  839. /*
  840. * SSL_CTX_set_keylog_callback configures a callback to log key material. This
  841. * is intended for debugging use with tools like Wireshark. The cb function
  842. * should log line followed by a newline.
  843. */
  844. void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb);
  845. /*
  846. * SSL_CTX_get_keylog_callback returns the callback configured by
  847. * SSL_CTX_set_keylog_callback.
  848. */
  849. SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx);
  850. int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data);
  851. uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx);
  852. int SSL_set_max_early_data(SSL *s, uint32_t max_early_data);
  853. uint32_t SSL_get_max_early_data(const SSL *s);
  854. int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data);
  855. uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx);
  856. int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data);
  857. uint32_t SSL_get_recv_max_early_data(const SSL *s);
  858. #ifdef __cplusplus
  859. }
  860. #endif
  861. # include <openssl/ssl2.h>
  862. # include <openssl/ssl3.h>
  863. # include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
  864. # include <openssl/dtls1.h> /* Datagram TLS */
  865. # include <openssl/srtp.h> /* Support for the use_srtp extension */
  866. # include <openssl/quic.h>
  867. #ifdef __cplusplus
  868. extern "C" {
  869. #endif
  870. /*
  871. * These need to be after the above set of includes due to a compiler bug
  872. * in VisualStudio 2015
  873. */
  874. {-
  875. generate_const_stack_macros("SSL_CIPHER")
  876. .generate_stack_macros("SSL_COMP");
  877. -}
  878. /* compatibility */
  879. # define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg)))
  880. # define SSL_get_app_data(s) (SSL_get_ex_data(s,0))
  881. # define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \
  882. (char *)(a)))
  883. # define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0))
  884. # define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0))
  885. # define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \
  886. (char *)(arg)))
  887. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  888. OSSL_DEPRECATEDIN_1_1_0 void SSL_set_debug(SSL *s, int debug);
  889. # endif
  890. /* TLSv1.3 KeyUpdate message types */
  891. /* -1 used so that this is an invalid value for the on-the-wire protocol */
  892. #define SSL_KEY_UPDATE_NONE -1
  893. /* Values as defined for the on-the-wire protocol */
  894. #define SSL_KEY_UPDATE_NOT_REQUESTED 0
  895. #define SSL_KEY_UPDATE_REQUESTED 1
  896. /*
  897. * The valid handshake states (one for each type message sent and one for each
  898. * type of message received). There are also two "special" states:
  899. * TLS = TLS or DTLS state
  900. * DTLS = DTLS specific state
  901. * CR/SR = Client Read/Server Read
  902. * CW/SW = Client Write/Server Write
  903. *
  904. * The "special" states are:
  905. * TLS_ST_BEFORE = No handshake has been initiated yet
  906. * TLS_ST_OK = A handshake has been successfully completed
  907. */
  908. typedef enum {
  909. TLS_ST_BEFORE,
  910. TLS_ST_OK,
  911. DTLS_ST_CR_HELLO_VERIFY_REQUEST,
  912. TLS_ST_CR_SRVR_HELLO,
  913. TLS_ST_CR_CERT,
  914. TLS_ST_CR_COMP_CERT,
  915. TLS_ST_CR_CERT_STATUS,
  916. TLS_ST_CR_KEY_EXCH,
  917. TLS_ST_CR_CERT_REQ,
  918. TLS_ST_CR_SRVR_DONE,
  919. TLS_ST_CR_SESSION_TICKET,
  920. TLS_ST_CR_CHANGE,
  921. TLS_ST_CR_FINISHED,
  922. TLS_ST_CW_CLNT_HELLO,
  923. TLS_ST_CW_CERT,
  924. TLS_ST_CW_COMP_CERT,
  925. TLS_ST_CW_KEY_EXCH,
  926. TLS_ST_CW_CERT_VRFY,
  927. TLS_ST_CW_CHANGE,
  928. TLS_ST_CW_NEXT_PROTO,
  929. TLS_ST_CW_FINISHED,
  930. TLS_ST_SW_HELLO_REQ,
  931. TLS_ST_SR_CLNT_HELLO,
  932. DTLS_ST_SW_HELLO_VERIFY_REQUEST,
  933. TLS_ST_SW_SRVR_HELLO,
  934. TLS_ST_SW_CERT,
  935. TLS_ST_SW_COMP_CERT,
  936. TLS_ST_SW_KEY_EXCH,
  937. TLS_ST_SW_CERT_REQ,
  938. TLS_ST_SW_SRVR_DONE,
  939. TLS_ST_SR_CERT,
  940. TLS_ST_SR_COMP_CERT,
  941. TLS_ST_SR_KEY_EXCH,
  942. TLS_ST_SR_CERT_VRFY,
  943. TLS_ST_SR_NEXT_PROTO,
  944. TLS_ST_SR_CHANGE,
  945. TLS_ST_SR_FINISHED,
  946. TLS_ST_SW_SESSION_TICKET,
  947. TLS_ST_SW_CERT_STATUS,
  948. TLS_ST_SW_CHANGE,
  949. TLS_ST_SW_FINISHED,
  950. TLS_ST_SW_ENCRYPTED_EXTENSIONS,
  951. TLS_ST_CR_ENCRYPTED_EXTENSIONS,
  952. TLS_ST_CR_CERT_VRFY,
  953. TLS_ST_SW_CERT_VRFY,
  954. TLS_ST_CR_HELLO_REQ,
  955. TLS_ST_SW_KEY_UPDATE,
  956. TLS_ST_CW_KEY_UPDATE,
  957. TLS_ST_SR_KEY_UPDATE,
  958. TLS_ST_CR_KEY_UPDATE,
  959. TLS_ST_EARLY_DATA,
  960. TLS_ST_PENDING_EARLY_DATA_END,
  961. TLS_ST_CW_END_OF_EARLY_DATA,
  962. TLS_ST_SR_END_OF_EARLY_DATA
  963. } OSSL_HANDSHAKE_STATE;
  964. /*
  965. * Most of the following state values are no longer used and are defined to be
  966. * the closest equivalent value in the current state machine code. Not all
  967. * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT
  968. * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP,
  969. * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT.
  970. */
  971. # define SSL_ST_CONNECT 0x1000
  972. # define SSL_ST_ACCEPT 0x2000
  973. # define SSL_ST_MASK 0x0FFF
  974. # define SSL_CB_LOOP 0x01
  975. # define SSL_CB_EXIT 0x02
  976. # define SSL_CB_READ 0x04
  977. # define SSL_CB_WRITE 0x08
  978. # define SSL_CB_ALERT 0x4000/* used in callback */
  979. # define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ)
  980. # define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE)
  981. # define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP)
  982. # define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT)
  983. # define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP)
  984. # define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT)
  985. # define SSL_CB_HANDSHAKE_START 0x10
  986. # define SSL_CB_HANDSHAKE_DONE 0x20
  987. /* Is the SSL_connection established? */
  988. # define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a))
  989. # define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a))
  990. int SSL_in_init(const SSL *s);
  991. int SSL_in_before(const SSL *s);
  992. int SSL_is_init_finished(const SSL *s);
  993. /*
  994. * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you
  995. * should not need these
  996. */
  997. # define SSL_ST_READ_HEADER 0xF0
  998. # define SSL_ST_READ_BODY 0xF1
  999. # define SSL_ST_READ_DONE 0xF2
  1000. /*-
  1001. * Obtain latest Finished message
  1002. * -- that we sent (SSL_get_finished)
  1003. * -- that we expected from peer (SSL_get_peer_finished).
  1004. * Returns length (0 == no Finished so far), copies up to 'count' bytes.
  1005. */
  1006. size_t SSL_get_finished(const SSL *s, void *buf, size_t count);
  1007. size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
  1008. /*
  1009. * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are
  1010. * 'ored' with SSL_VERIFY_PEER if they are desired
  1011. */
  1012. # define SSL_VERIFY_NONE 0x00
  1013. # define SSL_VERIFY_PEER 0x01
  1014. # define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
  1015. # define SSL_VERIFY_CLIENT_ONCE 0x04
  1016. # define SSL_VERIFY_POST_HANDSHAKE 0x08
  1017. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1018. # define OpenSSL_add_ssl_algorithms() SSL_library_init()
  1019. # define SSLeay_add_ssl_algorithms() SSL_library_init()
  1020. # endif
  1021. /* More backward compatibility */
  1022. # define SSL_get_cipher(s) \
  1023. SSL_CIPHER_get_name(SSL_get_current_cipher(s))
  1024. # define SSL_get_cipher_bits(s,np) \
  1025. SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)
  1026. # define SSL_get_cipher_version(s) \
  1027. SSL_CIPHER_get_version(SSL_get_current_cipher(s))
  1028. # define SSL_get_cipher_name(s) \
  1029. SSL_CIPHER_get_name(SSL_get_current_cipher(s))
  1030. # define SSL_get_time(a) SSL_SESSION_get_time(a)
  1031. # define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b))
  1032. # define SSL_get_timeout(a) SSL_SESSION_get_timeout(a)
  1033. # define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b))
  1034. # define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)
  1035. # define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)
  1036. DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
  1037. # define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value
  1038. * from SSL_AD_... */
  1039. /* These alert types are for SSLv3 and TLSv1 */
  1040. # define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY
  1041. /* fatal */
  1042. # define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE
  1043. /* fatal */
  1044. # define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC
  1045. # define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED
  1046. # define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW
  1047. /* fatal */
  1048. # define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE
  1049. /* fatal */
  1050. # define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE
  1051. /* Not for TLS */
  1052. # define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE
  1053. # define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE
  1054. # define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE
  1055. # define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED
  1056. # define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED
  1057. # define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN
  1058. /* fatal */
  1059. # define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER
  1060. /* fatal */
  1061. # define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA
  1062. /* fatal */
  1063. # define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED
  1064. /* fatal */
  1065. # define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR
  1066. # define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR
  1067. /* fatal */
  1068. # define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION
  1069. /* fatal */
  1070. # define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION
  1071. /* fatal */
  1072. # define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY
  1073. /* fatal */
  1074. # define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR
  1075. # define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED
  1076. # define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION
  1077. # define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION
  1078. # define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED
  1079. # define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION
  1080. # define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE
  1081. # define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME
  1082. # define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE
  1083. # define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE
  1084. /* fatal */
  1085. # define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY
  1086. /* fatal */
  1087. # define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK
  1088. # define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL
  1089. # define SSL_ERROR_NONE 0
  1090. # define SSL_ERROR_SSL 1
  1091. # define SSL_ERROR_WANT_READ 2
  1092. # define SSL_ERROR_WANT_WRITE 3
  1093. # define SSL_ERROR_WANT_X509_LOOKUP 4
  1094. # define SSL_ERROR_SYSCALL 5/* look at error stack/return
  1095. * value/errno */
  1096. # define SSL_ERROR_ZERO_RETURN 6
  1097. # define SSL_ERROR_WANT_CONNECT 7
  1098. # define SSL_ERROR_WANT_ACCEPT 8
  1099. # define SSL_ERROR_WANT_ASYNC 9
  1100. # define SSL_ERROR_WANT_ASYNC_JOB 10
  1101. # define SSL_ERROR_WANT_CLIENT_HELLO_CB 11
  1102. # define SSL_ERROR_WANT_RETRY_VERIFY 12
  1103. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1104. # define SSL_CTRL_SET_TMP_DH 3
  1105. # define SSL_CTRL_SET_TMP_ECDH 4
  1106. # define SSL_CTRL_SET_TMP_DH_CB 6
  1107. # endif
  1108. # define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9
  1109. # define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10
  1110. # define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11
  1111. # define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12
  1112. # define SSL_CTRL_GET_FLAGS 13
  1113. # define SSL_CTRL_EXTRA_CHAIN_CERT 14
  1114. # define SSL_CTRL_SET_MSG_CALLBACK 15
  1115. # define SSL_CTRL_SET_MSG_CALLBACK_ARG 16
  1116. /* only applies to datagram connections */
  1117. # define SSL_CTRL_SET_MTU 17
  1118. /* Stats */
  1119. # define SSL_CTRL_SESS_NUMBER 20
  1120. # define SSL_CTRL_SESS_CONNECT 21
  1121. # define SSL_CTRL_SESS_CONNECT_GOOD 22
  1122. # define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23
  1123. # define SSL_CTRL_SESS_ACCEPT 24
  1124. # define SSL_CTRL_SESS_ACCEPT_GOOD 25
  1125. # define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26
  1126. # define SSL_CTRL_SESS_HIT 27
  1127. # define SSL_CTRL_SESS_CB_HIT 28
  1128. # define SSL_CTRL_SESS_MISSES 29
  1129. # define SSL_CTRL_SESS_TIMEOUTS 30
  1130. # define SSL_CTRL_SESS_CACHE_FULL 31
  1131. # define SSL_CTRL_MODE 33
  1132. # define SSL_CTRL_GET_READ_AHEAD 40
  1133. # define SSL_CTRL_SET_READ_AHEAD 41
  1134. # define SSL_CTRL_SET_SESS_CACHE_SIZE 42
  1135. # define SSL_CTRL_GET_SESS_CACHE_SIZE 43
  1136. # define SSL_CTRL_SET_SESS_CACHE_MODE 44
  1137. # define SSL_CTRL_GET_SESS_CACHE_MODE 45
  1138. # define SSL_CTRL_GET_MAX_CERT_LIST 50
  1139. # define SSL_CTRL_SET_MAX_CERT_LIST 51
  1140. # define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52
  1141. /* see tls1.h for macros based on these */
  1142. # define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53
  1143. # define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54
  1144. # define SSL_CTRL_SET_TLSEXT_HOSTNAME 55
  1145. # define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56
  1146. # define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57
  1147. # define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58
  1148. # define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59
  1149. /*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */
  1150. /*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */
  1151. /*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */
  1152. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63
  1153. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64
  1154. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65
  1155. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66
  1156. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67
  1157. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68
  1158. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69
  1159. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70
  1160. # define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71
  1161. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1162. # define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72
  1163. # endif
  1164. # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75
  1165. # define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76
  1166. # define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77
  1167. # define SSL_CTRL_SET_SRP_ARG 78
  1168. # define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79
  1169. # define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80
  1170. # define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81
  1171. # define DTLS_CTRL_GET_TIMEOUT 73
  1172. # define DTLS_CTRL_HANDLE_TIMEOUT 74
  1173. # define SSL_CTRL_GET_RI_SUPPORT 76
  1174. # define SSL_CTRL_CLEAR_MODE 78
  1175. # define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79
  1176. # define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82
  1177. # define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83
  1178. # define SSL_CTRL_CHAIN 88
  1179. # define SSL_CTRL_CHAIN_CERT 89
  1180. # define SSL_CTRL_GET_GROUPS 90
  1181. # define SSL_CTRL_SET_GROUPS 91
  1182. # define SSL_CTRL_SET_GROUPS_LIST 92
  1183. # define SSL_CTRL_GET_SHARED_GROUP 93
  1184. # define SSL_CTRL_SET_SIGALGS 97
  1185. # define SSL_CTRL_SET_SIGALGS_LIST 98
  1186. # define SSL_CTRL_CERT_FLAGS 99
  1187. # define SSL_CTRL_CLEAR_CERT_FLAGS 100
  1188. # define SSL_CTRL_SET_CLIENT_SIGALGS 101
  1189. # define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102
  1190. # define SSL_CTRL_GET_CLIENT_CERT_TYPES 103
  1191. # define SSL_CTRL_SET_CLIENT_CERT_TYPES 104
  1192. # define SSL_CTRL_BUILD_CERT_CHAIN 105
  1193. # define SSL_CTRL_SET_VERIFY_CERT_STORE 106
  1194. # define SSL_CTRL_SET_CHAIN_CERT_STORE 107
  1195. # define SSL_CTRL_GET_PEER_SIGNATURE_NID 108
  1196. # define SSL_CTRL_GET_PEER_TMP_KEY 109
  1197. # define SSL_CTRL_GET_RAW_CIPHERLIST 110
  1198. # define SSL_CTRL_GET_EC_POINT_FORMATS 111
  1199. # define SSL_CTRL_GET_CHAIN_CERTS 115
  1200. # define SSL_CTRL_SELECT_CURRENT_CERT 116
  1201. # define SSL_CTRL_SET_CURRENT_CERT 117
  1202. # define SSL_CTRL_SET_DH_AUTO 118
  1203. # define DTLS_CTRL_SET_LINK_MTU 120
  1204. # define DTLS_CTRL_GET_LINK_MIN_MTU 121
  1205. # define SSL_CTRL_GET_EXTMS_SUPPORT 122
  1206. # define SSL_CTRL_SET_MIN_PROTO_VERSION 123
  1207. # define SSL_CTRL_SET_MAX_PROTO_VERSION 124
  1208. # define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125
  1209. # define SSL_CTRL_SET_MAX_PIPELINES 126
  1210. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127
  1211. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128
  1212. # define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129
  1213. # define SSL_CTRL_GET_MIN_PROTO_VERSION 130
  1214. # define SSL_CTRL_GET_MAX_PROTO_VERSION 131
  1215. # define SSL_CTRL_GET_SIGNATURE_NID 132
  1216. # define SSL_CTRL_GET_TMP_KEY 133
  1217. # define SSL_CTRL_GET_NEGOTIATED_GROUP 134
  1218. # define SSL_CTRL_GET_IANA_GROUPS 135
  1219. # define SSL_CTRL_SET_RETRY_VERIFY 136
  1220. # define SSL_CTRL_GET_VERIFY_CERT_STORE 137
  1221. # define SSL_CTRL_GET_CHAIN_CERT_STORE 138
  1222. # define SSL_CERT_SET_FIRST 1
  1223. # define SSL_CERT_SET_NEXT 2
  1224. # define SSL_CERT_SET_SERVER 3
  1225. # define DTLSv1_get_timeout(ssl, arg) \
  1226. SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg))
  1227. # define DTLSv1_handle_timeout(ssl) \
  1228. SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL)
  1229. # define SSL_num_renegotiations(ssl) \
  1230. SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)
  1231. # define SSL_clear_num_renegotiations(ssl) \
  1232. SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)
  1233. # define SSL_total_renegotiations(ssl) \
  1234. SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)
  1235. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1236. # define SSL_CTX_set_tmp_dh(ctx,dh) \
  1237. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh))
  1238. # endif
  1239. # define SSL_CTX_set_dh_auto(ctx, onoff) \
  1240. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL)
  1241. # define SSL_set_dh_auto(s, onoff) \
  1242. SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL)
  1243. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1244. # define SSL_set_tmp_dh(ssl,dh) \
  1245. SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh))
  1246. # endif
  1247. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1248. # define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \
  1249. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh))
  1250. # define SSL_set_tmp_ecdh(ssl,ecdh) \
  1251. SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh))
  1252. # endif
  1253. # define SSL_CTX_add_extra_chain_cert(ctx,x509) \
  1254. SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509))
  1255. # define SSL_CTX_get_extra_chain_certs(ctx,px509) \
  1256. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509)
  1257. # define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \
  1258. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509)
  1259. # define SSL_CTX_clear_extra_chain_certs(ctx) \
  1260. SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL)
  1261. # define SSL_CTX_set0_chain(ctx,sk) \
  1262. SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk))
  1263. # define SSL_CTX_set1_chain(ctx,sk) \
  1264. SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk))
  1265. # define SSL_CTX_add0_chain_cert(ctx,x509) \
  1266. SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509))
  1267. # define SSL_CTX_add1_chain_cert(ctx,x509) \
  1268. SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509))
  1269. # define SSL_CTX_get0_chain_certs(ctx,px509) \
  1270. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509)
  1271. # define SSL_CTX_clear_chain_certs(ctx) \
  1272. SSL_CTX_set0_chain(ctx,NULL)
  1273. # define SSL_CTX_build_cert_chain(ctx, flags) \
  1274. SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL)
  1275. # define SSL_CTX_select_current_cert(ctx,x509) \
  1276. SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509))
  1277. # define SSL_CTX_set_current_cert(ctx, op) \
  1278. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL)
  1279. # define SSL_CTX_set0_verify_cert_store(ctx,st) \
  1280. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st))
  1281. # define SSL_CTX_set1_verify_cert_store(ctx,st) \
  1282. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
  1283. # define SSL_CTX_get0_verify_cert_store(ctx,st) \
  1284. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
  1285. # define SSL_CTX_set0_chain_cert_store(ctx,st) \
  1286. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
  1287. # define SSL_CTX_set1_chain_cert_store(ctx,st) \
  1288. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
  1289. # define SSL_CTX_get0_chain_cert_store(ctx,st) \
  1290. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
  1291. # define SSL_set0_chain(s,sk) \
  1292. SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk))
  1293. # define SSL_set1_chain(s,sk) \
  1294. SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk))
  1295. # define SSL_add0_chain_cert(s,x509) \
  1296. SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509))
  1297. # define SSL_add1_chain_cert(s,x509) \
  1298. SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509))
  1299. # define SSL_get0_chain_certs(s,px509) \
  1300. SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509)
  1301. # define SSL_clear_chain_certs(s) \
  1302. SSL_set0_chain(s,NULL)
  1303. # define SSL_build_cert_chain(s, flags) \
  1304. SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL)
  1305. # define SSL_select_current_cert(s,x509) \
  1306. SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509))
  1307. # define SSL_set_current_cert(s,op) \
  1308. SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL)
  1309. # define SSL_set0_verify_cert_store(s,st) \
  1310. SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st))
  1311. # define SSL_set1_verify_cert_store(s,st) \
  1312. SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st))
  1313. #define SSL_get0_verify_cert_store(s,st) \
  1314. SSL_ctrl(s,SSL_CTRL_GET_VERIFY_CERT_STORE,0,(char *)(st))
  1315. # define SSL_set0_chain_cert_store(s,st) \
  1316. SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st))
  1317. # define SSL_set1_chain_cert_store(s,st) \
  1318. SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st))
  1319. #define SSL_get0_chain_cert_store(s,st) \
  1320. SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERT_STORE,0,(char *)(st))
  1321. # define SSL_get1_groups(s, glist) \
  1322. SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist))
  1323. # define SSL_get0_iana_groups(s, plst) \
  1324. SSL_ctrl(s,SSL_CTRL_GET_IANA_GROUPS,0,(uint16_t **)(plst))
  1325. # define SSL_CTX_set1_groups(ctx, glist, glistlen) \
  1326. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(int *)(glist))
  1327. # define SSL_CTX_set1_groups_list(ctx, s) \
  1328. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s))
  1329. # define SSL_set1_groups(s, glist, glistlen) \
  1330. SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist))
  1331. # define SSL_set1_groups_list(s, str) \
  1332. SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str))
  1333. # define SSL_get_shared_group(s, n) \
  1334. SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL)
  1335. # define SSL_get_negotiated_group(s) \
  1336. SSL_ctrl(s,SSL_CTRL_GET_NEGOTIATED_GROUP,0,NULL)
  1337. # define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \
  1338. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist))
  1339. # define SSL_CTX_set1_sigalgs_list(ctx, s) \
  1340. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s))
  1341. # define SSL_set1_sigalgs(s, slist, slistlen) \
  1342. SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist))
  1343. # define SSL_set1_sigalgs_list(s, str) \
  1344. SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str))
  1345. # define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \
  1346. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist))
  1347. # define SSL_CTX_set1_client_sigalgs_list(ctx, s) \
  1348. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s))
  1349. # define SSL_set1_client_sigalgs(s, slist, slistlen) \
  1350. SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist))
  1351. # define SSL_set1_client_sigalgs_list(s, str) \
  1352. SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str))
  1353. # define SSL_get0_certificate_types(s, clist) \
  1354. SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist))
  1355. # define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \
  1356. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \
  1357. (char *)(clist))
  1358. # define SSL_set1_client_certificate_types(s, clist, clistlen) \
  1359. SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist))
  1360. # define SSL_get_signature_nid(s, pn) \
  1361. SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn)
  1362. # define SSL_get_peer_signature_nid(s, pn) \
  1363. SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn)
  1364. # define SSL_get_peer_tmp_key(s, pk) \
  1365. SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk)
  1366. # define SSL_get_tmp_key(s, pk) \
  1367. SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk)
  1368. # define SSL_get0_raw_cipherlist(s, plst) \
  1369. SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst)
  1370. # define SSL_get0_ec_point_formats(s, plst) \
  1371. SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst)
  1372. # define SSL_CTX_set_min_proto_version(ctx, version) \
  1373. SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL)
  1374. # define SSL_CTX_set_max_proto_version(ctx, version) \
  1375. SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL)
  1376. # define SSL_CTX_get_min_proto_version(ctx) \
  1377. SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL)
  1378. # define SSL_CTX_get_max_proto_version(ctx) \
  1379. SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL)
  1380. # define SSL_set_min_proto_version(s, version) \
  1381. SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL)
  1382. # define SSL_set_max_proto_version(s, version) \
  1383. SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL)
  1384. # define SSL_get_min_proto_version(s) \
  1385. SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL)
  1386. # define SSL_get_max_proto_version(s) \
  1387. SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL)
  1388. const char *SSL_get0_group_name(SSL *s);
  1389. const char *SSL_group_to_name(SSL *s, int id);
  1390. /* Backwards compatibility, original 1.1.0 names */
  1391. # define SSL_CTRL_GET_SERVER_TMP_KEY \
  1392. SSL_CTRL_GET_PEER_TMP_KEY
  1393. # define SSL_get_server_tmp_key(s, pk) \
  1394. SSL_get_peer_tmp_key(s, pk)
  1395. int SSL_set0_tmp_dh_pkey(SSL *s, EVP_PKEY *dhpkey);
  1396. int SSL_CTX_set0_tmp_dh_pkey(SSL_CTX *ctx, EVP_PKEY *dhpkey);
  1397. /*
  1398. * The following symbol names are old and obsolete. They are kept
  1399. * for compatibility reasons only and should not be used anymore.
  1400. */
  1401. # define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS
  1402. # define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS
  1403. # define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST
  1404. # define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP
  1405. # define SSL_get1_curves SSL_get1_groups
  1406. # define SSL_CTX_set1_curves SSL_CTX_set1_groups
  1407. # define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list
  1408. # define SSL_set1_curves SSL_set1_groups
  1409. # define SSL_set1_curves_list SSL_set1_groups_list
  1410. # define SSL_get_shared_curve SSL_get_shared_group
  1411. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1412. /* Provide some compatibility macros for removed functionality. */
  1413. # define SSL_CTX_need_tmp_RSA(ctx) 0
  1414. # define SSL_CTX_set_tmp_rsa(ctx,rsa) 1
  1415. # define SSL_need_tmp_RSA(ssl) 0
  1416. # define SSL_set_tmp_rsa(ssl,rsa) 1
  1417. # define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0)
  1418. # define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0)
  1419. /*
  1420. * We "pretend" to call the callback to avoid warnings about unused static
  1421. * functions.
  1422. */
  1423. # define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0)
  1424. # define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0)
  1425. # endif
  1426. __owur const BIO_METHOD *BIO_f_ssl(void);
  1427. __owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client);
  1428. __owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx);
  1429. __owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);
  1430. __owur int BIO_ssl_copy_session_id(BIO *to, BIO *from);
  1431. void BIO_ssl_shutdown(BIO *ssl_bio);
  1432. __owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str);
  1433. __owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
  1434. __owur SSL_CTX *SSL_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
  1435. const SSL_METHOD *meth);
  1436. int SSL_CTX_up_ref(SSL_CTX *ctx);
  1437. void SSL_CTX_free(SSL_CTX *);
  1438. __owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t);
  1439. __owur long SSL_CTX_get_timeout(const SSL_CTX *ctx);
  1440. __owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
  1441. void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *);
  1442. void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *);
  1443. __owur int SSL_want(const SSL *s);
  1444. __owur int SSL_clear(SSL *s);
  1445. void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);
  1446. __owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
  1447. __owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s);
  1448. __owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
  1449. __owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c);
  1450. __owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c);
  1451. __owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c);
  1452. __owur const char *OPENSSL_cipher_name(const char *rfc_name);
  1453. __owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);
  1454. __owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);
  1455. __owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
  1456. __owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
  1457. __owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
  1458. __owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
  1459. __owur int SSL_get_fd(const SSL *s);
  1460. __owur int SSL_get_rfd(const SSL *s);
  1461. __owur int SSL_get_wfd(const SSL *s);
  1462. __owur const char *SSL_get_cipher_list(const SSL *s, int n);
  1463. __owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size);
  1464. __owur int SSL_get_read_ahead(const SSL *s);
  1465. __owur int SSL_pending(const SSL *s);
  1466. __owur int SSL_has_pending(const SSL *s);
  1467. # ifndef OPENSSL_NO_SOCK
  1468. __owur int SSL_set_fd(SSL *s, int fd);
  1469. __owur int SSL_set_rfd(SSL *s, int fd);
  1470. __owur int SSL_set_wfd(SSL *s, int fd);
  1471. # endif
  1472. void SSL_set0_rbio(SSL *s, BIO *rbio);
  1473. void SSL_set0_wbio(SSL *s, BIO *wbio);
  1474. void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio);
  1475. __owur BIO *SSL_get_rbio(const SSL *s);
  1476. __owur BIO *SSL_get_wbio(const SSL *s);
  1477. __owur int SSL_set_cipher_list(SSL *s, const char *str);
  1478. __owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
  1479. __owur int SSL_set_ciphersuites(SSL *s, const char *str);
  1480. void SSL_set_read_ahead(SSL *s, int yes);
  1481. __owur int SSL_get_verify_mode(const SSL *s);
  1482. __owur int SSL_get_verify_depth(const SSL *s);
  1483. __owur SSL_verify_cb SSL_get_verify_callback(const SSL *s);
  1484. void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback);
  1485. void SSL_set_verify_depth(SSL *s, int depth);
  1486. void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg);
  1487. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1488. OSSL_DEPRECATEDIN_3_0 __owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
  1489. OSSL_DEPRECATEDIN_3_0
  1490. __owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl,
  1491. const unsigned char *d, long len);
  1492. # endif
  1493. __owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
  1494. __owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d,
  1495. long len);
  1496. __owur int SSL_use_certificate(SSL *ssl, X509 *x);
  1497. __owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
  1498. __owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey,
  1499. STACK_OF(X509) *chain, int override);
  1500. /* serverinfo file format versions */
  1501. # define SSL_SERVERINFOV1 1
  1502. # define SSL_SERVERINFOV2 2
  1503. /* Set serverinfo data for the current active cert. */
  1504. __owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
  1505. size_t serverinfo_length);
  1506. __owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,
  1507. const unsigned char *serverinfo,
  1508. size_t serverinfo_length);
  1509. __owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);
  1510. #ifndef OPENSSL_NO_DEPRECATED_3_0
  1511. OSSL_DEPRECATEDIN_3_0
  1512. __owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
  1513. #endif
  1514. __owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);
  1515. __owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type);
  1516. #ifndef OPENSSL_NO_DEPRECATED_3_0
  1517. OSSL_DEPRECATEDIN_3_0
  1518. __owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file,
  1519. int type);
  1520. #endif
  1521. __owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file,
  1522. int type);
  1523. __owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file,
  1524. int type);
  1525. /* PEM type */
  1526. __owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file);
  1527. __owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file);
  1528. __owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
  1529. __owur STACK_OF(X509_NAME)
  1530. *SSL_load_client_CA_file_ex(const char *file, OSSL_LIB_CTX *libctx,
  1531. const char *propq);
  1532. __owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
  1533. const char *file);
  1534. int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
  1535. const char *dir);
  1536. int SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
  1537. const char *uri);
  1538. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1539. # define SSL_load_error_strings() \
  1540. OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
  1541. | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
  1542. # endif
  1543. __owur const char *SSL_state_string(const SSL *s);
  1544. __owur const char *SSL_rstate_string(const SSL *s);
  1545. __owur const char *SSL_state_string_long(const SSL *s);
  1546. __owur const char *SSL_rstate_string_long(const SSL *s);
  1547. __owur long SSL_SESSION_get_time(const SSL_SESSION *s);
  1548. __owur long SSL_SESSION_set_time(SSL_SESSION *s, long t);
  1549. __owur long SSL_SESSION_get_timeout(const SSL_SESSION *s);
  1550. __owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
  1551. __owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s);
  1552. __owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version);
  1553. __owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s);
  1554. __owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname);
  1555. void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s,
  1556. const unsigned char **alpn,
  1557. size_t *len);
  1558. __owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s,
  1559. const unsigned char *alpn,
  1560. size_t len);
  1561. __owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s);
  1562. __owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher);
  1563. __owur int SSL_SESSION_has_ticket(const SSL_SESSION *s);
  1564. __owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s);
  1565. void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick,
  1566. size_t *len);
  1567. __owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s);
  1568. __owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s,
  1569. uint32_t max_early_data);
  1570. __owur int SSL_copy_session_id(SSL *to, const SSL *from);
  1571. __owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s);
  1572. __owur int SSL_SESSION_set1_id_context(SSL_SESSION *s,
  1573. const unsigned char *sid_ctx,
  1574. unsigned int sid_ctx_len);
  1575. __owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
  1576. unsigned int sid_len);
  1577. __owur int SSL_SESSION_is_resumable(const SSL_SESSION *s);
  1578. __owur SSL_SESSION *SSL_SESSION_new(void);
  1579. __owur SSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src);
  1580. const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
  1581. unsigned int *len);
  1582. const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s,
  1583. unsigned int *len);
  1584. __owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);
  1585. # ifndef OPENSSL_NO_STDIO
  1586. int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);
  1587. # endif
  1588. int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);
  1589. int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x);
  1590. int SSL_SESSION_up_ref(SSL_SESSION *ses);
  1591. void SSL_SESSION_free(SSL_SESSION *ses);
  1592. __owur int i2d_SSL_SESSION(const SSL_SESSION *in, unsigned char **pp);
  1593. __owur int SSL_set_session(SSL *to, SSL_SESSION *session);
  1594. int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session);
  1595. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session);
  1596. __owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb);
  1597. __owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb);
  1598. __owur int SSL_has_matching_session_id(const SSL *s,
  1599. const unsigned char *id,
  1600. unsigned int id_len);
  1601. SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
  1602. long length);
  1603. SSL_SESSION *d2i_SSL_SESSION_ex(SSL_SESSION **a, const unsigned char **pp,
  1604. long length, OSSL_LIB_CTX *libctx,
  1605. const char *propq);
  1606. # ifdef OPENSSL_X509_H
  1607. __owur X509 *SSL_get0_peer_certificate(const SSL *s);
  1608. __owur X509 *SSL_get1_peer_certificate(const SSL *s);
  1609. /* Deprecated in 3.0.0 */
  1610. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1611. # define SSL_get_peer_certificate SSL_get1_peer_certificate
  1612. # endif
  1613. # endif
  1614. __owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
  1615. __owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
  1616. __owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
  1617. __owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx);
  1618. void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback);
  1619. void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);
  1620. void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,
  1621. int (*cb) (X509_STORE_CTX *, void *),
  1622. void *arg);
  1623. void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg),
  1624. void *arg);
  1625. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1626. OSSL_DEPRECATEDIN_3_0
  1627. __owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
  1628. OSSL_DEPRECATEDIN_3_0
  1629. __owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d,
  1630. long len);
  1631. # endif
  1632. __owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
  1633. __owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx,
  1634. const unsigned char *d, long len);
  1635. __owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
  1636. __owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len,
  1637. const unsigned char *d);
  1638. __owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey,
  1639. STACK_OF(X509) *chain, int override);
  1640. void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);
  1641. void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
  1642. pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx);
  1643. void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx);
  1644. void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb);
  1645. void SSL_set_default_passwd_cb_userdata(SSL *s, void *u);
  1646. pem_password_cb *SSL_get_default_passwd_cb(SSL *s);
  1647. void *SSL_get_default_passwd_cb_userdata(SSL *s);
  1648. __owur int SSL_CTX_check_private_key(const SSL_CTX *ctx);
  1649. __owur int SSL_check_private_key(const SSL *ctx);
  1650. __owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx,
  1651. const unsigned char *sid_ctx,
  1652. unsigned int sid_ctx_len);
  1653. SSL *SSL_new(SSL_CTX *ctx);
  1654. int SSL_up_ref(SSL *s);
  1655. int SSL_is_dtls(const SSL *s);
  1656. int SSL_is_tls(const SSL *s);
  1657. int SSL_is_quic(const SSL *s);
  1658. __owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,
  1659. unsigned int sid_ctx_len);
  1660. __owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);
  1661. __owur int SSL_set_purpose(SSL *ssl, int purpose);
  1662. __owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust);
  1663. __owur int SSL_set_trust(SSL *ssl, int trust);
  1664. __owur int SSL_set1_host(SSL *s, const char *hostname);
  1665. __owur int SSL_add1_host(SSL *s, const char *hostname);
  1666. __owur const char *SSL_get0_peername(SSL *s);
  1667. void SSL_set_hostflags(SSL *s, unsigned int flags);
  1668. __owur int SSL_CTX_dane_enable(SSL_CTX *ctx);
  1669. __owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md,
  1670. uint8_t mtype, uint8_t ord);
  1671. __owur int SSL_dane_enable(SSL *s, const char *basedomain);
  1672. __owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector,
  1673. uint8_t mtype, const unsigned char *data, size_t dlen);
  1674. __owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki);
  1675. __owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector,
  1676. uint8_t *mtype, const unsigned char **data,
  1677. size_t *dlen);
  1678. /*
  1679. * Bridge opacity barrier between libcrypt and libssl, also needed to support
  1680. * offline testing in test/danetest.c
  1681. */
  1682. SSL_DANE *SSL_get0_dane(SSL *ssl);
  1683. /*
  1684. * DANE flags
  1685. */
  1686. unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags);
  1687. unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags);
  1688. unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags);
  1689. unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags);
  1690. __owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
  1691. __owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
  1692. __owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
  1693. __owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);
  1694. # ifndef OPENSSL_NO_SRP
  1695. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1696. OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);
  1697. OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);
  1698. OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);
  1699. OSSL_DEPRECATEDIN_3_0
  1700. int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,
  1701. char *(*cb) (SSL *, void *));
  1702. OSSL_DEPRECATEDIN_3_0
  1703. int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,
  1704. int (*cb) (SSL *, void *));
  1705. OSSL_DEPRECATEDIN_3_0
  1706. int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
  1707. int (*cb) (SSL *, int *, void *));
  1708. OSSL_DEPRECATEDIN_3_0 int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);
  1709. OSSL_DEPRECATEDIN_3_0
  1710. int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
  1711. BIGNUM *sa, BIGNUM *v, char *info);
  1712. OSSL_DEPRECATEDIN_3_0
  1713. int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
  1714. const char *grp);
  1715. OSSL_DEPRECATEDIN_3_0 __owur BIGNUM *SSL_get_srp_g(SSL *s);
  1716. OSSL_DEPRECATEDIN_3_0 __owur BIGNUM *SSL_get_srp_N(SSL *s);
  1717. OSSL_DEPRECATEDIN_3_0 __owur char *SSL_get_srp_username(SSL *s);
  1718. OSSL_DEPRECATEDIN_3_0 __owur char *SSL_get_srp_userinfo(SSL *s);
  1719. # endif
  1720. # endif
  1721. /*
  1722. * ClientHello callback and helpers.
  1723. */
  1724. # define SSL_CLIENT_HELLO_SUCCESS 1
  1725. # define SSL_CLIENT_HELLO_ERROR 0
  1726. # define SSL_CLIENT_HELLO_RETRY (-1)
  1727. typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg);
  1728. void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb,
  1729. void *arg);
  1730. int SSL_client_hello_isv2(SSL *s);
  1731. unsigned int SSL_client_hello_get0_legacy_version(SSL *s);
  1732. size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out);
  1733. size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out);
  1734. size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);
  1735. size_t SSL_client_hello_get0_compression_methods(SSL *s,
  1736. const unsigned char **out);
  1737. int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen);
  1738. int SSL_client_hello_get_extension_order(SSL *s, uint16_t *exts,
  1739. size_t *num_exts);
  1740. int SSL_client_hello_get0_ext(SSL *s, unsigned int type,
  1741. const unsigned char **out, size_t *outlen);
  1742. void SSL_certs_clear(SSL *s);
  1743. void SSL_free(SSL *ssl);
  1744. # ifdef OSSL_ASYNC_FD
  1745. /*
  1746. * Windows application developer has to include windows.h to use these.
  1747. */
  1748. __owur int SSL_waiting_for_async(SSL *s);
  1749. __owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds);
  1750. __owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd,
  1751. size_t *numaddfds, OSSL_ASYNC_FD *delfd,
  1752. size_t *numdelfds);
  1753. __owur int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);
  1754. __owur int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);
  1755. __owur int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);
  1756. __owur int SSL_set_async_callback_arg(SSL *s, void *arg);
  1757. __owur int SSL_get_async_status(SSL *s, int *status);
  1758. # endif
  1759. __owur int SSL_accept(SSL *ssl);
  1760. __owur int SSL_stateless(SSL *s);
  1761. __owur int SSL_connect(SSL *ssl);
  1762. __owur int SSL_read(SSL *ssl, void *buf, int num);
  1763. __owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);
  1764. # define SSL_READ_EARLY_DATA_ERROR 0
  1765. # define SSL_READ_EARLY_DATA_SUCCESS 1
  1766. # define SSL_READ_EARLY_DATA_FINISH 2
  1767. __owur int SSL_read_early_data(SSL *s, void *buf, size_t num,
  1768. size_t *readbytes);
  1769. __owur int SSL_peek(SSL *ssl, void *buf, int num);
  1770. __owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);
  1771. __owur ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size,
  1772. int flags);
  1773. __owur int SSL_write(SSL *ssl, const void *buf, int num);
  1774. __owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written);
  1775. __owur int SSL_write_early_data(SSL *s, const void *buf, size_t num,
  1776. size_t *written);
  1777. long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);
  1778. long SSL_callback_ctrl(SSL *, int, void (*)(void));
  1779. long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);
  1780. long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
  1781. # define SSL_EARLY_DATA_NOT_SENT 0
  1782. # define SSL_EARLY_DATA_REJECTED 1
  1783. # define SSL_EARLY_DATA_ACCEPTED 2
  1784. __owur int SSL_get_early_data_status(const SSL *s);
  1785. __owur int SSL_get_error(const SSL *s, int ret_code);
  1786. __owur const char *SSL_get_version(const SSL *s);
  1787. __owur int SSL_get_handshake_rtt(const SSL *s, uint64_t *rtt);
  1788. /* This sets the 'default' SSL version that SSL_new() will create */
  1789. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1790. OSSL_DEPRECATEDIN_3_0
  1791. __owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth);
  1792. # endif
  1793. # ifndef OPENSSL_NO_SSL3_METHOD
  1794. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1795. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
  1796. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_server_method(void);
  1797. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *SSLv3_client_method(void);
  1798. # endif
  1799. # endif
  1800. #define SSLv23_method TLS_method
  1801. #define SSLv23_server_method TLS_server_method
  1802. #define SSLv23_client_method TLS_client_method
  1803. /* Negotiate highest available SSL/TLS version */
  1804. __owur const SSL_METHOD *TLS_method(void);
  1805. __owur const SSL_METHOD *TLS_server_method(void);
  1806. __owur const SSL_METHOD *TLS_client_method(void);
  1807. # ifndef OPENSSL_NO_TLS1_METHOD
  1808. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1809. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */
  1810. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_server_method(void);
  1811. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_client_method(void);
  1812. # endif
  1813. # endif
  1814. # ifndef OPENSSL_NO_TLS1_1_METHOD
  1815. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1816. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_method(void); /* TLSv1.1 */
  1817. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_server_method(void);
  1818. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_1_client_method(void);
  1819. # endif
  1820. # endif
  1821. # ifndef OPENSSL_NO_TLS1_2_METHOD
  1822. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1823. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_method(void); /* TLSv1.2 */
  1824. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_server_method(void);
  1825. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *TLSv1_2_client_method(void);
  1826. # endif
  1827. # endif
  1828. # ifndef OPENSSL_NO_DTLS1_METHOD
  1829. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1830. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
  1831. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_server_method(void);
  1832. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_client_method(void);
  1833. # endif
  1834. # endif
  1835. # ifndef OPENSSL_NO_DTLS1_2_METHOD
  1836. /* DTLSv1.2 */
  1837. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1838. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_method(void);
  1839. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_server_method(void);
  1840. OSSL_DEPRECATEDIN_1_1_0 __owur const SSL_METHOD *DTLSv1_2_client_method(void);
  1841. # endif
  1842. # endif
  1843. __owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */
  1844. __owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */
  1845. __owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */
  1846. __owur size_t DTLS_get_data_mtu(const SSL *s);
  1847. __owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);
  1848. __owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
  1849. __owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s);
  1850. __owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);
  1851. __owur int SSL_do_handshake(SSL *s);
  1852. int SSL_key_update(SSL *s, int updatetype);
  1853. int SSL_get_key_update_type(const SSL *s);
  1854. int SSL_renegotiate(SSL *s);
  1855. int SSL_renegotiate_abbreviated(SSL *s);
  1856. __owur int SSL_renegotiate_pending(const SSL *s);
  1857. int SSL_new_session_ticket(SSL *s);
  1858. int SSL_shutdown(SSL *s);
  1859. __owur int SSL_verify_client_post_handshake(SSL *s);
  1860. void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val);
  1861. void SSL_set_post_handshake_auth(SSL *s, int val);
  1862. __owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);
  1863. __owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s);
  1864. __owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
  1865. __owur const char *SSL_alert_type_string_long(int value);
  1866. __owur const char *SSL_alert_type_string(int value);
  1867. __owur const char *SSL_alert_desc_string_long(int value);
  1868. __owur const char *SSL_alert_desc_string(int value);
  1869. void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
  1870. void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
  1871. __owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s);
  1872. __owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx);
  1873. __owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x);
  1874. __owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x);
  1875. __owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s);
  1876. void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
  1877. void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
  1878. __owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);
  1879. __owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);
  1880. __owur int SSL_add_client_CA(SSL *ssl, X509 *x);
  1881. __owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x);
  1882. void SSL_set_connect_state(SSL *s);
  1883. void SSL_set_accept_state(SSL *s);
  1884. __owur long SSL_get_default_timeout(const SSL *s);
  1885. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  1886. # define SSL_library_init() OPENSSL_init_ssl(0, NULL)
  1887. # endif
  1888. __owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
  1889. __owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk);
  1890. __owur SSL *SSL_dup(SSL *ssl);
  1891. __owur X509 *SSL_get_certificate(const SSL *ssl);
  1892. /*
  1893. * EVP_PKEY
  1894. */
  1895. struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl);
  1896. __owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx);
  1897. __owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx);
  1898. void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);
  1899. __owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
  1900. void SSL_set_quiet_shutdown(SSL *ssl, int mode);
  1901. __owur int SSL_get_quiet_shutdown(const SSL *ssl);
  1902. void SSL_set_shutdown(SSL *ssl, int mode);
  1903. __owur int SSL_get_shutdown(const SSL *ssl);
  1904. __owur int SSL_version(const SSL *ssl);
  1905. __owur int SSL_client_version(const SSL *s);
  1906. __owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
  1907. __owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx);
  1908. __owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx);
  1909. __owur int SSL_CTX_set_default_verify_store(SSL_CTX *ctx);
  1910. __owur int SSL_CTX_load_verify_file(SSL_CTX *ctx, const char *CAfile);
  1911. __owur int SSL_CTX_load_verify_dir(SSL_CTX *ctx, const char *CApath);
  1912. __owur int SSL_CTX_load_verify_store(SSL_CTX *ctx, const char *CAstore);
  1913. __owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx,
  1914. const char *CAfile,
  1915. const char *CApath);
  1916. # define SSL_get0_session SSL_get_session/* just peek at pointer */
  1917. __owur SSL_SESSION *SSL_get_session(const SSL *ssl);
  1918. __owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
  1919. __owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
  1920. SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx);
  1921. void SSL_set_info_callback(SSL *ssl,
  1922. void (*cb) (const SSL *ssl, int type, int val));
  1923. void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type,
  1924. int val);
  1925. __owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);
  1926. void SSL_set_verify_result(SSL *ssl, long v);
  1927. __owur long SSL_get_verify_result(const SSL *ssl);
  1928. __owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s);
  1929. __owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out,
  1930. size_t outlen);
  1931. __owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out,
  1932. size_t outlen);
  1933. __owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess,
  1934. unsigned char *out, size_t outlen);
  1935. __owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess,
  1936. const unsigned char *in, size_t len);
  1937. uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess);
  1938. #define SSL_get_ex_new_index(l, p, newf, dupf, freef) \
  1939. CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef)
  1940. __owur int SSL_set_ex_data(SSL *ssl, int idx, void *data);
  1941. void *SSL_get_ex_data(const SSL *ssl, int idx);
  1942. #define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \
  1943. CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef)
  1944. __owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data);
  1945. void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx);
  1946. #define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \
  1947. CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef)
  1948. __owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data);
  1949. void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx);
  1950. __owur int SSL_get_ex_data_X509_STORE_CTX_idx(void);
  1951. # define SSL_CTX_sess_set_cache_size(ctx,t) \
  1952. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)
  1953. # define SSL_CTX_sess_get_cache_size(ctx) \
  1954. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)
  1955. # define SSL_CTX_set_session_cache_mode(ctx,m) \
  1956. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
  1957. # define SSL_CTX_get_session_cache_mode(ctx) \
  1958. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
  1959. # define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)
  1960. # define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)
  1961. # define SSL_CTX_get_read_ahead(ctx) \
  1962. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)
  1963. # define SSL_CTX_set_read_ahead(ctx,m) \
  1964. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)
  1965. # define SSL_CTX_get_max_cert_list(ctx) \
  1966. SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
  1967. # define SSL_CTX_set_max_cert_list(ctx,m) \
  1968. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
  1969. # define SSL_get_max_cert_list(ssl) \
  1970. SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)
  1971. # define SSL_set_max_cert_list(ssl,m) \
  1972. SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)
  1973. # define SSL_CTX_set_max_send_fragment(ctx,m) \
  1974. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
  1975. # define SSL_set_max_send_fragment(ssl,m) \
  1976. SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL)
  1977. # define SSL_CTX_set_split_send_fragment(ctx,m) \
  1978. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL)
  1979. # define SSL_set_split_send_fragment(ssl,m) \
  1980. SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL)
  1981. # define SSL_CTX_set_max_pipelines(ctx,m) \
  1982. SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL)
  1983. # define SSL_set_max_pipelines(ssl,m) \
  1984. SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL)
  1985. # define SSL_set_retry_verify(ssl) \
  1986. (SSL_ctrl(ssl,SSL_CTRL_SET_RETRY_VERIFY,0,NULL) > 0)
  1987. void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len);
  1988. void SSL_set_default_read_buffer_len(SSL *s, size_t len);
  1989. # ifndef OPENSSL_NO_DH
  1990. # ifndef OPENSSL_NO_DEPRECATED_3_0
  1991. /* NB: the |keylength| is only applicable when is_export is true */
  1992. OSSL_DEPRECATEDIN_3_0
  1993. void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
  1994. DH *(*dh) (SSL *ssl, int is_export,
  1995. int keylength));
  1996. OSSL_DEPRECATEDIN_3_0
  1997. void SSL_set_tmp_dh_callback(SSL *ssl,
  1998. DH *(*dh) (SSL *ssl, int is_export,
  1999. int keylength));
  2000. # endif
  2001. # endif
  2002. __owur const COMP_METHOD *SSL_get_current_compression(const SSL *s);
  2003. __owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s);
  2004. __owur const char *SSL_COMP_get_name(const COMP_METHOD *comp);
  2005. __owur const char *SSL_COMP_get0_name(const SSL_COMP *comp);
  2006. __owur int SSL_COMP_get_id(const SSL_COMP *comp);
  2007. STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
  2008. __owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP)
  2009. *meths);
  2010. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  2011. # define SSL_COMP_free_compression_methods() while(0) continue
  2012. # endif
  2013. __owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
  2014. const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);
  2015. int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
  2016. int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
  2017. int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,
  2018. int isv2format, STACK_OF(SSL_CIPHER) **sk,
  2019. STACK_OF(SSL_CIPHER) **scsvs);
  2020. /* TLS extensions functions */
  2021. __owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len);
  2022. __owur int SSL_set_session_ticket_ext_cb(SSL *s,
  2023. tls_session_ticket_ext_cb_fn cb,
  2024. void *arg);
  2025. /* Pre-shared secret session resumption functions */
  2026. __owur int SSL_set_session_secret_cb(SSL *s,
  2027. tls_session_secret_cb_fn session_secret_cb,
  2028. void *arg);
  2029. void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx,
  2030. int (*cb) (SSL *ssl,
  2031. int
  2032. is_forward_secure));
  2033. void SSL_set_not_resumable_session_callback(SSL *ssl,
  2034. int (*cb) (SSL *ssl,
  2035. int is_forward_secure));
  2036. void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx,
  2037. size_t (*cb) (SSL *ssl, int type,
  2038. size_t len, void *arg));
  2039. void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);
  2040. void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);
  2041. int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);
  2042. int SSL_set_record_padding_callback(SSL *ssl,
  2043. size_t (*cb) (SSL *ssl, int type,
  2044. size_t len, void *arg));
  2045. void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);
  2046. void *SSL_get_record_padding_callback_arg(const SSL *ssl);
  2047. int SSL_set_block_padding(SSL *ssl, size_t block_size);
  2048. int SSL_set_num_tickets(SSL *s, size_t num_tickets);
  2049. size_t SSL_get_num_tickets(const SSL *s);
  2050. int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);
  2051. size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);
  2052. /* QUIC support */
  2053. int SSL_handle_events(SSL *s);
  2054. __owur int SSL_get_event_timeout(SSL *s, struct timeval *tv, int *is_infinite);
  2055. __owur int SSL_get_rpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
  2056. __owur int SSL_get_wpoll_descriptor(SSL *s, BIO_POLL_DESCRIPTOR *desc);
  2057. __owur int SSL_net_read_desired(SSL *s);
  2058. __owur int SSL_net_write_desired(SSL *s);
  2059. __owur int SSL_set_blocking_mode(SSL *s, int blocking);
  2060. __owur int SSL_get_blocking_mode(SSL *s);
  2061. __owur int SSL_set1_initial_peer_addr(SSL *s, const BIO_ADDR *peer_addr);
  2062. __owur SSL *SSL_get0_connection(SSL *s);
  2063. __owur int SSL_is_connection(SSL *s);
  2064. #define SSL_STREAM_TYPE_NONE 0
  2065. #define SSL_STREAM_TYPE_READ (1U << 0)
  2066. #define SSL_STREAM_TYPE_WRITE (1U << 1)
  2067. #define SSL_STREAM_TYPE_BIDI (SSL_STREAM_TYPE_READ | SSL_STREAM_TYPE_WRITE)
  2068. __owur int SSL_get_stream_type(SSL *s);
  2069. __owur uint64_t SSL_get_stream_id(SSL *s);
  2070. __owur int SSL_is_stream_local(SSL *s);
  2071. #define SSL_DEFAULT_STREAM_MODE_NONE 0
  2072. #define SSL_DEFAULT_STREAM_MODE_AUTO_BIDI 1
  2073. #define SSL_DEFAULT_STREAM_MODE_AUTO_UNI 2
  2074. __owur int SSL_set_default_stream_mode(SSL *s, uint32_t mode);
  2075. #define SSL_STREAM_FLAG_UNI (1U << 0)
  2076. #define SSL_STREAM_FLAG_NO_BLOCK (1U << 1)
  2077. #define SSL_STREAM_FLAG_ADVANCE (1U << 2)
  2078. __owur SSL *SSL_new_stream(SSL *s, uint64_t flags);
  2079. #define SSL_INCOMING_STREAM_POLICY_AUTO 0
  2080. #define SSL_INCOMING_STREAM_POLICY_ACCEPT 1
  2081. #define SSL_INCOMING_STREAM_POLICY_REJECT 2
  2082. __owur int SSL_set_incoming_stream_policy(SSL *s, int policy, uint64_t aec);
  2083. #define SSL_ACCEPT_STREAM_NO_BLOCK (1U << 0)
  2084. __owur SSL *SSL_accept_stream(SSL *s, uint64_t flags);
  2085. __owur size_t SSL_get_accept_stream_queue_len(SSL *s);
  2086. # ifndef OPENSSL_NO_QUIC
  2087. __owur int SSL_inject_net_dgram(SSL *s, const unsigned char *buf,
  2088. size_t buf_len,
  2089. const BIO_ADDR *peer,
  2090. const BIO_ADDR *local);
  2091. # endif
  2092. typedef struct ssl_shutdown_ex_args_st {
  2093. uint64_t quic_error_code;
  2094. const char *quic_reason;
  2095. } SSL_SHUTDOWN_EX_ARGS;
  2096. #define SSL_SHUTDOWN_FLAG_RAPID (1U << 0)
  2097. #define SSL_SHUTDOWN_FLAG_NO_STREAM_FLUSH (1U << 1)
  2098. #define SSL_SHUTDOWN_FLAG_NO_BLOCK (1U << 2)
  2099. #define SSL_SHUTDOWN_FLAG_WAIT_PEER (1U << 3)
  2100. __owur int SSL_shutdown_ex(SSL *ssl, uint64_t flags,
  2101. const SSL_SHUTDOWN_EX_ARGS *args,
  2102. size_t args_len);
  2103. __owur int SSL_stream_conclude(SSL *ssl, uint64_t flags);
  2104. typedef struct ssl_stream_reset_args_st {
  2105. uint64_t quic_error_code;
  2106. } SSL_STREAM_RESET_ARGS;
  2107. __owur int SSL_stream_reset(SSL *ssl,
  2108. const SSL_STREAM_RESET_ARGS *args,
  2109. size_t args_len);
  2110. #define SSL_STREAM_STATE_NONE 0
  2111. #define SSL_STREAM_STATE_OK 1
  2112. #define SSL_STREAM_STATE_WRONG_DIR 2
  2113. #define SSL_STREAM_STATE_FINISHED 3
  2114. #define SSL_STREAM_STATE_RESET_LOCAL 4
  2115. #define SSL_STREAM_STATE_RESET_REMOTE 5
  2116. #define SSL_STREAM_STATE_CONN_CLOSED 6
  2117. __owur int SSL_get_stream_read_state(SSL *ssl);
  2118. __owur int SSL_get_stream_write_state(SSL *ssl);
  2119. __owur int SSL_get_stream_read_error_code(SSL *ssl, uint64_t *app_error_code);
  2120. __owur int SSL_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code);
  2121. #define SSL_CONN_CLOSE_FLAG_LOCAL (1U << 0)
  2122. #define SSL_CONN_CLOSE_FLAG_TRANSPORT (1U << 1)
  2123. typedef struct ssl_conn_close_info_st {
  2124. uint64_t error_code;
  2125. const char *reason;
  2126. size_t reason_len;
  2127. uint32_t flags;
  2128. } SSL_CONN_CLOSE_INFO;
  2129. __owur int SSL_get_conn_close_info(SSL *ssl,
  2130. SSL_CONN_CLOSE_INFO *info,
  2131. size_t info_len);
  2132. # ifndef OPENSSL_NO_DEPRECATED_1_1_0
  2133. # define SSL_cache_hit(s) SSL_session_reused(s)
  2134. # endif
  2135. __owur int SSL_session_reused(const SSL *s);
  2136. __owur int SSL_is_server(const SSL *s);
  2137. __owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void);
  2138. int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx);
  2139. void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx);
  2140. unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags);
  2141. __owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx,
  2142. unsigned int flags);
  2143. __owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre);
  2144. void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl);
  2145. void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx);
  2146. __owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value);
  2147. __owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv);
  2148. __owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd);
  2149. void SSL_add_ssl_module(void);
  2150. int SSL_config(SSL *s, const char *name);
  2151. int SSL_CTX_config(SSL_CTX *ctx, const char *name);
  2152. # ifndef OPENSSL_NO_SSL_TRACE
  2153. void SSL_trace(int write_p, int version, int content_type,
  2154. const void *buf, size_t len, SSL *ssl, void *arg);
  2155. # endif
  2156. # ifndef OPENSSL_NO_SOCK
  2157. int DTLSv1_listen(SSL *s, BIO_ADDR *client);
  2158. # endif
  2159. # ifndef OPENSSL_NO_CT
  2160. /*
  2161. * A callback for verifying that the received SCTs are sufficient.
  2162. * Expected to return 1 if they are sufficient, otherwise 0.
  2163. * May return a negative integer if an error occurs.
  2164. * A connection should be aborted if the SCTs are deemed insufficient.
  2165. */
  2166. typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx,
  2167. const STACK_OF(SCT) *scts, void *arg);
  2168. /*
  2169. * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate
  2170. * the received SCTs.
  2171. * If the callback returns a non-positive result, the connection is terminated.
  2172. * Call this function before beginning a handshake.
  2173. * If a NULL |callback| is provided, SCT validation is disabled.
  2174. * |arg| is arbitrary userdata that will be passed to the callback whenever it
  2175. * is invoked. Ownership of |arg| remains with the caller.
  2176. *
  2177. * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response
  2178. * will be requested.
  2179. */
  2180. int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,
  2181. void *arg);
  2182. int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
  2183. ssl_ct_validation_cb callback,
  2184. void *arg);
  2185. #define SSL_disable_ct(s) \
  2186. ((void) SSL_set_validation_callback((s), NULL, NULL))
  2187. #define SSL_CTX_disable_ct(ctx) \
  2188. ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL))
  2189. /*
  2190. * The validation type enumerates the available behaviours of the built-in SSL
  2191. * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct().
  2192. * The underlying callback is a static function in libssl.
  2193. */
  2194. enum {
  2195. SSL_CT_VALIDATION_PERMISSIVE = 0,
  2196. SSL_CT_VALIDATION_STRICT
  2197. };
  2198. /*
  2199. * Enable CT by setting up a callback that implements one of the built-in
  2200. * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always
  2201. * continues the handshake, the application can make appropriate decisions at
  2202. * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at
  2203. * least one valid SCT, or else handshake termination will be requested. The
  2204. * handshake may continue anyway if SSL_VERIFY_NONE is in effect.
  2205. */
  2206. int SSL_enable_ct(SSL *s, int validation_mode);
  2207. int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode);
  2208. /*
  2209. * Report whether a non-NULL callback is enabled.
  2210. */
  2211. int SSL_ct_is_enabled(const SSL *s);
  2212. int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx);
  2213. /* Gets the SCTs received from a connection */
  2214. const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s);
  2215. /*
  2216. * Loads the CT log list from the default location.
  2217. * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store,
  2218. * the log information loaded from this file will be appended to the
  2219. * CTLOG_STORE.
  2220. * Returns 1 on success, 0 otherwise.
  2221. */
  2222. int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx);
  2223. /*
  2224. * Loads the CT log list from the specified file path.
  2225. * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store,
  2226. * the log information loaded from this file will be appended to the
  2227. * CTLOG_STORE.
  2228. * Returns 1 on success, 0 otherwise.
  2229. */
  2230. int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
  2231. /*
  2232. * Sets the CT log list used by all SSL connections created from this SSL_CTX.
  2233. * Ownership of the CTLOG_STORE is transferred to the SSL_CTX.
  2234. */
  2235. void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs);
  2236. /*
  2237. * Gets the CT log list used by all SSL connections created from this SSL_CTX.
  2238. * This will be NULL unless one of the following functions has been called:
  2239. * - SSL_CTX_set_default_ctlog_list_file
  2240. * - SSL_CTX_set_ctlog_list_file
  2241. * - SSL_CTX_set_ctlog_store
  2242. */
  2243. const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx);
  2244. # endif /* OPENSSL_NO_CT */
  2245. /* What the "other" parameter contains in security callback */
  2246. /* Mask for type */
  2247. # define SSL_SECOP_OTHER_TYPE 0xffff0000
  2248. # define SSL_SECOP_OTHER_NONE 0
  2249. # define SSL_SECOP_OTHER_CIPHER (1 << 16)
  2250. # define SSL_SECOP_OTHER_CURVE (2 << 16)
  2251. # define SSL_SECOP_OTHER_DH (3 << 16)
  2252. # define SSL_SECOP_OTHER_PKEY (4 << 16)
  2253. # define SSL_SECOP_OTHER_SIGALG (5 << 16)
  2254. # define SSL_SECOP_OTHER_CERT (6 << 16)
  2255. /* Indicated operation refers to peer key or certificate */
  2256. # define SSL_SECOP_PEER 0x1000
  2257. /* Values for "op" parameter in security callback */
  2258. /* Called to filter ciphers */
  2259. /* Ciphers client supports */
  2260. # define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER)
  2261. /* Cipher shared by client/server */
  2262. # define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER)
  2263. /* Sanity check of cipher server selects */
  2264. # define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER)
  2265. /* Curves supported by client */
  2266. # define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE)
  2267. /* Curves shared by client/server */
  2268. # define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE)
  2269. /* Sanity check of curve server selects */
  2270. # define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE)
  2271. /* Temporary DH key */
  2272. # define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY)
  2273. /* SSL/TLS version */
  2274. # define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE)
  2275. /* Session tickets */
  2276. # define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE)
  2277. /* Supported signature algorithms sent to peer */
  2278. # define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG)
  2279. /* Shared signature algorithm */
  2280. # define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG)
  2281. /* Sanity check signature algorithm allowed */
  2282. # define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG)
  2283. /* Used to get mask of supported public key signature algorithms */
  2284. # define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG)
  2285. /* Use to see if compression is allowed */
  2286. # define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE)
  2287. /* EE key in certificate */
  2288. # define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT)
  2289. /* CA key in certificate */
  2290. # define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT)
  2291. /* CA digest algorithm in certificate */
  2292. # define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT)
  2293. /* Peer EE key in certificate */
  2294. # define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER)
  2295. /* Peer CA key in certificate */
  2296. # define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER)
  2297. /* Peer CA digest algorithm in certificate */
  2298. # define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER)
  2299. void SSL_set_security_level(SSL *s, int level);
  2300. __owur int SSL_get_security_level(const SSL *s);
  2301. void SSL_set_security_callback(SSL *s,
  2302. int (*cb) (const SSL *s, const SSL_CTX *ctx,
  2303. int op, int bits, int nid,
  2304. void *other, void *ex));
  2305. int (*SSL_get_security_callback(const SSL *s)) (const SSL *s,
  2306. const SSL_CTX *ctx, int op,
  2307. int bits, int nid, void *other,
  2308. void *ex);
  2309. void SSL_set0_security_ex_data(SSL *s, void *ex);
  2310. __owur void *SSL_get0_security_ex_data(const SSL *s);
  2311. void SSL_CTX_set_security_level(SSL_CTX *ctx, int level);
  2312. __owur int SSL_CTX_get_security_level(const SSL_CTX *ctx);
  2313. void SSL_CTX_set_security_callback(SSL_CTX *ctx,
  2314. int (*cb) (const SSL *s, const SSL_CTX *ctx,
  2315. int op, int bits, int nid,
  2316. void *other, void *ex));
  2317. int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s,
  2318. const SSL_CTX *ctx,
  2319. int op, int bits,
  2320. int nid,
  2321. void *other,
  2322. void *ex);
  2323. void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);
  2324. __owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);
  2325. /* OPENSSL_INIT flag 0x010000 reserved for internal use */
  2326. # define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L
  2327. # define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L
  2328. # define OPENSSL_INIT_SSL_DEFAULT \
  2329. (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS)
  2330. int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
  2331. # ifndef OPENSSL_NO_UNIT_TEST
  2332. __owur const struct openssl_ssl_test_functions *SSL_test_functions(void);
  2333. # endif
  2334. __owur int SSL_free_buffers(SSL *ssl);
  2335. __owur int SSL_alloc_buffers(SSL *ssl);
  2336. /* Status codes passed to the decrypt session ticket callback. Some of these
  2337. * are for internal use only and are never passed to the callback. */
  2338. typedef int SSL_TICKET_STATUS;
  2339. /* Support for ticket appdata */
  2340. /* fatal error, malloc failure */
  2341. # define SSL_TICKET_FATAL_ERR_MALLOC 0
  2342. /* fatal error, either from parsing or decrypting the ticket */
  2343. # define SSL_TICKET_FATAL_ERR_OTHER 1
  2344. /* No ticket present */
  2345. # define SSL_TICKET_NONE 2
  2346. /* Empty ticket present */
  2347. # define SSL_TICKET_EMPTY 3
  2348. /* the ticket couldn't be decrypted */
  2349. # define SSL_TICKET_NO_DECRYPT 4
  2350. /* a ticket was successfully decrypted */
  2351. # define SSL_TICKET_SUCCESS 5
  2352. /* same as above but the ticket needs to be renewed */
  2353. # define SSL_TICKET_SUCCESS_RENEW 6
  2354. /* Return codes for the decrypt session ticket callback */
  2355. typedef int SSL_TICKET_RETURN;
  2356. /* An error occurred */
  2357. #define SSL_TICKET_RETURN_ABORT 0
  2358. /* Do not use the ticket, do not send a renewed ticket to the client */
  2359. #define SSL_TICKET_RETURN_IGNORE 1
  2360. /* Do not use the ticket, send a renewed ticket to the client */
  2361. #define SSL_TICKET_RETURN_IGNORE_RENEW 2
  2362. /* Use the ticket, do not send a renewed ticket to the client */
  2363. #define SSL_TICKET_RETURN_USE 3
  2364. /* Use the ticket, send a renewed ticket to the client */
  2365. #define SSL_TICKET_RETURN_USE_RENEW 4
  2366. typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg);
  2367. typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss,
  2368. const unsigned char *keyname,
  2369. size_t keyname_length,
  2370. SSL_TICKET_STATUS status,
  2371. void *arg);
  2372. int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx,
  2373. SSL_CTX_generate_session_ticket_fn gen_cb,
  2374. SSL_CTX_decrypt_session_ticket_fn dec_cb,
  2375. void *arg);
  2376. int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len);
  2377. int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len);
  2378. typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us);
  2379. void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb);
  2380. typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg);
  2381. void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx,
  2382. SSL_allow_early_data_cb_fn cb,
  2383. void *arg);
  2384. void SSL_set_allow_early_data_cb(SSL *s,
  2385. SSL_allow_early_data_cb_fn cb,
  2386. void *arg);
  2387. /* store the default cipher strings inside the library */
  2388. const char *OSSL_default_cipher_list(void);
  2389. const char *OSSL_default_ciphersuites(void);
  2390. /* RFC8879 Certificate compression APIs */
  2391. int SSL_CTX_compress_certs(SSL_CTX *ctx, int alg);
  2392. int SSL_compress_certs(SSL *ssl, int alg);
  2393. int SSL_CTX_set1_cert_comp_preference(SSL_CTX *ctx, int *algs, size_t len);
  2394. int SSL_set1_cert_comp_preference(SSL *ssl, int *algs, size_t len);
  2395. int SSL_CTX_set1_compressed_cert(SSL_CTX *ctx, int algorithm, unsigned char *comp_data,
  2396. size_t comp_length, size_t orig_length);
  2397. int SSL_set1_compressed_cert(SSL *ssl, int algorithm, unsigned char *comp_data,
  2398. size_t comp_length, size_t orig_length);
  2399. size_t SSL_CTX_get1_compressed_cert(SSL_CTX *ctx, int alg, unsigned char **data, size_t *orig_len);
  2400. size_t SSL_get1_compressed_cert(SSL *ssl, int alg, unsigned char **data, size_t *orig_len);
  2401. __owur int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk);
  2402. __owur EVP_PKEY *SSL_get0_peer_rpk(const SSL *s);
  2403. __owur EVP_PKEY *SSL_SESSION_get0_peer_rpk(SSL_SESSION *s);
  2404. __owur int SSL_get_negotiated_client_cert_type(const SSL *s);
  2405. __owur int SSL_get_negotiated_server_cert_type(const SSL *s);
  2406. __owur int SSL_set1_client_cert_type(SSL *s, const unsigned char *val, size_t len);
  2407. __owur int SSL_set1_server_cert_type(SSL *s, const unsigned char *val, size_t len);
  2408. __owur int SSL_CTX_set1_client_cert_type(SSL_CTX *ctx, const unsigned char *val, size_t len);
  2409. __owur int SSL_CTX_set1_server_cert_type(SSL_CTX *ctx, const unsigned char *val, size_t len);
  2410. __owur int SSL_get0_client_cert_type(const SSL *s, unsigned char **t, size_t *len);
  2411. __owur int SSL_get0_server_cert_type(const SSL *s, unsigned char **t, size_t *len);
  2412. __owur int SSL_CTX_get0_client_cert_type(const SSL_CTX *ctx, unsigned char **t, size_t *len);
  2413. __owur int SSL_CTX_get0_server_cert_type(const SSL_CTX *s, unsigned char **t, size_t *len);
  2414. # ifdef __cplusplus
  2415. }
  2416. # endif
  2417. #endif