1c0341432SJohn Baldwin.\" Copyright (c) 2020, Chelsio Inc 2c0341432SJohn Baldwin.\" 3c0341432SJohn Baldwin.\" Redistribution and use in source and binary forms, with or without 4c0341432SJohn Baldwin.\" modification, are permitted provided that the following conditions are met: 5c0341432SJohn Baldwin.\" 6c0341432SJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright notice, 7c0341432SJohn Baldwin.\" this list of conditions and the following disclaimer. 8c0341432SJohn Baldwin.\" 9c0341432SJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright 10c0341432SJohn Baldwin.\" notice, this list of conditions and the following disclaimer in the 11c0341432SJohn Baldwin.\" documentation and/or other materials provided with the distribution. 12c0341432SJohn Baldwin.\" 13c0341432SJohn Baldwin.\" 3. Neither the name of the Chelsio Inc nor the names of its 14c0341432SJohn Baldwin.\" contributors may be used to endorse or promote products derived from 15c0341432SJohn Baldwin.\" this software without specific prior written permission. 16c0341432SJohn Baldwin.\" 17c0341432SJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18c0341432SJohn Baldwin.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19c0341432SJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20c0341432SJohn Baldwin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21c0341432SJohn Baldwin.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22c0341432SJohn Baldwin.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23c0341432SJohn Baldwin.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24c0341432SJohn Baldwin.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25c0341432SJohn Baldwin.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26c0341432SJohn Baldwin.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27c0341432SJohn Baldwin.\" POSSIBILITY OF SUCH DAMAGE. 28c0341432SJohn Baldwin.\" 29c0341432SJohn Baldwin.\" * Other names and brands may be claimed as the property of others. 30c0341432SJohn Baldwin.\" 31c0341432SJohn Baldwin.\" $FreeBSD$ 32c0341432SJohn Baldwin.\" 33*29fe41ddSJohn Baldwin.Dd April 20, 2020 34c0341432SJohn Baldwin.Dt CRYPTO_DRIVER 9 35c0341432SJohn Baldwin.Os 36c0341432SJohn Baldwin.Sh NAME 37c0341432SJohn Baldwin.Nm crypto_driver 38c0341432SJohn Baldwin.Nd interface for symmetric cryptographic drivers 39c0341432SJohn Baldwin.Sh SYNOPSIS 40c0341432SJohn Baldwin.In opencrypto/cryptodev.h 41c0341432SJohn Baldwin.Ft int 42c0341432SJohn Baldwin.Fo crypto_apply 43c0341432SJohn Baldwin.Fa "struct cryptop *crp" 44c0341432SJohn Baldwin.Fa "int off" 45c0341432SJohn Baldwin.Fa "int len" 46c0341432SJohn Baldwin.Fa "int (*f)(void *, void *, u_int)" 47c0341432SJohn Baldwin.Fa "void *arg" 48c0341432SJohn Baldwin.Fc 49c0341432SJohn Baldwin.Ft void * 50c0341432SJohn Baldwin.Fo crypto_contiguous_subsegment 51c0341432SJohn Baldwin.Fa "struct cryptop *crp" 52c0341432SJohn Baldwin.Fa "size_t skip" 53c0341432SJohn Baldwin.Fa "size_t len" 54c0341432SJohn Baldwin.Fc 55c0341432SJohn Baldwin.Ft void 56c0341432SJohn Baldwin.Fn crypto_copyback "struct cryptop *crp" "int off" "int size" "const void *src" 57c0341432SJohn Baldwin.Ft void 58c0341432SJohn Baldwin.Fn crypto_copydata "struct cryptop *crp" "int off" "int size" "void *dst" 59c0341432SJohn Baldwin.Ft void 60c0341432SJohn Baldwin.Fn crypto_done "struct cryptop *crp" 61c0341432SJohn Baldwin.Ft int32_t 62c0341432SJohn Baldwin.Fn crypto_get_driverid "device_t dev" "size_t session_size" "int flags" 63c0341432SJohn Baldwin.Ft void * 64c0341432SJohn Baldwin.Fn crypto_get_driver_session "crypto_session_t crypto_session" 65*29fe41ddSJohn Baldwin.Ft void 66*29fe41ddSJohn Baldwin.Fn crypto_read_iv "struct cryptop *crp" "void *iv" 67c0341432SJohn Baldwin.Ft int 68c0341432SJohn Baldwin.Fn crypto_unblock "uint32_t driverid" "int what" 69c0341432SJohn Baldwin.Ft int 70c0341432SJohn Baldwin.Fn crypto_unregister_all "uint32_t driverid" 71c0341432SJohn Baldwin.Ft int 72c0341432SJohn Baldwin.Fn CRYPTODEV_FREESESSION "device_t dev" "crypto_session_t crypto_session" 73c0341432SJohn Baldwin.Ft int 74c0341432SJohn Baldwin.Fo CRYPTODEV_NEWSESSION 75c0341432SJohn Baldwin.Fa "device_t dev" 76c0341432SJohn Baldwin.Fa "crypto_session_t crypto_session" 77c0341432SJohn Baldwin.Fa "const struct crypto_session_params *csp" 78c0341432SJohn Baldwin.Fc 79c0341432SJohn Baldwin.Ft int 80c0341432SJohn Baldwin.Fo CRYPTODEV_PROBESESSION 81c0341432SJohn Baldwin.Fa "device_t dev" 82c0341432SJohn Baldwin.Fa "const struct crypto_session_params *csp" 83c0341432SJohn Baldwin.Fc 84c0341432SJohn Baldwin.Ft int 85c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS "device_t dev" "struct cryptop *crp" "int flags" 86c0341432SJohn Baldwin.Ft void 87c0341432SJohn Baldwin.Fo hmac_init_ipad 88c0341432SJohn Baldwin.Fa "struct auth_hash *axf" 89c0341432SJohn Baldwin.Fa "const char *key" 90c0341432SJohn Baldwin.Fa "int klen" 91c0341432SJohn Baldwin.Fa "void *auth_ctx" 92c0341432SJohn Baldwin.Fc 93c0341432SJohn Baldwin.Ft void 94c0341432SJohn Baldwin.Fo hmac_init_opad 95c0341432SJohn Baldwin.Fa "struct auth_hash *axf" 96c0341432SJohn Baldwin.Fa "const char *key" 97c0341432SJohn Baldwin.Fa "int klen" 98c0341432SJohn Baldwin.Fa "void *auth_ctx" 99c0341432SJohn Baldwin.Fc 100c0341432SJohn Baldwin.Sh DESCRIPTION 101c0341432SJohn BaldwinSymmetric cryptographic drivers process cryptographic requests 102c0341432SJohn Baldwinsubmitted to sessions associated with the driver. 103c0341432SJohn Baldwin.Pp 104c0341432SJohn BaldwinCryptographic drivers call 105c0341432SJohn Baldwin.Fn crypto_get_driverid 106c0341432SJohn Baldwinto register with the cryptographic framework. 107c0341432SJohn Baldwin.Fa dev 108c0341432SJohn Baldwinis the device used to service requests. 109c0341432SJohn BaldwinThe 110c0341432SJohn Baldwin.Fn CRYPTODEV 111c0341432SJohn Baldwinmethods are defined in the method table for the device driver attached to 112c0341432SJohn Baldwin.Fa dev . 113c0341432SJohn Baldwin.Fa session_size 114c0341432SJohn Baldwinspecifies the size of a driver-specific per-session structure allocated by 115c0341432SJohn Baldwinthe cryptographic framework. 116c0341432SJohn Baldwin.Fa flags 117c0341432SJohn Baldwinis a bitmask of properties about the driver. 118c0341432SJohn BaldwinExactly one of 119c0341432SJohn Baldwin.Dv CRYPTOCAP_F_SOFTWARE 120c0341432SJohn Baldwinor 121c0341432SJohn Baldwin.Dv CRYPTOCAP_F_HARDWARE 122c0341432SJohn Baldwinmust be specified. 123c0341432SJohn Baldwin.Dv CRYPTOCAP_F_SOFTWARE 124c0341432SJohn Baldwinshould be used for drivers which process requests using host CPUs. 125c0341432SJohn Baldwin.Dv CRYPTOCAP_F_HARDWARE 126c0341432SJohn Baldwinshould be used for drivers which process requests on separate co-processors. 127c0341432SJohn Baldwin.Dv CRYPTOCAP_F_SYNC 128c0341432SJohn Baldwinshould be set for drivers which process requests synchronously in 129c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS . 130c0341432SJohn Baldwin.Fn crypto_get_driverid 131c0341432SJohn Baldwinreturns an opaque driver id. 132c0341432SJohn Baldwin.Pp 133c0341432SJohn Baldwin.Fn crypto_unregister_all 134c0341432SJohn Baldwinunregisters a driver from the cryptographic framework. 135c0341432SJohn BaldwinIf there are any pending operations or open sessions, 136c0341432SJohn Baldwinthis function will sleep. 137c0341432SJohn Baldwin.Fa driverid 138c0341432SJohn Baldwinis the value returned by an earlier call to 139c0341432SJohn Baldwin.Fn crypto_get_driverid . 140c0341432SJohn Baldwin.Pp 141c0341432SJohn BaldwinWhen a new session is created by 142c0341432SJohn Baldwin.Fn crypto_newsession , 143c0341432SJohn Baldwin.Fn CRYPTODEV_PROBESESSION 144c0341432SJohn Baldwinis invoked by the cryptographic framework on each active driver to 145c0341432SJohn Baldwindetermine the best driver to use for the session. 146c0341432SJohn BaldwinThis method should inspect the session parameters in 147c0341432SJohn Baldwin.Fa csp . 148c0341432SJohn BaldwinIf a driver does not support requests described by 149c0341432SJohn Baldwin.Fa csp , 150c0341432SJohn Baldwinthis method should return an error value. 151c0341432SJohn BaldwinIf the driver does support requests described by 152c0341432SJohn Baldwin.Fa csp , 153c0341432SJohn Baldwinit should return a negative value. 154c0341432SJohn BaldwinThe framework prefers drivers with the largest negative value, 155c0341432SJohn Baldwinsimilar to 156c0341432SJohn Baldwin.Xr DEVICE_PROBE 9 . 157c0341432SJohn BaldwinThe following values are defined for non-error return values from this 158c0341432SJohn Baldwinmethod: 159c0341432SJohn Baldwin.Bl -tag -width "CRYPTODEV_PROBE_ACCEL_SOFTWARE" 160c0341432SJohn Baldwin.It Dv CRYPTODEV_PROBE_HARDWARE 161c0341432SJohn BaldwinThe driver processes requests via a co-processor. 162c0341432SJohn Baldwin.It Dv CRYPTODEV_PROBE_ACCEL_SOFTWARE 163c0341432SJohn BaldwinThe driver processes requests on the host CPU using optimized instructions 164c0341432SJohn Baldwinsuch as AES-NI. 165c0341432SJohn Baldwin.It Dv CRYPTODEV_PROBE_SOFTWARE 166c0341432SJohn BaldwinThe driver processes requests on the host CPU. 167c0341432SJohn Baldwin.El 168c0341432SJohn Baldwin.Pp 169c0341432SJohn BaldwinThis method should not sleep. 170c0341432SJohn Baldwin.Pp 171c0341432SJohn BaldwinOnce the framework has chosen a driver for a session, 172c0341432SJohn Baldwinthe framework invokes the 173c0341432SJohn Baldwin.Fn CRYPTODEV_NEWSESSION 174c0341432SJohn Baldwinmethod to initialize driver-specific session state. 175c0341432SJohn BaldwinPrior to calling this method, 176c0341432SJohn Baldwinthe framework allocates a per-session driver-specific data structure. 177c0341432SJohn BaldwinThis structure is initialized with zeroes, 178c0341432SJohn Baldwinand its size is set by the 179c0341432SJohn Baldwin.Fa session_size 180c0341432SJohn Baldwinpassed to 181c0341432SJohn Baldwin.Fn crypto_get_driverid . 182c0341432SJohn BaldwinThis method can retrieve a pointer to this data structure by passing 183c0341432SJohn Baldwin.Fa crypto_session 184c0341432SJohn Baldwinto 185c0341432SJohn Baldwin.Fn crypto_get_driver_session . 186c0341432SJohn BaldwinSession parameters are described in 187c0341432SJohn Baldwin.Fa csp . 188c0341432SJohn Baldwin.Pp 189c0341432SJohn BaldwinThis method should not sleep. 190c0341432SJohn Baldwin.Pp 191c0341432SJohn Baldwin.Fn CRYPTODEV_FREESESSION 192c0341432SJohn Baldwinis invoked to release any driver-specific state when a session is 193c0341432SJohn Baldwindestroyed. 194c0341432SJohn BaldwinThe per-session driver-specific data structure is explicitly zeroed 195c0341432SJohn Baldwinand freed by the framework after this method returns. 196c0341432SJohn BaldwinIf a driver requires no additional tear-down steps, it can leave 197c0341432SJohn Baldwinthis method undefined. 198c0341432SJohn Baldwin.Pp 199c0341432SJohn BaldwinThis method should not sleep. 200c0341432SJohn Baldwin.Pp 201c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS 202c0341432SJohn Baldwinis invoked for each request submitted to an active session. 203c0341432SJohn BaldwinThis method can either complete a request synchronously or 204c0341432SJohn Baldwinschedule it to be completed asynchronously, 205c0341432SJohn Baldwinbut it must not sleep. 206c0341432SJohn Baldwin.Pp 207c0341432SJohn BaldwinIf this method is not able to complete a request due to insufficient 208c0341432SJohn Baldwinresources such as a full command queue, 209c0341432SJohn Baldwinit can defer the request by returning 210c0341432SJohn Baldwin.Dv ERESTART . 211c0341432SJohn BaldwinThe request will be queued by the framework and retried once the 212c0341432SJohn Baldwindriver releases pending requests via 213c0341432SJohn Baldwin.Fn crypto_unblock . 214c0341432SJohn BaldwinAny requests submitted to sessions belonging to the driver will also 215c0341432SJohn Baldwinbe queued until 216c0341432SJohn Baldwin.Fn crypto_unblock 217c0341432SJohn Baldwinis called. 218c0341432SJohn Baldwin.Pp 219c0341432SJohn BaldwinIf a driver encounters errors while processing a request, 220c0341432SJohn Baldwinit should report them via the 221c0341432SJohn Baldwin.Fa crp_etype 222c0341432SJohn Baldwinfield of 223c0341432SJohn Baldwin.Fa crp 224c0341432SJohn Baldwinrather than returning an error directly. 225c0341432SJohn Baldwin.Pp 226c0341432SJohn Baldwin.Fa flags 227c0341432SJohn Baldwinmay be set to 228c0341432SJohn Baldwin.Dv CRYPTO_HINT_MORE 229c0341432SJohn Baldwinif there are additional requests queued for this driver. 230c0341432SJohn BaldwinThe driver can use this as a hint to batch completion interrupts. 231c0341432SJohn BaldwinNote that these additional requests may be from different sessions. 232c0341432SJohn Baldwin.Pp 233c0341432SJohn Baldwin.Fn crypto_get_driver_session 234c0341432SJohn Baldwinreturns a pointer to the driver-specific per-session data structure 235c0341432SJohn Baldwinfor the session 236c0341432SJohn Baldwin.Fa crypto_session . 237c0341432SJohn BaldwinThis function can be used in the 238c0341432SJohn Baldwin.Fn CRYPTODEV_NEWSESSION , 239c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS , 240c0341432SJohn Baldwinand 241c0341432SJohn Baldwin.Fn CRYPTODEV_FREESESSION 242c0341432SJohn Baldwincallbacks. 243c0341432SJohn Baldwin.Pp 244c0341432SJohn Baldwin.Fn crypto_copydata 245c0341432SJohn Baldwincopies 246c0341432SJohn Baldwin.Fa size 247c0341432SJohn Baldwinbytes out of the data buffer for 248c0341432SJohn Baldwin.Fa crp 249c0341432SJohn Baldwininto a local buffer pointed to by 250c0341432SJohn Baldwin.Fa dst . 251c0341432SJohn BaldwinThe bytes are read starting at an offset of 252c0341432SJohn Baldwin.Fa off 253c0341432SJohn Baldwinbytes in the request's data buffer. 254c0341432SJohn Baldwin.Pp 255c0341432SJohn Baldwin.Fn crypto_copyback 256c0341432SJohn Baldwincopies 257c0341432SJohn Baldwin.Fa size 258c0341432SJohn Baldwinbytes from the local buffer pointed to by 259c0341432SJohn Baldwin.Fa src 260c0341432SJohn Baldwininto the data buffer for 261c0341432SJohn Baldwin.Fa crp . 262c0341432SJohn BaldwinThe bytes are written starting at an offset of 263c0341432SJohn Baldwin.Fa off 264c0341432SJohn Baldwinbytes in the request's data buffer. 265c0341432SJohn Baldwin.Pp 266*29fe41ddSJohn Baldwin.Fn crypto_read_iv 267*29fe41ddSJohn Baldwincopies the IV or nonce for 268*29fe41ddSJohn Baldwin.Fa crp 269*29fe41ddSJohn Baldwininto the the local buffer pointed to by 270*29fe41ddSJohn Baldwin.Fa iv . 271*29fe41ddSJohn Baldwin.Pp 272c0341432SJohn BaldwinA driver calls 273c0341432SJohn Baldwin.Fn crypto_done 274c0341432SJohn Baldwinto mark the request 275c0341432SJohn Baldwin.Fa crp 276c0341432SJohn Baldwinas completed. 277c0341432SJohn BaldwinAny errors should be set in 278c0341432SJohn Baldwin.Fa crp_etype 279c0341432SJohn Baldwinprior to calling this function. 280c0341432SJohn Baldwin.Pp 281c0341432SJohn BaldwinIf a driver defers a request by returning 282c0341432SJohn Baldwin.Dv ERESTART 283c0341432SJohn Baldwinfrom 284c0341432SJohn Baldwin.Dv CRYPTO_PROCESS , 285c0341432SJohn Baldwinthe framework will queue all requests for the driver until the driver calls 286c0341432SJohn Baldwin.Fn crypto_unblock 287c0341432SJohn Baldwinto indicate that the temporary resource shortage has been relieved. 288c0341432SJohn BaldwinFor example, 289c0341432SJohn Baldwinif a driver returns 290c0341432SJohn Baldwin.Dv ERESTART 291c0341432SJohn Baldwindue to a full command ring, 292c0341432SJohn Baldwinit would invoke 293c0341432SJohn Baldwin.Fn crypto_unblock 294c0341432SJohn Baldwinfrom a command completion interrupt that makes a command ring entry available. 295c0341432SJohn Baldwin.Fa driverid 296c0341432SJohn Baldwinis the value returned by 297c0341432SJohn Baldwin.Fn crypto_get_driverid . 298c0341432SJohn Baldwin.Fa what 299c0341432SJohn Baldwinindicates which types of requests the driver is able to handle again: 300c0341432SJohn Baldwin.Bl -tag -width "CRYPTO_ASYMQ" 301c0341432SJohn Baldwin.It Dv CRYPTO_SYMQ 302c0341432SJohn Baldwinindicates that the driver is able to handle symmetric requests passed to 303c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS . 304c0341432SJohn Baldwin.It Dv CRYPTO_ASYMQ 305c0341432SJohn Baldwinindicates that the driver is able to handle asymmetric requests passed to 306c0341432SJohn Baldwin.Fn CRYPTODEV_KPROCESS . 307c0341432SJohn Baldwin.El 308c0341432SJohn Baldwin.Pp 309c0341432SJohn Baldwin.Fn crypto_apply 310c0341432SJohn Baldwinis a helper routine that can be used to invoke a caller-supplied function 311c0341432SJohn Baldwinto a region of the data buffer for 312c0341432SJohn Baldwin.Fa crp . 313c0341432SJohn BaldwinThe function 314c0341432SJohn Baldwin.Fa f 315c0341432SJohn Baldwinis called one or more times. 316c0341432SJohn BaldwinFor each invocation, 317c0341432SJohn Baldwinthe first argument to 318c0341432SJohn Baldwin.Fa f 319c0341432SJohn Baldwinis the value of 320c0341432SJohn Baldwin.Fa arg passed to 321c0341432SJohn Baldwin.Fn crypto_apply . 322c0341432SJohn BaldwinThe second and third arguments to 323c0341432SJohn Baldwin.Fa f 324c0341432SJohn Baldwinare a pointer and length to a segment of the buffer mapped into the kernel. 325c0341432SJohn BaldwinThe function is called enough times to cover the 326c0341432SJohn Baldwin.Fa len 327c0341432SJohn Baldwinbytes of the data buffer which starts at an offset 328c0341432SJohn Baldwin.Fa off . 329c0341432SJohn BaldwinIf any invocation of 330c0341432SJohn Baldwin.Fa f 331c0341432SJohn Baldwinreturns a non-zero value, 332c0341432SJohn Baldwin.Fn crypto_apply 333c0341432SJohn Baldwinimmediately returns that value without invoking 334c0341432SJohn Baldwin.Fa f 335c0341432SJohn Baldwinon any remaining segments of the region, 336c0341432SJohn Baldwinotherwise 337c0341432SJohn Baldwin.Fn crypto_apply 338c0341432SJohn Baldwinreturns the value from the final call to 339c0341432SJohn Baldwin.Fa f . 340c0341432SJohn Baldwin.Pp 341c0341432SJohn Baldwin.Fn crypto_contiguous_subsegment 342c0341432SJohn Baldwinattempts to locate a single, virtually-contiguous segment of the data buffer 343c0341432SJohn Baldwinfor 344c0341432SJohn Baldwin.Fa crp . 345c0341432SJohn BaldwinThe segment must be 346c0341432SJohn Baldwin.Fa len 347c0341432SJohn Baldwinbytes long and start at an offset of 348c0341432SJohn Baldwin.Fa skip 349c0341432SJohn Baldwinbytes. 350c0341432SJohn BaldwinIf a segment is found, 351c0341432SJohn Baldwina pointer to the start of the segment is returned. 352c0341432SJohn BaldwinOtherwise, 353c0341432SJohn Baldwin.Dv NULL 354c0341432SJohn Baldwinis returned. 355c0341432SJohn Baldwin.Pp 356c0341432SJohn Baldwin.Fn hmac_init_ipad 357c0341432SJohn Baldwinprepares an authentication context to generate the inner hash of an HMAC. 358c0341432SJohn Baldwin.Fa axf 359c0341432SJohn Baldwinis a software implementation of an authentication algorithm such as the 360c0341432SJohn Baldwinvalue returned by 361c0341432SJohn Baldwin.Fn crypto_auth_hash . 362c0341432SJohn Baldwin.Fa key 363c0341432SJohn Baldwinis a pointer to a HMAC key of 364c0341432SJohn Baldwin.Fa klen 365c0341432SJohn Baldwinbytes. 366c0341432SJohn Baldwin.Fa auth_ctx 367c0341432SJohn Baldwinpoints to a valid authentication context for the desired algorithm. 368c0341432SJohn BaldwinThe function initializes the context with the supplied key. 369c0341432SJohn Baldwin.Pp 370c0341432SJohn Baldwin.Fn hmac_init_opad 371c0341432SJohn Baldwinis similar to 372c0341432SJohn Baldwin.Fn hmac_init_ipad 373c0341432SJohn Baldwinexcept that it prepares an authentication context to generate the 374c0341432SJohn Baldwinouter hash of an HMAC. 375c0341432SJohn Baldwin.Sh RETURN VALUES 376c0341432SJohn Baldwin.Fn crypto_apply 377c0341432SJohn Baldwinreturns the return value from the caller-supplied callback function. 378c0341432SJohn Baldwin.Pp 379c0341432SJohn Baldwin.Fn crypto_contiguous_subsegment 380c0341432SJohn Baldwinreturns a pointer to a contiguous segment or 381c0341432SJohn Baldwin.Dv NULL . 382c0341432SJohn Baldwin.Pp 383c0341432SJohn Baldwin.Fn crypto_get_driverid 384c0341432SJohn Baldwinreturns a driver identifier on success or -1 on error. 385c0341432SJohn Baldwin.Pp 386c0341432SJohn Baldwin.Fn crypto_unblock , 387c0341432SJohn Baldwin.Fn crypto_unregister_all , 388c0341432SJohn Baldwin.Fn CRYPTODEV_FREESESSION , 389c0341432SJohn Baldwin.Fn CRYPTODEV_NEWSESSION , 390c0341432SJohn Baldwinand 391c0341432SJohn Baldwin.Fn CRYPTODEV_PROCESS 392c0341432SJohn Baldwinreturn zero on success or an error on failure. 393c0341432SJohn Baldwin.Pp 394c0341432SJohn Baldwin.Fn CRYPTODEV_PROBESESSION 395c0341432SJohn Baldwinreturns a negative value on success or an error on failure. 396c0341432SJohn Baldwin.Sh SEE ALSO 397c0341432SJohn Baldwin.Xr crypto 7 , 398c0341432SJohn Baldwin.Xr crypto 9 , 399c0341432SJohn Baldwin.Xr crypto_request 9 , 400c0341432SJohn Baldwin.Xr crypto_session 9 401