cjson
fuzzing
inputs
test1 test10 test11 test2 test3 test3.bu test3.uf test3.uu test4 test5 test6 test7 test8 test9library_config
cJSONConfig.cmake.in cJSONConfigVersion.cmake.in libcjson.pc.in libcjson_utils.pc.in uninstall.cmaketests
inputs
test1 test1.expected test10 test10.expected test11 test11.expected test2 test2.expected test3 test3.expected test4 test4.expected test5 test5.expected test6 test7 test7.expected test8 test8.expected test9 test9.expectedjson-patch-tests
.editorconfig .gitignore .npmignore README.md cjson-utils-tests.json package.json spec_tests.json tests.jsonunity
auto
colour_prompt.rb colour_reporter.rb generate_config.yml generate_module.rb generate_test_runner.rb parse_output.rb stylize_as_junit.rb test_file_filter.rb type_sanitizer.rb unity_test_summary.py unity_test_summary.rb unity_to_junit.pydocs
ThrowTheSwitchCodingStandard.md UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf UnityAssertionsReference.md UnityConfigurationGuide.md UnityGettingStartedGuide.md UnityHelperScriptsGuide.md license.txtexamples
unity_config.hcurl
.github
scripts
cleancmd.pl cmp-config.pl cmp-pkg-config.sh codespell-ignore.words codespell.sh distfiles.sh pyspelling.words pyspelling.yaml randcurl.pl requirements-docs.txt requirements-proselint.txt requirements.txt shellcheck-ci.sh shellcheck.sh spellcheck.curl trimmarkdownheader.pl typos.sh typos.toml verify-examples.pl verify-synopsis.pl yamlcheck.sh yamlcheck.yamlworkflows
appveyor-status.yml checkdocs.yml checksrc.yml checkurls.yml codeql.yml configure-vs-cmake.yml curl-for-win.yml distcheck.yml fuzz.yml http3-linux.yml label.yml linux-old.yml linux.yml macos.yml non-native.yml windows.ymlCMake
CurlSymbolHiding.cmake CurlTests.c FindBrotli.cmake FindCares.cmake FindGSS.cmake FindGnuTLS.cmake FindLDAP.cmake FindLibbacktrace.cmake FindLibgsasl.cmake FindLibidn2.cmake FindLibpsl.cmake FindLibssh.cmake FindLibssh2.cmake FindLibuv.cmake FindMbedTLS.cmake FindNGHTTP2.cmake FindNGHTTP3.cmake FindNGTCP2.cmake FindNettle.cmake FindQuiche.cmake FindRustls.cmake FindWolfSSL.cmake FindZstd.cmake Macros.cmake OtherTests.cmake PickyWarnings.cmake Utilities.cmake cmake_uninstall.in.cmake curl-config.in.cmake unix-cache.cmake win32-cache.cmakedocs
cmdline-opts
.gitignore CMakeLists.txt MANPAGE.md Makefile.am Makefile.inc _AUTHORS.md _BUGS.md _DESCRIPTION.md _ENVIRONMENT.md _EXITCODES.md _FILES.md _GLOBBING.md _NAME.md _OPTIONS.md _OUTPUT.md _PROGRESS.md _PROTOCOLS.md _PROXYPREFIX.md _SEEALSO.md _SYNOPSIS.md _URL.md _VARIABLES.md _VERSION.md _WWW.md abstract-unix-socket.md alt-svc.md anyauth.md append.md aws-sigv4.md basic.md ca-native.md cacert.md capath.md cert-status.md cert-type.md cert.md ciphers.md compressed-ssh.md compressed.md config.md connect-timeout.md connect-to.md continue-at.md cookie-jar.md cookie.md create-dirs.md create-file-mode.md crlf.md crlfile.md curves.md data-ascii.md data-binary.md data-raw.md data-urlencode.md data.md delegation.md digest.md disable-eprt.md disable-epsv.md disable.md disallow-username-in-url.md dns-interface.md dns-ipv4-addr.md dns-ipv6-addr.md dns-servers.md doh-cert-status.md doh-insecure.md doh-url.md dump-ca-embed.md dump-header.md ech.md egd-file.md engine.md etag-compare.md etag-save.md expect100-timeout.md fail-early.md fail-with-body.md fail.md false-start.md follow.md form-escape.md form-string.md form.md ftp-account.md ftp-alternative-to-user.md ftp-create-dirs.md ftp-method.md ftp-pasv.md ftp-port.md ftp-pret.md ftp-skip-pasv-ip.md ftp-ssl-ccc-mode.md ftp-ssl-ccc.md ftp-ssl-control.md get.md globoff.md happy-eyeballs-timeout-ms.md haproxy-clientip.md haproxy-protocol.md head.md header.md help.md hostpubmd5.md hostpubsha256.md hsts.md http0.9.md http1.0.md http1.1.md http2-prior-knowledge.md http2.md http3-only.md http3.md ignore-content-length.md insecure.md interface.md ip-tos.md ipfs-gateway.md ipv4.md ipv6.md json.md junk-session-cookies.md keepalive-cnt.md keepalive-time.md key-type.md key.md knownhosts.md krb.md libcurl.md limit-rate.md list-only.md local-port.md location-trusted.md location.md login-options.md mail-auth.md mail-from.md mail-rcpt-allowfails.md mail-rcpt.md mainpage.idx manual.md max-filesize.md max-redirs.md max-time.md metalink.md mptcp.md negotiate.md netrc-file.md netrc-optional.md netrc.md next.md no-alpn.md no-buffer.md no-clobber.md no-keepalive.md no-npn.md no-progress-meter.md no-sessionid.md noproxy.md ntlm-wb.md ntlm.md oauth2-bearer.md out-null.md output-dir.md output.md parallel-immediate.md parallel-max-host.md parallel-max.md parallel.md pass.md path-as-is.md pinnedpubkey.md post301.md post302.md post303.md preproxy.md progress-bar.md proto-default.md proto-redir.md proto.md proxy-anyauth.md proxy-basic.md proxy-ca-native.md proxy-cacert.md proxy-capath.md proxy-cert-type.md proxy-cert.md proxy-ciphers.md proxy-crlfile.md proxy-digest.md proxy-header.md proxy-http2.md proxy-insecure.md proxy-key-type.md proxy-key.md proxy-negotiate.md proxy-ntlm.md proxy-pass.md proxy-pinnedpubkey.md proxy-service-name.md proxy-ssl-allow-beast.md proxy-ssl-auto-client-cert.md proxy-tls13-ciphers.md proxy-tlsauthtype.md proxy-tlspassword.md proxy-tlsuser.md proxy-tlsv1.md proxy-user.md proxy.md proxy1.0.md proxytunnel.md pubkey.md quote.md random-file.md range.md rate.md raw.md referer.md remote-header-name.md remote-name-all.md remote-name.md remote-time.md remove-on-error.md request-target.md request.md resolve.md retry-all-errors.md retry-connrefused.md retry-delay.md retry-max-time.md retry.md sasl-authzid.md sasl-ir.md service-name.md show-error.md show-headers.md sigalgs.md silent.md skip-existing.md socks4.md socks4a.md socks5-basic.md socks5-gssapi-nec.md socks5-gssapi-service.md socks5-gssapi.md socks5-hostname.md socks5.md speed-limit.md speed-time.md ssl-allow-beast.md ssl-auto-client-cert.md ssl-no-revoke.md ssl-reqd.md ssl-revoke-best-effort.md ssl-sessions.md ssl.md sslv2.md sslv3.md stderr.md styled-output.md suppress-connect-headers.md tcp-fastopen.md tcp-nodelay.md telnet-option.md tftp-blksize.md tftp-no-options.md time-cond.md tls-earlydata.md tls-max.md tls13-ciphers.md tlsauthtype.md tlspassword.md tlsuser.md tlsv1.0.md tlsv1.1.md tlsv1.2.md tlsv1.3.md tlsv1.md tr-encoding.md trace-ascii.md trace-config.md trace-ids.md trace-time.md trace.md unix-socket.md upload-file.md upload-flags.md url-query.md url.md use-ascii.md user-agent.md user.md variable.md verbose.md version.md vlan-priority.md write-out.md xattr.mdexamples
.checksrc .gitignore 10-at-a-time.c CMakeLists.txt Makefile.am Makefile.example Makefile.inc README.md adddocsref.pl address-scope.c altsvc.c anyauthput.c block_ip.c cacertinmem.c certinfo.c chkspeed.c connect-to.c cookie_interface.c crawler.c debug.c default-scheme.c ephiperfifo.c evhiperfifo.c externalsocket.c fileupload.c ftp-delete.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c ftpsget.c ftpupload.c ftpuploadfrommem.c ftpuploadresume.c getinfo.c getinmemory.c getredirect.c getreferrer.c ghiper.c headerapi.c hiperfifo.c hsts-preload.c htmltidy.c htmltitle.cpp http-options.c http-post.c http2-download.c http2-pushinmemory.c http2-serverpush.c http2-upload.c http3-present.c http3.c httpcustomheader.c httpput-postfields.c httpput.c https.c imap-append.c imap-authzid.c imap-copy.c imap-create.c imap-delete.c imap-examine.c imap-fetch.c imap-list.c imap-lsub.c imap-multi.c imap-noop.c imap-search.c imap-ssl.c imap-store.c imap-tls.c interface.c ipv6.c keepalive.c localport.c log_failed_transfers.c maxconnects.c multi-app.c multi-debugcallback.c multi-double.c multi-event.c multi-formadd.c multi-legacy.c multi-post.c multi-single.c multi-uv.c netrc.c parseurl.c persistent.c pop3-authzid.c pop3-dele.c pop3-list.c pop3-multi.c pop3-noop.c pop3-retr.c pop3-ssl.c pop3-stat.c pop3-tls.c pop3-top.c pop3-uidl.c post-callback.c postinmemory.c postit2-formadd.c postit2.c progressfunc.c protofeats.c range.c resolve.c rtsp-options.c sendrecv.c sepheaders.c sessioninfo.c sftpget.c sftpuploadresume.c shared-connection-cache.c simple.c simplepost.c simplessl.c smooth-gtk-thread.c smtp-authzid.c smtp-expn.c smtp-mail.c smtp-mime.c smtp-multi.c smtp-ssl.c smtp-tls.c smtp-vrfy.c sslbackend.c synctime.c threaded.c unixsocket.c url2file.c urlapi.c usercertinmem.c version-check.pl websocket-cb.c websocket-updown.c websocket.c xmlstream.cinternals
BUFQ.md BUFREF.md CHECKSRC.md CLIENT-READERS.md CLIENT-WRITERS.md CODE_STYLE.md CONNECTION-FILTERS.md CREDENTIALS.md CURLX.md DYNBUF.md HASH.md LLIST.md MID.md MQTT.md MULTI-EV.md NEW-PROTOCOL.md PEERS.md PORTING.md RATELIMITS.md README.md SCORECARD.md SPLAY.md STRPARSE.md THRDPOOL-AND-QUEUE.md TIME-KEEPING.md TLS-SESSIONS.md UINT_SETS.md WEBSOCKET.mdlibcurl
opts
CMakeLists.txt CURLINFO_ACTIVESOCKET.md CURLINFO_APPCONNECT_TIME.md CURLINFO_APPCONNECT_TIME_T.md CURLINFO_CAINFO.md CURLINFO_CAPATH.md CURLINFO_CERTINFO.md CURLINFO_CONDITION_UNMET.md CURLINFO_CONNECT_TIME.md CURLINFO_CONNECT_TIME_T.md CURLINFO_CONN_ID.md CURLINFO_CONTENT_LENGTH_DOWNLOAD.md CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md CURLINFO_CONTENT_LENGTH_UPLOAD.md CURLINFO_CONTENT_LENGTH_UPLOAD_T.md CURLINFO_CONTENT_TYPE.md CURLINFO_COOKIELIST.md CURLINFO_EARLYDATA_SENT_T.md CURLINFO_EFFECTIVE_METHOD.md CURLINFO_EFFECTIVE_URL.md CURLINFO_FILETIME.md CURLINFO_FILETIME_T.md CURLINFO_FTP_ENTRY_PATH.md CURLINFO_HEADER_SIZE.md CURLINFO_HTTPAUTH_AVAIL.md CURLINFO_HTTPAUTH_USED.md CURLINFO_HTTP_CONNECTCODE.md CURLINFO_HTTP_VERSION.md CURLINFO_LASTSOCKET.md CURLINFO_LOCAL_IP.md CURLINFO_LOCAL_PORT.md CURLINFO_NAMELOOKUP_TIME.md CURLINFO_NAMELOOKUP_TIME_T.md CURLINFO_NUM_CONNECTS.md CURLINFO_OS_ERRNO.md CURLINFO_POSTTRANSFER_TIME_T.md CURLINFO_PRETRANSFER_TIME.md CURLINFO_PRETRANSFER_TIME_T.md CURLINFO_PRIMARY_IP.md CURLINFO_PRIMARY_PORT.md CURLINFO_PRIVATE.md CURLINFO_PROTOCOL.md CURLINFO_PROXYAUTH_AVAIL.md CURLINFO_PROXYAUTH_USED.md CURLINFO_PROXY_ERROR.md CURLINFO_PROXY_SSL_VERIFYRESULT.md CURLINFO_QUEUE_TIME_T.md CURLINFO_REDIRECT_COUNT.md CURLINFO_REDIRECT_TIME.md CURLINFO_REDIRECT_TIME_T.md CURLINFO_REDIRECT_URL.md CURLINFO_REFERER.md CURLINFO_REQUEST_SIZE.md CURLINFO_RESPONSE_CODE.md CURLINFO_RETRY_AFTER.md CURLINFO_RTSP_CLIENT_CSEQ.md CURLINFO_RTSP_CSEQ_RECV.md CURLINFO_RTSP_SERVER_CSEQ.md CURLINFO_RTSP_SESSION_ID.md CURLINFO_SCHEME.md CURLINFO_SIZE_DELIVERED.md CURLINFO_SIZE_DOWNLOAD.md CURLINFO_SIZE_DOWNLOAD_T.md CURLINFO_SIZE_UPLOAD.md CURLINFO_SIZE_UPLOAD_T.md CURLINFO_SPEED_DOWNLOAD.md CURLINFO_SPEED_DOWNLOAD_T.md CURLINFO_SPEED_UPLOAD.md CURLINFO_SPEED_UPLOAD_T.md CURLINFO_SSL_ENGINES.md CURLINFO_SSL_VERIFYRESULT.md CURLINFO_STARTTRANSFER_TIME.md CURLINFO_STARTTRANSFER_TIME_T.md CURLINFO_TLS_SESSION.md CURLINFO_TLS_SSL_PTR.md CURLINFO_TOTAL_TIME.md CURLINFO_TOTAL_TIME_T.md CURLINFO_USED_PROXY.md CURLINFO_XFER_ID.md CURLMINFO_XFERS_ADDED.md CURLMINFO_XFERS_CURRENT.md CURLMINFO_XFERS_DONE.md CURLMINFO_XFERS_PENDING.md CURLMINFO_XFERS_RUNNING.md CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.md CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.md CURLMOPT_MAXCONNECTS.md CURLMOPT_MAX_CONCURRENT_STREAMS.md CURLMOPT_MAX_HOST_CONNECTIONS.md CURLMOPT_MAX_PIPELINE_LENGTH.md CURLMOPT_MAX_TOTAL_CONNECTIONS.md CURLMOPT_NETWORK_CHANGED.md CURLMOPT_NOTIFYDATA.md CURLMOPT_NOTIFYFUNCTION.md CURLMOPT_PIPELINING.md CURLMOPT_PIPELINING_SERVER_BL.md CURLMOPT_PIPELINING_SITE_BL.md CURLMOPT_PUSHDATA.md CURLMOPT_PUSHFUNCTION.md CURLMOPT_QUICK_EXIT.md CURLMOPT_RESOLVE_THREADS_MAX.md CURLMOPT_SOCKETDATA.md CURLMOPT_SOCKETFUNCTION.md CURLMOPT_TIMERDATA.md CURLMOPT_TIMERFUNCTION.md CURLOPT_ABSTRACT_UNIX_SOCKET.md CURLOPT_ACCEPTTIMEOUT_MS.md CURLOPT_ACCEPT_ENCODING.md CURLOPT_ADDRESS_SCOPE.md CURLOPT_ALTSVC.md CURLOPT_ALTSVC_CTRL.md CURLOPT_APPEND.md CURLOPT_AUTOREFERER.md CURLOPT_AWS_SIGV4.md CURLOPT_BUFFERSIZE.md CURLOPT_CAINFO.md CURLOPT_CAINFO_BLOB.md CURLOPT_CAPATH.md CURLOPT_CA_CACHE_TIMEOUT.md CURLOPT_CERTINFO.md CURLOPT_CHUNK_BGN_FUNCTION.md CURLOPT_CHUNK_DATA.md CURLOPT_CHUNK_END_FUNCTION.md CURLOPT_CLOSESOCKETDATA.md CURLOPT_CLOSESOCKETFUNCTION.md CURLOPT_CONNECTTIMEOUT.md CURLOPT_CONNECTTIMEOUT_MS.md CURLOPT_CONNECT_ONLY.md CURLOPT_CONNECT_TO.md CURLOPT_CONV_FROM_NETWORK_FUNCTION.md CURLOPT_CONV_FROM_UTF8_FUNCTION.md CURLOPT_CONV_TO_NETWORK_FUNCTION.md CURLOPT_COOKIE.md CURLOPT_COOKIEFILE.md CURLOPT_COOKIEJAR.md CURLOPT_COOKIELIST.md CURLOPT_COOKIESESSION.md CURLOPT_COPYPOSTFIELDS.md CURLOPT_CRLF.md CURLOPT_CRLFILE.md CURLOPT_CURLU.md CURLOPT_CUSTOMREQUEST.md CURLOPT_DEBUGDATA.md CURLOPT_DEBUGFUNCTION.md CURLOPT_DEFAULT_PROTOCOL.md CURLOPT_DIRLISTONLY.md CURLOPT_DISALLOW_USERNAME_IN_URL.md CURLOPT_DNS_CACHE_TIMEOUT.md CURLOPT_DNS_INTERFACE.md CURLOPT_DNS_LOCAL_IP4.md CURLOPT_DNS_LOCAL_IP6.md CURLOPT_DNS_SERVERS.md CURLOPT_DNS_SHUFFLE_ADDRESSES.md CURLOPT_DNS_USE_GLOBAL_CACHE.md CURLOPT_DOH_SSL_VERIFYHOST.md CURLOPT_DOH_SSL_VERIFYPEER.md CURLOPT_DOH_SSL_VERIFYSTATUS.md CURLOPT_DOH_URL.md CURLOPT_ECH.md CURLOPT_EGDSOCKET.md CURLOPT_ERRORBUFFER.md CURLOPT_EXPECT_100_TIMEOUT_MS.md CURLOPT_FAILONERROR.md CURLOPT_FILETIME.md CURLOPT_FNMATCH_DATA.md CURLOPT_FNMATCH_FUNCTION.md CURLOPT_FOLLOWLOCATION.md CURLOPT_FORBID_REUSE.md CURLOPT_FRESH_CONNECT.md CURLOPT_FTPPORT.md CURLOPT_FTPSSLAUTH.md CURLOPT_FTP_ACCOUNT.md CURLOPT_FTP_ALTERNATIVE_TO_USER.md CURLOPT_FTP_CREATE_MISSING_DIRS.md CURLOPT_FTP_FILEMETHOD.md CURLOPT_FTP_SKIP_PASV_IP.md CURLOPT_FTP_SSL_CCC.md CURLOPT_FTP_USE_EPRT.md CURLOPT_FTP_USE_EPSV.md CURLOPT_FTP_USE_PRET.md CURLOPT_GSSAPI_DELEGATION.md CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md CURLOPT_HAPROXYPROTOCOL.md CURLOPT_HAPROXY_CLIENT_IP.md CURLOPT_HEADER.md CURLOPT_HEADERDATA.md CURLOPT_HEADERFUNCTION.md CURLOPT_HEADEROPT.md CURLOPT_HSTS.md CURLOPT_HSTSREADDATA.md CURLOPT_HSTSREADFUNCTION.md CURLOPT_HSTSWRITEDATA.md CURLOPT_HSTSWRITEFUNCTION.md CURLOPT_HSTS_CTRL.md CURLOPT_HTTP09_ALLOWED.md CURLOPT_HTTP200ALIASES.md CURLOPT_HTTPAUTH.md CURLOPT_HTTPGET.md CURLOPT_HTTPHEADER.md CURLOPT_HTTPPOST.md CURLOPT_HTTPPROXYTUNNEL.md CURLOPT_HTTP_CONTENT_DECODING.md CURLOPT_HTTP_TRANSFER_DECODING.md CURLOPT_HTTP_VERSION.md CURLOPT_IGNORE_CONTENT_LENGTH.md CURLOPT_INFILESIZE.md CURLOPT_INFILESIZE_LARGE.md CURLOPT_INTERFACE.md CURLOPT_INTERLEAVEDATA.md CURLOPT_INTERLEAVEFUNCTION.md CURLOPT_IOCTLDATA.md CURLOPT_IOCTLFUNCTION.md CURLOPT_IPRESOLVE.md CURLOPT_ISSUERCERT.md CURLOPT_ISSUERCERT_BLOB.md CURLOPT_KEEP_SENDING_ON_ERROR.md CURLOPT_KEYPASSWD.md CURLOPT_KRBLEVEL.md CURLOPT_LOCALPORT.md CURLOPT_LOCALPORTRANGE.md CURLOPT_LOGIN_OPTIONS.md CURLOPT_LOW_SPEED_LIMIT.md CURLOPT_LOW_SPEED_TIME.md CURLOPT_MAIL_AUTH.md CURLOPT_MAIL_FROM.md CURLOPT_MAIL_RCPT.md CURLOPT_MAIL_RCPT_ALLOWFAILS.md CURLOPT_MAXAGE_CONN.md CURLOPT_MAXCONNECTS.md CURLOPT_MAXFILESIZE.md CURLOPT_MAXFILESIZE_LARGE.md CURLOPT_MAXLIFETIME_CONN.md CURLOPT_MAXREDIRS.md CURLOPT_MAX_RECV_SPEED_LARGE.md CURLOPT_MAX_SEND_SPEED_LARGE.md CURLOPT_MIMEPOST.md CURLOPT_MIME_OPTIONS.md CURLOPT_NETRC.md CURLOPT_NETRC_FILE.md CURLOPT_NEW_DIRECTORY_PERMS.md CURLOPT_NEW_FILE_PERMS.md CURLOPT_NOBODY.md CURLOPT_NOPROGRESS.md CURLOPT_NOPROXY.md CURLOPT_NOSIGNAL.md CURLOPT_OPENSOCKETDATA.md CURLOPT_OPENSOCKETFUNCTION.md CURLOPT_PASSWORD.md CURLOPT_PATH_AS_IS.md CURLOPT_PINNEDPUBLICKEY.md CURLOPT_PIPEWAIT.md CURLOPT_PORT.md CURLOPT_POST.md CURLOPT_POSTFIELDS.md CURLOPT_POSTFIELDSIZE.md CURLOPT_POSTFIELDSIZE_LARGE.md CURLOPT_POSTQUOTE.md CURLOPT_POSTREDIR.md CURLOPT_PREQUOTE.md CURLOPT_PREREQDATA.md CURLOPT_PREREQFUNCTION.md CURLOPT_PRE_PROXY.md CURLOPT_PRIVATE.md CURLOPT_PROGRESSDATA.md CURLOPT_PROGRESSFUNCTION.md CURLOPT_PROTOCOLS.md CURLOPT_PROTOCOLS_STR.md CURLOPT_PROXY.md CURLOPT_PROXYAUTH.md CURLOPT_PROXYHEADER.md CURLOPT_PROXYPASSWORD.md CURLOPT_PROXYPORT.md CURLOPT_PROXYTYPE.md CURLOPT_PROXYUSERNAME.md CURLOPT_PROXYUSERPWD.md CURLOPT_PROXY_CAINFO.md CURLOPT_PROXY_CAINFO_BLOB.md CURLOPT_PROXY_CAPATH.md CURLOPT_PROXY_CRLFILE.md CURLOPT_PROXY_ISSUERCERT.md CURLOPT_PROXY_ISSUERCERT_BLOB.md CURLOPT_PROXY_KEYPASSWD.md CURLOPT_PROXY_PINNEDPUBLICKEY.md CURLOPT_PROXY_SERVICE_NAME.md CURLOPT_PROXY_SSLCERT.md CURLOPT_PROXY_SSLCERTTYPE.md CURLOPT_PROXY_SSLCERT_BLOB.md CURLOPT_PROXY_SSLKEY.md CURLOPT_PROXY_SSLKEYTYPE.md CURLOPT_PROXY_SSLKEY_BLOB.md CURLOPT_PROXY_SSLVERSION.md CURLOPT_PROXY_SSL_CIPHER_LIST.md CURLOPT_PROXY_SSL_OPTIONS.md CURLOPT_PROXY_SSL_VERIFYHOST.md CURLOPT_PROXY_SSL_VERIFYPEER.md CURLOPT_PROXY_TLS13_CIPHERS.md CURLOPT_PROXY_TLSAUTH_PASSWORD.md CURLOPT_PROXY_TLSAUTH_TYPE.md CURLOPT_PROXY_TLSAUTH_USERNAME.md CURLOPT_PROXY_TRANSFER_MODE.md CURLOPT_PUT.md CURLOPT_QUICK_EXIT.md CURLOPT_QUOTE.md CURLOPT_RANDOM_FILE.md CURLOPT_RANGE.md CURLOPT_READDATA.md CURLOPT_READFUNCTION.md CURLOPT_REDIR_PROTOCOLS.md CURLOPT_REDIR_PROTOCOLS_STR.md CURLOPT_REFERER.md CURLOPT_REQUEST_TARGET.md CURLOPT_RESOLVE.md CURLOPT_RESOLVER_START_DATA.md CURLOPT_RESOLVER_START_FUNCTION.md CURLOPT_RESUME_FROM.md CURLOPT_RESUME_FROM_LARGE.md CURLOPT_RTSP_CLIENT_CSEQ.md CURLOPT_RTSP_REQUEST.md CURLOPT_RTSP_SERVER_CSEQ.md CURLOPT_RTSP_SESSION_ID.md CURLOPT_RTSP_STREAM_URI.md CURLOPT_RTSP_TRANSPORT.md CURLOPT_SASL_AUTHZID.md CURLOPT_SASL_IR.md CURLOPT_SEEKDATA.md CURLOPT_SEEKFUNCTION.md CURLOPT_SERVER_RESPONSE_TIMEOUT.md CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.md CURLOPT_SERVICE_NAME.md CURLOPT_SHARE.md CURLOPT_SOCKOPTDATA.md CURLOPT_SOCKOPTFUNCTION.md CURLOPT_SOCKS5_AUTH.md CURLOPT_SOCKS5_GSSAPI_NEC.md CURLOPT_SOCKS5_GSSAPI_SERVICE.md CURLOPT_SSH_AUTH_TYPES.md CURLOPT_SSH_COMPRESSION.md CURLOPT_SSH_HOSTKEYDATA.md CURLOPT_SSH_HOSTKEYFUNCTION.md CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md CURLOPT_SSH_KEYDATA.md CURLOPT_SSH_KEYFUNCTION.md CURLOPT_SSH_KNOWNHOSTS.md CURLOPT_SSH_PRIVATE_KEYFILE.md CURLOPT_SSH_PUBLIC_KEYFILE.md CURLOPT_SSLCERT.md CURLOPT_SSLCERTTYPE.md CURLOPT_SSLCERT_BLOB.md CURLOPT_SSLENGINE.md CURLOPT_SSLENGINE_DEFAULT.md CURLOPT_SSLKEY.md CURLOPT_SSLKEYTYPE.md CURLOPT_SSLKEY_BLOB.md CURLOPT_SSLVERSION.md CURLOPT_SSL_CIPHER_LIST.md CURLOPT_SSL_CTX_DATA.md CURLOPT_SSL_CTX_FUNCTION.md CURLOPT_SSL_EC_CURVES.md CURLOPT_SSL_ENABLE_ALPN.md CURLOPT_SSL_ENABLE_NPN.md CURLOPT_SSL_FALSESTART.md CURLOPT_SSL_OPTIONS.md CURLOPT_SSL_SESSIONID_CACHE.md CURLOPT_SSL_SIGNATURE_ALGORITHMS.md CURLOPT_SSL_VERIFYHOST.md CURLOPT_SSL_VERIFYPEER.md CURLOPT_SSL_VERIFYSTATUS.md CURLOPT_STDERR.md CURLOPT_STREAM_DEPENDS.md CURLOPT_STREAM_DEPENDS_E.md CURLOPT_STREAM_WEIGHT.md CURLOPT_SUPPRESS_CONNECT_HEADERS.md CURLOPT_TCP_FASTOPEN.md CURLOPT_TCP_KEEPALIVE.md CURLOPT_TCP_KEEPCNT.md CURLOPT_TCP_KEEPIDLE.md CURLOPT_TCP_KEEPINTVL.md CURLOPT_TCP_NODELAY.md CURLOPT_TELNETOPTIONS.md CURLOPT_TFTP_BLKSIZE.md CURLOPT_TFTP_NO_OPTIONS.md CURLOPT_TIMECONDITION.md CURLOPT_TIMEOUT.md CURLOPT_TIMEOUT_MS.md CURLOPT_TIMEVALUE.md CURLOPT_TIMEVALUE_LARGE.md CURLOPT_TLS13_CIPHERS.md CURLOPT_TLSAUTH_PASSWORD.md CURLOPT_TLSAUTH_TYPE.md CURLOPT_TLSAUTH_USERNAME.md CURLOPT_TRAILERDATA.md CURLOPT_TRAILERFUNCTION.md CURLOPT_TRANSFERTEXT.md CURLOPT_TRANSFER_ENCODING.md CURLOPT_UNIX_SOCKET_PATH.md CURLOPT_UNRESTRICTED_AUTH.md CURLOPT_UPKEEP_INTERVAL_MS.md CURLOPT_UPLOAD.md CURLOPT_UPLOAD_BUFFERSIZE.md CURLOPT_UPLOAD_FLAGS.md CURLOPT_URL.md CURLOPT_USERAGENT.md CURLOPT_USERNAME.md CURLOPT_USERPWD.md CURLOPT_USE_SSL.md CURLOPT_VERBOSE.md CURLOPT_WILDCARDMATCH.md CURLOPT_WRITEDATA.md CURLOPT_WRITEFUNCTION.md CURLOPT_WS_OPTIONS.md CURLOPT_XFERINFODATA.md CURLOPT_XFERINFOFUNCTION.md CURLOPT_XOAUTH2_BEARER.md CURLSHOPT_LOCKFUNC.md CURLSHOPT_SHARE.md CURLSHOPT_UNLOCKFUNC.md CURLSHOPT_UNSHARE.md CURLSHOPT_USERDATA.md Makefile.am Makefile.incinclude
curl
Makefile.am curl.h curlver.h easy.h header.h mprintf.h multi.h options.h stdcheaders.h system.h typecheck-gcc.h urlapi.h websockets.hlib
curlx
base64.c base64.h basename.c basename.h dynbuf.c dynbuf.h fopen.c fopen.h inet_ntop.c inet_ntop.h inet_pton.c inet_pton.h multibyte.c multibyte.h nonblock.c nonblock.h snprintf.c snprintf.h strcopy.c strcopy.h strdup.c strdup.h strerr.c strerr.h strparse.c strparse.h timediff.c timediff.h timeval.c timeval.h version_win32.c version_win32.h wait.c wait.h warnless.c warnless.h winapi.c winapi.hvauth
cleartext.c cram.c digest.c digest.h digest_sspi.c gsasl.c krb5_gssapi.c krb5_sspi.c ntlm.c ntlm_sspi.c oauth2.c spnego_gssapi.c spnego_sspi.c vauth.c vauth.hvquic
curl_ngtcp2.c curl_ngtcp2.h curl_quiche.c curl_quiche.h vquic-tls.c vquic-tls.h vquic.c vquic.h vquic_int.hvtls
apple.c apple.h cipher_suite.c cipher_suite.h gtls.c gtls.h hostcheck.c hostcheck.h keylog.c keylog.h mbedtls.c mbedtls.h openssl.c openssl.h rustls.c rustls.h schannel.c schannel.h schannel_int.h schannel_verify.c vtls.c vtls.h vtls_int.h vtls_scache.c vtls_scache.h vtls_spack.c vtls_spack.h wolfssl.c wolfssl.h x509asn1.c x509asn1.hm4
.gitignore curl-amissl.m4 curl-apple-sectrust.m4 curl-compilers.m4 curl-confopts.m4 curl-functions.m4 curl-gnutls.m4 curl-mbedtls.m4 curl-openssl.m4 curl-override.m4 curl-reentrant.m4 curl-rustls.m4 curl-schannel.m4 curl-sysconfig.m4 curl-wolfssl.m4 xc-am-iface.m4 xc-cc-check.m4 xc-lt-iface.m4 xc-val-flgs.m4 zz40-xc-ovr.m4 zz50-xc-ovr.m4projects
OS400
.checksrc README.OS400 ccsidcurl.c ccsidcurl.h config400.default curl.cmd curl.inc.in curlcl.c curlmain.c initscript.sh make-docs.sh make-include.sh make-lib.sh make-src.sh make-tests.sh makefile.sh os400sys.c os400sys.hWindows
tmpl
.gitattributes README.txt curl-all.sln curl.sln curl.vcxproj curl.vcxproj.filters libcurl.sln libcurl.vcxproj libcurl.vcxproj.filtersvms
Makefile.am backup_gnv_curl_src.com build_curl-config_script.com build_gnv_curl.com build_gnv_curl_pcsi_desc.com build_gnv_curl_pcsi_text.com build_gnv_curl_release_notes.com build_libcurl_pc.com build_vms.com clean_gnv_curl.com compare_curl_source.com config_h.com curl_crtl_init.c curl_gnv_build_steps.txt curl_release_note_start.txt curl_startup.com curlmsg.h curlmsg.msg curlmsg.sdl curlmsg_vms.h generate_config_vms_h_curl.com generate_vax_transfer.com gnv_conftest.c_first gnv_curl_configure.sh gnv_libcurl_symbols.opt gnv_link_curl.com macro32_exactcase.patch make_gnv_curl_install.sh make_pcsi_curl_kit_name.com pcsi_gnv_curl_file_list.txt pcsi_product_gnv_curl.com readme report_openssl_version.c setup_gnv_curl_build.com stage_curl_install.com vms_eco_level.hscripts
.checksrc CMakeLists.txt Makefile.am badwords badwords-all badwords.txt cd2cd cd2nroff cdall checksrc-all.pl checksrc.pl cmakelint.sh completion.pl contributors.sh contrithanks.sh coverage.sh delta dmaketgz extract-unit-protos firefox-db2pem.sh installcheck.sh maketgz managen mdlinkcheck mk-ca-bundle.pl mk-unity.pl nroff2cd perlcheck.sh pythonlint.sh randdisable release-notes.pl release-tools.sh schemetable.c singleuse.pl spacecheck.pl top-complexity top-length verify-release wcurlsrc
.checksrc .gitignore CMakeLists.txt Makefile.am Makefile.inc config2setopts.c config2setopts.h curl.rc curlinfo.c mk-file-embed.pl mkhelp.pl slist_wc.c slist_wc.h terminal.c terminal.h tool_cb_dbg.c tool_cb_dbg.h tool_cb_hdr.c tool_cb_hdr.h tool_cb_prg.c tool_cb_prg.h tool_cb_rea.c tool_cb_rea.h tool_cb_see.c tool_cb_see.h tool_cb_soc.c tool_cb_soc.h tool_cb_wrt.c tool_cb_wrt.h tool_cfgable.c tool_cfgable.h tool_dirhie.c tool_dirhie.h tool_doswin.c tool_doswin.h tool_easysrc.c tool_easysrc.h tool_filetime.c tool_filetime.h tool_findfile.c tool_findfile.h tool_formparse.c tool_formparse.h tool_getparam.c tool_getparam.h tool_getpass.c tool_getpass.h tool_help.c tool_help.h tool_helpers.c tool_helpers.h tool_hugehelp.h tool_ipfs.c tool_ipfs.h tool_libinfo.c tool_libinfo.h tool_listhelp.c tool_main.c tool_main.h tool_msgs.c tool_msgs.h tool_operate.c tool_operate.h tool_operhlp.c tool_operhlp.h tool_paramhlp.c tool_paramhlp.h tool_parsecfg.c tool_parsecfg.h tool_progress.c tool_progress.h tool_sdecls.h tool_setopt.c tool_setopt.h tool_setup.h tool_ssls.c tool_ssls.h tool_stderr.c tool_stderr.h tool_urlglob.c tool_urlglob.h tool_util.c tool_util.h tool_version.h tool_vms.c tool_vms.h tool_writeout.c tool_writeout.h tool_writeout_json.c tool_writeout_json.h tool_xattr.c tool_xattr.h var.c var.htests
certs
.gitignore CMakeLists.txt Makefile.am Makefile.inc genserv.pl srp-verifier-conf srp-verifier-db test-ca.cnf test-ca.prm test-client-cert.prm test-client-eku-only.prm test-localhost-san-first.prm test-localhost-san-last.prm test-localhost.nn.prm test-localhost.prm test-localhost0h.prmdata
.gitignore DISABLED Makefile.am data-xml1 data1400.c data1401.c data1402.c data1403.c data1404.c data1405.c data1406.c data1407.c data1420.c data1461.txt data1463.txt data1465.c data1481.c data1705-1.md data1705-2.md data1705-3.md data1705-4.md data1705-stdout.1 data1706-1.md data1706-2.md data1706-3.md data1706-4.md data1706-stdout.txt data320.html test1 test10 test100 test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 test1008 test1009 test101 test1010 test1011 test1012 test1013 test1014 test1015 test1016 test1017 test1018 test1019 test102 test1020 test1021 test1022 test1023 test1024 test1025 test1026 test1027 test1028 test1029 test103 test1030 test1031 test1032 test1033 test1034 test1035 test1036 test1037 test1038 test1039 test104 test1040 test1041 test1042 test1043 test1044 test1045 test1046 test1047 test1048 test1049 test105 test1050 test1051 test1052 test1053 test1054 test1055 test1056 test1057 test1058 test1059 test106 test1060 test1061 test1062 test1063 test1064 test1065 test1066 test1067 test1068 test1069 test107 test1070 test1071 test1072 test1073 test1074 test1075 test1076 test1077 test1078 test1079 test108 test1080 test1081 test1082 test1083 test1084 test1085 test1086 test1087 test1088 test1089 test109 test1090 test1091 test1092 test1093 test1094 test1095 test1096 test1097 test1098 test1099 test11 test110 test1100 test1101 test1102 test1103 test1104 test1105 test1106 test1107 test1108 test1109 test111 test1110 test1111 test1112 test1113 test1114 test1115 test1116 test1117 test1118 test1119 test112 test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 test1128 test1129 test113 test1130 test1131 test1132 test1133 test1134 test1135 test1136 test1137 test1138 test1139 test114 test1140 test1141 test1142 test1143 test1144 test1145 test1146 test1147 test1148 test1149 test115 test1150 test1151 test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 test116 test1160 test1161 test1162 test1163 test1164 test1165 test1166 test1167 test1168 test1169 test117 test1170 test1171 test1172 test1173 test1174 test1175 test1176 test1177 test1178 test1179 test118 test1180 test1181 test1182 test1183 test1184 test1185 test1186 test1187 test1188 test1189 test119 test1190 test1191 test1192 test1193 test1194 test1195 test1196 test1197 test1198 test1199 test12 test120 test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 test1208 test1209 test121 test1210 test1211 test1212 test1213 test1214 test1215 test1216 test1217 test1218 test1219 test122 test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 test1228 test1229 test123 test1230 test1231 test1232 test1233 test1234 test1235 test1236 test1237 test1238 test1239 test124 test1240 test1241 test1242 test1243 test1244 test1245 test1246 test1247 test1248 test1249 test125 test1250 test1251 test1252 test1253 test1254 test1255 test1256 test1257 test1258 test1259 test126 test1260 test1261 test1262 test1263 test1264 test1265 test1266 test1267 test1268 test1269 test127 test1270 test1271 test1272 test1273 test1274 test1275 test1276 test1277 test1278 test1279 test128 test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 test1288 test1289 test129 test1290 test1291 test1292 test1293 test1294 test1295 test1296 test1297 test1298 test1299 test13 test130 test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 test1308 test1309 test131 test1310 test1311 test1312 test1313 test1314 test1315 test1316 test1317 test1318 test1319 test132 test1320 test1321 test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 test133 test1330 test1331 test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 test134 test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 test1348 test1349 test135 test1350 test1351 test1352 test1353 test1354 test1355 test1356 test1357 test1358 test1359 test136 test1360 test1361 test1362 test1363 test1364 test1365 test1366 test1367 test1368 test1369 test137 test1370 test1371 test1372 test1373 test1374 test1375 test1376 test1377 test1378 test1379 test138 test1380 test1381 test1382 test1383 test1384 test1385 test1386 test1387 test1388 test1389 test139 test1390 test1391 test1392 test1393 test1394 test1395 test1396 test1397 test1398 test1399 test14 test140 test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 test1408 test1409 test141 test1410 test1411 test1412 test1413 test1414 test1415 test1416 test1417 test1418 test1419 test142 test1420 test1421 test1422 test1423 test1424 test1425 test1426 test1427 test1428 test1429 test143 test1430 test1431 test1432 test1433 test1434 test1435 test1436 test1437 test1438 test1439 test144 test1440 test1441 test1442 test1443 test1444 test1445 test1446 test1447 test1448 test1449 test145 test1450 test1451 test1452 test1453 test1454 test1455 test1456 test1457 test1458 test1459 test146 test1460 test1461 test1462 test1463 test1464 test1465 test1466 test1467 test1468 test1469 test147 test1470 test1471 test1472 test1473 test1474 test1475 test1476 test1477 test1478 test1479 test148 test1480 test1481 test1482 test1483 test1484 test1485 test1486 test1487 test1488 test1489 test149 test1490 test1491 test1492 test1493 test1494 test1495 test1496 test1497 test1498 test1499 test15 test150 test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 test1508 test1509 test151 test1510 test1511 test1512 test1513 test1514 test1515 test1516 test1517 test1518 test1519 test152 test1520 test1521 test1522 test1523 test1524 test1525 test1526 test1527 test1528 test1529 test153 test1530 test1531 test1532 test1533 test1534 test1535 test1536 test1537 test1538 test1539 test154 test1540 test1541 test1542 test1543 test1544 test1545 test1546 test1547 test1548 test1549 test155 test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 test1558 test1559 test156 test1560 test1561 test1562 test1563 test1564 test1565 test1566 test1567 test1568 test1569 test157 test1570 test1571 test1572 test1573 test1574 test1575 test1576 test1577 test1578 test1579 test158 test1580 test1581 test1582 test1583 test1584 test1585 test1586 test1587 test1588 test1589 test159 test1590 test1591 test1592 test1593 test1594 test1595 test1596 test1597 test1598 test1599 test16 test160 test1600 test1601 test1602 test1603 test1604 test1605 test1606 test1607 test1608 test1609 test161 test1610 test1611 test1612 test1613 test1614 test1615 test1616 test1617 test1618 test1619 test162 test1620 test1621 test1622 test1623 test1624 test1625 test1626 test1627 test1628 test1629 test163 test1630 test1631 test1632 test1633 test1634 test1635 test1636 test1637 test1638 test1639 test164 test1640 test1641 test1642 test1643 test1644 test1645 test165 test1650 test1651 test1652 test1653 test1654 test1655 test1656 test1657 test1658 test1659 test166 test1660 test1661 test1662 test1663 test1664 test1665 test1666 test1667 test1668 test1669 test167 test1670 test1671 test1672 test1673 test1674 test1675 test1676 test168 test1680 test1681 test1682 test1683 test1684 test1685 test169 test17 test170 test1700 test1701 test1702 test1703 test1704 test1705 test1706 test1707 test1708 test1709 test171 test1710 test1711 test1712 test1713 test1714 test1715 test172 test1720 test1721 test173 test174 test175 test176 test177 test178 test179 test18 test180 test1800 test1801 test1802 test181 test182 test183 test184 test1847 test1848 test1849 test185 test1850 test1851 test186 test187 test188 test189 test19 test190 test1900 test1901 test1902 test1903 test1904 test1905 test1906 test1907 test1908 test1909 test191 test1910 test1911 test1912 test1913 test1914 test1915 test1916 test1917 test1918 test1919 test192 test1920 test1921 test193 test1933 test1934 test1935 test1936 test1937 test1938 test1939 test194 test1940 test1941 test1942 test1943 test1944 test1945 test1946 test1947 test1948 test195 test1955 test1956 test1957 test1958 test1959 test196 test1960 test1964 test1965 test1966 test197 test1970 test1971 test1972 test1973 test1974 test1975 test1976 test1977 test1978 test1979 test198 test1980 test1981 test1982 test1983 test1984 test199 test2 test20 test200 test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 test2008 test2009 test201 test2010 test2011 test2012 test2013 test2014 test202 test2023 test2024 test2025 test2026 test2027 test2028 test2029 test203 test2030 test2031 test2032 test2033 test2034 test2035 test2037 test2038 test2039 test204 test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 test2048 test2049 test205 test2050 test2051 test2052 test2053 test2054 test2055 test2056 test2057 test2058 test2059 test206 test2060 test2061 test2062 test2063 test2064 test2065 test2066 test2067 test2068 test2069 test207 test2070 test2071 test2072 test2073 test2074 test2075 test2076 test2077 test2078 test2079 test208 test2080 test2081 test2082 test2083 test2084 test2085 test2086 test2087 test2088 test2089 test209 test2090 test2091 test2092 test21 test210 test2100 test2101 test2102 test2103 test2104 test211 test212 test213 test214 test215 test216 test217 test218 test219 test22 test220 test2200 test2201 test2202 test2203 test2204 test2205 test2206 test2207 test221 test222 test223 test224 test225 test226 test227 test228 test229 test23 test230 test2300 test2301 test2302 test2303 test2304 test2306 test2307 test2308 test2309 test231 test232 test233 test234 test235 test236 test237 test238 test239 test24 test240 test2400 test2401 test2402 test2403 test2404 test2405 test2406 test2407 test2408 test2409 test241 test2410 test2411 test242 test243 test244 test245 test246 test247 test248 test249 test25 test250 test2500 test2501 test2502 test2503 test2504 test2505 test2506 test251 test252 test253 test254 test255 test256 test257 test258 test259 test26 test260 test2600 test2601 test2602 test2603 test2604 test2605 test261 test262 test263 test264 test265 test266 test267 test268 test269 test27 test270 test2700 test2701 test2702 test2703 test2704 test2705 test2706 test2707 test2708 test2709 test271 test2710 test2711 test2712 test2713 test2714 test2715 test2716 test2717 test2718 test2719 test272 test2720 test2721 test2722 test2723 test273 test274 test275 test276 test277 test278 test279 test28 test280 test281 test282 test283 test284 test285 test286 test287 test288 test289 test29 test290 test291 test292 test293 test294 test295 test296 test297 test298 test299 test3 test30 test300 test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 test3008 test3009 test301 test3010 test3011 test3012 test3013 test3014 test3015 test3016 test3017 test3018 test3019 test302 test3020 test3021 test3022 test3023 test3024 test3025 test3026 test3027 test3028 test3029 test303 test3030 test3031 test3032 test3033 test3034 test3035 test3036 test304 test305 test306 test307 test308 test309 test31 test310 test3100 test3101 test3102 test3103 test3104 test3105 test3106 test311 test312 test313 test314 test315 test316 test317 test318 test319 test32 test320 test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 test3208 test3209 test321 test3210 test3211 test3212 test3213 test3214 test3215 test3216 test3217 test3218 test3219 test322 test3220 test323 test324 test325 test326 test327 test328 test329 test33 test330 test3300 test3301 test3302 test331 test332 test333 test334 test335 test336 test337 test338 test339 test34 test340 test341 test342 test343 test344 test345 test346 test347 test348 test349 test35 test350 test351 test352 test353 test354 test355 test356 test357 test358 test359 test36 test360 test361 test362 test363 test364 test365 test366 test367 test368 test369 test37 test370 test371 test372 test373 test374 test375 test376 test378 test379 test38 test380 test381 test383 test384 test385 test386 test387 test388 test389 test39 test390 test391 test392 test393 test394 test395 test396 test397 test398 test399 test4 test40 test400 test4000 test4001 test401 test402 test403 test404 test405 test406 test407 test408 test409 test41 test410 test411 test412 test413 test414 test415 test416 test417 test418 test419 test42 test420 test421 test422 test423 test424 test425 test426 test427 test428 test429 test43 test430 test431 test432 test433 test434 test435 test436 test437 test438 test439 test44 test440 test441 test442 test443 test444 test445 test446 test447 test448 test449 test45 test450 test451 test452 test453 test454 test455 test456 test457 test458 test459 test46 test460 test461 test462 test463 test467 test468 test469 test47 test470 test471 test472 test473 test474 test475 test476 test477 test478 test479 test48 test480 test481 test482 test483 test484 test485 test486 test487 test488 test489 test49 test490 test491 test492 test493 test494 test495 test496 test497 test498 test499 test5 test50 test500 test501 test502 test503 test504 test505 test506 test507 test508 test509 test51 test510 test511 test512 test513 test514 test515 test516 test517 test518 test519 test52 test520 test521 test522 test523 test524 test525 test526 test527 test528 test529 test53 test530 test531 test532 test533 test534 test535 test536 test537 test538 test539 test54 test540 test541 test542 test543 test544 test545 test546 test547 test548 test549 test55 test550 test551 test552 test553 test554 test555 test556 test557 test558 test559 test56 test560 test561 test562 test563 test564 test565 test566 test567 test568 test569 test57 test570 test571 test572 test573 test574 test575 test576 test577 test578 test579 test58 test580 test581 test582 test583 test584 test585 test586 test587 test588 test589 test59 test590 test591 test592 test593 test594 test595 test596 test597 test598 test599 test6 test60 test600 test601 test602 test603 test604 test605 test606 test607 test608 test609 test61 test610 test611 test612 test613 test614 test615 test616 test617 test618 test619 test62 test620 test621 test622 test623 test624 test625 test626 test627 test628 test629 test63 test630 test631 test632 test633 test634 test635 test636 test637 test638 test639 test64 test640 test641 test642 test643 test644 test645 test646 test647 test648 test649 test65 test650 test651 test652 test653 test654 test655 test656 test658 test659 test66 test660 test661 test662 test663 test664 test665 test666 test667 test668 test669 test67 test670 test671 test672 test673 test674 test675 test676 test677 test678 test679 test68 test680 test681 test682 test683 test684 test685 test686 test687 test688 test689 test69 test690 test691 test692 test693 test694 test695 test696 test697 test698 test699 test7 test70 test700 test701 test702 test703 test704 test705 test706 test707 test708 test709 test71 test710 test711 test712 test713 test714 test715 test716 test717 test718 test719 test72 test720 test721 test722 test723 test724 test725 test726 test727 test728 test729 test73 test730 test731 test732 test733 test734 test735 test736 test737 test738 test739 test74 test740 test741 test742 test743 test744 test745 test746 test747 test748 test749 test75 test750 test751 test752 test753 test754 test755 test756 test757 test758 test759 test76 test760 test761 test762 test763 test764 test765 test766 test767 test768 test769 test77 test770 test771 test772 test773 test774 test775 test776 test777 test778 test779 test78 test780 test781 test782 test783 test784 test785 test786 test787 test788 test789 test79 test790 test791 test792 test793 test794 test795 test796 test797 test798 test799 test8 test80 test800 test801 test802 test803 test804 test805 test806 test807 test808 test809 test81 test810 test811 test812 test813 test814 test815 test816 test817 test818 test819 test82 test820 test821 test822 test823 test824 test825 test826 test827 test828 test829 test83 test830 test831 test832 test833 test834 test835 test836 test837 test838 test839 test84 test840 test841 test842 test843 test844 test845 test846 test847 test848 test849 test85 test850 test851 test852 test853 test854 test855 test856 test857 test858 test859 test86 test860 test861 test862 test863 test864 test865 test866 test867 test868 test869 test87 test870 test871 test872 test873 test874 test875 test876 test877 test878 test879 test88 test880 test881 test882 test883 test884 test885 test886 test887 test888 test889 test89 test890 test891 test892 test893 test894 test895 test896 test897 test898 test899 test9 test90 test900 test901 test902 test903 test904 test905 test906 test907 test908 test909 test91 test910 test911 test912 test913 test914 test915 test916 test917 test918 test919 test92 test920 test921 test922 test923 test924 test925 test926 test927 test928 test929 test93 test930 test931 test932 test933 test934 test935 test936 test937 test938 test939 test94 test940 test941 test942 test943 test944 test945 test946 test947 test948 test949 test95 test950 test951 test952 test953 test954 test955 test956 test957 test958 test959 test96 test960 test961 test962 test963 test964 test965 test966 test967 test968 test969 test97 test970 test971 test972 test973 test974 test975 test976 test977 test978 test979 test98 test980 test981 test982 test983 test984 test985 test986 test987 test988 test989 test99 test990 test991 test992 test993 test994 test995 test996 test997 test998 test999http
testenv
__init__.py caddy.py certs.py client.py curl.py dante.py dnsd.py env.py httpd.py nghttpx.py ports.py sshd.py vsftpd.py ws_echo_server.pylibtest
.gitignore CMakeLists.txt Makefile.am Makefile.inc cli_ftp_upload.c cli_h2_pausing.c cli_h2_serverpush.c cli_h2_upgrade_extreme.c cli_hx_download.c cli_hx_upload.c cli_tls_session_reuse.c cli_upload_pausing.c cli_ws_data.c cli_ws_pingpong.c first.c first.h lib1156.c lib1301.c lib1308.c lib1485.c lib1500.c lib1501.c lib1502.c lib1506.c lib1507.c lib1508.c lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c lib1514.c lib1515.c lib1517.c lib1518.c lib1520.c lib1522.c lib1523.c lib1525.c lib1526.c lib1527.c lib1528.c lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c lib1534.c lib1535.c lib1536.c lib1537.c lib1538.c lib1540.c lib1541.c lib1542.c lib1545.c lib1549.c lib1550.c lib1551.c lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c lib1558.c lib1559.c lib1560.c lib1564.c lib1565.c lib1567.c lib1568.c lib1569.c lib1571.c lib1576.c lib1582.c lib1587.c lib1588.c lib1589.c lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c lib1598.c lib1599.c lib1662.c lib1900.c lib1901.c lib1902.c lib1903.c lib1905.c lib1906.c lib1907.c lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c lib1915.c lib1916.c lib1918.c lib1919.c lib1920.c lib1921.c lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c lib1940.c lib1945.c lib1947.c lib1948.c lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c lib1960.c lib1964.c lib1965.c lib1970.c lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c lib2023.c lib2032.c lib2082.c lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c lib2402.c lib2404.c lib2405.c lib2502.c lib2504.c lib2505.c lib2506.c lib2700.c lib3010.c lib3025.c lib3026.c lib3027.c lib3033.c lib3034.c lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c lib3207.c lib3208.c lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c lib508.c lib509.c lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c lib516.c lib517.c lib518.c lib519.c lib520.c lib521.c lib523.c lib524.c lib525.c lib526.c lib530.c lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c lib542.c lib543.c lib544.c lib547.c lib549.c lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c lib559.c lib560.c lib562.c lib564.c lib566.c lib567.c lib568.c lib569.c lib570.c lib571.c lib572.c lib573.c lib574.c lib575.c lib576.c lib578.c lib579.c lib582.c lib583.c lib586.c lib589.c lib590.c lib591.c lib597.c lib598.c lib599.c lib643.c lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c lib659.c lib661.c lib666.c lib667.c lib668.c lib670.c lib674.c lib676.c lib677.c lib678.c lib694.c lib695.c lib751.c lib753.c lib757.c lib758.c lib766.c memptr.c mk-lib1521.pl test1013.pl test1022.pl test307.pl test610.pl test613.pl testtrace.c testtrace.h testutil.c testutil.h unitcheck.hserver
.checksrc .gitignore CMakeLists.txt Makefile.am Makefile.inc dnsd.c first.c first.h getpart.c mqttd.c resolve.c rtspd.c sockfilt.c socksd.c sws.c tftpd.c util.ctunit
.gitignore CMakeLists.txt Makefile.am Makefile.inc README.md tool1394.c tool1604.c tool1621.c tool1622.c tool1623.c tool1720.cunit
.gitignore CMakeLists.txt Makefile.am Makefile.inc README.md unit1300.c unit1302.c unit1303.c unit1304.c unit1305.c unit1307.c unit1309.c unit1323.c unit1330.c unit1395.c unit1396.c unit1397.c unit1398.c unit1399.c unit1600.c unit1601.c unit1602.c unit1603.c unit1605.c unit1606.c unit1607.c unit1608.c unit1609.c unit1610.c unit1611.c unit1612.c unit1614.c unit1615.c unit1616.c unit1620.c unit1625.c unit1626.c unit1627.c unit1636.c unit1650.c unit1651.c unit1652.c unit1653.c unit1654.c unit1655.c unit1656.c unit1657.c unit1658.c unit1660.c unit1661.c unit1663.c unit1664.c unit1666.c unit1667.c unit1668.c unit1669.c unit1674.c unit1675.c unit1676.c unit1979.c unit1980.c unit2600.c unit2601.c unit2602.c unit2603.c unit2604.c unit2605.c unit3200.c unit3205.c unit3211.c unit3212.c unit3213.c unit3214.c unit3216.c unit3219.c unit3300.c unit3301.c unit3302.cexamples
.env config.ini crypto_test.lua env_test.lua fs_example.lua http_server.lua https_test.lua ini_example.lua json.lua log.lua path_fs_example.lua process_example.lua request_download.lua request_test.lua run_all.lua sqlite_example.lua sqlite_http_template.lua stash_test.lua template_test.lua timer.lua websocket.luainiparser
example
iniexample.c iniwrite.c parse.c twisted-errors.ini twisted-genhuge.py twisted-ofkey.ini twisted-ofval.ini twisted.initest
CMakeLists.txt test_dictionary.c test_iniparser.c unity-config.yml unity_config.hjinjac
libjinjac
src
CMakeLists.txt ast.c ast.h block_statement.c block_statement.h buffer.c buffer.h buildin.c buildin.h common.h convert.c convert.h flex_decl.h jfunction.c jfunction.h jinja_expression.l jinja_expression.y jinjac_parse.c jinjac_parse.h jinjac_stream.c jinjac_stream.h jlist.c jlist.h jobject.c jobject.h parameter.c parameter.h str_obj.c str_obj.h trace.c trace.htest
.gitignore CMakeLists.txt autotest.rb test_01.expected test_01.jinja test_01b.expected test_01b.jinja test_01c.expected test_01c.jinja test_01d.expected test_01d.jinja test_02.expected test_02.jinja test_03.expected test_03.jinja test_04.expected test_04.jinja test_05.expected test_05.jinja test_06.expected test_06.jinja test_07.expected test_07.jinja test_08.expected test_08.jinja test_08b.expected test_08b.jinja test_09.expected test_09.jinja test_10.expected test_10.jinja test_11.expected test_11.jinja test_12.expected test_12.jinja test_13.expected test_13.jinja test_14.expected test_14.jinja test_15.expected test_15.jinja test_16.expected test_16.jinja test_17.expected test_17.jinja test_18.expected test_18.jinja test_18b.expected test_18b.jinja test_18c.expected test_18c.jinja test_19.expected test_19.jinja test_19b.expected test_19b.jinja test_19c.expected test_19c.jinja test_19d.expected test_19d.jinja test_19e.expected test_19e.jinja test_19f.expected test_19f.jinja test_20.expected test_20.jinja test_21.expected test_21.jinja test_22.expected test_22.jinja test_22a.expected test_22a.jinja test_22b.expected test_22b.jinja test_23.expected test_23.jinja test_24.expected test_24.jinjalibev
Changes LICENSE Makefile Makefile.am Makefile.in README Symbols.ev Symbols.event aclocal.m4 autogen.sh compile config.guess config.h config.h.in config.status config.sub configure configure.ac depcomp ev++.h ev.3 ev.c ev.h ev.pod ev_epoll.c ev_kqueue.c ev_poll.c ev_port.c ev_select.c ev_vars.h ev_win32.c ev_wrap.h event.c event.h install-sh libev.m4 libtool ltmain.sh missing mkinstalldirs stamp-h1luajit
doc
bluequad-print.css bluequad.css contact.html ext_buffer.html ext_c_api.html ext_ffi.html ext_ffi_api.html ext_ffi_semantics.html ext_ffi_tutorial.html ext_jit.html ext_profiler.html extensions.html install.html luajit.html running.htmldynasm
dasm_arm.h dasm_arm.lua dasm_arm64.h dasm_arm64.lua dasm_mips.h dasm_mips.lua dasm_mips64.lua dasm_ppc.h dasm_ppc.lua dasm_proto.h dasm_x64.lua dasm_x86.h dasm_x86.lua dynasm.luasrc
host
.gitignore README buildvm.c buildvm.h buildvm_asm.c buildvm_fold.c buildvm_lib.c buildvm_libbc.h buildvm_peobj.c genlibbc.lua genminilua.lua genversion.lua minilua.cjit
.gitignore bc.lua bcsave.lua dis_arm.lua dis_arm64.lua dis_arm64be.lua dis_mips.lua dis_mips64.lua dis_mips64el.lua dis_mips64r6.lua dis_mips64r6el.lua dis_mipsel.lua dis_ppc.lua dis_x64.lua dis_x86.lua dump.lua p.lua v.lua zone.luawolfssl
.github
workflows
ada.yml arduino.yml async-examples.yml async.yml atecc608-sim.yml bind.yml cmake-autoconf.yml cmake.yml codespell.yml coverity-scan-fixes.yml cryptocb-only.yml curl.yml cyrus-sasl.yml disable-pk-algs.yml docker-Espressif.yml docker-OpenWrt.yml emnet-nonblock.yml fil-c.yml freertos-mem-track.yml gencertbuf.yml grpc.yml haproxy.yml hostap-vm.yml intelasm-c-fallback.yml ipmitool.yml jwt-cpp.yml krb5.yml libspdm.yml libssh2.yml libvncserver.yml linuxkm.yml macos-apple-native-cert-validation.yml mbedtls.sh mbedtls.yml membrowse-comment.yml membrowse-onboard.yml membrowse-report.yml memcached.sh memcached.yml mono.yml mosquitto.yml msmtp.yml msys2.yml multi-arch.yml multi-compiler.yml net-snmp.yml nginx.yml no-malloc.yml no-tls.yml nss.sh nss.yml ntp.yml ocsp.yml openldap.yml openssh.yml openssl-ech.yml opensslcoexist.yml openvpn.yml os-check.yml packaging.yml pam-ipmi.yml pq-all.yml pr-commit-check.yml psk.yml puf.yml python.yml rng-tools.yml rust-wrapper.yml se050-sim.yml smallStackSize.yml socat.yml softhsm.yml sssd.yml stm32-sim.yml stsafe-a120-sim.yml stunnel.yml symbol-prefixes.yml threadx.yml tls-anvil.yml trackmemory.yml watcomc.yml win-csharp-test.yml wolfCrypt-Wconversion.yml wolfboot-integration.yml wolfsm.yml xcode.yml zephyr-4.x.yml zephyr.ymlIDE
ARDUINO
Arduino_README_prepend.md README.md include.am keywords.txt library.properties.template wolfssl-arduino.cpp wolfssl-arduino.sh wolfssl.hECLIPSE
Espressif
ESP-IDF
examples
template
CMakeLists.txt Makefile README.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp8266wolfssl_benchmark
VisualGDB
wolfssl_benchmark_IDF_v4.4_ESP32.sln wolfssl_benchmark_IDF_v4.4_ESP32.vgdbproj wolfssl_benchmark_IDF_v5_ESP32.sln wolfssl_benchmark_IDF_v5_ESP32.vgdbproj wolfssl_benchmark_IDF_v5_ESP32C3.sln wolfssl_benchmark_IDF_v5_ESP32C3.vgdbproj wolfssl_benchmark_IDF_v5_ESP32S3.sln wolfssl_benchmark_IDF_v5_ESP32S3.vgdbprojwolfssl_client
CMakeLists.txt Makefile README.md README_server_sm.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp32c2 sdkconfig.defaults.esp8266 wolfssl_client_ESP8266.vgdbprojwolfssl_server
CMakeLists.txt Makefile README.md README_server_sm.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp32c2 sdkconfig.defaults.esp8266 wolfssl_server_ESP8266.vgdbprojwolfssl_test
VisualGDB
wolfssl_test-IDF_v5_ESP32.sln wolfssl_test-IDF_v5_ESP32.vgdbproj wolfssl_test-IDF_v5_ESP32C3.sln wolfssl_test-IDF_v5_ESP32C3.vgdbproj wolfssl_test-IDF_v5_ESP32C6.sln wolfssl_test-IDF_v5_ESP32C6.vgdbproj wolfssl_test_IDF_v5_ESP32S3.sln wolfssl_test_IDF_v5_ESP32S3.vgdbprojGCC-ARM
Makefile Makefile.bench Makefile.client Makefile.common Makefile.server Makefile.static Makefile.test README.md include.am linker.ld linker_fips.ldIAR-EWARM
embOS
SAMV71_XULT
embOS_SAMV71_XULT_user_settings
user_settings.h user_settings_simple_example.h user_settings_verbose_example.hembOS_wolfcrypt_benchmark_SAMV71_XULT
README_wolfcrypt_benchmark wolfcrypt_benchmark.ewd wolfcrypt_benchmark.ewpINTIME-RTOS
Makefile README.md include.am libwolfssl.c libwolfssl.vcxproj user_settings.h wolfExamples.c wolfExamples.h wolfExamples.sln wolfExamples.vcxproj wolfssl-lib.sln wolfssl-lib.vcxprojMQX
Makefile README-jp.md README.md client-tls.c include.am server-tls.c user_config.h user_settings.hMSVS-2019-AZSPHERE
wolfssl_new_azsphere
.gitignore CMakeLists.txt CMakeSettings.json app_manifest.json applibs_versions.h launch.vs.json main.cNETOS
Makefile.wolfcrypt.inc README.md include.am user_settings.h user_settings.h-cert2425 user_settings.h-cert3389 wolfssl_netos_custom.cPlatformIO
examples
wolfssl_benchmark
CMakeLists.txt README.md platformio.ini sdkconfig.defaults wolfssl_benchmark.code-workspaceROWLEY-CROSSWORKS-ARM
Kinetis_FlashPlacement.xml README.md arm_startup.c benchmark_main.c hw.h include.am kinetis_hw.c retarget.c test_main.c user_settings.h wolfssl.hzp wolfssl_ltc.hzpRenesas
e2studio
RA6M3
README.md README_APRA6M_en.md README_APRA6M_jp.md include.amRX72N
EnvisionKit
Simple
README_EN.md README_JP.mdwolfssl_demo
key_data.c key_data.h user_settings.h wolfssl_demo.c wolfssl_demo.h wolfssl_tsip_unit_test.cSTM32Cube
README.md STM32_Benchmarks.md default_conf.ftl include.am main.c wolfssl_example.c wolfssl_example.hWIN
README.txt include.am test.vcxproj user_settings.h user_settings_dtls.h wolfssl-fips.sln wolfssl-fips.vcxprojWIN-SRTP-KDF-140-3
README.txt include.am resource.h test.vcxproj user_settings.h wolfssl-fips.rc wolfssl-fips.sln wolfssl-fips.vcxprojWIN10
README.txt include.am resource.h test.vcxproj user_settings.h wolfssl-fips.rc wolfssl-fips.sln wolfssl-fips.vcxprojXCODE
Benchmark
include.amXilinxSDK
README.md bench.sh combine.sh eclipse_formatter_profile.xml graph.sh include.am user_settings.h wolfssl_example.capple-universal
wolfssl-multiplatform
iotsafe
Makefile README.md ca-cert.c devices.c devices.h include.am main.c memory-tls.c startup.c target.ld user_settings.hmynewt
README.md apps.wolfcrypttest.pkg.yml crypto.wolfssl.pkg.yml crypto.wolfssl.syscfg.yml include.am setup.shcerts
1024
ca-cert.der ca-cert.pem ca-key.der ca-key.pem client-cert.der client-cert.pem client-key.der client-key.pem client-keyPub.der dh1024.der dh1024.pem dsa-pub-1024.pem dsa1024.der dsa1024.pem include.am rsa1024.der server-cert.der server-cert.pem server-key.der server-key.pemcrl
extra-crls
ca-int-cert-revoked.pem claim-root.pem crl_critical_entry.pem crlnum_57oct.pem crlnum_64oct.pem general-server-crl.pem large_crlnum.pem large_crlnum2.pemdilithium
bench_dilithium_level2_key.der bench_dilithium_level3_key.der bench_dilithium_level5_key.der include.amecc
bp256r1-key.der bp256r1-key.pem ca-secp256k1-cert.pem ca-secp256k1-key.pem client-bp256r1-cert.der client-bp256r1-cert.pem client-secp256k1-cert.der client-secp256k1-cert.pem genecc.sh include.am secp256k1-key.der secp256k1-key.pem secp256k1-param.pem secp256k1-privkey.der secp256k1-privkey.pem server-bp256r1-cert.der server-bp256r1-cert.pem server-secp256k1-cert.der server-secp256k1-cert.pem server2-secp256k1-cert.der server2-secp256k1-cert.pem wolfssl.cnf wolfssl_384.cnfed25519
ca-ed25519-key.der ca-ed25519-key.pem ca-ed25519-priv.der ca-ed25519-priv.pem ca-ed25519.der ca-ed25519.pem client-ed25519-key.der client-ed25519-key.pem client-ed25519-priv.der client-ed25519-priv.pem client-ed25519.der client-ed25519.pem eddsa-ed25519.der eddsa-ed25519.pem gen-ed25519-certs.sh gen-ed25519-keys.sh gen-ed25519.sh include.am root-ed25519-key.der root-ed25519-key.pem root-ed25519-priv.der root-ed25519-priv.pem root-ed25519.der root-ed25519.pem server-ed25519-cert.pem server-ed25519-key.der server-ed25519-key.pem server-ed25519-priv.der server-ed25519-priv.pem server-ed25519.der server-ed25519.pemed448
ca-ed448-key.der ca-ed448-key.pem ca-ed448-priv.der ca-ed448-priv.pem ca-ed448.der ca-ed448.pem client-ed448-key.der client-ed448-key.pem client-ed448-priv.der client-ed448-priv.pem client-ed448.der client-ed448.pem gen-ed448-certs.sh gen-ed448-keys.sh include.am root-ed448-key.der root-ed448-key.pem root-ed448-priv.der root-ed448-priv.pem root-ed448.der root-ed448.pem server-ed448-cert.pem server-ed448-key.der server-ed448-key.pem server-ed448-priv.der server-ed448-priv.pem server-ed448.der server-ed448.pemexternal
DigiCertGlobalRootCA.pem README.txt ca-digicert-ev.pem ca-globalsign-root.pem ca-google-root.pem ca_collection.pem include.amintermediate
ca_false_intermediate
gentestcert.sh int_ca.key server.key test_ca.key test_ca.pem test_int_not_cacert.pem test_sign_bynoca_srv.pem wolfssl_base.conf wolfssl_srv.conflms
bc_hss_L2_H5_W8_root.der bc_hss_L3_H5_W4_root.der bc_lms_chain_ca.der bc_lms_chain_leaf.der bc_lms_native_bc_root.der bc_lms_sha256_h10_w8_root.der bc_lms_sha256_h5_w4_root.der include.ammldsa
README.txt include.am mldsa44-cert.der mldsa44-cert.pem mldsa44-key.pem mldsa44_bare-priv.der mldsa44_bare-seed.der mldsa44_oqskeypair.der mldsa44_priv-only.der mldsa44_pub-spki.der mldsa44_seed-only.der mldsa44_seed-priv.der mldsa65-cert.der mldsa65-cert.pem mldsa65-key.pem mldsa65_bare-priv.der mldsa65_bare-seed.der mldsa65_oqskeypair.der mldsa65_priv-only.der mldsa65_pub-spki.der mldsa65_seed-only.der mldsa65_seed-priv.der mldsa87-cert.der mldsa87-cert.pem mldsa87-key.pem mldsa87_bare-priv.der mldsa87_bare-seed.der mldsa87_oqskeypair.der mldsa87_priv-only.der mldsa87_pub-spki.der mldsa87_seed-only.der mldsa87_seed-priv.derocsp
imposter-root-ca-cert.der imposter-root-ca-cert.pem imposter-root-ca-key.der imposter-root-ca-key.pem include.am index-ca-and-intermediate-cas.txt index-ca-and-intermediate-cas.txt.attr index-intermediate1-ca-issued-certs.txt index-intermediate1-ca-issued-certs.txt.attr index-intermediate2-ca-issued-certs.txt index-intermediate2-ca-issued-certs.txt.attr index-intermediate3-ca-issued-certs.txt index-intermediate3-ca-issued-certs.txt.attr intermediate1-ca-cert.der intermediate1-ca-cert.pem intermediate1-ca-key.der intermediate1-ca-key.pem intermediate2-ca-cert.der intermediate2-ca-cert.pem intermediate2-ca-key.der intermediate2-ca-key.pem intermediate3-ca-cert.der intermediate3-ca-cert.pem intermediate3-ca-key.der intermediate3-ca-key.pem ocsp-responder-cert.der ocsp-responder-cert.pem ocsp-responder-key.der ocsp-responder-key.pem openssl.cnf renewcerts-for-test.sh renewcerts.sh root-ca-cert.der root-ca-cert.pem root-ca-crl.pem root-ca-key.der root-ca-key.pem server1-cert.der server1-cert.pem server1-chain-noroot.pem server1-key.der server1-key.pem server2-cert.der server2-cert.pem server2-key.der server2-key.pem server3-cert.der server3-cert.pem server3-key.der server3-key.pem server4-cert.der server4-cert.pem server4-key.der server4-key.pem server5-cert.der server5-cert.pem server5-key.der server5-key.pem test-leaf-response.der test-multi-response.der test-response-nointern.der test-response-rsapss.der test-response.derp521
ca-p521-key.der ca-p521-key.pem ca-p521-priv.der ca-p521-priv.pem ca-p521.der ca-p521.pem client-p521-key.der client-p521-key.pem client-p521-priv.der client-p521-priv.pem client-p521.der client-p521.pem gen-p521-certs.sh gen-p521-keys.sh include.am root-p521-key.der root-p521-key.pem root-p521-priv.der root-p521-priv.pem root-p521.der root-p521.pem server-p521-cert.pem server-p521-key.der server-p521-key.pem server-p521-priv.der server-p521-priv.pem server-p521.der server-p521.pemrpk
client-cert-rpk.der client-ecc-cert-rpk.der include.am server-cert-rpk.der server-ecc-cert-rpk.derrsapss
ca-3072-rsapss-key.der ca-3072-rsapss-key.pem ca-3072-rsapss-priv.der ca-3072-rsapss-priv.pem ca-3072-rsapss.der ca-3072-rsapss.pem ca-rsapss-key.der ca-rsapss-key.pem ca-rsapss-priv.der ca-rsapss-priv.pem ca-rsapss.der ca-rsapss.pem client-3072-rsapss-key.der client-3072-rsapss-key.pem client-3072-rsapss-priv.der client-3072-rsapss-priv.pem client-3072-rsapss.der client-3072-rsapss.pem client-rsapss-key.der client-rsapss-key.pem client-rsapss-priv.der client-rsapss-priv.pem client-rsapss.der client-rsapss.pem gen-rsapss-keys.sh include.am renew-rsapss-certs.sh root-3072-rsapss-key.der root-3072-rsapss-key.pem root-3072-rsapss-priv.der root-3072-rsapss-priv.pem root-3072-rsapss.der root-3072-rsapss.pem root-rsapss-key.der root-rsapss-key.pem root-rsapss-priv.der root-rsapss-priv.pem root-rsapss.der root-rsapss.pem server-3072-rsapss-cert.pem server-3072-rsapss-key.der server-3072-rsapss-key.pem server-3072-rsapss-priv.der server-3072-rsapss-priv.pem server-3072-rsapss.der server-3072-rsapss.pem server-mix-rsapss-cert.pem server-rsapss-cert.pem server-rsapss-key.der server-rsapss-key.pem server-rsapss-priv.der server-rsapss-priv.pem server-rsapss.der server-rsapss.pemslhdsa
bench_slhdsa_sha2_128f_key.der bench_slhdsa_sha2_128s_key.der bench_slhdsa_sha2_192f_key.der bench_slhdsa_sha2_192s_key.der bench_slhdsa_sha2_256f_key.der bench_slhdsa_sha2_256s_key.der bench_slhdsa_shake128f_key.der bench_slhdsa_shake128s_key.der bench_slhdsa_shake192f_key.der bench_slhdsa_shake192s_key.der bench_slhdsa_shake256f_key.der bench_slhdsa_shake256s_key.der client-mldsa44-priv.pem client-mldsa44-sha2.der client-mldsa44-sha2.pem client-mldsa44-shake.der client-mldsa44-shake.pem gen-slhdsa-mldsa-certs.sh include.am root-slhdsa-sha2-128s-priv.der root-slhdsa-sha2-128s-priv.pem root-slhdsa-sha2-128s.der root-slhdsa-sha2-128s.pem root-slhdsa-shake-128s-priv.der root-slhdsa-shake-128s-priv.pem root-slhdsa-shake-128s.der root-slhdsa-shake-128s.pem server-mldsa44-priv.pem server-mldsa44-sha2.der server-mldsa44-sha2.pem server-mldsa44-shake.der server-mldsa44-shake.pemsm2
ca-sm2-key.der ca-sm2-key.pem ca-sm2-priv.der ca-sm2-priv.pem ca-sm2.der ca-sm2.pem client-sm2-key.der client-sm2-key.pem client-sm2-priv.der client-sm2-priv.pem client-sm2.der client-sm2.pem fix_sm2_spki.py gen-sm2-certs.sh gen-sm2-keys.sh include.am root-sm2-key.der root-sm2-key.pem root-sm2-priv.der root-sm2-priv.pem root-sm2.der root-sm2.pem self-sm2-cert.pem self-sm2-key.pem self-sm2-priv.pem server-sm2-cert.der server-sm2-cert.pem server-sm2-key.der server-sm2-key.pem server-sm2-priv.der server-sm2-priv.pem server-sm2.der server-sm2.pemstatickeys
dh-ffdhe2048-params.pem dh-ffdhe2048-pub.der dh-ffdhe2048-pub.pem dh-ffdhe2048.der dh-ffdhe2048.pem ecc-secp256r1.der ecc-secp256r1.pem gen-static.sh include.am x25519-pub.der x25519-pub.pem x25519.der x25519.pemtest
catalog.txt cert-bad-neg-int.der cert-bad-oid.der cert-bad-utf8.der cert-ext-ia.cfg cert-ext-ia.der cert-ext-ia.pem cert-ext-joi.cfg cert-ext-joi.der cert-ext-joi.pem cert-ext-mnc.der cert-ext-multiple.cfg cert-ext-multiple.der cert-ext-multiple.pem cert-ext-nc-combined.der cert-ext-nc-combined.pem cert-ext-nc.cfg cert-ext-nc.der cert-ext-nc.pem cert-ext-ncdns.der cert-ext-ncdns.pem cert-ext-ncip.der cert-ext-ncip.pem cert-ext-ncmixed.der cert-ext-ncmulti.der cert-ext-ncmulti.pem cert-ext-ncrid.der cert-ext-ncrid.pem cert-ext-nct.cfg cert-ext-nct.der cert-ext-nct.pem cert-ext-ndir-exc.cfg cert-ext-ndir-exc.der cert-ext-ndir-exc.pem cert-ext-ndir.cfg cert-ext-ndir.der cert-ext-ndir.pem cert-ext-ns.der cert-over-max-altnames.cfg cert-over-max-altnames.der cert-over-max-altnames.pem cert-over-max-nc.cfg cert-over-max-nc.der cert-over-max-nc.pem client-ecc-cert-ski.hex cn-ip-literal.der cn-ip-wildcard.der crit-cert.pem crit-key.pem dh1024.der dh1024.pem dh512.der dh512.pem digsigku.pem encrypteddata.msg gen-badsig.sh gen-ext-certs.sh gen-testcerts.sh include.am kari-keyid-cms.msg ktri-keyid-cms.msg ossl-trusted-cert.pem server-badaltname.der server-badaltname.pem server-badaltnull.der server-badaltnull.pem server-badcn.der server-badcn.pem server-badcnnull.der server-badcnnull.pem server-cert-ecc-badsig.der server-cert-ecc-badsig.pem server-cert-rsa-badsig.der server-cert-rsa-badsig.pem server-duplicate-policy.pem server-garbage.der server-garbage.pem server-goodalt.der server-goodalt.pem server-goodaltwild.der server-goodaltwild.pem server-goodcn.der server-goodcn.pem server-goodcnwild.der server-goodcnwild.pem server-localhost.der server-localhost.pem smime-test-canon.p7s smime-test-multipart-badsig.p7s smime-test-multipart.p7s smime-test.p7stest-pathlen
assemble-chains.sh chainA-ICA1-key.pem chainA-ICA1-pathlen0.pem chainA-assembled.pem chainA-entity-key.pem chainA-entity.pem chainB-ICA1-key.pem chainB-ICA1-pathlen0.pem chainB-ICA2-key.pem chainB-ICA2-pathlen1.pem chainB-assembled.pem chainB-entity-key.pem chainB-entity.pem chainC-ICA1-key.pem chainC-ICA1-pathlen1.pem chainC-assembled.pem chainC-entity-key.pem chainC-entity.pem chainD-ICA1-key.pem chainD-ICA1-pathlen127.pem chainD-assembled.pem chainD-entity-key.pem chainD-entity.pem chainE-ICA1-key.pem chainE-ICA1-pathlen128.pem chainE-assembled.pem chainE-entity-key.pem chainE-entity.pem chainF-ICA1-key.pem chainF-ICA1-pathlen1.pem chainF-ICA2-key.pem chainF-ICA2-pathlen0.pem chainF-assembled.pem chainF-entity-key.pem chainF-entity.pem chainG-ICA1-key.pem chainG-ICA1-pathlen0.pem chainG-ICA2-key.pem chainG-ICA2-pathlen1.pem chainG-ICA3-key.pem chainG-ICA3-pathlen99.pem chainG-ICA4-key.pem chainG-ICA4-pathlen5.pem chainG-ICA5-key.pem chainG-ICA5-pathlen20.pem chainG-ICA6-key.pem chainG-ICA6-pathlen10.pem chainG-ICA7-key.pem chainG-ICA7-pathlen100.pem chainG-assembled.pem chainG-entity-key.pem chainG-entity.pem chainH-ICA1-key.pem chainH-ICA1-pathlen0.pem chainH-ICA2-key.pem chainH-ICA2-pathlen2.pem chainH-ICA3-key.pem chainH-ICA3-pathlen2.pem chainH-ICA4-key.pem chainH-ICA4-pathlen2.pem chainH-assembled.pem chainH-entity-key.pem chainH-entity.pem chainI-ICA1-key.pem chainI-ICA1-no_pathlen.pem chainI-ICA2-key.pem chainI-ICA2-no_pathlen.pem chainI-ICA3-key.pem chainI-ICA3-pathlen2.pem chainI-assembled.pem chainI-entity-key.pem chainI-entity.pem chainJ-ICA1-key.pem chainJ-ICA1-no_pathlen.pem chainJ-ICA2-key.pem chainJ-ICA2-no_pathlen.pem chainJ-ICA3-key.pem chainJ-ICA3-no_pathlen.pem chainJ-ICA4-key.pem chainJ-ICA4-pathlen2.pem chainJ-assembled.pem chainJ-entity-key.pem chainJ-entity.pem include.am refreshkeys.shtest-serial0
ee_normal.pem ee_serial0.pem generate_certs.sh include.am intermediate_serial0.pem root_serial0.pem root_serial0_key.pem selfsigned_nonca_serial0.pemxmss
bc_xmss_chain_ca.der bc_xmss_chain_leaf.der bc_xmss_sha2_10_256_root.der bc_xmss_sha2_16_256_root.der bc_xmssmt_sha2_20_2_256_root.der bc_xmssmt_sha2_20_4_256_root.der bc_xmssmt_sha2_40_8_256_root.der include.amcmake
Config.cmake.in README.md config.in functions.cmake include.am options.h.in wolfssl-config-version.cmake.in wolfssl-targets.cmake.indebian
changelog.in control.in copyright include.am libwolfssl-dev.install libwolfssl.install rules.indoc
dox_comments
header_files
aes.h arc4.h ascon.h asn.h asn_public.h blake2.h bn.h camellia.h chacha.h chacha20_poly1305.h cmac.h coding.h compress.h cryptocb.h curve25519.h curve448.h des3.h dh.h doxygen_groups.h doxygen_pages.h dsa.h ecc.h eccsi.h ed25519.h ed448.h error-crypt.h evp.h hash.h hmac.h iotsafe.h kdf.h logging.h md2.h md4.h md5.h memory.h ocsp.h pem.h pkcs11.h pkcs7.h poly1305.h psa.h puf.h pwdbased.h quic.h random.h ripemd.h rsa.h sakke.h sha.h sha256.h sha3.h sha512.h signature.h siphash.h srp.h ssl.h tfm.h types.h wc_encrypt.h wc_port.h wc_she.h wc_slhdsa.h wolfio.hheader_files-ja
aes.h arc4.h ascon.h asn.h asn_public.h blake2.h bn.h camellia.h chacha.h chacha20_poly1305.h cmac.h coding.h compress.h cryptocb.h curve25519.h curve448.h des3.h dh.h doxygen_groups.h doxygen_pages.h dsa.h ecc.h eccsi.h ed25519.h ed448.h error-crypt.h evp.h hash.h hmac.h iotsafe.h kdf.h logging.h md2.h md4.h md5.h memory.h ocsp.h pem.h pkcs11.h pkcs7.h poly1305.h psa.h pwdbased.h quic.h random.h ripemd.h rsa.h sakke.h sha.h sha256.h sha3.h sha512.h signature.h siphash.h srp.h ssl.h tfm.h types.h wc_encrypt.h wc_port.h wolfio.hexamples
async
Makefile README.md async_client.c async_server.c async_tls.c async_tls.h include.am user_settings.hconfigs
README.md include.am user_settings_EBSnet.h user_settings_all.h user_settings_arduino.h user_settings_baremetal.h user_settings_ca.h user_settings_curve25519nonblock.h user_settings_dtls13.h user_settings_eccnonblock.h user_settings_espressif.h user_settings_fipsv2.h user_settings_fipsv5.h user_settings_min_ecc.h user_settings_openssl_compat.h user_settings_pkcs7.h user_settings_platformio.h user_settings_pq.h user_settings_rsa_only.h user_settings_stm32.h user_settings_template.h user_settings_tls12.h user_settings_tls13.h user_settings_wolfboot_keytools.h user_settings_wolfssh.h user_settings_wolftpm.hechoclient
echoclient.c echoclient.h echoclient.sln echoclient.vcproj echoclient.vcxproj include.am quitlinuxkm
Kbuild Makefile README.md get_thread_size.c include.am linuxkm-fips-hash-wrapper.sh linuxkm-fips-hash.c linuxkm_memory.c linuxkm_memory.h linuxkm_wc_port.h lkcapi_aes_glue.c lkcapi_dh_glue.c lkcapi_ecdh_glue.c lkcapi_ecdsa_glue.c lkcapi_glue.c lkcapi_rsa_glue.c lkcapi_sha_glue.c module_exports.c.template module_hooks.c pie_redirect_table.c wolfcrypt.lds x86_vector_register_glue.cm4
ax_add_am_macro.m4 ax_am_jobserver.m4 ax_am_macros.m4 ax_append_compile_flags.m4 ax_append_flag.m4 ax_append_link_flags.m4 ax_append_to_file.m4 ax_atomic.m4 ax_bsdkm.m4 ax_check_compile_flag.m4 ax_check_link_flag.m4 ax_compiler_version.m4 ax_count_cpus.m4 ax_create_generic_config.m4 ax_debug.m4 ax_file_escapes.m4 ax_harden_compiler_flags.m4 ax_linuxkm.m4 ax_print_to_file.m4 ax_pthread.m4 ax_require_defined.m4 ax_tls.m4 ax_vcs_checkout.m4 hexversion.m4 lib_socket_nsl.m4 visibility.m4mqx
wolfcrypt_benchmark
ReferencedRSESystems.xml wolfcrypt_benchmark_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchwolfcrypt_test
ReferencedRSESystems.xml wolfcrypt_test_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchwolfssl_client
ReferencedRSESystems.xml wolfssl_client_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchscripts
aria-cmake-build-test.sh asn1_oid_sum.pl benchmark.test benchmark_compare.sh cleanup_testfiles.sh crl-gen-openssl.test crl-revoked.test dertoc.pl dtls.test dtlscid.test external.test google.test include.am makedistsmall.sh memtest.sh ocsp-responder-openssl-interop.test ocsp-stapling-with-ca-as-responder.test ocsp-stapling-with-wolfssl-responder.test ocsp-stapling.test ocsp-stapling2.test ocsp-stapling_tls13multi.test ocsp.test openssl.test openssl_srtp.test pem.test ping.test pkcallbacks.test psk.test resume.test rsapss.test sniffer-gen.sh sniffer-ipv6.pcap sniffer-static-rsa.pcap sniffer-testsuite.test sniffer-tls12-keylog.out sniffer-tls12-keylog.pcap sniffer-tls12-keylog.sslkeylog sniffer-tls13-dh-resume.pcap sniffer-tls13-dh.pcap sniffer-tls13-ecc-resume.pcap sniffer-tls13-ecc.pcap sniffer-tls13-hrr.pcap sniffer-tls13-keylog.out sniffer-tls13-keylog.pcap sniffer-tls13-keylog.sslkeylog sniffer-tls13-x25519-resume.pcap sniffer-tls13-x25519.pcap stm32l4-v4_0_1_build.sh tls13.test trusted_peer.test unit.test.in user_settings_asm.shsrc
bio.c conf.c crl.c dtls.c dtls13.c include.am internal.c keys.c ocsp.c pk.c pk_ec.c pk_rsa.c quic.c sniffer.c ssl.c ssl_api_cert.c ssl_api_crl_ocsp.c ssl_api_pk.c ssl_asn1.c ssl_bn.c ssl_certman.c ssl_crypto.c ssl_ech.c ssl_load.c ssl_misc.c ssl_p7p12.c ssl_sess.c ssl_sk.c tls.c tls13.c wolfio.c x509.c x509_str.ctests
api
api.h api_decl.h create_ocsp_test_blobs.py include.am test_aes.c test_aes.h test_arc4.c test_arc4.h test_ascon.c test_ascon.h test_ascon_kats.h test_asn.c test_asn.h test_blake2.c test_blake2.h test_camellia.c test_camellia.h test_certman.c test_certman.h test_chacha.c test_chacha.h test_chacha20_poly1305.c test_chacha20_poly1305.h test_cmac.c test_cmac.h test_curve25519.c test_curve25519.h test_curve448.c test_curve448.h test_des3.c test_des3.h test_dh.c test_dh.h test_digest.h test_dsa.c test_dsa.h test_dtls.c test_dtls.h test_ecc.c test_ecc.h test_ed25519.c test_ed25519.h test_ed448.c test_ed448.h test_evp.c test_evp.h test_evp_cipher.c test_evp_cipher.h test_evp_digest.c test_evp_digest.h test_evp_pkey.c test_evp_pkey.h test_hash.c test_hash.h test_hmac.c test_hmac.h test_md2.c test_md2.h test_md4.c test_md4.h test_md5.c test_md5.h test_mldsa.c test_mldsa.h test_mlkem.c test_mlkem.h test_ocsp.c test_ocsp.h test_ocsp_test_blobs.h test_ossl_asn1.c test_ossl_asn1.h test_ossl_bio.c test_ossl_bio.h test_ossl_bn.c test_ossl_bn.h test_ossl_cipher.c test_ossl_cipher.h test_ossl_dgst.c test_ossl_dgst.h test_ossl_dh.c test_ossl_dh.h test_ossl_dsa.c test_ossl_dsa.h test_ossl_ec.c test_ossl_ec.h test_ossl_ecx.c test_ossl_ecx.h test_ossl_mac.c test_ossl_mac.h test_ossl_obj.c test_ossl_obj.h test_ossl_p7p12.c test_ossl_p7p12.h test_ossl_pem.c test_ossl_pem.h test_ossl_rand.c test_ossl_rand.h test_ossl_rsa.c test_ossl_rsa.h test_ossl_sk.c test_ossl_sk.h test_ossl_x509.c test_ossl_x509.h test_ossl_x509_acert.c test_ossl_x509_acert.h test_ossl_x509_crypto.c test_ossl_x509_crypto.h test_ossl_x509_ext.c test_ossl_x509_ext.h test_ossl_x509_info.c test_ossl_x509_info.h test_ossl_x509_io.c test_ossl_x509_io.h test_ossl_x509_lu.c test_ossl_x509_lu.h test_ossl_x509_name.c test_ossl_x509_name.h test_ossl_x509_pk.c test_ossl_x509_pk.h test_ossl_x509_str.c test_ossl_x509_str.h test_ossl_x509_vp.c test_ossl_x509_vp.h test_pkcs12.c test_pkcs12.h test_pkcs7.c test_pkcs7.h test_poly1305.c test_poly1305.h test_random.c test_random.h test_rc2.c test_rc2.h test_ripemd.c test_ripemd.h test_rsa.c test_rsa.h test_sha.c test_sha.h test_sha256.c test_sha256.h test_sha3.c test_sha3.h test_sha512.c test_sha512.h test_she.c test_she.h test_signature.c test_signature.h test_slhdsa.c test_slhdsa.h test_sm2.c test_sm2.h test_sm3.c test_sm3.h test_sm4.c test_sm4.h test_tls.c test_tls.h test_tls13.c test_tls13.h test_tls_ext.c test_tls_ext.h test_wc_encrypt.c test_wc_encrypt.h test_wolfmath.c test_wolfmath.h test_x509.c test_x509.hwolfcrypt
benchmark
README.md benchmark-VS2022.sln benchmark-VS2022.vcxproj benchmark-VS2022.vcxproj.user benchmark.c benchmark.h benchmark.sln benchmark.vcproj benchmark.vcxproj include.amsrc
port
Espressif
esp_crt_bundle
README.md cacrt_all.pem cacrt_deprecated.pem cacrt_local.pem esp_crt_bundle.c gen_crt_bundle.py pio_install_cryptography.pyRenesas
README.md renesas_common.c renesas_fspsm_aes.c renesas_fspsm_rsa.c renesas_fspsm_sha.c renesas_fspsm_util.c renesas_rx64_hw_sha.c renesas_rx64_hw_util.c renesas_tsip_aes.c renesas_tsip_rsa.c renesas_tsip_sha.c renesas_tsip_util.carm
armv8-32-aes-asm.S armv8-32-aes-asm_c.c armv8-32-chacha-asm.S armv8-32-chacha-asm_c.c armv8-32-curve25519.S armv8-32-curve25519_c.c armv8-32-mlkem-asm.S armv8-32-mlkem-asm_c.c armv8-32-poly1305-asm.S armv8-32-poly1305-asm_c.c armv8-32-sha256-asm.S armv8-32-sha256-asm_c.c armv8-32-sha3-asm.S armv8-32-sha3-asm_c.c armv8-32-sha512-asm.S armv8-32-sha512-asm_c.c armv8-aes-asm.S armv8-aes-asm_c.c armv8-aes.c armv8-chacha-asm.S armv8-chacha-asm_c.c armv8-curve25519.S armv8-curve25519_c.c armv8-mlkem-asm.S armv8-mlkem-asm_c.c armv8-poly1305-asm.S armv8-poly1305-asm_c.c armv8-sha256-asm.S armv8-sha256-asm_c.c armv8-sha256.c armv8-sha3-asm.S armv8-sha3-asm_c.c armv8-sha512-asm.S armv8-sha512-asm_c.c armv8-sha512.c cryptoCell.c cryptoCellHash.c thumb2-aes-asm.S thumb2-aes-asm_c.c thumb2-chacha-asm.S thumb2-chacha-asm_c.c thumb2-curve25519.S thumb2-curve25519_c.c thumb2-mlkem-asm.S thumb2-mlkem-asm_c.c thumb2-poly1305-asm.S thumb2-poly1305-asm_c.c thumb2-sha256-asm.S thumb2-sha256-asm_c.c thumb2-sha3-asm.S thumb2-sha3-asm_c.c thumb2-sha512-asm.S thumb2-sha512-asm_c.ccaam
README.md caam_aes.c caam_doc.pdf caam_driver.c caam_error.c caam_integrity.c caam_qnx.c caam_sha.c wolfcaam_aes.c wolfcaam_cmac.c wolfcaam_ecdsa.c wolfcaam_fsl_nxp.c wolfcaam_hash.c wolfcaam_hmac.c wolfcaam_init.c wolfcaam_qnx.c wolfcaam_rsa.c wolfcaam_seco.c wolfcaam_x25519.cdevcrypto
README.md devcrypto_aes.c devcrypto_ecdsa.c devcrypto_hash.c devcrypto_hmac.c devcrypto_rsa.c devcrypto_x25519.c wc_devcrypto.criscv
riscv-64-aes.c riscv-64-chacha.c riscv-64-poly1305.c riscv-64-sha256.c riscv-64-sha3.c riscv-64-sha512.cwolfssl
openssl
aes.h asn1.h asn1t.h bio.h bn.h buffer.h camellia.h cmac.h cms.h compat_types.h conf.h crypto.h des.h dh.h dsa.h ec.h ec25519.h ec448.h ecdh.h ecdsa.h ed25519.h ed448.h engine.h err.h evp.h fips_rand.h hmac.h include.am kdf.h lhash.h md4.h md5.h modes.h obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h pem.h pkcs12.h pkcs7.h rand.h rc4.h ripemd.h rsa.h safestack.h sha.h sha3.h srp.h ssl.h ssl23.h stack.h tls1.h txt_db.h ui.h x509.h x509_vfy.h x509v3.hwolfcrypt
port
Renesas
renesas-fspsm-crypt.h renesas-fspsm-types.h renesas-rx64-hw-crypt.h renesas-tsip-crypt.h renesas_cmn.h renesas_fspsm_internal.h renesas_sync.h renesas_tsip_internal.h renesas_tsip_types.hcaam
caam_driver.h caam_error.h caam_qnx.h wolfcaam.h wolfcaam_aes.h wolfcaam_cmac.h wolfcaam_ecdsa.h wolfcaam_fsl_nxp.h wolfcaam_hash.h wolfcaam_qnx.h wolfcaam_rsa.h wolfcaam_seco.h wolfcaam_sha.h wolfcaam_x25519.hwrapper
Ada
examples
src
aes_verify_main.adb rsa_verify_main.adb sha256_main.adb spark_sockets.adb spark_sockets.ads spark_terminal.adb spark_terminal.ads tls_client.adb tls_client.ads tls_client_main.adb tls_server.adb tls_server.ads tls_server_main.adbtests
src
aes_bindings_tests.adb aes_bindings_tests.ads rsa_verify_bindings_tests.adb rsa_verify_bindings_tests.ads sha256_bindings_tests.adb sha256_bindings_tests.ads tests.adbCSharp
wolfSSL-Example-IOCallbacks
App.config wolfSSL-Example-IOCallbacks.cs wolfSSL-Example-IOCallbacks.csprojwolfSSL-TLS-ServerThreaded
App.config wolfSSL-TLS-ServerThreaded.cs wolfSSL-TLS-ServerThreaded.csprojrust
wolfssl-wolfcrypt
src
aes.rs blake2.rs chacha20_poly1305.rs cmac.rs cmac_mac.rs curve25519.rs dh.rs dilithium.rs ecc.rs ecdsa.rs ed25519.rs ed448.rs fips.rs hkdf.rs hmac.rs hmac_mac.rs kdf.rs lib.rs lms.rs mlkem.rs mlkem_kem.rs pbkdf2_password_hash.rs prf.rs random.rs rsa.rs rsa_pkcs1v15.rs sha.rs sha_digest.rs sys.rstests
test_aes.rs test_blake2.rs test_chacha20_poly1305.rs test_cmac.rs test_cmac_mac.rs test_curve25519.rs test_dh.rs test_dilithium.rs test_ecc.rs test_ecdsa.rs test_ed25519.rs test_ed448.rs test_hkdf.rs test_hmac.rs test_hmac_mac.rs test_kdf.rs test_lms.rs test_mlkem.rs test_mlkem_kem.rs test_pbkdf2_password_hash.rs test_prf.rs test_random.rs test_rsa.rs test_rsa_pkcs1v15.rs test_sha.rs test_sha_digest.rs test_wolfcrypt.rszephyr
samples
wolfssl_benchmark
CMakeLists.txt README install_test.sh prj.conf sample.yaml zephyr_legacy.conf zephyr_v4.1.confwolfssl_test
CMakeLists.txt README install_test.sh prj-no-malloc.conf prj.conf sample.yaml zephyr_legacy.conf zephyr_v4.1.conf
wolfssl/tests/api/test_dtls.c
raw
1/* test_dtls.c
2 *
3 * Copyright (C) 2006-2026 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL.
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20 */
21
22#include <tests/unit.h>
23
24#ifdef NO_INLINE
25 #include <wolfssl/wolfcrypt/misc.h>
26#else
27 #define WOLFSSL_MISC_INCLUDED
28 #include <wolfcrypt/src/misc.c>
29#endif
30
31#include <wolfssl/ssl.h>
32#include <wolfssl/internal.h>
33
34#include <tests/utils.h>
35#include <tests/api/test_dtls.h>
36
37int test_dtls12_basic_connection_id(void)
38{
39 EXPECT_DECLS;
40#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS_CID)
41 unsigned char client_cid[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
42 unsigned char server_cid[] = { 0, 1, 2, 3, 4, 5 };
43 unsigned char readBuf[40];
44 void * cid = NULL;
45 const char* params[] = {
46#ifndef NO_RSA
47#ifndef NO_SHA256
48#if defined(WOLFSSL_AES_128) && defined(WOLFSSL_STATIC_RSA)
49 "AES128-SHA256",
50#ifdef HAVE_AESCCM
51 "AES128-CCM8",
52#endif
53#endif /* WOLFSSL_AES_128 && WOLFSSL_STATIC_RSA */
54#if defined(WOLFSSL_AES_128)
55 "DHE-RSA-AES128-SHA256",
56 "ECDHE-RSA-AES128-SHA256",
57#ifdef HAVE_AESGCM
58 "DHE-RSA-AES128-GCM-SHA256",
59 "ECDHE-RSA-AES128-GCM-SHA256",
60#endif
61#endif /* WOLFSSL_AES_128 */
62#endif /* NO_SHA256 */
63#endif /* NO_RSA */
64#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305) && !defined(HAVE_FIPS)
65 "DHE-RSA-CHACHA20-POLY1305",
66 "DHE-RSA-CHACHA20-POLY1305-OLD",
67 "ECDHE-RSA-CHACHA20-POLY1305",
68 "ECDHE-RSA-CHACHA20-POLY1305-OLD",
69#endif
70#ifndef NO_PSK
71 "DHE-PSK-AES128-CBC-SHA256",
72 #ifdef WOLFSSL_AES_256
73 "DHE-PSK-AES256-GCM-SHA384",
74 #endif
75#ifdef HAVE_NULL_CIPHER
76 "DHE-PSK-NULL-SHA256",
77#endif
78 "DHE-PSK-AES128-CCM",
79#endif
80 };
81 size_t i;
82 struct {
83 byte drop:1;
84 byte changeCID:1;
85 } run_params[] = {
86 { .drop = 0, .changeCID = 0 },
87 { .drop = 1, .changeCID = 0 },
88 { .drop = 0, .changeCID = 1 },
89 };
90
91 /* We check if the side included the CID in their output */
92#define CLIENT_CID() mymemmem(test_ctx.s_buff, test_ctx.s_len, \
93 client_cid, sizeof(client_cid))
94#define SERVER_CID() mymemmem(test_ctx.c_buff, test_ctx.c_len, \
95 server_cid, sizeof(server_cid))
96#define RESET_CID(cid) if ((cid) != NULL) { \
97 ((char*)(cid))[0] = -1; \
98 }
99
100
101 printf("\n");
102 for (i = 0; i < XELEM_CNT(params) && EXPECT_SUCCESS(); i++) {
103 size_t j;
104 for (j = 0; j < XELEM_CNT(run_params); j++) {
105 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
106 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
107 struct test_memio_ctx test_ctx;
108
109 printf("Testing %s run #%ld ... ", params[i], (long int)j);
110
111 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
112
113 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c,
114 &ssl_s, wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
115 0);
116
117 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i]), 1);
118 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i]), 1);
119
120 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_c), 1);
121 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, server_cid,
122 sizeof(server_cid)), 1);
123 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_s), 1);
124 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_s, client_cid,
125 sizeof(client_cid)), 1);
126
127#ifndef NO_PSK
128 if (XSTRSTR(params[i], "-PSK-") != NULL) {
129 wolfSSL_set_psk_client_callback(ssl_c, my_psk_client_cb);
130 wolfSSL_set_psk_server_callback(ssl_s, my_psk_server_cb);
131 }
132#endif
133
134#ifdef HAVE_SECURE_RENEGOTIATION
135 ExpectIntEQ(wolfSSL_UseSecureRenegotiation(ssl_c), 1);
136 ExpectIntEQ(wolfSSL_UseSecureRenegotiation(ssl_s), 1);
137#endif
138
139 /* CH1 */
140 wolfSSL_SetLoggingPrefix("client");
141 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
142 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
143 ExpectNull(CLIENT_CID());
144 if (run_params[j].drop) {
145 test_memio_clear_buffer(&test_ctx, 0);
146 test_memio_clear_buffer(&test_ctx, 1);
147 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
148 ExpectNull(CLIENT_CID());
149 }
150 /* HVR */
151 wolfSSL_SetLoggingPrefix("server");
152 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
153 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
154 ExpectNull(SERVER_CID());
155 /* No point dropping HVR */
156 /* CH2 */
157 wolfSSL_SetLoggingPrefix("client");
158 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
159 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
160 ExpectNull(CLIENT_CID());
161 if (run_params[j].drop) {
162 test_memio_clear_buffer(&test_ctx, 0);
163 test_memio_clear_buffer(&test_ctx, 1);
164 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
165 ExpectNull(CLIENT_CID());
166 }
167 /* Server first flight */
168 wolfSSL_SetLoggingPrefix("server");
169 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
170 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
171 ExpectNull(SERVER_CID());
172 if (run_params[j].drop) {
173 test_memio_clear_buffer(&test_ctx, 0);
174 test_memio_clear_buffer(&test_ctx, 1);
175 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), 1);
176 ExpectNull(SERVER_CID());
177 }
178 /* Client second flight */
179 wolfSSL_SetLoggingPrefix("client");
180 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
181 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
182 ExpectNotNull(CLIENT_CID());
183 if (run_params[j].drop) {
184 test_memio_clear_buffer(&test_ctx, 0);
185 test_memio_clear_buffer(&test_ctx, 1);
186 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
187 ExpectNotNull(CLIENT_CID());
188 }
189 /* Server second flight */
190 wolfSSL_SetLoggingPrefix("server");
191 ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
192 ExpectNotNull(SERVER_CID());
193 if (run_params[j].drop) {
194 test_memio_clear_buffer(&test_ctx, 0);
195 test_memio_clear_buffer(&test_ctx, 1);
196 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), 1);
197 ExpectNotNull(SERVER_CID());
198 }
199 /* Client complete connection */
200 wolfSSL_SetLoggingPrefix("client");
201 ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
202 ExpectNull(CLIENT_CID());
203
204 /* Write some data */
205 wolfSSL_SetLoggingPrefix("client");
206 ExpectIntEQ(wolfSSL_write(ssl_c, params[i],
207 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
208 ExpectNotNull(CLIENT_CID());
209 wolfSSL_SetLoggingPrefix("server");
210 ExpectIntEQ(wolfSSL_write(ssl_s, params[i],
211 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
212 ExpectNotNull(SERVER_CID());
213 /* Read the data */
214 wolfSSL_SetLoggingPrefix("client");
215 XMEMSET(readBuf, 0, sizeof(readBuf));
216 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)),
217 XSTRLEN(params[i]));
218 ExpectStrEQ(readBuf, params[i]);
219 XMEMSET(readBuf, 0, sizeof(readBuf));
220 wolfSSL_SetLoggingPrefix("server");
221 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)),
222 XSTRLEN(params[i]));
223 ExpectStrEQ(readBuf, params[i]);
224 /* Write short data */
225 wolfSSL_SetLoggingPrefix("client");
226 ExpectIntEQ(wolfSSL_write(ssl_c, params[i], 1), 1);
227 ExpectNotNull(CLIENT_CID());
228 wolfSSL_SetLoggingPrefix("server");
229 ExpectIntEQ(wolfSSL_write(ssl_s, params[i], 1), 1);
230 ExpectNotNull(SERVER_CID());
231 /* Read the short data */
232 XMEMSET(readBuf, 0, sizeof(readBuf));
233 wolfSSL_SetLoggingPrefix("client");
234 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), 1);
235 ExpectIntEQ(readBuf[0], params[i][0]);
236 XMEMSET(readBuf, 0, sizeof(readBuf));
237 wolfSSL_SetLoggingPrefix("server");
238 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), 1);
239 ExpectIntEQ(readBuf[0], params[i][0]);
240 /* Write some data but with wrong CID */
241 wolfSSL_SetLoggingPrefix("client");
242 ExpectIntEQ(wolfSSL_write(ssl_c, params[i],
243 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
244 /* Reset client cid. */
245 ExpectNotNull(cid = CLIENT_CID());
246 RESET_CID(cid);
247 wolfSSL_SetLoggingPrefix("server");
248 ExpectIntEQ(wolfSSL_write(ssl_s, params[i],
249 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
250 /* Reset server cid. */
251 ExpectNotNull(cid = SERVER_CID());
252 RESET_CID(cid);
253 /* Try to read the data but it shouldn't be there */
254 wolfSSL_SetLoggingPrefix("client");
255 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
256 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
257 wolfSSL_SetLoggingPrefix("server");
258 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
259 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
260
261#ifdef HAVE_SECURE_RENEGOTIATION
262 /* do two SCR's */
263 wolfSSL_SetLoggingPrefix("client");
264 ExpectIntEQ(wolfSSL_Rehandshake(ssl_c), -1);
265 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
266 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
267 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
268 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
269 /* SCR's after the first one have extra internal logic */
270 wolfSSL_SetLoggingPrefix("client");
271 ExpectIntEQ(wolfSSL_Rehandshake(ssl_c), -1);
272 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
273 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
274 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
275 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
276
277 if (run_params[j].changeCID) {
278 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, client_cid,
279 sizeof(client_cid)), 0);
280 /* Forcefully change the CID */
281 ssl_c->dtlsCidInfo->rx->id[0] = -1;
282 /* We need to init the rehandshake from the client, otherwise
283 * we won't be able to test changing the CID. It would be
284 * rejected by the record CID matching code. */
285 wolfSSL_SetLoggingPrefix("client");
286 ExpectIntEQ(wolfSSL_Rehandshake(ssl_c), -1);
287 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1),
288 WOLFSSL_ERROR_WANT_READ);
289 ExpectNotNull(CLIENT_CID());
290 ExpectIntEQ(wolfSSL_SSL_renegotiate_pending(ssl_c), 1);
291 /* Server first flight */
292 wolfSSL_SetLoggingPrefix("server");
293 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
294 /* We expect the server to reject the CID change. */
295 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), DTLS_CID_ERROR);
296 goto loop_exit;
297 }
298 /* Server init'd SCR */
299 /* Server request */
300 wolfSSL_SetLoggingPrefix("server");
301 ExpectIntEQ(wolfSSL_Rehandshake(ssl_s), -1);
302 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
303 ExpectNotNull(SERVER_CID());
304 ExpectIntEQ(wolfSSL_SSL_renegotiate_pending(ssl_s), 1);
305 if (run_params[j].drop) {
306 test_memio_clear_buffer(&test_ctx, 0);
307 test_memio_clear_buffer(&test_ctx, 1);
308 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), 1);
309 ExpectNotNull(SERVER_CID());
310 }
311 /* Init SCR on client side with the server's request */
312 /* CH no HVR on SCR */
313 XMEMSET(readBuf, 0, sizeof(readBuf));
314 wolfSSL_SetLoggingPrefix("client");
315 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
316 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
317 ExpectNotNull(CLIENT_CID());
318 ExpectIntEQ(wolfSSL_SSL_renegotiate_pending(ssl_c), 1);
319 if (run_params[j].drop) {
320 test_memio_clear_buffer(&test_ctx, 0);
321 test_memio_clear_buffer(&test_ctx, 1);
322 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
323 ExpectNotNull(CLIENT_CID());
324 }
325 /* Server first flight */
326 wolfSSL_SetLoggingPrefix("server");
327 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
328 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
329 ExpectNotNull(SERVER_CID());
330 if (run_params[j].drop) {
331 test_memio_clear_buffer(&test_ctx, 0);
332 test_memio_clear_buffer(&test_ctx, 1);
333 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), 1);
334 ExpectNotNull(SERVER_CID());
335 }
336 /* Client second flight */
337 wolfSSL_SetLoggingPrefix("client");
338 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
339 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
340 ExpectNotNull(CLIENT_CID());
341 if (run_params[j].drop) {
342 test_memio_clear_buffer(&test_ctx, 0);
343 test_memio_clear_buffer(&test_ctx, 1);
344 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
345 ExpectNotNull(CLIENT_CID());
346 }
347 ExpectIntEQ(wolfSSL_write(ssl_c, params[i],
348 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
349 /* Server second flight */
350 wolfSSL_SetLoggingPrefix("server");
351 ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
352 XMEMSET(readBuf, 0, sizeof(readBuf));
353 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)),
354 XSTRLEN(params[i]));
355 ExpectStrEQ(readBuf, params[i]);
356 if (!run_params[j].drop) {
357 ExpectIntEQ(wolfSSL_write(ssl_s, params[i],
358 (int)XSTRLEN(params[i])), XSTRLEN(params[i]));
359 }
360 /* Test loading old epoch */
361 /* Client complete connection */
362 wolfSSL_SetLoggingPrefix("client");
363 if (!run_params[j].drop) {
364 ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
365 XMEMSET(readBuf, 0, sizeof(readBuf));
366 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)),
367 XSTRLEN(params[i]));
368 ExpectStrEQ(readBuf, params[i]);
369 }
370 ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
371 ExpectNull(CLIENT_CID());
372 ExpectIntEQ(wolfSSL_SSL_renegotiate_pending(ssl_c), 0);
373 ExpectIntEQ(wolfSSL_SSL_renegotiate_pending(ssl_s), 0);
374#endif
375 /* Close connection */
376 wolfSSL_SetLoggingPrefix("client");
377 ExpectIntEQ(wolfSSL_shutdown(ssl_c), WOLFSSL_SHUTDOWN_NOT_DONE);
378 ExpectNotNull(CLIENT_CID());
379 wolfSSL_SetLoggingPrefix("server");
380 ExpectIntEQ(wolfSSL_shutdown(ssl_s), WOLFSSL_SHUTDOWN_NOT_DONE);
381 ExpectNotNull(SERVER_CID());
382 wolfSSL_SetLoggingPrefix("client");
383 ExpectIntEQ(wolfSSL_shutdown(ssl_c), 1);
384 wolfSSL_SetLoggingPrefix("server");
385 ExpectIntEQ(wolfSSL_shutdown(ssl_s), 1);
386
387#ifdef HAVE_SECURE_RENEGOTIATION
388loop_exit:
389#endif
390 wolfSSL_SetLoggingPrefix(NULL);
391 wolfSSL_free(ssl_c);
392 wolfSSL_CTX_free(ctx_c);
393 wolfSSL_free(ssl_s);
394 wolfSSL_CTX_free(ctx_s);
395
396 if (EXPECT_SUCCESS())
397 printf("ok\n");
398 else
399 printf("failed\n");
400 }
401
402 }
403
404#undef CLIENT_CID
405#undef SERVER_CID
406#undef RESET_CID
407#endif
408 return EXPECT_RESULT();
409}
410
411int test_dtls13_basic_connection_id(void)
412{
413 EXPECT_DECLS;
414#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13) \
415 && defined(WOLFSSL_DTLS_CID)
416 unsigned char client_cid[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
417 unsigned char server_cid[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
418 unsigned char readBuf[50];
419 void * cid = NULL;
420 const char* params[] = {
421#ifndef NO_SHA256
422#ifdef WOLFSSL_AES_128
423#ifdef HAVE_AESGCM
424 "TLS13-AES128-GCM-SHA256",
425#endif
426#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
427 "TLS13-CHACHA20-POLY1305-SHA256",
428#endif
429#ifdef HAVE_AESCCM
430 "TLS13-AES128-CCM-8-SHA256",
431 "TLS13-AES128-CCM-SHA256",
432#endif
433#endif
434#ifdef HAVE_NULL_CIPHER
435 "TLS13-SHA256-SHA256",
436#endif
437#endif
438 };
439 size_t i;
440
441 /* We check if the side included the CID in their output */
442#define CLIENT_CID() mymemmem(test_ctx.s_buff, test_ctx.s_len, \
443 client_cid, sizeof(client_cid))
444#define SERVER_CID() mymemmem(test_ctx.c_buff, test_ctx.c_len, \
445 server_cid, sizeof(server_cid))
446#define RESET_CID(cid) if ((cid) != NULL) { \
447 ((char*)(cid))[0] = -1; \
448 }
449
450
451 printf("\n");
452 for (i = 0; i < XELEM_CNT(params) && EXPECT_SUCCESS(); i++) {
453 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
454 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
455 struct test_memio_ctx test_ctx;
456
457 printf("Testing %s ... ", params[i]);
458
459 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
460
461 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
462 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
463
464 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i]), WOLFSSL_SUCCESS);
465 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i]), WOLFSSL_SUCCESS);
466
467 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_c), 1);
468 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, server_cid, sizeof(server_cid)),
469 1);
470 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_s), 1);
471 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_s, client_cid, sizeof(client_cid)),
472 1);
473
474 /* CH1 */
475 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
476 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
477 ExpectNull(CLIENT_CID());
478 /* HRR */
479 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
480 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
481 ExpectNull(SERVER_CID());
482 /* CH2 */
483 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
484 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
485 ExpectNull(CLIENT_CID());
486 /* Server first flight */
487 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
488 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
489 ExpectNotNull(SERVER_CID());
490 /* Client second flight */
491 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
492 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
493 ExpectNotNull(CLIENT_CID());
494 /* Server process flight */
495 ExpectIntEQ(wolfSSL_negotiate(ssl_s), 1);
496 /* Client process flight */
497 ExpectIntEQ(wolfSSL_negotiate(ssl_c), 1);
498
499 /* Write some data */
500 ExpectIntEQ(wolfSSL_write(ssl_c, params[i], (int)XSTRLEN(params[i])),
501 XSTRLEN(params[i]));
502 ExpectNotNull(CLIENT_CID());
503 ExpectIntEQ(wolfSSL_write(ssl_s, params[i], (int)XSTRLEN(params[i])),
504 XSTRLEN(params[i]));
505 ExpectNotNull(SERVER_CID());
506 /* Read the data */
507 XMEMSET(readBuf, 0, sizeof(readBuf));
508 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)),
509 XSTRLEN(params[i]));
510 ExpectStrEQ(readBuf, params[i]);
511 XMEMSET(readBuf, 0, sizeof(readBuf));
512 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)),
513 XSTRLEN(params[i]));
514 ExpectStrEQ(readBuf, params[i]);
515 /* Write short data */
516 ExpectIntEQ(wolfSSL_write(ssl_c, params[i], 1), 1);
517 ExpectNotNull(CLIENT_CID());
518 ExpectIntEQ(wolfSSL_write(ssl_s, params[i], 1), 1);
519 ExpectNotNull(SERVER_CID());
520 /* Read the short data */
521 XMEMSET(readBuf, 0, sizeof(readBuf));
522 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), 1);
523 ExpectIntEQ(readBuf[0], params[i][0]);
524 XMEMSET(readBuf, 0, sizeof(readBuf));
525 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), 1);
526 ExpectIntEQ(readBuf[0], params[i][0]);
527 /* Write some data but with wrong CID */
528 ExpectIntEQ(wolfSSL_write(ssl_c, params[i], (int)XSTRLEN(params[i])),
529 XSTRLEN(params[i]));
530 /* Reset client cid. */
531 ExpectNotNull(cid = CLIENT_CID());
532 RESET_CID(cid);
533 ExpectIntEQ(wolfSSL_write(ssl_s, params[i], (int)XSTRLEN(params[i])),
534 XSTRLEN(params[i]));
535 /* Reset server cid. */
536 ExpectNotNull(cid = SERVER_CID());
537 RESET_CID(cid);
538 /* Try to read the data but it shouldn't be there */
539 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
540 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
541 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
542 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
543
544 /* Close connection */
545 ExpectIntEQ(wolfSSL_shutdown(ssl_c), WOLFSSL_SHUTDOWN_NOT_DONE);
546 ExpectNotNull(CLIENT_CID());
547 ExpectIntEQ(wolfSSL_shutdown(ssl_s), WOLFSSL_SHUTDOWN_NOT_DONE);
548 ExpectNotNull(SERVER_CID());
549 ExpectIntEQ(wolfSSL_shutdown(ssl_c), 1);
550 ExpectIntEQ(wolfSSL_shutdown(ssl_s), 1);
551
552 if (EXPECT_SUCCESS())
553 printf("ok\n");
554 else
555 printf("failed\n");
556
557 wolfSSL_free(ssl_c);
558 wolfSSL_CTX_free(ctx_c);
559 wolfSSL_free(ssl_s);
560 wolfSSL_CTX_free(ctx_s);
561 }
562
563#undef CLIENT_CID
564#undef SERVER_CID
565#undef RESET_CID
566
567#endif
568 return EXPECT_RESULT();
569}
570
571/** Test DTLS 1.3 behavior when server hits WANT_WRITE during HRR
572 * The test sets up a DTLS 1.3 connection where the server is forced to
573 * return WANT_WRITE when sending the HelloRetryRequest. After the handshake,
574 * application data is exchanged in both directions to verify the connection
575 * works as expected.
576 */
577int test_dtls13_hrr_want_write(void)
578{
579 EXPECT_DECLS;
580#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13)
581 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
582 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
583 const char msg[] = "hello";
584 const int msgLen = sizeof(msg);
585 struct test_memio_ctx test_ctx;
586 char readBuf[sizeof(msg)];
587
588 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
589
590 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
591 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
592 0);
593
594 /* Client sends first ClientHello */
595 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
596 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
597
598 /* Force server to hit WANT_WRITE when producing the HRR */
599 test_memio_simulate_want_write(&test_ctx, 0, 1);
600 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
601 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_WRITE);
602
603 /* Allow the server to flush the HRR and proceed */
604 test_memio_simulate_want_write(&test_ctx, 0, 0);
605 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
606 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
607
608 /* Resume the DTLS 1.3 handshake */
609 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
610
611 /* Verify post-handshake application data in both directions */
612 XMEMSET(readBuf, 0, sizeof(readBuf));
613 ExpectIntEQ(wolfSSL_write(ssl_c, msg, msgLen), msgLen);
614 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), msgLen);
615 ExpectStrEQ(readBuf, msg);
616
617 XMEMSET(readBuf, 0, sizeof(readBuf));
618 ExpectIntEQ(wolfSSL_write(ssl_s, msg, msgLen), msgLen);
619 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), msgLen);
620 ExpectStrEQ(readBuf, msg);
621
622 wolfSSL_free(ssl_c);
623 wolfSSL_CTX_free(ctx_c);
624 wolfSSL_free(ssl_s);
625 wolfSSL_CTX_free(ctx_s);
626#endif
627 return EXPECT_RESULT();
628}
629
630#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13)
631struct test_dtls13_wwrite_ctx {
632 int want_write;
633 struct test_memio_ctx *text_ctx;
634};
635static int test_dtls13_want_write_send_cb(WOLFSSL *ssl, char *data, int sz, void *ctx)
636{
637 struct test_dtls13_wwrite_ctx *wwctx = (struct test_dtls13_wwrite_ctx *)ctx;
638 wwctx->want_write = !wwctx->want_write;
639 if (wwctx->want_write) {
640 return WOLFSSL_CBIO_ERR_WANT_WRITE;
641 }
642 return test_memio_write_cb(ssl, data, sz, wwctx->text_ctx);
643}
644#endif
645/** Test DTLS 1.3 behavior when every other write returns WANT_WRITE
646 * The test sets up a DTLS 1.3 connection where both client and server
647 * alternate between WANT_WRITE and successful writes. After the handshake,
648 * application data is exchanged in both directions to verify the connection
649 * works as expected.
650 *
651 * Data exchanged after the handshake is also tested with simulated WANT_WRITE
652 * conditions to ensure the connection remains functional.
653 */
654int test_dtls13_every_write_want_write(void)
655{
656 EXPECT_DECLS;
657#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13)
658 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
659 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
660 struct test_memio_ctx test_ctx;
661 const char msg[] = "want-write";
662 const int msgLen = sizeof(msg);
663 char readBuf[sizeof(msg)];
664 struct test_dtls13_wwrite_ctx wwctx_c;
665 struct test_dtls13_wwrite_ctx wwctx_s;
666
667 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
668
669 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
670 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
671 0);
672
673 wwctx_c.want_write = 0;
674 wwctx_c.text_ctx = &test_ctx;
675 wolfSSL_SetIOWriteCtx(ssl_c, &wwctx_c);
676 wolfSSL_SSLSetIOSend(ssl_c, test_dtls13_want_write_send_cb);
677 wwctx_s.want_write = 0;
678 wwctx_s.text_ctx = &test_ctx;
679 wolfSSL_SetIOWriteCtx(ssl_s, &wwctx_s);
680 wolfSSL_SSLSetIOSend(ssl_s, test_dtls13_want_write_send_cb);
681
682 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 20, NULL), 0);
683
684 ExpectTrue(wolfSSL_is_init_finished(ssl_c));
685 ExpectTrue(wolfSSL_is_init_finished(ssl_s));
686
687 test_memio_simulate_want_write(&test_ctx, 0, 0);
688 test_memio_simulate_want_write(&test_ctx, 1, 0);
689
690 wolfSSL_SetIOWriteCtx(ssl_c, &test_ctx);
691 wolfSSL_SSLSetIOSend(ssl_c, test_memio_write_cb);
692 wolfSSL_SetIOWriteCtx(ssl_s, &test_ctx);
693 wolfSSL_SSLSetIOSend(ssl_s, test_memio_write_cb);
694
695 XMEMSET(readBuf, 0, sizeof(readBuf));
696 ExpectIntEQ(wolfSSL_write(ssl_c, msg, msgLen), msgLen);
697 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), msgLen);
698 ExpectStrEQ(readBuf, msg);
699
700 XMEMSET(readBuf, 0, sizeof(readBuf));
701 ExpectIntEQ(wolfSSL_write(ssl_s, msg, msgLen), msgLen);
702 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), msgLen);
703 ExpectStrEQ(readBuf, msg);
704
705 test_memio_simulate_want_write(&test_ctx, 0, 1);
706 XMEMSET(readBuf, 0, sizeof(readBuf));
707 ExpectIntEQ(wolfSSL_write(ssl_s, msg, msgLen), -1);
708 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_WRITE);
709 test_memio_simulate_want_write(&test_ctx, 0, 0);
710 ExpectIntEQ(wolfSSL_write(ssl_s, msg, msgLen), msgLen);
711 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), msgLen);
712 ExpectStrEQ(readBuf, msg);
713
714 XMEMSET(readBuf, 0, sizeof(readBuf));
715 test_memio_simulate_want_write(&test_ctx, 1, 1);
716 ExpectIntEQ(wolfSSL_write(ssl_c, msg, msgLen), -1);
717 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_WRITE);
718 test_memio_simulate_want_write(&test_ctx, 1, 0);
719 ExpectIntEQ(wolfSSL_write(ssl_c, msg, msgLen), msgLen);
720 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), msgLen);
721 ExpectStrEQ(readBuf, msg);
722
723 wolfSSL_free(ssl_c);
724 wolfSSL_CTX_free(ctx_c);
725 wolfSSL_free(ssl_s);
726 wolfSSL_CTX_free(ctx_s);
727#endif
728 return EXPECT_RESULT();
729}
730
731int test_wolfSSL_dtls_cid_parse(void)
732{
733 EXPECT_DECLS;
734#if defined(WOLFSSL_DTLS) && defined(WOLFSSL_DTLS_CID)
735 /* Taken from Wireshark. Right-click -> copy -> ... as escaped string */
736 /* Plaintext ServerHelloDone. No CID. */
737 byte noCid[] =
738 "\x16\xfe\xfd\x00\x00\x00\x00\x00\x00\x00\x04\x00\x0c\x0e\x00\x00" \
739 "\x00\x00\x04\x00\x00\x00\x00\x00\x00";
740 /* 1.2 app data containing CID */
741 byte cid12[] =
742 "\x19\xfe\xfd\x00\x01\x00\x00\x00\x00\x00\x01\x77\xa3\x79\x34\xb3" \
743 "\xf1\x1f\x34\x00\x1f\xdb\x8c\x28\x25\x9f\xe1\x02\x26\x77\x1c\x3a" \
744 "\x50\x1b\x50\x99\xd0\xb5\x20\xd8\x2c\x2e\xaa\x36\x36\xe0\xb7\xb7" \
745 "\xf7\x7d\xff\xb0";
746#ifdef WOLFSSL_DTLS13
747 /* 1.3 app data containing CID */
748 byte cid13[] =
749 "\x3f\x70\x64\x04\xc6\xfb\x97\x21\xd9\x28\x27\x00\x17\xc1\x01\x86" \
750 "\xe7\x23\x2c\xad\x65\x83\xa8\xf4\xbf\xbf\x7b\x25\x16\x80\x19\xc3" \
751 "\x81\xda\xf5\x3f";
752#endif
753
754 ExpectPtrEq(wolfSSL_dtls_cid_parse(noCid, sizeof(noCid), 8), NULL);
755 ExpectPtrEq(wolfSSL_dtls_cid_parse(cid12, sizeof(cid12), 8), cid12 + 11);
756#ifdef WOLFSSL_DTLS13
757 ExpectPtrEq(wolfSSL_dtls_cid_parse(cid13, sizeof(cid13), 8), cid13 + 1);
758#endif
759#endif
760 return EXPECT_RESULT();
761}
762
763int test_wolfSSL_dtls_set_pending_peer(void)
764{
765 EXPECT_DECLS;
766#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
767 defined(WOLFSSL_DTLS) && defined(WOLFSSL_DTLS_CID)
768 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
769 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
770 struct test_memio_ctx test_ctx;
771 unsigned char peer[10];
772 unsigned int peerSz;
773 unsigned char readBuf[10];
774 unsigned char client_cid[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
775 unsigned char server_cid[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
776
777 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
778
779 /* Setup DTLS contexts */
780 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
781 wolfDTLS_client_method, wolfDTLS_server_method), 0);
782
783 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_c), 1);
784 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, server_cid,
785 sizeof(server_cid)), 1);
786 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_s), 1);
787 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_s, client_cid,
788 sizeof(client_cid)), 1);
789
790 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
791
792 peerSz = sizeof(peer);
793 /* Fail since no peer set */
794 ExpectIntEQ(wolfSSL_dtls_get_peer(ssl_s, peer, &peerSz), 0);
795 ExpectIntEQ(wolfSSL_dtls_set_pending_peer(ssl_s, (void*)"123", 4), 1);
796 ExpectIntEQ(wolfSSL_write(ssl_c, "test", 5), 5);
797 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), 5);
798 ExpectStrEQ(readBuf, "test");
799 peerSz = sizeof(peer);
800 ExpectIntEQ(wolfSSL_dtls_get_peer(ssl_s, peer, &peerSz), 1);
801 ExpectIntEQ(peerSz, 4);
802 ExpectStrEQ(peer, "123");
803
804 wolfSSL_free(ssl_s);
805 wolfSSL_free(ssl_c);
806 wolfSSL_CTX_free(ctx_s);
807 wolfSSL_CTX_free(ctx_c);
808#endif
809 return EXPECT_RESULT();
810}
811
812int test_dtls13_epochs(void) {
813 EXPECT_DECLS;
814#if defined(WOLFSSL_DTLS13) && !defined(NO_WOLFSSL_CLIENT)
815 WOLFSSL_CTX* ctx = NULL;
816 WOLFSSL* ssl = NULL;
817 byte input[20];
818 word32 inOutIdx = 0;
819
820 XMEMSET(input, 0, sizeof(input));
821
822 ExpectNotNull(ctx = wolfSSL_CTX_new(wolfDTLSv1_3_client_method()));
823 ExpectNotNull(ssl = wolfSSL_new(ctx));
824 /* Some manual setup to enter the epoch check */
825 ExpectTrue(ssl->options.tls1_3 = 1);
826
827 inOutIdx = 0;
828 if (ssl != NULL) ssl->keys.curEpoch64 = w64From32(0x0, 0x0);
829 ExpectIntEQ(DoApplicationData(ssl, input, &inOutIdx, 0), SANITY_MSG_E);
830 inOutIdx = 0;
831 if (ssl != NULL) ssl->keys.curEpoch64 = w64From32(0x0, 0x2);
832 ExpectIntEQ(DoApplicationData(ssl, input, &inOutIdx, 0), SANITY_MSG_E);
833
834 if (ssl != NULL) ssl->keys.curEpoch64 = w64From32(0x0, 0x1);
835 ExpectIntEQ(Dtls13CheckEpoch(ssl, client_hello), SANITY_MSG_E);
836 ExpectIntEQ(Dtls13CheckEpoch(ssl, server_hello), SANITY_MSG_E);
837 ExpectIntEQ(Dtls13CheckEpoch(ssl, hello_verify_request), SANITY_MSG_E);
838 ExpectIntEQ(Dtls13CheckEpoch(ssl, hello_retry_request), SANITY_MSG_E);
839 ExpectIntEQ(Dtls13CheckEpoch(ssl, hello_request), SANITY_MSG_E);
840 ExpectIntEQ(Dtls13CheckEpoch(ssl, encrypted_extensions), SANITY_MSG_E);
841 ExpectIntEQ(Dtls13CheckEpoch(ssl, server_key_exchange), SANITY_MSG_E);
842 ExpectIntEQ(Dtls13CheckEpoch(ssl, server_hello_done), SANITY_MSG_E);
843 ExpectIntEQ(Dtls13CheckEpoch(ssl, client_key_exchange), SANITY_MSG_E);
844 ExpectIntEQ(Dtls13CheckEpoch(ssl, certificate_request), SANITY_MSG_E);
845 ExpectIntEQ(Dtls13CheckEpoch(ssl, certificate), SANITY_MSG_E);
846 ExpectIntEQ(Dtls13CheckEpoch(ssl, certificate_verify), SANITY_MSG_E);
847 ExpectIntEQ(Dtls13CheckEpoch(ssl, finished), SANITY_MSG_E);
848 ExpectIntEQ(Dtls13CheckEpoch(ssl, certificate_status), SANITY_MSG_E);
849 ExpectIntEQ(Dtls13CheckEpoch(ssl, change_cipher_hs), SANITY_MSG_E);
850 ExpectIntEQ(Dtls13CheckEpoch(ssl, key_update), SANITY_MSG_E);
851 ExpectIntEQ(Dtls13CheckEpoch(ssl, session_ticket), SANITY_MSG_E);
852 ExpectIntEQ(Dtls13CheckEpoch(ssl, end_of_early_data), SANITY_MSG_E);
853 ExpectIntEQ(Dtls13CheckEpoch(ssl, message_hash), SANITY_MSG_E);
854 ExpectIntEQ(Dtls13CheckEpoch(ssl, no_shake), SANITY_MSG_E);
855
856 wolfSSL_CTX_free(ctx);
857 wolfSSL_free(ssl);
858#endif
859 return EXPECT_RESULT();
860}
861
862int test_dtls13_ack_order(void)
863{
864 EXPECT_DECLS;
865#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13)
866 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
867 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
868 struct test_memio_ctx test_ctx;
869 unsigned char readBuf[50];
870 word32 length = 0;
871 /* struct {
872 * uint64 epoch;
873 * uint64 sequence_number;
874 * } RecordNumber;
875 * Big endian */
876 static const unsigned char expected_output[] = {
877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
878 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
880 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
881 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
882 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
883 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
884 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
886 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
887 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
888 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
889 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
890 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
891 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
892 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
893 };
894
895 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
896
897 /* Get a populated DTLS object */
898 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
899 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
900 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
901 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
902 /* Clear the buffer of any extra messages */
903 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
904 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
905 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
906 ExpectIntEQ(test_ctx.c_len, 0);
907 ExpectIntEQ(test_ctx.s_len, 0);
908
909 /* Add seen records */
910 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 2)), 0);
911 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 0)), 0);
912 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 1)), 0);
913 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 4)), 0);
914 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 2), w64From32(0, 0)), 0);
915 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 6)), 0);
916 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3), w64From32(0, 6)), 0);
917 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 2), w64From32(0, 1)), 0);
918 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 2), w64From32(0, 2)), 0);
919 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 2), w64From32(0, 2)), 0);
920 ExpectIntEQ(Dtls13WriteAckMessage(ssl_c, ssl_c->dtls13Rtx.seenRecords,
921 ssl_c->dtls13Rtx.seenRecordsCount, &length), 0);
922
923 /* must zero the span reserved for the header to avoid read of uninited
924 * data.
925 */
926 XMEMSET(ssl_c->buffers.outputBuffer.buffer, 0,
927 5 /* DTLS13_UNIFIED_HEADER_SIZE */);
928 /* N * RecordNumber + 2 extra bytes for length */
929 ExpectIntEQ(length, sizeof(expected_output) + 2);
930 ExpectNotNull(mymemmem(ssl_c->buffers.outputBuffer.buffer,
931 ssl_c->buffers.outputBuffer.bufferSize, expected_output,
932 sizeof(expected_output)));
933
934 wolfSSL_free(ssl_c);
935 wolfSSL_CTX_free(ctx_c);
936 wolfSSL_free(ssl_s);
937 wolfSSL_CTX_free(ctx_s);
938#endif
939 return EXPECT_RESULT();
940}
941
942int test_dtls13_ack_overflow(void)
943{
944 EXPECT_DECLS;
945#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13)
946 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
947 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
948 struct test_memio_ctx test_ctx;
949 unsigned char readBuf[50];
950 word32 length = 0;
951 int i;
952
953 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
954
955 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
956 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
957 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
958 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
959 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
960 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
961 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
962
963 /* Edge case 1: one below limit - all inserts must succeed */
964 for (i = 0; i < DTLS13_ACK_MAX_RECORDS - 1; i++) {
965 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 0),
966 w64From32(0, (word32)i)), 0);
967 }
968 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, DTLS13_ACK_MAX_RECORDS - 1);
969
970 /* Edge case 2: insert the last allowed record - must succeed */
971 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 0),
972 w64From32(0, (word32)(DTLS13_ACK_MAX_RECORDS - 1))), 0);
973 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, DTLS13_ACK_MAX_RECORDS);
974
975 /* Writing a full-but-valid list must succeed */
976 ExpectIntEQ(Dtls13WriteAckMessage(ssl_c, ssl_c->dtls13Rtx.seenRecords,
977 ssl_c->dtls13Rtx.seenRecordsCount, &length), 0);
978
979 /* Edge case 3: one over limit - must be silently dropped */
980 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 0),
981 w64From32(0, (word32)DTLS13_ACK_MAX_RECORDS)), 0);
982 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, DTLS13_ACK_MAX_RECORDS);
983
984 /* Bypass the insert guard to force the list one element over the limit,
985 * then verify Dtls13WriteAckMessage errors out instead of overflowing */
986 ssl_c->dtls13Rtx.seenRecordsCount = 0;
987 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 1),
988 w64From32(0, (word32)DTLS13_ACK_MAX_RECORDS)), 0);
989 ssl_c->dtls13Rtx.seenRecordsCount = (word16)(DTLS13_ACK_MAX_RECORDS + 1);
990 ExpectIntEQ(Dtls13WriteAckMessage(ssl_c, ssl_c->dtls13Rtx.seenRecords,
991 ssl_c->dtls13Rtx.seenRecordsCount, &length), BUFFER_E);
992
993 wolfSSL_free(ssl_c);
994 wolfSSL_CTX_free(ctx_c);
995 wolfSSL_free(ssl_s);
996 wolfSSL_CTX_free(ctx_s);
997#endif
998 return EXPECT_RESULT();
999}
1000
1001int test_dtls13_ack_dup_write_counter(void)
1002{
1003 EXPECT_DECLS;
1004#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13) \
1005 && defined(HAVE_WRITE_DUP)
1006 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1007 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1008 WOLFSSL *ssl_c2 = NULL;
1009 struct test_memio_ctx test_ctx;
1010 unsigned char readBuf[50];
1011 int i;
1012
1013 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1014
1015 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1016 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
1017 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1018 /* Drain any post-handshake messages */
1019 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
1020 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
1021 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1022 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1023
1024 /* Split ssl_c: ssl_c becomes READ_DUP_SIDE, ssl_c2 becomes WRITE_DUP_SIDE */
1025 ExpectNotNull(ssl_c2 = wolfSSL_write_dup(ssl_c));
1026
1027 /* Cycle 1: add records, trigger handoff, verify counter is reset to 0 */
1028 for (i = 0; i < 5; i++)
1029 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 3),
1030 w64From32(0, (word32)i)), 0);
1031 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, 5);
1032 ssl_c->dtls13Rtx.sendAcks = 1;
1033 ExpectIntEQ(Dtls13DoScheduledWork(ssl_c), 0);
1034 /* seenRecords ownership was transferred to dupWrite->sendAckList;
1035 * seenRecordsCount must be reset to 0, not left at 5. */
1036 ExpectNull(ssl_c->dtls13Rtx.seenRecords);
1037 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, 0);
1038
1039 /* Cycle 2 (different epoch to avoid the dup-filter): verify the counter
1040 * did not accumulate across the previous transfer. Without the fix,
1041 * seenRecordsCount would now be 10 after this second batch. */
1042 for (i = 0; i < 5; i++)
1043 ExpectIntEQ(Dtls13RtxAddAck(ssl_c, w64From32(0, 4),
1044 w64From32(0, (word32)i)), 0);
1045 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, 5);
1046 ssl_c->dtls13Rtx.sendAcks = 1;
1047 ExpectIntEQ(Dtls13DoScheduledWork(ssl_c), 0);
1048 ExpectNull(ssl_c->dtls13Rtx.seenRecords);
1049 ExpectIntEQ(ssl_c->dtls13Rtx.seenRecordsCount, 0);
1050
1051 wolfSSL_free(ssl_c);
1052 wolfSSL_free(ssl_c2);
1053 wolfSSL_CTX_free(ctx_c);
1054 wolfSSL_free(ssl_s);
1055 wolfSSL_CTX_free(ctx_s);
1056#endif
1057 return EXPECT_RESULT();
1058}
1059
1060int test_dtls_version_checking(void)
1061{
1062 EXPECT_DECLS;
1063#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
1064 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1065 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1066 struct test_memio_ctx test_ctx;
1067
1068 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1069
1070 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1071 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
1072 0);
1073
1074 /* CH */
1075 ExpectIntEQ(wolfSSL_connect(ssl_c), WOLFSSL_FATAL_ERROR);
1076 ExpectIntEQ(wolfSSL_get_error(ssl_c, WOLFSSL_FATAL_ERROR),
1077 WOLFSSL_ERROR_WANT_READ);
1078
1079 /* modify CH DTLS header to have version 1.1 (0xfe, 0xfe) */
1080 ExpectIntGE(test_ctx.s_len, 3);
1081 if (EXPECT_SUCCESS()) {
1082 test_ctx.s_buff[1] = 0xfe;
1083 test_ctx.s_buff[2] = 0xfe;
1084 }
1085
1086 ExpectIntEQ(wolfSSL_accept(ssl_s), WOLFSSL_FATAL_ERROR);
1087 ExpectIntEQ(wolfSSL_get_error(ssl_s, WOLFSSL_FATAL_ERROR),
1088 WOLFSSL_ERROR_WANT_READ);
1089 /* server should drop the message */
1090 ExpectIntEQ(test_ctx.c_len, 0);
1091
1092 wolfSSL_free(ssl_c);
1093 ssl_c = wolfSSL_new(ctx_c);
1094 ExpectNotNull(ssl_c);
1095 wolfSSL_SetIOWriteCtx(ssl_c, &test_ctx);
1096 wolfSSL_SetIOReadCtx(ssl_c, &test_ctx);
1097
1098 /* try again */
1099 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1100
1101 wolfSSL_free(ssl_c);
1102 wolfSSL_CTX_free(ctx_c);
1103 wolfSSL_free(ssl_s);
1104 wolfSSL_CTX_free(ctx_s);
1105#endif /* HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES && WOLFSSL_DTLS */
1106 return EXPECT_RESULT();
1107}
1108
1109#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
1110static int test_dtls_shutdown(WOLFSSL *s, WOLFSSL *c, WOLFSSL_CTX *cc, WOLFSSL_CTX *cs)
1111{
1112 EXPECT_DECLS;
1113 /* Cleanup */
1114 wolfSSL_SetLoggingPrefix("client");
1115 ExpectIntEQ(wolfSSL_shutdown(c), WOLFSSL_SHUTDOWN_NOT_DONE);
1116 wolfSSL_SetLoggingPrefix("server");
1117 ExpectIntEQ(wolfSSL_shutdown(s), WOLFSSL_SHUTDOWN_NOT_DONE);
1118 wolfSSL_SetLoggingPrefix("client");
1119 ExpectIntEQ(wolfSSL_shutdown(c), 1);
1120 wolfSSL_SetLoggingPrefix("server");
1121 ExpectIntEQ(wolfSSL_shutdown(s), 1);
1122
1123 wolfSSL_SetLoggingPrefix(NULL);
1124 wolfSSL_free(c);
1125 wolfSSL_CTX_free(cc);
1126 wolfSSL_free(s);
1127 wolfSSL_CTX_free(cs);
1128 return EXPECT_RESULT();
1129}
1130
1131static int test_dtls_communication(WOLFSSL *s, WOLFSSL *c)
1132{
1133 EXPECT_DECLS;
1134 unsigned char readBuf[50];
1135
1136 wolfSSL_SetLoggingPrefix("client");
1137 ExpectIntEQ(wolfSSL_write(c, "client message", 14), 14);
1138
1139 wolfSSL_SetLoggingPrefix("server");
1140 XMEMSET(readBuf, 0, sizeof(readBuf));
1141 ExpectIntEQ(wolfSSL_read(s, readBuf, sizeof(readBuf)), 14);
1142 ExpectStrEQ(readBuf, "client message");
1143
1144 wolfSSL_SetLoggingPrefix("server");
1145 ExpectIntEQ(wolfSSL_write(s, "server message", 14), 14);
1146
1147 wolfSSL_SetLoggingPrefix("client");
1148 XMEMSET(readBuf, 0, sizeof(readBuf));
1149 ExpectIntEQ(wolfSSL_read(c, readBuf, sizeof(readBuf)), 14);
1150 ExpectStrEQ(readBuf, "server message");
1151
1152 /* this extra round is consuming newSessionTicket and acks */
1153 wolfSSL_SetLoggingPrefix("client");
1154 ExpectIntEQ(wolfSSL_write(c, "client message 2", 16), 16);
1155
1156 wolfSSL_SetLoggingPrefix("server");
1157 XMEMSET(readBuf, 0, sizeof(readBuf));
1158 ExpectIntEQ(wolfSSL_read(s, readBuf, sizeof(readBuf)), 16);
1159 ExpectStrEQ(readBuf, "client message 2");
1160
1161 wolfSSL_SetLoggingPrefix("server");
1162 ExpectIntEQ(wolfSSL_write(s, "server message 2", 16), 16);
1163
1164 wolfSSL_SetLoggingPrefix("client");
1165 XMEMSET(readBuf, 0, sizeof(readBuf));
1166 ExpectIntEQ(wolfSSL_read(c, readBuf, sizeof(readBuf)), 16);
1167 ExpectStrEQ(readBuf, "server message 2");
1168
1169 return EXPECT_RESULT();
1170}
1171
1172#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS)
1173int test_dtls13_longer_length(void)
1174{
1175 EXPECT_DECLS;
1176 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1177 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1178 struct test_memio_ctx test_ctx;
1179 unsigned char readBuf[50];
1180 int seq16bit = 0;
1181 int ret;
1182
1183 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1184
1185 /* Setup DTLS contexts */
1186 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1187 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
1188 0);
1189
1190 /* Complete handshake */
1191 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1192
1193 /* Create good record with length mismatch */
1194 wolfSSL_SetLoggingPrefix("client");
1195 ExpectIntEQ(wolfSSL_write(ssl_c, "client message", 14), 14);
1196
1197 /* check client wrote the record */
1198 ExpectIntGT(test_ctx.s_len, 14);
1199 /* check length is included in the record header */
1200 ExpectIntGT(test_ctx.s_buff[0x0] & (1 << 2), 0);
1201 seq16bit = (test_ctx.s_buff[0x0] & (1 << 3)) != 0;
1202 /* big endian, modify LSB byte */
1203 seq16bit *= 2;
1204 /* modify length to be bigger */
1205 test_ctx.s_buff[0x2 + seq16bit] = 0xff;
1206
1207 /* Try to read the malformed record */
1208 wolfSSL_SetLoggingPrefix("server");
1209 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1210 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1211 ExpectIntEQ(test_ctx.s_len, 0);
1212
1213 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1214 ret = test_dtls_shutdown(ssl_s, ssl_c, ctx_c, ctx_s);
1215 ExpectIntEQ(ret, TEST_SUCCESS);
1216
1217 return EXPECT_RESULT();
1218}
1219#else
1220int test_dtls13_longer_length(void)
1221{
1222 return TEST_SKIPPED;
1223}
1224#endif /* WOLFSSL_DTLS13 && !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS) */
1225
1226#if defined(WOLFSSL_DTLS13) && !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS)
1227int test_dtls13_short_read(void)
1228{
1229 EXPECT_DECLS;
1230 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1231 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1232 struct test_memio_ctx test_ctx;
1233 unsigned char readBuf[50];
1234 int i;
1235 int ret;
1236
1237 /* we setup two test, in the first one the server reads just two bytes of
1238 * the header, in the second one it reads just the header (5) */
1239 for (i = 0; i < 2; i++) {
1240 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1241
1242 /* Setup DTLS contexts */
1243 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1244 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
1245 0);
1246
1247 /* Complete handshake */
1248 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1249
1250 /* create a good record in the buffer */
1251 wolfSSL_SetLoggingPrefix("client");
1252 ExpectIntEQ(wolfSSL_write(ssl_c, "client message", 14), 14);
1253
1254 /* check client wrote the record */
1255 ExpectIntGT(test_ctx.s_len, 14);
1256 /* return less data */
1257 ExpectIntEQ(
1258 test_memio_modify_message_len(&test_ctx, 0, 0, i == 0 ? 2 : 5), 0);
1259 /* Try to read the malformed record */
1260 wolfSSL_SetLoggingPrefix("server");
1261 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1262 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1263 ExpectIntEQ(test_ctx.s_len, 0);
1264
1265 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1266 ret = test_dtls_shutdown(ssl_s, ssl_c, ctx_c, ctx_s);
1267 ExpectIntEQ(ret, TEST_SUCCESS);
1268 ssl_c = ssl_s = NULL;
1269 ctx_c = ctx_s = NULL;
1270 }
1271
1272 return EXPECT_RESULT();
1273}
1274#else
1275int test_dtls13_short_read(void)
1276{
1277 return TEST_SKIPPED;
1278}
1279#endif /* WOLFSSL_DTLS13 && !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS) */
1280
1281#if !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS)
1282int test_dtls12_short_read(void)
1283{
1284 EXPECT_DECLS;
1285 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1286 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1287 struct test_memio_ctx test_ctx;
1288 unsigned char readBuf[50];
1289 int i;
1290 int ret;
1291
1292 for (i = 0; i < 3; i++) {
1293 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1294
1295 /* Setup DTLS contexts */
1296 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1297 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
1298 0);
1299 /* Complete handshake */
1300 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1301
1302 /* create a good record in the buffer */
1303 wolfSSL_SetLoggingPrefix("client");
1304 ExpectIntEQ(wolfSSL_write(ssl_c, "bad", 3), 3);
1305
1306 /* check client wrote the record */
1307 ExpectIntGT(test_ctx.s_len, 13 + 3);
1308 /* return less data */
1309 switch (i) {
1310 case 0:
1311 ExpectIntEQ(test_memio_modify_message_len(&test_ctx, 0, 0, 2), 0);
1312 break;
1313 case 1:
1314 ExpectIntEQ(test_memio_modify_message_len(&test_ctx, 0, 0, 13), 0);
1315 break;
1316 case 2:
1317 ExpectIntEQ(test_memio_modify_message_len(&test_ctx, 0, 0, 15), 0);
1318 break;
1319 }
1320
1321 /* Try to read the malformed record */
1322 wolfSSL_SetLoggingPrefix("server");
1323 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1324 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1325 ExpectIntEQ(test_ctx.s_len, 0);
1326
1327 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1328 ret = test_dtls_shutdown(ssl_s, ssl_c, ctx_c, ctx_s);
1329 ExpectIntEQ(ret, TEST_SUCCESS);
1330 ssl_c = ssl_s = NULL;
1331 ctx_c = ctx_s = NULL;
1332 }
1333
1334 return EXPECT_RESULT();
1335}
1336#else
1337int test_dtls12_short_read(void)
1338{
1339 return TEST_SKIPPED;
1340}
1341#endif /* !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS) */
1342
1343#if !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS)
1344int test_dtls12_record_length_mismatch(void)
1345{
1346 EXPECT_DECLS;
1347 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1348 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1349 struct test_memio_ctx test_ctx;
1350 unsigned char readBuf[50];
1351 int ret;
1352
1353 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1354
1355 /* Setup DTLS contexts */
1356 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1357 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
1358 0);
1359
1360 /* Complete handshake */
1361 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1362
1363 /* write a message from client */
1364 ExpectIntEQ(wolfSSL_write(ssl_c, "bad", 3), 3);
1365
1366 /* check that the message is written in the buffer */
1367 ExpectIntGT(test_ctx.s_len, 14);
1368 /* modify the length field to be bigger than the content */
1369 test_ctx.s_buff[12] = 0xff;
1370
1371 /* Try to read the malformed record */
1372 wolfSSL_SetLoggingPrefix("server");
1373 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1374 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1375 ExpectIntEQ(test_ctx.s_len, 0);
1376
1377 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1378 ret = test_dtls_shutdown(ssl_s, ssl_c, ctx_c, ctx_s);
1379 ExpectIntEQ(ret, TEST_SUCCESS);
1380
1381 return EXPECT_RESULT();
1382}
1383
1384int test_dtls_record_cross_boundaries(void)
1385{
1386 EXPECT_DECLS;
1387 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1388 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1389 struct test_memio_ctx test_ctx;
1390 unsigned char readBuf[256];
1391 int rec0_len, rec1_len;
1392
1393 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1394
1395 /* Setup DTLS contexts */
1396 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1397 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
1398 0);
1399
1400 /* Complete handshake */
1401 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1402
1403 /* create a first record in the buffer */
1404 wolfSSL_SetLoggingPrefix("client");
1405 ExpectIntEQ(wolfSSL_write(ssl_c, "test0", 5), 5);
1406 rec0_len = test_ctx.s_msg_sizes[0];
1407
1408 /* create a second record in the buffer */
1409 ExpectIntEQ(wolfSSL_write(ssl_c, "test1", 5), 5);
1410 rec1_len = test_ctx.s_msg_sizes[1];
1411
1412 ExpectIntLE(rec0_len + rec1_len, sizeof(readBuf));
1413 if (EXPECT_SUCCESS())
1414 XMEMCPY(readBuf, test_ctx.s_buff, rec0_len + rec1_len);
1415
1416 /* clear buffer */
1417 test_memio_clear_buffer(&test_ctx, 0);
1418
1419 /* inject first record + 1 bytes of second record */
1420 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, (const char*)readBuf,
1421 rec0_len + 1),
1422 0);
1423
1424 /* inject second record */
1425 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0,
1426 (const char*)readBuf + rec0_len + 1, rec1_len - 1),
1427 0);
1428 ExpectIntEQ(test_ctx.s_len, rec0_len + rec1_len);
1429
1430 /* reading the record should return just the first message*/
1431 wolfSSL_SetLoggingPrefix("server");
1432 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), 5);
1433 ExpectBufEQ(readBuf, "test0", 5);
1434
1435 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)),
1436 WOLFSSL_FATAL_ERROR);
1437 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1438
1439 /* cleanup */
1440 wolfSSL_free(ssl_s);
1441 wolfSSL_free(ssl_c);
1442 wolfSSL_CTX_free(ctx_s);
1443 wolfSSL_CTX_free(ctx_c);
1444
1445 return EXPECT_RESULT();
1446}
1447#else
1448int test_dtls12_record_length_mismatch(void)
1449{
1450 return TEST_SKIPPED;
1451}
1452int test_dtls_record_cross_boundaries(void)
1453{
1454 return TEST_SKIPPED;
1455}
1456#endif /* !defined(WOLFSSL_DTLS_RECORDS_CAN_SPAN_DATAGRAMS) */
1457
1458int test_dtls_short_ciphertext(void)
1459{
1460 EXPECT_DECLS;
1461 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1462 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1463 struct test_memio_ctx test_ctx;
1464 unsigned char readBuf[50];
1465 int ret;
1466
1467 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1468
1469 /* Setup DTLS contexts */
1470 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1471 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method),
1472 0);
1473
1474 /* Complete handshake */
1475 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1476
1477 /* Create a message, that looks encrypted but shorter than minimum ciphertext length */
1478 /* create the data in the buffer */
1479 ExpectIntEQ(wolfSSL_write(ssl_c, "bad", 3), 3);
1480
1481 /* check client wrote the record */
1482 ExpectIntGT(test_ctx.s_len, 14);
1483
1484 /* modify the length field to be smaller than the content */
1485 test_ctx.s_buff[11] = 0x00;
1486 test_ctx.s_buff[12] = 0x02;
1487 /* modify the amount of data to send */
1488 ExpectIntEQ(test_memio_modify_message_len(&test_ctx, 0, 0, 15), 0);
1489
1490 /* Try to read the malformed record */
1491 wolfSSL_SetLoggingPrefix("server");
1492 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), -1);
1493 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1494 ExpectIntEQ(test_ctx.s_len, 0);
1495
1496 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1497
1498 ret = test_dtls_shutdown(ssl_s, ssl_c, ctx_c, ctx_s);
1499 ExpectIntEQ(ret, TEST_SUCCESS);
1500
1501 return EXPECT_RESULT();
1502}
1503#else
1504int test_dtls_short_ciphertext(void)
1505{
1506 return TEST_SKIPPED;
1507}
1508int test_dtls12_record_length_mismatch(void)
1509{
1510 return TEST_SKIPPED;
1511}
1512int test_dtls12_short_read(void)
1513{
1514 return TEST_SKIPPED;
1515}
1516int test_dtls13_short_read(void)
1517{
1518 return TEST_SKIPPED;
1519}
1520int test_dtls13_longer_length(void)
1521{
1522 return TEST_SKIPPED;
1523}
1524int test_dtls_record_cross_boundaries(void)
1525{
1526 return TEST_SKIPPED;
1527}
1528#endif /* defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS) */
1529
1530#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1531 !defined(WOLFSSL_NO_TLS12) && !defined(NO_SHA256)
1532/* This test that the DTLS record boundary check doesn't interfere with TLS
1533 * records processing */
1534int test_records_span_network_boundaries(void)
1535{
1536 EXPECT_DECLS;
1537 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1538 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1539 struct test_memio_ctx test_ctx;
1540 unsigned char readBuf[256];
1541 int record_len;
1542
1543 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1544
1545 /* Setup DTLS contexts */
1546 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1547 wolfTLSv1_2_client_method, wolfTLSv1_2_server_method),
1548 0);
1549
1550 /* Complete handshake */
1551 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1552
1553 /* create a good record in the buffer */
1554 wolfSSL_SetLoggingPrefix("client");
1555 ExpectIntEQ(wolfSSL_write(ssl_c, "test", 4), 4);
1556 ExpectIntLE(test_ctx.s_len, sizeof(readBuf));
1557 ExpectIntGT(test_ctx.s_len, 10);
1558 record_len = test_ctx.s_len;
1559 if (EXPECT_SUCCESS())
1560 XMEMCPY(readBuf, test_ctx.s_buff, record_len);
1561
1562 /* drop record and simulate a split write */
1563 ExpectIntEQ(test_memio_drop_message(&test_ctx, 0, 0), 0);
1564 ExpectIntEQ(test_ctx.s_msg_count, 0);
1565
1566 /* inject first record header */
1567 ExpectIntEQ(
1568 test_memio_inject_message(&test_ctx, 0, (const char*)readBuf, 5), 0);
1569 ExpectIntEQ(test_ctx.s_msg_count, 1);
1570 ExpectIntEQ(test_ctx.s_msg_sizes[0], 5);
1571
1572 /* inject another 5 bytes of the record */
1573 ExpectIntEQ(
1574 test_memio_inject_message(&test_ctx, 0, (const char*)readBuf + 5, 5),
1575 0);
1576 ExpectIntEQ(test_ctx.s_msg_count, 2);
1577 ExpectIntEQ(test_ctx.s_msg_sizes[1], 5);
1578
1579 /* inject the rest of the record */
1580 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0,
1581 (const char*)readBuf + 10, record_len - 10),
1582 0);
1583 ExpectIntEQ(test_ctx.s_msg_count, 3);
1584 ExpectIntEQ(test_ctx.s_msg_sizes[2], record_len - 10);
1585
1586 /* read the record */
1587 wolfSSL_SetLoggingPrefix("server");
1588 ExpectIntEQ(wolfSSL_read(ssl_s, readBuf, sizeof(readBuf)), 4);
1589 ExpectIntEQ(test_ctx.s_len, 0);
1590
1591 ExpectBufEQ(readBuf, "test", 4);
1592
1593 wolfSSL_free(ssl_s);
1594 wolfSSL_free(ssl_c);
1595 wolfSSL_CTX_free(ctx_s);
1596 wolfSSL_CTX_free(ctx_c);
1597
1598 return EXPECT_RESULT();
1599}
1600#else
1601int test_records_span_network_boundaries(void)
1602{
1603 return TEST_SKIPPED;
1604}
1605#endif /* defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1606 !defined(WOLFSSL_NO_TLS12) */
1607
1608int test_dtls_mtu_fragment_headroom(void)
1609{
1610#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1611 defined(WOLFSSL_DTLS_MTU) && defined(HAVE_AESGCM) && defined(HAVE_ECC) && \
1612 !defined(WOLFSSL_NO_DTLS_SIZE_CHECK)
1613 EXPECT_DECLS;
1614 struct {
1615 method_provider client_meth;
1616 method_provider server_meth;
1617 const char* cipher;
1618 int use_cid;
1619 } params[] = {
1620#if defined(WOLFSSL_DTLS13) && defined(WOLFSSL_TLS13)
1621 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method,
1622 "TLS13-AES128-GCM-SHA256", 0 },
1623#ifdef WOLFSSL_DTLS_CID
1624 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method,
1625 "TLS13-AES128-GCM-SHA256", 1 },
1626#endif
1627#endif
1628#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_NO_TLS12)
1629 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
1630 "ECDHE-RSA-AES128-GCM-SHA256", 0 },
1631#ifdef WOLFSSL_DTLS_CID
1632 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
1633 "ECDHE-RSA-AES128-GCM-SHA256", 1 },
1634#endif
1635#if !defined(WOLFSSL_AEAD_ONLY) && !defined(NO_AES) && !defined(NO_SHA)
1636 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
1637 "ECDHE-RSA-AES128-SHA", 0 },
1638#ifdef WOLFSSL_DTLS_CID
1639 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
1640 "ECDHE-RSA-AES128-SHA", 1 },
1641#endif
1642#endif
1643#endif
1644 };
1645 size_t i;
1646
1647 for (i = 0; i < XELEM_CNT(params) && EXPECT_SUCCESS(); i++) {
1648 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1649 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1650 struct test_memio_ctx test_ctx;
1651 unsigned char payload[33];
1652 word16 mtu;
1653 int recordLen;
1654 int overhead;
1655 int ret;
1656
1657 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1658 XMEMSET(payload, 'A', sizeof(payload));
1659
1660 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1661 params[i].client_meth, params[i].server_meth),
1662 0);
1663
1664 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i].cipher), 1);
1665 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i].cipher), 1);
1666
1667#ifdef WOLFSSL_DTLS_CID
1668 if (params[i].use_cid) {
1669 unsigned char cid_c[] = { 0,1,2,3 };
1670 unsigned char cid_s[] = { 4,5,6,7,8,9 };
1671 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_c), 1);
1672 ExpectIntEQ(wolfSSL_dtls_cid_use(ssl_s), 1);
1673 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_c, cid_s, (int)sizeof(cid_s)),
1674 1);
1675 ExpectIntEQ(wolfSSL_dtls_cid_set(ssl_s, cid_c, (int)sizeof(cid_c)),
1676 1);
1677 }
1678#endif
1679
1680 /* Complete handshake and clear any leftover records. */
1681 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1682 test_memio_clear_buffer(&test_ctx, 1);
1683 test_memio_clear_buffer(&test_ctx, 0);
1684
1685 /* Measure application-data record overhead. */
1686 ExpectIntEQ(wolfSSL_write(ssl_c, payload, 32), 32);
1687 ExpectIntEQ(test_ctx.s_msg_count, 1);
1688 recordLen = test_ctx.s_len;
1689 ExpectIntGT(recordLen, 32);
1690 overhead = recordLen - 32;
1691
1692 /* Reset buffers before MTU-limited send. */
1693 test_memio_clear_buffer(&test_ctx, 0);
1694 test_memio_clear_buffer(&test_ctx, 1);
1695
1696 /* Set MTU to overhead + 32 bytes of payload. */
1697 mtu = (word16)(overhead + 32);
1698 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_c, mtu), WOLFSSL_SUCCESS);
1699 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_s, mtu), WOLFSSL_SUCCESS);
1700
1701 /* With the tightened MTU, we should still be able to send 32 bytes. */
1702 ExpectIntEQ(wolfSSL_write(ssl_c, payload, 32), 32);
1703 ExpectIntEQ(test_ctx.s_msg_count, 1);
1704 recordLen = test_ctx.s_len;
1705 ExpectIntEQ(recordLen, overhead + 32);
1706 ExpectIntLE(recordLen, mtu);
1707
1708 /* Underestimation: drop MTU by 1 and expect DTLS_SIZE_ERROR. */
1709 test_memio_clear_buffer(&test_ctx, 0);
1710 test_memio_clear_buffer(&test_ctx, 1);
1711 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_c, mtu - 1), WOLFSSL_SUCCESS);
1712 ret = wolfSSL_write(ssl_c, payload, 32);
1713 ExpectIntNE(ret, 32);
1714 ExpectIntEQ(wolfSSL_get_error(ssl_c, ret), DTLS_SIZE_ERROR);
1715
1716 wolfSSL_free(ssl_c);
1717 wolfSSL_CTX_free(ctx_c);
1718 wolfSSL_free(ssl_s);
1719 wolfSSL_CTX_free(ctx_s);
1720 }
1721 return EXPECT_RESULT();
1722#else
1723 return TEST_SKIPPED;
1724#endif
1725}
1726
1727int test_dtls_rtx_across_epoch_change(void)
1728{
1729 EXPECT_DECLS;
1730#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1731 defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS)
1732 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1733 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1734 struct test_memio_ctx test_ctx;
1735#if defined(WOLFSSL_HAVE_MLKEM)
1736 /* When ML-KEM is used in the key share, the hello messages are fragmented
1737 *into two messages */
1738 int helloMsgCount = 2;
1739 int groups[2] = {
1740 #if defined(HAVE_CURVE25519) && defined(WOLFSSL_PQC_HYBRIDS) && \
1741 !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_NO_ML_KEM_768)
1742 WOLFSSL_X25519MLKEM768,
1743 #elif defined(HAVE_ECC) && defined(WOLFSSL_PQC_HYBRIDS) && \
1744 !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_NO_ML_KEM_768)
1745 WOLFSSL_SECP256R1MLKEM768,
1746 #elif defined(HAVE_ECC) && defined(WOLFSSL_PQC_HYBRIDS) && \
1747 !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_NO_ML_KEM_1024)
1748 WOLFSSL_SECP384R1MLKEM1024,
1749 #elif !defined(WOLFSSL_NO_ML_KEM_1024) && !defined(WOLFSSL_NO_ML_KEM) && \
1750 !defined(WOLFSSL_TLS_NO_MLKEM_STANDALONE)
1751 WOLFSSL_ML_KEM_1024,
1752 #elif !defined(WOLFSSL_NO_ML_KEM_768) && !defined(WOLFSSL_NO_ML_KEM) && \
1753 !defined(WOLFSSL_TLS_NO_MLKEM_STANDALONE)
1754 WOLFSSL_ML_KEM_768,
1755 #elif !defined(WOLFSSL_NO_ML_KEM_512) && \
1756 !defined(WOLFSSL_TLS_NO_MLKEM_STANDALONE)
1757 WOLFSSL_ML_KEM_512,
1758 #elif defined(WOLFSSL_MLKEM_KYBER) && !defined(WOLFSSL_NO_KYBER1024)
1759 WOLFSSL_KYBER_LEVEL5,
1760 #elif defined(WOLFSSL_MLKEM_KYBER) && !defined(WOLFSSL_NO_KYBER768)
1761 WOLFSSL_KYBER_LEVEL3,
1762 #elif defined(WOLFSSL_MLKEM_KYBER) && !defined(WOLFSSL_NO_KYBER512)
1763 WOLFSSL_KYBER_LEVEL1,
1764 #endif
1765 WOLFSSL_ECC_SECP256R1,
1766 };
1767#else
1768 /* When ECC is used in the key share, the hello messages are not
1769 * fragmented */
1770 int helloMsgCount = 1;
1771#endif
1772
1773 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1774
1775 /* Setup DTLS contexts */
1776 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1777 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
1778 0);
1779
1780#if defined(WOLFSSL_HAVE_MLKEM)
1781 ExpectIntEQ(wolfSSL_set_groups(ssl_c, groups, 2), WOLFSSL_SUCCESS);
1782 ExpectIntEQ(wolfSSL_set_groups(ssl_s, groups, 2), WOLFSSL_SUCCESS);
1783#endif
1784
1785 /* CH0 */
1786 wolfSSL_SetLoggingPrefix("client:");
1787 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1788 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
1789
1790 /* HRR */
1791 wolfSSL_SetLoggingPrefix("server:");
1792 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
1793 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
1794
1795 /* CH1 */
1796 wolfSSL_SetLoggingPrefix("client:");
1797 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1798 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
1799
1800 /* SH ... FINISHED */
1801 wolfSSL_SetLoggingPrefix("server:");
1802 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
1803 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
1804
1805 /* we should have now SH ... FINISHED messages in the buffer*/
1806 ExpectIntGE(test_ctx.c_msg_count, 2);
1807
1808 /* drop everything but the SH */
1809 while (test_ctx.c_msg_count > helloMsgCount && EXPECT_SUCCESS()) {
1810 ExpectIntEQ(test_memio_drop_message(&test_ctx, 1, test_ctx.c_msg_count - 1), 0);
1811 }
1812
1813 /* Read the SH */
1814 wolfSSL_SetLoggingPrefix("client:");
1815 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1816 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
1817
1818 /* trigger client timeout */
1819 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
1820 /* this should have triggered a rtx */
1821 ExpectIntGT(test_ctx.s_msg_count, 0);
1822
1823 /* finish the handshake */
1824 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
1825
1826 /* Test communication works correctly */
1827 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
1828
1829 /* Cleanup */
1830 wolfSSL_free(ssl_c);
1831 wolfSSL_CTX_free(ctx_c);
1832 wolfSSL_free(ssl_s);
1833 wolfSSL_CTX_free(ctx_s);
1834#endif /* defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1835 defined(WOLFSSL_DTLS13) */
1836 return EXPECT_RESULT();
1837}
1838
1839#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1840 defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS)
1841static int test_dtls13_get_message_seq(const char* msg, int msgSz,
1842 word16* msgSeq)
1843{
1844 int hsOff = DTLS_RECORD_HEADER_SZ;
1845
1846 if (msg == NULL || msgSeq == NULL ||
1847 msgSz < DTLS_RECORD_HEADER_SZ + DTLS_HANDSHAKE_HEADER_SZ) {
1848 return BAD_FUNC_ARG;
1849 }
1850
1851 *msgSeq = ((word16)(byte)msg[hsOff + 4] << 8) |
1852 (word16)(byte)msg[hsOff + 5];
1853
1854 return WOLFSSL_SUCCESS;
1855}
1856#endif
1857
1858int test_dtls13_ch2_rtx_no_ch1(void)
1859{
1860 EXPECT_DECLS;
1861#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1862 defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS)
1863 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1864 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1865 struct test_memio_ctx test_ctx;
1866 const char* msg = NULL;
1867 int msgSz = 0;
1868 word16 ch1Seq = 0;
1869 int i;
1870 int foundCh1Seq = 0;
1871
1872 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1873
1874 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1875 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
1876 0);
1877
1878 /* To force HRR */
1879 ExpectIntEQ(wolfSSL_NoKeyShares(ssl_c), WOLFSSL_SUCCESS);
1880
1881 /* CH1 */
1882 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1883 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
1884 ExpectIntEQ(test_memio_get_message(&test_ctx, 0, &msg, &msgSz, 0), 0);
1885 ExpectIntGE(msgSz, DTLS_RECORD_HEADER_SZ + DTLS_HANDSHAKE_HEADER_SZ);
1886 ExpectIntEQ(test_dtls13_get_message_seq(msg, msgSz, &ch1Seq),
1887 WOLFSSL_SUCCESS);
1888
1889 /* HRR */
1890 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
1891 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1892 ExpectIntGT(test_ctx.c_msg_count, 0);
1893
1894 /* CH2 */
1895 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1896 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
1897 ExpectIntGT(test_ctx.s_msg_count, 0);
1898
1899 /* Drop CH2 and trigger the client retransmission timeout. */
1900 test_memio_clear_buffer(&test_ctx, 0);
1901 if (wolfSSL_dtls13_use_quick_timeout(ssl_c))
1902 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
1903 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
1904 ExpectIntGT(test_ctx.s_msg_count, 0);
1905
1906 for (i = 0; i < test_ctx.s_msg_count && EXPECT_SUCCESS(); i++) {
1907 int hsOff = DTLS_RECORD_HEADER_SZ;
1908 word16 msgSeq = 0;
1909
1910 ExpectIntEQ(test_memio_get_message(&test_ctx, 0, &msg, &msgSz, i), 0);
1911 /* memio stores one DTLS record per message in this handshake path. */
1912 if (msgSz >= DTLS_RECORD_HEADER_SZ + DTLS_HANDSHAKE_HEADER_SZ &&
1913 (byte)msg[0] == handshake && msg[hsOff] == client_hello) {
1914 ExpectIntEQ(test_dtls13_get_message_seq(msg, msgSz, &msgSeq),
1915 WOLFSSL_SUCCESS);
1916 if (msgSeq == ch1Seq)
1917 foundCh1Seq = 1;
1918 }
1919 }
1920
1921 ExpectIntEQ(foundCh1Seq, 0);
1922
1923 wolfSSL_free(ssl_c);
1924 wolfSSL_CTX_free(ctx_c);
1925 wolfSSL_free(ssl_s);
1926 wolfSSL_CTX_free(ctx_s);
1927#endif
1928 return EXPECT_RESULT();
1929}
1930
1931int test_dtls13_frag_ch2_with_ch1_rtx(void)
1932{
1933 EXPECT_DECLS;
1934#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
1935 defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS) && \
1936 defined(WOLFSSL_DTLS_MTU) && defined(WOLFSSL_DTLS_CH_FRAG) && \
1937 (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0))
1938 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
1939 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
1940 struct test_memio_ctx test_ctx;
1941 char hrr[TEST_MEMIO_BUF_SZ];
1942 int hrrSz = (int)sizeof(hrr);
1943 char ch1Rtx[TEST_MEMIO_BUF_SZ];
1944 int ch1RtxSz = (int)sizeof(ch1Rtx);
1945 char ch2[TEST_MEMIO_BUF_SZ];
1946 int ch2Sz = 0;
1947 int ch2MsgCount = 0;
1948 int ch2MsgSizes[TEST_MEMIO_MAX_MSGS] = {0};
1949 /* The DTLS record sequence number occupies the last 8 bytes of the
1950 * record header. */
1951 int recordSeqOff = DTLS_RECORD_HEADER_SZ - 8;
1952 int ch2Seq = 0;
1953 int ch1RtxSeq = 0;
1954 int off;
1955 int i;
1956
1957 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
1958
1959 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
1960 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
1961 0);
1962
1963 /* To force HRR */
1964 ExpectIntEQ(wolfSSL_NoKeyShares(ssl_c), WOLFSSL_SUCCESS);
1965 ExpectIntEQ(wolfSSL_dtls13_allow_ch_frag(ssl_s, 1), WOLFSSL_SUCCESS);
1966
1967 /* CH1 */
1968 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1969 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
1970
1971 /* HRR */
1972 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
1973 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
1974 ExpectIntEQ(test_memio_copy_message(&test_ctx, 1, hrr, &hrrSz, 0), 0);
1975
1976 /* Drop HRR, trigger CH1 retransmission, copy and drop it */
1977 test_memio_clear_buffer(&test_ctx, 1);
1978 if (wolfSSL_dtls13_use_quick_timeout(ssl_c))
1979 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
1980 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
1981 ExpectIntEQ(test_memio_copy_message(&test_ctx, 0, ch1Rtx, &ch1RtxSz, 0), 0);
1982 test_memio_clear_buffer(&test_ctx, 0);
1983
1984 /* Force CH2 fragmentation. MTU must be small enough to fragment but large
1985 * enough that the cookie extension lands in the first fragment, otherwise
1986 * the server can't validate it statelessly and the test scenario (server
1987 * stateful after frag 1) does not hold. With --enable-all (PQ groups in
1988 * supported_groups), the cookie extension can sit ~400 bytes into CH2; 600
1989 * gives margin while still producing multiple fragments (CH2 is ~2KB). */
1990 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_c, 600), WOLFSSL_SUCCESS);
1991
1992 /* Forward HRR and let the client create fragmented CH2 */
1993 ExpectIntEQ(test_memio_inject_message(&test_ctx, 1, hrr, hrrSz), 0);
1994 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
1995 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
1996
1997 ExpectIntGT(test_ctx.s_msg_count, 1);
1998 ExpectIntLE(test_ctx.s_msg_count, TEST_MEMIO_MAX_MSGS);
1999 ExpectIntLE(test_ctx.s_len, (int)sizeof(ch2));
2000 if (EXPECT_SUCCESS()) {
2001 ch2Sz = test_ctx.s_len;
2002 ch2MsgCount = test_ctx.s_msg_count;
2003 XMEMCPY(ch2, test_ctx.s_buff, ch2Sz);
2004 XMEMCPY(ch2MsgSizes, test_ctx.s_msg_sizes,
2005 sizeof(ch2MsgSizes[0]) * (size_t)ch2MsgCount);
2006
2007 ch2Seq = ((byte)ch2[recordSeqOff + 4] << 8) |
2008 (byte)ch2[recordSeqOff + 5];
2009 ch1RtxSeq = ch2Seq + ch2MsgCount;
2010
2011 /* Synthesize a CH1 retransmission that can pass the replay window after
2012 * the first CH2 fragment makes the server stateful. The handshake
2013 * message_seq remains the original CH1 value; only the DTLS record
2014 * sequence is moved past the fragmented CH2 flight */
2015 ch1Rtx[recordSeqOff + 0] = 0;
2016 ch1Rtx[recordSeqOff + 1] = 0;
2017 ch1Rtx[recordSeqOff + 2] = 0;
2018 ch1Rtx[recordSeqOff + 3] = 0;
2019 ch1Rtx[recordSeqOff + 4] = (byte)(ch1RtxSeq >> 8);
2020 ch1Rtx[recordSeqOff + 5] = (byte)ch1RtxSeq;
2021 }
2022
2023 test_memio_clear_buffer(&test_ctx, 0);
2024
2025 /* Deliver CH2 first fragment only. Now server is stateful */
2026 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, ch2, ch2MsgSizes[0]), 0);
2027 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2028 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2029
2030 /* Deliver the retransmitted CH1 between CH2 fragments, it should be
2031 * discarded as rtx */
2032 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, ch1Rtx, ch1RtxSz), 0);
2033 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2034 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2035 test_memio_clear_buffer(&test_ctx, 1);
2036
2037 /* Deliver the rest of CH2 */
2038 off = ch2MsgSizes[0];
2039 for (i = 1; i < ch2MsgCount && EXPECT_SUCCESS(); i++) {
2040 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, ch2 + off,
2041 ch2MsgSizes[i]), 0);
2042 off += ch2MsgSizes[i];
2043 }
2044
2045 /* Restore MTU so the client's input buffer can hold the full server
2046 * flight (e.g. an SH carrying a hybrid PQC key share). */
2047 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_c, 1500), WOLFSSL_SUCCESS);
2048
2049 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2050
2051 wolfSSL_free(ssl_c);
2052 wolfSSL_CTX_free(ctx_c);
2053 wolfSSL_free(ssl_s);
2054 wolfSSL_CTX_free(ctx_s);
2055#endif
2056 return EXPECT_RESULT();
2057}
2058
2059int test_dtls_drop_client_ack(void)
2060{
2061 EXPECT_DECLS;
2062#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
2063 defined(WOLFSSL_DTLS13) && defined(WOLFSSL_DTLS)
2064 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2065 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2066 struct test_memio_ctx test_ctx;
2067 char data[32];
2068
2069 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2070
2071 /* Setup DTLS contexts */
2072 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2073 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method),
2074 0);
2075
2076 /* disable new session ticket to simplify testing */
2077 ExpectIntEQ(wolfSSL_no_ticket_TLSv13(ssl_s), 0);
2078
2079 /* CH0 */
2080 wolfSSL_SetLoggingPrefix("client:");
2081 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2082 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2083
2084 /* HRR */
2085 wolfSSL_SetLoggingPrefix("server:");
2086 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2087 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2088
2089 /* CH1 */
2090 wolfSSL_SetLoggingPrefix("client:");
2091 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2092 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2093
2094 /* SH ... FINISHED */
2095 wolfSSL_SetLoggingPrefix("server:");
2096 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2097 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2098
2099 /* ... FINISHED */
2100 wolfSSL_SetLoggingPrefix("client:");
2101 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2102 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2103
2104 /* init is finished should return false at this point */
2105 ExpectFalse(wolfSSL_is_init_finished(ssl_c));
2106
2107 /* ACK */
2108 ExpectIntEQ(wolfSSL_accept(ssl_s), WOLFSSL_SUCCESS);
2109 /* Drop the ack */
2110 test_memio_clear_buffer(&test_ctx, 1);
2111
2112 /* trigger client timeout, finished should be rtx */
2113 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2114 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2115 /* this should have triggered a rtx */
2116 ExpectIntGT(test_ctx.s_msg_count, 0);
2117
2118 /* this should re-send the ack immediately */
2119 ExpectIntEQ(wolfSSL_read(ssl_s, data, 32), -1);
2120 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2121 ExpectIntEQ(test_ctx.c_msg_count, 1);
2122
2123 /* This should advance the connection on the client */
2124 ExpectIntEQ(wolfSSL_negotiate(ssl_c), WOLFSSL_SUCCESS);
2125
2126 /* Test communication works correctly */
2127 ExpectIntEQ(test_dtls_communication(ssl_s, ssl_c), TEST_SUCCESS);
2128
2129 /* Cleanup */
2130 wolfSSL_free(ssl_c);
2131 wolfSSL_CTX_free(ctx_c);
2132 wolfSSL_free(ssl_s);
2133 wolfSSL_CTX_free(ctx_s);
2134#endif /* defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
2135 defined(WOLFSSL_DTLS13) */
2136 return EXPECT_RESULT();
2137}
2138
2139int test_dtls_bogus_finished_epoch_zero(void)
2140{
2141 EXPECT_DECLS;
2142#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS) && \
2143 !defined(WOLFSSL_NO_TLS12) && defined(HAVE_AES_CBC) && \
2144 defined(WOLFSSL_AES_128) && !defined(NO_SHA256)
2145 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2146 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2147 struct test_memio_ctx test_ctx;
2148 int error;
2149
2150 /* bogus Finished message bytes from the original bug report (epoch 0)
2151 * https://github.com/wolfSSL/wolfssl/issues/9188 */
2152 static const unsigned char bogus_finished[] = {
2153 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2154 0x18, 0x14, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2155 0x0c, 0xd9, 0xc6, 0xe3, 0x01, 0x59, 0xf2, 0xc2, 0x4f, 0xfa, 0xfd, 0x20,
2156 0xd7
2157 };
2158
2159 /* serverHelloDone message bytes */
2160 static const unsigned char server_hello_done_message[] = {
2161 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
2162 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2163 0x00
2164 };
2165
2166 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2167
2168 /* setting up dtls 1.2 contexts */
2169 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2170 wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method), 0);
2171
2172 /* start handshake, send first ClientHelloDone */
2173 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2174 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2175
2176 /* clearing server buffer to inject the wrong Finished packet */
2177 test_memio_clear_buffer(&test_ctx, 1);
2178 ExpectIntEQ(test_memio_inject_message(&test_ctx, 1,
2179 (const char*)bogus_finished, sizeof(bogus_finished)), 0);
2180
2181 /* continue client handshake to process it */
2182 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2183
2184 /* client should terminate with dtls sequence error */
2185 error = wolfSSL_get_error(ssl_c, -1);
2186
2187 /* check if the error is SEQUENCE_ERROR, handshake should not
2188 * expect a finished packet in that moment, in particular should not
2189 * be in epoch = 0 (should be epoch = 1) */
2190 ExpectTrue(error == WC_NO_ERR_TRACE(SEQUENCE_ERROR) ||
2191 error == WC_NO_ERR_TRACE(WOLFSSL_ERROR_WANT_READ));
2192
2193 /* forcing injection ServerHelloDone to test if client would replay
2194 * ClientHello */
2195 test_memio_clear_buffer(&test_ctx, 0);
2196 ExpectIntEQ(test_memio_inject_message(&test_ctx, 1,
2197 (const char*)server_hello_done_message, sizeof(server_hello_done_message)), 0);
2198 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2199
2200 /* verifying no ClientHello replay occurred,
2201 * buffer should empty since we exit early on
2202 * because of the bogus finished packet */
2203 ExpectIntLE(test_ctx.s_len, 0);
2204
2205 wolfSSL_free(ssl_c);
2206 wolfSSL_CTX_free(ctx_c);
2207 wolfSSL_free(ssl_s);
2208 wolfSSL_CTX_free(ctx_s);
2209#endif
2210 return EXPECT_RESULT();
2211}
2212
2213int test_dtls_replay(void)
2214{
2215 EXPECT_DECLS;
2216#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
2217 size_t i;
2218 struct {
2219 method_provider client_meth;
2220 method_provider server_meth;
2221 const char* tls_version;
2222 } params[] = {
2223#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2224 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method, "DTLSv1_3" },
2225#endif
2226#if !defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_DTLS)
2227 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method, "DTLSv1_2" },
2228#endif
2229#if !defined(NO_OLD_TLS) && defined(WOLFSSL_DTLS)
2230 { wolfDTLSv1_client_method, wolfDTLSv1_server_method, "DTLSv1_0" },
2231#endif
2232 };
2233 for (i = 0; i < XELEM_CNT(params) && !EXPECT_FAIL(); i++) {
2234 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2235 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2236 struct test_memio_ctx test_ctx;
2237
2238 char msg_buf[256];
2239 int msg_len = sizeof(msg_buf);
2240 byte app_data[8];
2241
2242 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2243
2244 /* Setup DTLS contexts */
2245 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2246 params[i].client_meth, params[i].server_meth), 0);
2247 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2248
2249 ExpectIntEQ(wolfSSL_write(ssl_c, "test", 4), 4);
2250 ExpectIntEQ(test_memio_copy_message(&test_ctx, 0, msg_buf, &msg_len, 0), 0);
2251 ExpectIntEQ(wolfSSL_read(ssl_s, app_data, sizeof(app_data)), 4);
2252 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, msg_buf, msg_len), 0);
2253 ExpectIntEQ(wolfSSL_read(ssl_s, app_data, sizeof(app_data)), -1);
2254 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2255
2256 wolfSSL_free(ssl_c);
2257 wolfSSL_CTX_free(ctx_c);
2258 wolfSSL_free(ssl_s);
2259 wolfSSL_CTX_free(ctx_s);
2260 }
2261#endif
2262 return EXPECT_RESULT();
2263}
2264
2265#if defined(WOLFSSL_DTLS13) && defined(HAVE_SSL_MEMIO_TESTS_DEPENDENCIES) && \
2266 defined(WOLFSSL_SRTP)
2267static int test_dtls_srtp_ctx_ready(WOLFSSL_CTX* ctx)
2268{
2269 EXPECT_DECLS;
2270 ExpectIntEQ(wolfSSL_CTX_set_tlsext_use_srtp(ctx, "SRTP_AEAD_AES_256_GCM:"
2271 "SRTP_AEAD_AES_128_GCM:SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32"),
2272 0);
2273 return EXPECT_RESULT();
2274}
2275
2276int test_dtls_srtp(void)
2277{
2278 EXPECT_DECLS;
2279 test_ssl_cbf client_cbf;
2280 test_ssl_cbf server_cbf;
2281
2282 XMEMSET(&client_cbf, 0, sizeof(client_cbf));
2283 XMEMSET(&server_cbf, 0, sizeof(server_cbf));
2284
2285 client_cbf.method = wolfDTLSv1_3_client_method;
2286 client_cbf.ctx_ready = test_dtls_srtp_ctx_ready;
2287 server_cbf.method = wolfDTLSv1_3_server_method;
2288 server_cbf.ctx_ready = test_dtls_srtp_ctx_ready;
2289
2290 ExpectIntEQ(test_wolfSSL_client_server_nofail_memio(&client_cbf,
2291 &server_cbf, NULL), TEST_SUCCESS);
2292
2293 return EXPECT_RESULT();
2294}
2295#else
2296int test_dtls_srtp(void)
2297{
2298 EXPECT_DECLS;
2299 return EXPECT_RESULT();
2300}
2301#endif
2302
2303int test_dtls_timeout(void)
2304{
2305 EXPECT_DECLS;
2306#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
2307 size_t i;
2308 struct {
2309 method_provider client_meth;
2310 method_provider server_meth;
2311 } params[] = {
2312#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2313 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method },
2314#endif
2315#if !defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_DTLS)
2316 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method },
2317#endif
2318#if !defined(NO_OLD_TLS) && defined(WOLFSSL_DTLS)
2319 { wolfDTLSv1_client_method, wolfDTLSv1_server_method },
2320#endif
2321 };
2322
2323 for (i = 0; i < XELEM_CNT(params) && !EXPECT_FAIL(); i++) {
2324 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2325 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2326 struct test_memio_ctx test_ctx;
2327
2328 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2329
2330 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2331 params[i].client_meth, params[i].server_meth), 0);
2332 ExpectIntEQ(wolfSSL_dtls_set_timeout_max(ssl_c, 2), WOLFSSL_SUCCESS);
2333 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
2334 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2335#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2336 /* will return 0 when not 1.3 */
2337 if (wolfSSL_dtls13_use_quick_timeout(ssl_c))
2338 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2339#endif
2340 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2341 ExpectIntEQ(wolfSSL_dtls_get_current_timeout(ssl_c), 2);
2342 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
2343 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
2344 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
2345 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2346 ExpectIntEQ(wolfSSL_dtls_get_current_timeout(ssl_c), 1);
2347#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2348 /* will return 0 when not 1.3 */
2349 if (wolfSSL_dtls13_use_quick_timeout(ssl_c))
2350 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2351#endif
2352 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), WOLFSSL_SUCCESS);
2353 ExpectIntEQ(wolfSSL_dtls_get_current_timeout(ssl_c), 2);
2354 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2355
2356 wolfSSL_free(ssl_s);
2357 wolfSSL_free(ssl_c);
2358 wolfSSL_CTX_free(ctx_s);
2359 wolfSSL_CTX_free(ctx_c);
2360 }
2361#endif
2362 return EXPECT_RESULT();
2363}
2364
2365int test_dtls_certreq_order(void)
2366{
2367 EXPECT_DECLS;
2368#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS) && \
2369 !defined(WOLFSSL_NO_TLS12) && defined(HAVE_AESGCM) && \
2370 defined(WOLFSSL_AES_128) && !defined(NO_SHA256) && !defined(NO_RSA) && \
2371 !defined(NO_DH)
2372 /* This test checks that a certificate request message
2373 * received before server certificate message is properly detected.
2374 * The binary is taken from https://github.com/wolfSSL/wolfssl/issues/9198
2375 */
2376 static const unsigned char certreq_before_cert_bin[] = {
2377 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2378 0x39, 0x02, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2379 0x2d, 0xfe, 0xfd, 0x48, 0xc0, 0xd5, 0xf2, 0x60, 0xb4, 0x20, 0xbb, 0x38,
2380 0x51, 0xd9, 0xd4, 0x7a, 0xcb, 0x93, 0x3d, 0xbe, 0x70, 0x39, 0x9b, 0xf6,
2381 0xc9, 0x2d, 0xa3, 0x3a, 0xf0, 0x1d, 0x4f, 0xb7, 0x70, 0xe9, 0x8c, 0x00,
2382 0x00, 0x9e, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x00, 0x01, 0x01, 0x16, 0xfe,
2383 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3a, 0x0d,
2384 0x00, 0x00, 0x2e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x01,
2385 0x01, 0x00, 0x28, 0x02, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05, 0x02, 0x06,
2386 0x02, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, 0x06,
2387 0x01, 0x02, 0x03, 0x03, 0x03, 0x04, 0x03, 0x05, 0x03, 0x06, 0x03, 0x08,
2388 0x04, 0x08, 0x05, 0x08, 0x06, 0x07, 0x08, 0x00, 0x00, 0x16, 0xfe, 0xfd,
2389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x2b, 0x0b, 0x00,
2390 0x03, 0x1f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x00, 0x03,
2391 0x1c, 0x00, 0x03, 0x19, 0x30, 0x82, 0x03, 0x15, 0x30, 0x82, 0x01, 0xfd,
2392 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x40, 0xe7, 0x6e, 0x85, 0x66,
2393 0x7c, 0x3f, 0x04, 0x87, 0x4c, 0x3f, 0x94, 0x21, 0x6d, 0x21, 0x65, 0xa5,
2394 0x28, 0xa7, 0x38, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
2395 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16,
2396 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x64, 0x74, 0x6c, 0x73, 0x2d,
2397 0x66, 0x75, 0x7a, 0x7a, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e,
2398 0x17, 0x0d, 0x32, 0x34, 0x30, 0x36, 0x30, 0x36, 0x31, 0x32, 0x31, 0x33,
2399 0x30, 0x33, 0x5a, 0x17, 0x0d, 0x33, 0x38, 0x30, 0x32, 0x31, 0x33, 0x31,
2400 0x32, 0x31, 0x33, 0x30, 0x33, 0x5a, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16,
2401 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x64, 0x74, 0x6c, 0x73, 0x2d,
2402 0x66, 0x75, 0x7a, 0x7a, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x82,
2403 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
2404 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
2405 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbb, 0x2a, 0x06, 0xfa, 0xaf,
2406 0x9c, 0xb7, 0xeb, 0x33, 0xce, 0xde, 0xf6, 0xb6, 0x0a, 0x93, 0xb3, 0x97,
2407 0x7a, 0x36, 0x55, 0x89, 0xc2, 0xf5, 0x45, 0x84, 0x6d, 0x45, 0x25, 0x5c,
2408 0x4f, 0xa8, 0x8a, 0x41, 0x29, 0x5b, 0x71, 0x98, 0x6c, 0x63, 0xe7, 0xcf,
2409 0x7f, 0xb4, 0x9d, 0x06, 0x76, 0x60, 0x8c, 0x6a, 0x26, 0x47, 0x65, 0x5d,
2410 0x74, 0x7a, 0xb5, 0x40, 0x33, 0x61, 0xe0, 0x28, 0xed, 0xa6, 0x66, 0x6a,
2411 0x4b, 0x97, 0xaf, 0xae, 0x6c, 0xa1, 0xf2, 0xfc, 0xd0, 0xf1, 0x61, 0x98,
2412 0x05, 0x2a, 0x02, 0x42, 0x13, 0x06, 0x7c, 0x4a, 0x7e, 0x53, 0x01, 0x87,
2413 0x27, 0x6c, 0x41, 0xe8, 0xed, 0x6e, 0xb2, 0x45, 0x90, 0xe8, 0x93, 0xc0,
2414 0x20, 0xff, 0x64, 0xdf, 0x48, 0x57, 0xb9, 0x62, 0x8c, 0x14, 0x88, 0xc9,
2415 0x4a, 0x56, 0x3f, 0x5d, 0x9f, 0xeb, 0x1d, 0x79, 0x75, 0xfd, 0x24, 0xad,
2416 0xb6, 0x65, 0x1d, 0x53, 0x81, 0x5c, 0x67, 0xbe, 0x3a, 0x9d, 0xcd, 0xe1,
2417 0x47, 0xab, 0x8d, 0xd4, 0xa5, 0xbd, 0xa6, 0xd7, 0x60, 0xf9, 0x5c, 0x32,
2418 0x51, 0x65, 0x7e, 0x8b, 0xd6, 0xa1, 0x5b, 0xa2, 0xf5, 0x60, 0xaf, 0x29,
2419 0xff, 0x9f, 0x3a, 0xa4, 0xd0, 0x5d, 0x6e, 0x96, 0x09, 0xe8, 0xcf, 0xc3,
2420 0xe1, 0xe8, 0x5a, 0x82, 0xce, 0x9a, 0x3c, 0xc6, 0xbb, 0xe5, 0x4c, 0xa8,
2421 0xa4, 0xb0, 0xfd, 0x86, 0x06, 0x8b, 0x3f, 0x7e, 0x38, 0xe4, 0x06, 0xdf,
2422 0xf7, 0x9c, 0xc6, 0x8b, 0x1d, 0xb5, 0xad, 0x7a, 0x91, 0x5f, 0x64, 0xa5,
2423 0x69, 0xc8, 0x7b, 0x77, 0x32, 0x71, 0x8f, 0x73, 0x82, 0xd2, 0x21, 0xe8,
2424 0xa8, 0x81, 0xfe, 0x76, 0x7f, 0x20, 0xd1, 0xb6, 0x42, 0x9e, 0xaf, 0x60,
2425 0x85, 0x47, 0xf5, 0xfe, 0x9f, 0x85, 0xbf, 0xb0, 0x11, 0xb7, 0xf7, 0x83,
2426 0x0d, 0x80, 0x63, 0xa0, 0xf7, 0x0c, 0x2c, 0x83, 0x12, 0xa9, 0x0f, 0x02,
2427 0x03, 0x01, 0x00, 0x01, 0xa3, 0x53, 0x30, 0x51, 0x30, 0x1d, 0x06, 0x03,
2428 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x2a, 0xb5, 0x00, 0x45, 0x06,
2429 0x08, 0xef, 0xe5, 0xfa, 0x78, 0x19, 0x47, 0x5b, 0x04, 0x40, 0x18, 0xf3,
2430 0xeb, 0xab, 0x99, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18,
2431 0x30, 0x16, 0x80, 0x14, 0x2a, 0xb5, 0x00, 0x45, 0x06, 0x08, 0xef, 0xe5,
2432 0xfa, 0x78, 0x19, 0x47, 0x5b, 0x04, 0x40, 0x18, 0xf3, 0xeb, 0xab, 0x99,
2433 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05,
2434 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
2435 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01,
2436 0x00, 0xa7, 0x58, 0x65, 0xfc, 0x60, 0x3e, 0xb7, 0x34, 0x82, 0xde, 0x04,
2437 0x06, 0x3d, 0x69, 0x62, 0x8a, 0x4c, 0xcc, 0xd6, 0x54, 0x72, 0x81, 0xcb,
2438 0x31, 0xdf, 0x63, 0xaf, 0x84, 0x27, 0x62, 0xbf, 0xe8, 0x6b, 0xf9, 0x81,
2439 0xd4, 0x5a, 0x98, 0x88, 0xae, 0x05, 0x5b, 0x2c, 0xa3, 0xf8, 0xb0, 0xde,
2440 0x9b, 0x44, 0xc7, 0x1d, 0x19, 0x52, 0x02, 0x02, 0xd9, 0x0e, 0x66, 0x7b,
2441 0x25, 0xdf, 0x95, 0x03, 0x5e, 0x4b, 0x15, 0xef, 0xda, 0x86, 0x2e, 0x8b,
2442 0xc4, 0xe7, 0x2d, 0x3f, 0x5f, 0xea, 0x1f, 0x13, 0x81, 0x2e, 0x6e, 0xf8,
2443 0x7f, 0x0b, 0x3b, 0x95, 0x4f, 0xb6, 0xb3, 0x91, 0xcf, 0x89, 0x52, 0xdb,
2444 0xb7, 0xb1, 0x5d, 0x79, 0xdf, 0x3a, 0xf3, 0xe2, 0x46, 0xc4, 0x04, 0xf3,
2445 0xf4, 0xf1, 0xc3, 0xf3, 0xa4, 0x98, 0x47, 0xae, 0x46, 0x99, 0x43, 0x4b,
2446 0x20, 0xba, 0x33, 0xaa, 0x7e, 0x2e, 0x80, 0x88, 0x25, 0x84, 0x73, 0x6d,
2447 0x44, 0x5f, 0x48, 0x57, 0x0a, 0xc4, 0x4a, 0x4d, 0xc4, 0xd1, 0x47, 0x5f,
2448 0x4f, 0xd5, 0xdb, 0x3e, 0x90, 0xbd, 0xe1, 0x6a, 0xcb, 0xe4, 0xf3, 0xe6,
2449 0x64, 0x26, 0xbd, 0xb6, 0x0b, 0x95, 0x6f, 0x4e, 0x1b, 0x09, 0x25, 0x68,
2450 0x93, 0xb6, 0xd0, 0xc2, 0xfc, 0xce, 0x8f, 0x64, 0xf5, 0x75, 0x50, 0x58,
2451 0xe5, 0x3e, 0x00, 0x01, 0xfd, 0x62, 0x37, 0xe1, 0x37, 0x1e, 0x9f, 0x97,
2452 0x88, 0xb1, 0xa9, 0x6f, 0xad, 0x93, 0x41, 0x01, 0xfb, 0x38, 0x24, 0xc8,
2453 0x08, 0xa0, 0x68, 0x4b, 0x34, 0x8b, 0x76, 0xea, 0x01, 0x62, 0x9d, 0xfa,
2454 0xdc, 0x91, 0x50, 0x47, 0x98, 0xec, 0x0c, 0x44, 0x58, 0xb6, 0x16, 0xa0,
2455 0x05, 0xf2, 0x94, 0x34, 0x6d, 0xcb, 0xbc, 0xe4, 0x58, 0xd6, 0x97, 0x9d,
2456 0x57, 0xa5, 0x5a, 0x65, 0xfa, 0xab, 0x94, 0x24, 0xbf, 0x06, 0x64, 0xc0,
2457 0xe5, 0x89, 0xe4, 0x2e, 0x46, 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00,
2458 0x00, 0x00, 0x00, 0x03, 0x03, 0x17, 0x0c, 0x00, 0x03, 0x0b, 0x00, 0x03,
2459 0x00, 0x00, 0x00, 0x00, 0x03, 0x0b, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff,
2460 0xff, 0xff, 0xff, 0xff, 0xad, 0xf8, 0x54, 0x58, 0xa2, 0xbb, 0x4a, 0x9a,
2461 0xaf, 0xdc, 0x56, 0x20, 0x27, 0x3d, 0x3c, 0xf1, 0xd8, 0xb9, 0xc5, 0x83,
2462 0xce, 0x2d, 0x36, 0x95, 0xa9, 0xe1, 0x36, 0x41, 0x14, 0x64, 0x33, 0xfb,
2463 0xcc, 0x93, 0x9d, 0xce, 0x24, 0x9b, 0x3e, 0xf9, 0x7d, 0x2f, 0xe3, 0x63,
2464 0x63, 0x0c, 0x75, 0xd8, 0xf6, 0x81, 0xb2, 0x02, 0xae, 0xc4, 0x61, 0x7a,
2465 0xd3, 0xdf, 0x1e, 0xd5, 0xd5, 0xfd, 0x65, 0x61, 0x24, 0x33, 0xf5, 0x1f,
2466 0x5f, 0x06, 0x6e, 0xd0, 0x85, 0x63, 0x65, 0x55, 0x3d, 0xed, 0x1a, 0xf3,
2467 0xb5, 0x57, 0x13, 0x5e, 0x7f, 0x57, 0xc9, 0x35, 0x98, 0x4f, 0x0c, 0x70,
2468 0xe0, 0xe6, 0x8b, 0x77, 0xe2, 0xa6, 0x89, 0xda, 0xf3, 0xef, 0xe8, 0x72,
2469 0x1d, 0xf1, 0x58, 0xa1, 0x36, 0xad, 0xe7, 0x35, 0x30, 0xac, 0xca, 0x4f,
2470 0x48, 0x3a, 0x79, 0x7a, 0xbc, 0x0a, 0xb1, 0x82, 0xb3, 0x24, 0xfb, 0x61,
2471 0xd1, 0x08, 0xa9, 0x4b, 0xb2, 0xc8, 0xe3, 0xfb, 0xb9, 0x6a, 0xda, 0xb7,
2472 0x60, 0xd7, 0xf4, 0x68, 0x1d, 0x4f, 0x42, 0xa3, 0xde, 0x39, 0x4d, 0xf4,
2473 0xae, 0x56, 0xed, 0xe7, 0x63, 0x72, 0xbb, 0x19, 0x0b, 0x07, 0xa7, 0xc8,
2474 0xee, 0x0a, 0x6d, 0x70, 0x9e, 0x02, 0xfc, 0xe1, 0xcd, 0xf7, 0xe2, 0xec,
2475 0xc0, 0x34, 0x04, 0xcd, 0x28, 0x34, 0x2f, 0x61, 0x91, 0x72, 0xfe, 0x9c,
2476 0xe9, 0x85, 0x83, 0xff, 0x8e, 0x4f, 0x12, 0x32, 0xee, 0xf2, 0x81, 0x83,
2477 0xc3, 0xfe, 0x3b, 0x1b, 0x4c, 0x6f, 0xad, 0x73, 0x3b, 0xb5, 0xfc, 0xbc,
2478 0x2e, 0xc2, 0x20, 0x05, 0xc5, 0x8e, 0xf1, 0x83, 0x7d, 0x16, 0x83, 0xb2,
2479 0xc6, 0xf3, 0x4a, 0x26, 0xc1, 0xb2, 0xef, 0xfa, 0x88, 0x6b, 0x42, 0x38,
2480 0x61, 0x28, 0x5c, 0x97, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
2481 0x00, 0x01, 0x02, 0x01, 0x00, 0xea, 0x10, 0x0e, 0xb8, 0xc4, 0xc9, 0xc9,
2482 0x9a, 0x8c, 0x03, 0x04, 0x56, 0x4f, 0x3d, 0x2d, 0x64, 0x51, 0xc9, 0x1e,
2483 0xf7, 0x63, 0x06, 0x81, 0xca, 0x89, 0x5c, 0x81, 0xb9, 0x78, 0xe0, 0xf5,
2484 0x43, 0xe4, 0x47, 0x40, 0x8f, 0x0e, 0xab, 0x0e, 0xd0, 0xb4, 0x43, 0x92,
2485 0x2a, 0x03, 0x4a, 0x1f, 0x69, 0x7b, 0xc3, 0x0c, 0x13, 0x0d, 0xf3, 0xd8,
2486 0xaa, 0xd7, 0x1e, 0x0e, 0xf5, 0x09, 0x7d, 0xda, 0xc9, 0x7c, 0x16, 0xfd,
2487 0xe6, 0xbb, 0x2d, 0xc1, 0x12, 0x20, 0xad, 0x8f, 0x1b, 0x64, 0x79, 0xb9,
2488 0xbc, 0x26, 0x11, 0xec, 0x3d, 0x20, 0xa6, 0x18, 0x6c, 0xb3, 0x27, 0xbe,
2489 0x86, 0xde, 0x0e, 0x49, 0x8f, 0xc2, 0x0e, 0x86, 0x8b, 0x2a, 0xc7, 0x4c,
2490 0xb5, 0x09, 0xed, 0x94, 0x6d, 0xb6, 0x50, 0xfb, 0xc1, 0x8e, 0xd7, 0xce,
2491 0x58, 0xf8, 0xb0, 0x68, 0xbc, 0xcf, 0x28, 0xc5, 0x1c, 0xf3, 0x99, 0x17,
2492 0x22, 0xaa, 0x40, 0x28, 0x90, 0x78, 0x34, 0xe2, 0x0f, 0x28, 0x0d, 0x22,
2493 0xe1, 0x55, 0xcd, 0x90, 0x26, 0x84, 0xa0, 0xd8, 0xea, 0xd9, 0xe8, 0x83,
2494 0x43, 0x24, 0xef, 0x66, 0xa6, 0x7f, 0x9f, 0x56, 0x10, 0x6f, 0xc9, 0x13,
2495 0x2f, 0xb1, 0x00, 0x49, 0xc7, 0x88, 0x8d, 0xec, 0x55, 0xc1, 0xdb, 0x39,
2496 0xa2, 0x5e, 0xbd, 0xde, 0xb6, 0x0a, 0x1c, 0x1f, 0xa4, 0x1a, 0x93, 0xc2,
2497 0xee, 0x9c, 0x63, 0x3b, 0x09, 0xcf, 0xf6, 0x93, 0x83, 0xfe, 0xd7, 0x4d,
2498 0x35, 0xd3, 0x15, 0x74, 0x23, 0x5a, 0x33, 0xdc, 0x64, 0x9d, 0xba, 0x2a,
2499 0xb0, 0x63, 0x26, 0x17, 0x44, 0xe2, 0xfa, 0x41, 0xb1, 0xb2, 0xf2, 0x63,
2500 0xb2, 0x51, 0x50, 0xfc, 0x31, 0xc2, 0xd6, 0xda, 0x01, 0x18, 0xcf, 0xe8,
2501 0x9b, 0xed, 0x4c, 0x69, 0x38, 0xe1, 0xe2, 0x69, 0x53, 0xdc, 0x85, 0x40,
2502 0x4e, 0x9a, 0x1d, 0xe8, 0x2a, 0xe1, 0x27, 0xad, 0x8e, 0x03, 0x01, 0x01,
2503 0x00, 0xad, 0x55, 0xc0, 0xac, 0xbb, 0x32, 0x93, 0x86, 0xc6, 0xdf, 0x5d,
2504 0x58, 0x94, 0xba, 0x35, 0x81, 0x32, 0x54, 0x98, 0xdc, 0x85, 0x6f, 0x1e,
2505 0x41, 0xe4, 0x3d, 0x1e, 0x0d, 0x37, 0x85, 0x05, 0xd1, 0xf7, 0xb2, 0x3a,
2506 0xd5, 0xb1, 0x8c, 0x93, 0x20, 0x8a, 0x42, 0xf0, 0xc9, 0x86, 0xcc, 0xf4,
2507 0xa1, 0x17, 0x8d, 0x65, 0xd0, 0xea, 0x23, 0x9f, 0xf7, 0xcf, 0x3e, 0x7b,
2508 0x51, 0x55, 0xfe, 0x3d, 0x6c, 0x9e, 0x3e, 0x51, 0x39, 0xd8, 0xa0, 0xa0,
2509 0x8a, 0x6b, 0xd8, 0x4d, 0x41, 0x7f, 0x97, 0x5c, 0x8e, 0x25, 0x7b, 0x24,
2510 0x72, 0x1a, 0x46, 0xac, 0x8f, 0x8e, 0xd7, 0xe8, 0xa6, 0x31, 0x1e, 0x7c,
2511 0xd0, 0xa9, 0x31, 0x84, 0xa6, 0x60, 0x73, 0xb3, 0xb9, 0x26, 0xa3, 0x4e,
2512 0xd5, 0x03, 0x3f, 0xef, 0xaa, 0x5a, 0x41, 0x8d, 0x1f, 0x0b, 0xb6, 0x37,
2513 0x63, 0x9b, 0xa1, 0xfe, 0x43, 0x5b, 0x73, 0xa2, 0x5b, 0xce, 0x53, 0x61,
2514 0x05, 0x1f, 0x75, 0x35, 0xf1, 0x71, 0x5b, 0xf6, 0x60, 0x1e, 0xcc, 0x62,
2515 0xae, 0xca, 0xe3, 0x4f, 0xc0, 0xc0, 0xfd, 0xe1, 0x42, 0xc3, 0xbc, 0x29,
2516 0x84, 0x74, 0x30, 0x0a, 0x22, 0x69, 0x10, 0x3d, 0xb6, 0x7c, 0x54, 0xc7,
2517 0x54, 0xe2, 0xaf, 0x3a, 0xee, 0xa3, 0x05, 0xd4, 0x89, 0xa2, 0xc3, 0xa1,
2518 0x51, 0x45, 0x25, 0x8e, 0xc5, 0x5a, 0xc8, 0x75, 0x50, 0xd9, 0x98, 0x67,
2519 0x3c, 0xd2, 0xfa, 0x96, 0x6a, 0xaa, 0x1b, 0x0a, 0x29, 0x15, 0xfe, 0xd0,
2520 0xbb, 0x1a, 0xf5, 0xa4, 0xcd, 0xbe, 0xce, 0xa2, 0x3e, 0x0c, 0x03, 0x9c,
2521 0xab, 0x3a, 0x34, 0xe2, 0x0e, 0x0e, 0xa0, 0xb3, 0x9a, 0x2a, 0x3f, 0xa2,
2522 0x1e, 0xd3, 0x33, 0x38, 0x42, 0x6e, 0x65, 0xf8, 0xda, 0xfa, 0x90, 0x73,
2523 0xa5, 0x66, 0x84, 0xe0, 0xfe, 0x99, 0xe9, 0xc1, 0x94, 0x24, 0x04, 0x7f,
2524 0x05, 0xda, 0xc7, 0xcd, 0xce, 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00,
2525 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x04,
2526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2527 };
2528 WOLFSSL_CTX *ctx_c = NULL;
2529 WOLFSSL *ssl_c = NULL;
2530 struct test_memio_ctx test_ctx;
2531
2532 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2533
2534 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, NULL, &ssl_c, NULL,
2535 wolfDTLSv1_2_client_method, NULL), 0);
2536
2537 /* start handshake, send first ClientHello */
2538 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2539 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2540 ExpectIntEQ(test_memio_inject_message(&test_ctx, 1,
2541 (const char*)certreq_before_cert_bin,
2542 sizeof(certreq_before_cert_bin)), 0);
2543 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2544 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), OUT_OF_ORDER_E);
2545
2546 wolfSSL_free(ssl_c);
2547 wolfSSL_CTX_free(ctx_c);
2548#endif
2549 return EXPECT_RESULT();
2550}
2551
2552#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
2553struct {
2554 struct test_memio_ctx* test_ctx;
2555 WOLFSSL* ssl_s;
2556 int fd;
2557 SOCKADDR_S peer_addr;
2558} test_memio_wolfio_ctx;
2559
2560static ssize_t test_memio_wolfio_recvfrom(int sockfd, void* buf,
2561 size_t len, int flags, void* src_addr, void* addrlen)
2562{
2563 int ret;
2564 (void)flags;
2565 if (sockfd != test_memio_wolfio_ctx.fd) {
2566 errno = EINVAL;
2567 return -1;
2568 }
2569 ret = test_memio_read_cb(test_memio_wolfio_ctx.ssl_s,
2570 (char*)buf, (int)len, test_memio_wolfio_ctx.test_ctx);
2571 if (ret <= 0) {
2572 if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ))
2573 errno = EAGAIN;
2574 else
2575 errno = EINVAL;
2576 return -1;
2577 }
2578 XMEMCPY(src_addr, &test_memio_wolfio_ctx.peer_addr,
2579 MIN(sizeof(test_memio_wolfio_ctx.peer_addr),
2580 *(word32*)addrlen));
2581 *(word32*)addrlen = sizeof(test_memio_wolfio_ctx.peer_addr);
2582 return ret;
2583}
2584
2585static ssize_t test_memio_wolfio_sendto(int sockfd, const void* buf,
2586 size_t len, int flags, const void* dest_addr, word32 addrlen)
2587{
2588 int ret;
2589 (void) flags;
2590 (void) dest_addr;
2591 (void) addrlen;
2592 if (sockfd != test_memio_wolfio_ctx.fd) {
2593 errno = EINVAL;
2594 return -1;
2595 }
2596 if (dest_addr != NULL && addrlen != 0 &&
2597 (sizeof(test_memio_wolfio_ctx.peer_addr) != addrlen ||
2598 XMEMCMP(dest_addr, &test_memio_wolfio_ctx.peer_addr,
2599 addrlen) != 0)) {
2600 errno = EINVAL;
2601 return -1;
2602 }
2603 ret = test_memio_write_cb(test_memio_wolfio_ctx.ssl_s, (char*)buf,
2604 (int)len, test_memio_wolfio_ctx.test_ctx);
2605 if (ret <= 0) {
2606 if (ret == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_WRITE))
2607 errno = EAGAIN;
2608 else
2609 errno = EINVAL;
2610 return -1;
2611 }
2612 return ret;
2613}
2614#endif
2615
2616/* Test stateless API with wolfio */
2617int test_dtls_memio_wolfio(void)
2618{
2619 EXPECT_DECLS;
2620#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
2621 size_t i;
2622 struct {
2623 method_provider client_meth;
2624 method_provider server_meth;
2625 } params[] = {
2626#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2627 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method },
2628#endif
2629#if !defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_DTLS)
2630 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method },
2631#endif
2632#if !defined(NO_OLD_TLS) && defined(WOLFSSL_DTLS)
2633 { wolfDTLSv1_client_method, wolfDTLSv1_server_method },
2634#endif
2635 };
2636 XMEMSET(&test_memio_wolfio_ctx, 0, sizeof(test_memio_wolfio_ctx));
2637 for (i = 0; i < XELEM_CNT(params) && !EXPECT_FAIL(); i++) {
2638 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2639 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2640 struct test_memio_ctx test_ctx;
2641
2642 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2643
2644 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2645 params[i].client_meth, params[i].server_meth), 0);
2646
2647 test_memio_wolfio_ctx.test_ctx = &test_ctx;
2648 test_memio_wolfio_ctx.ssl_s = ssl_s;
2649 /* Large number to error out if any syscalls are called with it */
2650 test_memio_wolfio_ctx.fd = 6000;
2651 XMEMSET(&test_memio_wolfio_ctx.peer_addr, 0,
2652 sizeof(test_memio_wolfio_ctx.peer_addr));
2653 test_memio_wolfio_ctx.peer_addr.ss_family = AF_INET;
2654
2655 wolfSSL_dtls_set_using_nonblock(ssl_s, 1);
2656 wolfSSL_SetRecvFrom(ssl_s, test_memio_wolfio_recvfrom);
2657 wolfSSL_SetSendTo(ssl_s, test_memio_wolfio_sendto);
2658 /* Restore default functions */
2659 wolfSSL_SSLSetIORecv(ssl_s, EmbedReceiveFrom);
2660 wolfSSL_SSLSetIOSend(ssl_s, EmbedSendTo);
2661 ExpectIntEQ(wolfSSL_set_fd(ssl_s, test_memio_wolfio_ctx.fd),
2662 WOLFSSL_SUCCESS);
2663
2664 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2665
2666 wolfSSL_free(ssl_s);
2667 wolfSSL_free(ssl_c);
2668 wolfSSL_CTX_free(ctx_s);
2669 wolfSSL_CTX_free(ctx_c);
2670 }
2671#endif
2672 return EXPECT_RESULT();
2673}
2674
2675/* DTLS using stateless API handling new addresses with wolfio */
2676int test_dtls_memio_wolfio_stateless(void)
2677{
2678 EXPECT_DECLS;
2679#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS)
2680 size_t i, j;
2681 struct {
2682 method_provider client_meth;
2683 method_provider server_meth;
2684 } params[] = {
2685#if defined(WOLFSSL_TLS13) && defined(WOLFSSL_DTLS13)
2686 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method },
2687#endif
2688#if !defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_DTLS)
2689 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method },
2690#endif
2691#if !defined(NO_OLD_TLS) && defined(WOLFSSL_DTLS)
2692 { wolfDTLSv1_client_method, wolfDTLSv1_server_method },
2693#endif
2694 };
2695 XMEMSET(&test_memio_wolfio_ctx, 0, sizeof(test_memio_wolfio_ctx));
2696 for (i = 0; i < XELEM_CNT(params) && !EXPECT_FAIL(); i++) {
2697 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2698 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2699 struct test_memio_ctx test_ctx;
2700 char chBuf[1000];
2701 int chSz = sizeof(chBuf);
2702
2703 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2704
2705 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2706 params[i].client_meth, params[i].server_meth), 0);
2707
2708 test_memio_wolfio_ctx.test_ctx = &test_ctx;
2709 test_memio_wolfio_ctx.ssl_s = ssl_s;
2710 /* Large number to error out if any syscalls are called with it */
2711 test_memio_wolfio_ctx.fd = 6000;
2712 XMEMSET(&test_memio_wolfio_ctx.peer_addr, 0,
2713 sizeof(test_memio_wolfio_ctx.peer_addr));
2714 test_memio_wolfio_ctx.peer_addr.ss_family = AF_INET;
2715
2716 wolfSSL_dtls_set_using_nonblock(ssl_s, 1);
2717 wolfSSL_SetRecvFrom(ssl_s, test_memio_wolfio_recvfrom);
2718 /* Restore default functions */
2719 wolfSSL_SSLSetIORecv(ssl_s, EmbedReceiveFrom);
2720 ExpectIntEQ(wolfSSL_set_read_fd(ssl_s, test_memio_wolfio_ctx.fd),
2721 WOLFSSL_SUCCESS);
2722
2723 /* start handshake, send first ClientHello */
2724 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2725 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2726 ExpectIntEQ(test_memio_copy_message(&test_ctx, 0, chBuf, &chSz, 0), 0);
2727 ExpectIntGT(chSz, 0);
2728 test_memio_clear_buffer(&test_ctx, 0);
2729
2730 /* Send CH from different addresses */
2731 for (j = 0; j < 10 && !EXPECT_FAIL(); j++,
2732 (((SOCKADDR_IN*)&test_memio_wolfio_ctx.peer_addr))->sin_port++) {
2733 const char* hrrBuf = NULL;
2734 int hrrSz = 0;
2735 ExpectIntEQ(test_memio_inject_message(&test_ctx, 0, chBuf, chSz), 0);
2736 ExpectIntEQ(wolfDTLS_accept_stateless(ssl_s), 0);
2737 ExpectIntEQ(test_memio_get_message(&test_ctx, 1, &hrrBuf, &hrrSz, 0), 0);
2738 ExpectNotNull(hrrBuf);
2739 ExpectIntGT(hrrSz, 0);
2740 test_memio_clear_buffer(&test_ctx, 0);
2741 }
2742 test_memio_clear_buffer(&test_ctx, 1);
2743 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_c), 1);
2744 ExpectIntEQ(wolfDTLS_accept_stateless(ssl_s), 0);
2745 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2746 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2747 ExpectIntEQ(wolfDTLS_accept_stateless(ssl_s), 1);
2748
2749 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2750
2751 wolfSSL_free(ssl_s);
2752 wolfSSL_free(ssl_c);
2753 wolfSSL_CTX_free(ctx_s);
2754 wolfSSL_CTX_free(ctx_c);
2755 }
2756#endif
2757 return EXPECT_RESULT();
2758}
2759
2760int test_dtls_mtu_split_messages(void)
2761{
2762#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
2763 defined(WOLFSSL_DTLS_MTU) && defined(WOLFSSL_NO_DTLS_SIZE_CHECK) && \
2764 defined(HAVE_AESGCM) && defined(HAVE_ECC)
2765 EXPECT_DECLS;
2766 struct {
2767 method_provider client_meth;
2768 method_provider server_meth;
2769 const char* cipher;
2770 } params[] = {
2771#if defined(WOLFSSL_DTLS13) && defined(WOLFSSL_TLS13)
2772 { wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method,
2773 "TLS13-AES128-GCM-SHA256" },
2774#endif
2775#if defined(WOLFSSL_DTLS) && !defined(WOLFSSL_NO_TLS12)
2776 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
2777 "ECDHE-RSA-AES128-GCM-SHA256" },
2778#if !defined(WOLFSSL_AEAD_ONLY) && !defined(NO_AES) && !defined(NO_SHA)
2779 /* Block cipher test */
2780 { wolfDTLSv1_2_client_method, wolfDTLSv1_2_server_method,
2781 "ECDHE-RSA-AES128-SHA" },
2782#endif
2783#endif
2784 };
2785 size_t i;
2786
2787 for (i = 0; i < XELEM_CNT(params) && EXPECT_SUCCESS(); i++) {
2788 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2789 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2790 struct test_memio_ctx test_ctx;
2791 /* Payload larger than typical MTU to force splitting */
2792 unsigned char payload[200];
2793 unsigned char readBuf[200];
2794 word16 mtu;
2795 int recordLen;
2796 int overhead;
2797 int totalRead;
2798 int ret;
2799 int j;
2800
2801 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2802 XMEMSET(payload, 'A', sizeof(payload));
2803
2804 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2805 params[i].client_meth, params[i].server_meth),
2806 0);
2807
2808 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_c, params[i].cipher), 1);
2809 ExpectIntEQ(wolfSSL_set_cipher_list(ssl_s, params[i].cipher), 1);
2810
2811 /* Complete handshake and clear any leftover records. */
2812 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2813 test_memio_clear_buffer(&test_ctx, 1);
2814 test_memio_clear_buffer(&test_ctx, 0);
2815
2816 /* Measure application-data record overhead with small payload. */
2817 ExpectIntEQ(wolfSSL_write(ssl_c, payload, 32), 32);
2818 ExpectIntEQ(test_ctx.s_msg_count, 1);
2819 recordLen = test_ctx.s_len;
2820 ExpectIntGT(recordLen, 32);
2821 overhead = recordLen - 32;
2822
2823 /* Reset buffers before MTU-limited send. */
2824 test_memio_clear_buffer(&test_ctx, 0);
2825 test_memio_clear_buffer(&test_ctx, 1);
2826
2827 /* Set MTU to allow only ~50 bytes of payload per record.
2828 * This ensures a 200-byte payload must be split into multiple msgs. */
2829 mtu = (word16)(overhead + 50);
2830 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_c, mtu), WOLFSSL_SUCCESS);
2831 ExpectIntEQ(wolfSSL_dtls_set_mtu(ssl_s, mtu), WOLFSSL_SUCCESS);
2832
2833 /* Write payload larger than MTU allows in single record.
2834 * With WOLFSSL_NO_DTLS_SIZE_CHECK, this should split into multiple
2835 * messages instead of returning DTLS_SIZE_ERROR. */
2836 ExpectIntEQ(wolfSSL_write(ssl_c, payload, (int)sizeof(payload)),
2837 (int)sizeof(payload));
2838
2839 /* Verify multiple messages were sent */
2840 ExpectIntGT(test_ctx.s_msg_count, 1);
2841
2842 /* Each record should fit within MTU */
2843 for (j = 0; j < test_ctx.s_msg_count && EXPECT_SUCCESS(); j++) {
2844 ExpectIntLE(test_ctx.s_msg_sizes[j], mtu);
2845 }
2846
2847 /* Read all data on server side and verify it matches */
2848 totalRead = 0;
2849 while (totalRead < (int)sizeof(payload) && EXPECT_SUCCESS()) {
2850 ret = wolfSSL_read(ssl_s, readBuf + totalRead,
2851 (int)sizeof(readBuf) - totalRead);
2852 if (ret > 0) {
2853 totalRead += ret;
2854 }
2855 else {
2856 break;
2857 }
2858 }
2859 ExpectIntEQ(totalRead, (int)sizeof(payload));
2860 ExpectIntEQ(XMEMCMP(payload, readBuf, sizeof(payload)), 0);
2861
2862 wolfSSL_free(ssl_c);
2863 wolfSSL_CTX_free(ctx_c);
2864 wolfSSL_free(ssl_s);
2865 wolfSSL_CTX_free(ctx_s);
2866 }
2867 return EXPECT_RESULT();
2868#else
2869 return TEST_SKIPPED;
2870#endif
2871}
2872
2873/* Test DTLS 1.3 minimum retransmission interval. This test calls
2874 * wolfSSL_dtls_got_timeout() to simulate timeouts and verify that
2875 * retransmissions are spaced at least DTLS13_MIN_RTX_INTERVAL apart.
2876 * This tests relies on timing of the retransmission logic so it may be
2877 * flaky on very slow systems.
2878 */
2879int test_dtls13_min_rtx_interval(void)
2880{
2881 EXPECT_DECLS;
2882#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && \
2883 defined(WOLFSSL_DTLS13) && !defined(DTLS13_MIN_RTX_INTERVAL) && \
2884 !defined(NO_ASN_TIME)
2885 /* We don't want to test when DTLS13_MIN_RTX_INTERVAL is defined because
2886 * it may be too low to trigger reliably in a test. The default value is
2887 * 1 second which is sufficient for testing here. */
2888 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2889 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2890 struct test_memio_ctx test_ctx;
2891 int c_msg_count = 0;
2892
2893 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2894
2895 /* Setup DTLS 1.3 contexts */
2896 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2897 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
2898
2899 /* CH0 */
2900 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2901 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
2902
2903 /* HRR */
2904 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2905 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
2906
2907 /* CH1 */
2908 ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
2909 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
2910
2911 /* SH ... FINISHED */
2912 ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
2913 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
2914
2915 /* We should have SH ... FINISHED messages in the buffer */
2916 ExpectIntGE(test_ctx.c_msg_count, 2);
2917
2918 /* Drop everything */
2919 test_memio_clear_buffer(&test_ctx, 1);
2920
2921 /* First timeout. This one should trigger a retransmission */
2922 if (wolfSSL_dtls13_use_quick_timeout(ssl_s))
2923 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), WOLFSSL_SUCCESS);
2924 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), WOLFSSL_SUCCESS);
2925 /* Save the message count to make sure no new messages are sent */
2926 ExpectIntGE(test_ctx.c_msg_count, 2);
2927 c_msg_count = test_ctx.c_msg_count;
2928
2929 /* Second timeout. This one should not trigger a retransmission */
2930 if (wolfSSL_dtls13_use_quick_timeout(ssl_s))
2931 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), WOLFSSL_SUCCESS);
2932 ExpectIntEQ(wolfSSL_dtls_got_timeout(ssl_s), WOLFSSL_SUCCESS);
2933 /* This is the critical check. The message count should not increase
2934 * after the second timeout. DTLS13_MIN_RTX_INTERVAL should have blocked
2935 * retransmission here. */
2936 ExpectIntEQ(c_msg_count, test_ctx.c_msg_count);
2937
2938 /* Now complete the handshake. We didn't clear the first retransmission
2939 * so the handshake should proceed without issues. */
2940 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2941
2942 /* Cleanup */
2943 wolfSSL_free(ssl_c);
2944 wolfSSL_CTX_free(ctx_c);
2945 wolfSSL_free(ssl_s);
2946 wolfSSL_CTX_free(ctx_s);
2947#endif
2948 return EXPECT_RESULT();
2949}
2950
2951/* RFC 9147 Section 5.3: DTLS 1.3 ServerHello must have empty
2952 * legacy_session_id_echo, even if the ClientHello had a non-empty
2953 * legacy_session_id. */
2954int test_dtls13_no_session_id_echo(void)
2955{
2956 EXPECT_DECLS;
2957#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13) && \
2958 defined(HAVE_SESSION_TICKET)
2959 struct test_memio_ctx test_ctx;
2960 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
2961 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
2962 WOLFSSL_SESSION *sess = NULL;
2963 char readBuf[1];
2964 /* Use traditional groups to avoid HRR from PQ key share mismatch */
2965 int groups[] = {
2966 WOLFSSL_ECC_SECP256R1,
2967 WOLFSSL_ECC_SECP384R1,
2968 };
2969
2970 /* First connection: complete a DTLS 1.3 handshake to get a session */
2971 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
2972 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
2973 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
2974 ExpectIntEQ(wolfSSL_set_groups(ssl_c, groups, 2), WOLFSSL_SUCCESS);
2975 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
2976
2977 /* Read to process any NewSessionTicket */
2978 ExpectIntEQ(wolfSSL_read(ssl_c, readBuf, sizeof(readBuf)), -1);
2979 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
2980
2981 ExpectNotNull(sess = wolfSSL_get1_session(ssl_c));
2982
2983 /* Ensure the session has a non-empty session ID so the ClientHello
2984 * will have a populated legacy_session_id field (which is legal per
2985 * RFC 9147). */
2986 if (sess != NULL && sess->sessionIDSz == 0) {
2987 sess->sessionIDSz = ID_LEN;
2988 XMEMSET(sess->sessionID, 0x42, ID_LEN);
2989 }
2990
2991 wolfSSL_free(ssl_c); ssl_c = NULL;
2992 wolfSSL_free(ssl_s); ssl_s = NULL;
2993 wolfSSL_CTX_free(ctx_c); ctx_c = NULL;
2994 wolfSSL_CTX_free(ctx_s); ctx_s = NULL;
2995
2996 /* Second connection: set the session on the client so the ClientHello
2997 * contains a non-empty legacy_session_id. Verify the server does NOT
2998 * echo it in the ServerHello. */
2999 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
3000 ExpectIntEQ(test_memio_setup(&test_ctx, &ctx_c, &ctx_s, &ssl_c, &ssl_s,
3001 wolfDTLSv1_3_client_method, wolfDTLSv1_3_server_method), 0);
3002 ExpectIntEQ(wolfSSL_set_session(ssl_c, sess), WOLFSSL_SUCCESS);
3003 /* Use traditional groups to avoid HRR from key share mismatch */
3004 ExpectIntEQ(wolfSSL_set_groups(ssl_c, groups, 2), WOLFSSL_SUCCESS);
3005 /* Disable HRR cookie so the server directly sends a ServerHello */
3006 ExpectIntEQ(wolfSSL_disable_hrr_cookie(ssl_s), WOLFSSL_SUCCESS);
3007
3008 /* Client sends ClientHello (with non-empty legacy_session_id) */
3009 ExpectIntEQ(wolfSSL_negotiate(ssl_c), -1);
3010 ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), WOLFSSL_ERROR_WANT_READ);
3011
3012 /* Server processes ClientHello and sends ServerHello + flight */
3013 ExpectIntEQ(wolfSSL_negotiate(ssl_s), -1);
3014 ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
3015
3016 /* Verify the ServerHello on the wire.
3017 * Layout: DTLS Record Header (13) + DTLS Handshake Header (12) +
3018 * ProtocolVersion (2) + Random (32) = offset 59 for
3019 * legacy_session_id_echo length byte. */
3020 ExpectIntGE(test_ctx.c_len, 60);
3021 ExpectIntEQ(test_ctx.c_buff[0], handshake);
3022 ExpectIntEQ(test_ctx.c_buff[DTLS_RECORD_HEADER_SZ], server_hello);
3023 ExpectIntEQ(test_ctx.c_buff[DTLS_RECORD_HEADER_SZ +
3024 DTLS_HANDSHAKE_HEADER_SZ + OPAQUE16_LEN + RAN_LEN], 0);
3025
3026 /* Complete the handshake */
3027 ExpectIntEQ(test_memio_do_handshake(ssl_c, ssl_s, 10, NULL), 0);
3028
3029 wolfSSL_SESSION_free(sess);
3030 wolfSSL_free(ssl_c);
3031 wolfSSL_free(ssl_s);
3032 wolfSSL_CTX_free(ctx_c);
3033 wolfSSL_CTX_free(ctx_s);
3034#endif
3035 return EXPECT_RESULT();
3036}
3037
3038/* Test that a DTLS 1.3 handshake with an oversized certificate chain does
3039 * not crash or cause out-of-bounds access in SendTls13Certificate. */
3040int test_dtls13_oversized_cert_chain(void)
3041{
3042 EXPECT_DECLS;
3043#if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES) && defined(WOLFSSL_DTLS13) \
3044 && !defined(NO_FILESYSTEM) && !defined(NO_RSA)
3045 WOLFSSL_CTX *ctx_c = NULL, *ctx_s = NULL;
3046 WOLFSSL *ssl_c = NULL, *ssl_s = NULL;
3047 struct test_memio_ctx test_ctx;
3048 XFILE f = XBADFILE;
3049 long sz = 0;
3050 byte *cert = NULL;
3051 byte *chain = NULL;
3052 int copies, off, i;
3053
3054 XMEMSET(&test_ctx, 0, sizeof(test_ctx));
3055
3056 /* Read server cert */
3057 f = XFOPEN(svrCertFile, "rb");
3058 ExpectTrue(f != XBADFILE);
3059 if (EXPECT_SUCCESS()) {
3060 (void)XFSEEK(f, 0, XSEEK_END);
3061 sz = XFTELL(f);
3062 (void)XFSEEK(f, 0, XSEEK_SET);
3063 }
3064 ExpectTrue(sz > 0);
3065 cert = (byte*)XMALLOC((size_t)(sz + 1), NULL, DYNAMIC_TYPE_TMP_BUFFER);
3066 ExpectNotNull(cert);
3067 if (EXPECT_SUCCESS())
3068 ExpectIntEQ((int)XFREAD(cert, 1, (size_t)sz, f), (int)sz);
3069 if (f != XBADFILE)
3070 XFCLOSE(f);
3071
3072 /* Build an oversized chain by duplicating the cert */
3073 copies = EXPECT_SUCCESS() ? (int)(70000 / sz) + 2 : 0;
3074 chain = (byte*)XMALLOC((size_t)(sz * copies + 1), NULL,
3075 DYNAMIC_TYPE_TMP_BUFFER);
3076 ExpectNotNull(chain);
3077 off = 0;
3078 if (EXPECT_SUCCESS()) {
3079 for (i = 0; i < copies; i++) {
3080 XMEMCPY(chain + off, cert, (size_t)sz);
3081 off += (int)sz;
3082 }
3083 }
3084
3085 /* Server context: load the oversized chain */
3086 ExpectNotNull(ctx_s = wolfSSL_CTX_new(wolfDTLSv1_3_server_method()));
3087 ExpectIntEQ(wolfSSL_CTX_use_certificate_chain_buffer(ctx_s,
3088 chain, (long)off), WOLFSSL_SUCCESS);
3089 ExpectIntEQ(wolfSSL_CTX_use_PrivateKey_file(ctx_s, svrKeyFile,
3090 WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS);
3091 if (EXPECT_SUCCESS()) {
3092 wolfSSL_SetIORecv(ctx_s, test_memio_read_cb);
3093 wolfSSL_SetIOSend(ctx_s, test_memio_write_cb);
3094 }
3095
3096 /* Client context: no verification (chain certs are duplicates) */
3097 ExpectNotNull(ctx_c = wolfSSL_CTX_new(wolfDTLSv1_3_client_method()));
3098 if (EXPECT_SUCCESS()) {
3099 wolfSSL_CTX_set_verify(ctx_c, WOLFSSL_VERIFY_NONE, NULL);
3100 wolfSSL_SetIORecv(ctx_c, test_memio_read_cb);
3101 wolfSSL_SetIOSend(ctx_c, test_memio_write_cb);
3102 }
3103
3104 ExpectNotNull(ssl_s = wolfSSL_new(ctx_s));
3105 if (EXPECT_SUCCESS()) {
3106 wolfSSL_SetIOWriteCtx(ssl_s, &test_ctx);
3107 wolfSSL_SetIOReadCtx(ssl_s, &test_ctx);
3108 }
3109
3110 ExpectNotNull(ssl_c = wolfSSL_new(ctx_c));
3111 if (EXPECT_SUCCESS()) {
3112 wolfSSL_SetIOWriteCtx(ssl_c, &test_ctx);
3113 wolfSSL_SetIOReadCtx(ssl_c, &test_ctx);
3114 }
3115
3116 /* Handshake must not crash. If SendTls13Certificate mishandles the
3117 * oversized chain this will trigger a wild pointer dereference or stack
3118 * overflow resulting with the test failing.
3119 * The correct behaviour either returns BUFFER_E or succeeds
3120 * if the build config truncated the chain during loading. */
3121 (void)test_memio_do_handshake(ssl_c, ssl_s, 10, NULL);
3122
3123 wolfSSL_free(ssl_c);
3124 wolfSSL_free(ssl_s);
3125 wolfSSL_CTX_free(ctx_c);
3126 wolfSSL_CTX_free(ctx_s);
3127 XFREE(cert, NULL, DYNAMIC_TYPE_TMP_BUFFER);
3128 XFREE(chain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
3129#endif
3130 return EXPECT_RESULT();
3131}