xref: /freebsd/share/man/man9/crypto.9 (revision 0957b409)
1.\"	$OpenBSD: crypto.9,v 1.19 2002/07/16 06:31:57 angelos Exp $
2.\"
3.\" The author of this manual page is Angelos D. Keromytis (angelos@cis.upenn.edu)
4.\"
5.\" Copyright (c) 2000, 2001 Angelos D. Keromytis
6.\"
7.\" Permission to use, copy, and modify this software with or without fee
8.\" is hereby granted, provided that this entire notice is included in
9.\" all source code copies of any software which is or includes a copy or
10.\" modification of this software.
11.\"
12.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
14.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
15.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
16.\" PURPOSE.
17.\"
18.\" $FreeBSD$
19.\"
20.Dd July 17, 2018
21.Dt CRYPTO 9
22.Os
23.Sh NAME
24.Nm crypto
25.Nd API for cryptographic services in the kernel
26.Sh SYNOPSIS
27.In opencrypto/cryptodev.h
28.Ft int32_t
29.Fn crypto_get_driverid device_t size_t int
30.Ft int
31.Fn crypto_register uint32_t int uint16_t uint32_t "int \*[lp]*\*[rp]\*[lp]void *, uint32_t *, struct cryptoini *\*[rp]" "int \*[lp]*\*[rp]\*[lp]void *, uint64_t\*[rp]" "int \*[lp]*\*[rp]\*[lp]void *, struct cryptop *\*[rp]" "void *"
32.Ft int
33.Fn crypto_kregister uint32_t int uint32_t "int \*[lp]*\*[rp]\*[lp]void *, struct cryptkop *\*[rp]" "void *"
34.Ft int
35.Fn crypto_unregister uint32_t int
36.Ft int
37.Fn crypto_unregister_all uint32_t
38.Ft void
39.Fn crypto_done "struct cryptop *"
40.Ft void
41.Fn crypto_kdone "struct cryptkop *"
42.Ft int
43.Fn crypto_find_driver "const char *"
44.Ft int
45.Fn crypto_newsession "crypto_session_t *" "struct cryptoini *" int
46.Ft int
47.Fn crypto_freesession crypto_session_t
48.Ft int
49.Fn crypto_dispatch "struct cryptop *"
50.Ft int
51.Fn crypto_kdispatch "struct cryptkop *"
52.Ft int
53.Fn crypto_unblock uint32_t int
54.Ft "struct cryptop *"
55.Fn crypto_getreq int
56.Ft void
57.Fn crypto_freereq void
58.Bd -literal
59#define	CRYPTO_SYMQ	0x1
60#define	CRYPTO_ASYMQ	0x2
61
62#define EALG_MAX_BLOCK_LEN      16
63
64struct cryptoini {
65	int                cri_alg;
66	int                cri_klen;
67	int                cri_mlen;
68	caddr_t            cri_key;
69	uint8_t            cri_iv[EALG_MAX_BLOCK_LEN];
70	struct cryptoini  *cri_next;
71};
72
73struct cryptodesc {
74	int                crd_skip;
75	int                crd_len;
76	int                crd_inject;
77	int                crd_flags;
78	struct cryptoini   CRD_INI;
79#define crd_iv          CRD_INI.cri_iv
80#define crd_key         CRD_INI.cri_key
81#define crd_alg         CRD_INI.cri_alg
82#define crd_klen        CRD_INI.cri_klen
83	struct cryptodesc *crd_next;
84};
85
86struct cryptop {
87	TAILQ_ENTRY(cryptop) crp_next;
88	crypto_session_t   crp_session;
89	int                crp_ilen;
90	int                crp_olen;
91	int                crp_etype;
92	int                crp_flags;
93	caddr_t            crp_buf;
94	caddr_t            crp_opaque;
95	struct cryptodesc *crp_desc;
96	int              (*crp_callback) (struct cryptop *);
97	caddr_t            crp_mac;
98};
99
100struct crparam {
101        caddr_t         crp_p;
102        u_int           crp_nbits;
103};
104
105#define CRK_MAXPARAM    8
106
107struct cryptkop {
108        TAILQ_ENTRY(cryptkop) krp_next;
109        u_int              krp_op;         /* ie. CRK_MOD_EXP or other */
110        u_int              krp_status;     /* return status */
111        u_short            krp_iparams;    /* # of input parameters */
112        u_short            krp_oparams;    /* # of output parameters */
113        uint32_t           krp_hid;
114        struct crparam     krp_param[CRK_MAXPARAM];
115        int               (*krp_callback)(struct cryptkop *);
116};
117.Ed
118.Sh DESCRIPTION
119.Nm
120is a framework for drivers of cryptographic hardware to register with
121the kernel so
122.Dq consumers
123(other kernel subsystems, and
124users through the
125.Pa /dev/crypto
126device) are able to make use of it.
127Drivers register with the framework the algorithms they support,
128and provide entry points (functions) the framework may call to
129establish, use, and tear down sessions.
130Sessions are used to cache cryptographic information in a particular driver
131(or associated hardware), so initialization is not needed with every request.
132Consumers of cryptographic services pass a set of
133descriptors that instruct the framework (and the drivers registered
134with it) of the operations that should be applied on the data (more
135than one cryptographic operation can be requested).
136.Pp
137Keying operations are supported as well.
138Unlike the symmetric operators described above,
139these sessionless commands perform mathematical operations using
140input and output parameters.
141.Pp
142Since the consumers may not be associated with a process, drivers may
143not
144.Xr sleep 9 .
145The same holds for the framework.
146Thus, a callback mechanism is used
147to notify a consumer that a request has been completed (the
148callback is specified by the consumer on a per-request basis).
149The callback is invoked by the framework whether the request was
150successfully completed or not.
151An error indication is provided in the latter case.
152A specific error code,
153.Er EAGAIN ,
154is used to indicate that a session handle has changed and that the
155request may be re-submitted immediately with the new session.
156Errors are only returned to the invoking function if not
157enough information to call the callback is available (meaning, there
158was a fatal error in verifying the arguments).
159For session initialization and teardown no callback mechanism is used.
160.Pp
161The
162.Fn crypto_find_driver
163function may be called to return the specific id of the provided name.
164If the specified driver could not be found, the returned id is -1.
165.Pp
166The
167.Fn crypto_newsession
168routine is called by consumers of cryptographic services (such as the
169.Xr ipsec 4
170stack) that wish to establish a new session with the framework.
171The second argument contains all the necessary information for
172the driver to establish the session.
173The third argument is either a specific driver id, or one or both
174of
175.Dv CRYPTOCAP_F_HARDWARE ,
176to select hardware devices,
177or
178.Dv CRYPTOCAP_F_SOFTWARE ,
179to select software devices.
180If both are specified, a hardware device will be returned
181before a software device will be.
182On success, the value pointed to by the first argument will be the opaque
183session handle.
184The various fields in the
185.Vt cryptoini
186structure are:
187.Bl -tag -width ".Va cri_next"
188.It Va cri_alg
189Contains an algorithm identifier.
190Currently supported algorithms are:
191.Pp
192.Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -compact
193.It Dv CRYPTO_AES_128_NIST_GMAC
194.It Dv CRYPTO_AES_192_NIST_GMAC
195.It Dv CRYPTO_AES_256_NIST_GMAC
196.It Dv CRYPTO_AES_CBC
197.It Dv CRYPTO_AES_ICM
198.It Dv CRYPTO_AES_NIST_GCM_16
199.It Dv CRYPTO_AES_NIST_GMAC
200.It Dv CRYPTO_AES_XTS
201.It Dv CRYPTO_ARC4
202.It Dv CRYPTO_BLF_CBC
203.It Dv CRYPTO_CAMELLIA_CBC
204.It Dv CRYPTO_CAST_CBC
205.It Dv CRYPTO_DEFLATE_COMP
206.It Dv CRYPTO_DES_CBC
207.It Dv CRYPTO_3DES_CBC
208.It Dv CRYPTO_MD5
209.It Dv CRYPTO_MD5_HMAC
210.It Dv CRYPTO_MD5_KPDK
211.It Dv CRYPTO_NULL_HMAC
212.It Dv CRYPTO_NULL_CBC
213.It Dv CRYPTO_RIPEMD160_HMAC
214.It Dv CRYPTO_SHA1
215.It Dv CRYPTO_SHA1_HMAC
216.It Dv CRYPTO_SHA1_KPDK
217.It Dv CRYPTO_SHA2_256_HMAC
218.It Dv CRYPTO_SHA2_384_HMAC
219.It Dv CRYPTO_SHA2_512_HMAC
220.It Dv CRYPTO_SKIPJACK_CBC
221.El
222.It Va cri_klen
223Specifies the length of the key in bits, for variable-size key
224algorithms.
225.It Va cri_mlen
226Specifies how many bytes from the calculated hash should be copied back.
2270 means entire hash.
228.It Va cri_key
229Contains the key to be used with the algorithm.
230.It Va cri_iv
231Contains an explicit initialization vector (IV), if it does not prefix
232the data.
233This field is ignored during initialization
234.Pq Nm crypto_newsession .
235If no IV is explicitly passed (see below on details), a random IV is used
236by the device driver processing the request.
237.It Va cri_next
238Contains a pointer to another
239.Vt cryptoini
240structure.
241Multiple such structures may be linked to establish multi-algorithm sessions
242.Xr ( ipsec 4
243is an example consumer of such a feature).
244.El
245.Pp
246The
247.Vt cryptoini
248structure and its contents will not be modified by the framework (or
249the drivers used).
250.Pp
251.Fn crypto_freesession
252is called with the session handle returned by
253.Fn crypto_newsession
254to free the session.
255.Pp
256.Fn crypto_dispatch
257is called to process a request.
258The various fields in the
259.Vt cryptop
260structure are:
261.Bl -tag -width ".Va crp_callback"
262.It Va crp_session
263Contains the session handle.
264.It Va crp_ilen
265Indicates the total length in bytes of the buffer to be processed.
266.It Va crp_olen
267On return, contains the total length of the result.
268For symmetric crypto operations, this will be the same as the input length.
269This will be used if the framework needs to allocate a new
270buffer for the result (or for re-formatting the input).
271.It Va crp_callback
272This routine is invoked upon completion of the request, whether
273successful or not.
274It is invoked through the
275.Fn crypto_done
276routine.
277If the request was not successful, an error code is set in the
278.Va crp_etype
279field.
280It is the responsibility of the callback routine to set the appropriate
281.Xr spl 9
282level.
283.It Va crp_etype
284Contains the error type, if any errors were encountered, or zero if
285the request was successfully processed.
286If the
287.Er EAGAIN
288error code is returned, the session handle has changed (and has been recorded
289in the
290.Va crp_session
291field).
292The consumer should record the new session handle and use it in all subsequent
293requests.
294In this case, the request may be re-submitted immediately.
295This mechanism is used by the framework to perform
296session migration (move a session from one driver to another, because
297of availability, performance, or other considerations).
298.Pp
299Note that this field only makes sense when examined by
300the callback routine specified in
301.Va crp_callback .
302Errors are returned to the invoker of
303.Fn crypto_process
304only when enough information is not present to call the callback
305routine (i.e., if the pointer passed is
306.Dv NULL
307or if no callback routine was specified).
308.It Va crp_flags
309Is a bitmask of flags associated with this request.
310Currently defined flags are:
311.Bl -tag -width ".Dv CRYPTO_F_CBIFSYNC"
312.It Dv CRYPTO_F_IMBUF
313The buffer pointed to by
314.Va crp_buf
315is an mbuf chain.
316.It Dv CRYPTO_F_IOV
317The buffer pointed to by
318.Va crp_buf
319is an
320.Vt uio
321structure.
322.It Dv CRYPTO_F_BATCH
323Batch operation if possible.
324.It Dv CRYPTO_F_CBIMM
325Do callback immediately instead of doing it from a dedicated kernel thread.
326.It Dv CRYPTO_F_DONE
327Operation completed.
328.It Dv CRYPTO_F_CBIFSYNC
329Do callback immediately if operation is synchronous (that the driver
330specified the
331.Dv CRYPTOCAP_F_SYNC
332flag).
333.It Dv CRYPTO_F_ASYNC
334Try to do the crypto operation in a pool of workers
335if the operation is synchronous (that is, if the driver specified the
336.Dv CRYPTOCAP_F_SYNC
337flag).
338It aims to speed up processing by dispatching crypto operations
339on different processors.
340.It Dv CRYPTO_F_ASYNC_KEEPORDER
341Dispatch callbacks in the same order they are posted.
342Only relevant if the
343.Dv CRYPTO_F_ASYNC
344flag is set and if the operation is synchronous.
345.El
346.It Va crp_buf
347Points to the input buffer.
348On return (when the callback is invoked),
349it contains the result of the request.
350The input buffer may be an mbuf
351chain or a contiguous buffer,
352depending on
353.Va crp_flags .
354.It Va crp_opaque
355This is passed through the crypto framework untouched and is
356intended for the invoking application's use.
357.It Va crp_desc
358This is a linked list of descriptors.
359Each descriptor provides
360information about what type of cryptographic operation should be done
361on the input buffer.
362The various fields are:
363.Bl -tag -width ".Va crd_inject"
364.It Va crd_iv
365When the flag
366.Dv CRD_F_IV_EXPLICIT
367is set, this field contains the IV.
368.It Va crd_key
369When the
370.Dv CRD_F_KEY_EXPLICIT
371flag is set, the
372.Va crd_key
373points to a buffer with encryption or authentication key.
374.It Va crd_alg
375An algorithm to use.
376Must be the same as the one given at newsession time.
377.It Va crd_klen
378The
379.Va crd_key
380key length.
381.It Va crd_skip
382The offset in the input buffer where processing should start.
383.It Va crd_len
384How many bytes, after
385.Va crd_skip ,
386should be processed.
387.It Va crd_inject
388The
389.Va crd_inject
390field specifies an offset in bytes from the beginning of the buffer.
391For encryption algorithms, this may be where the IV will be inserted
392when encrypting or where the IV may be found for
393decryption (subject to
394.Va crd_flags ) .
395For MAC algorithms, this is where the result of the keyed hash will be
396inserted.
397.It Va crd_flags
398The following flags are defined:
399.Bl -tag -width 3n
400.It Dv CRD_F_ENCRYPT
401For encryption algorithms, this bit is set when encryption is required
402(when not set, decryption is performed).
403.It Dv CRD_F_IV_PRESENT
404.\" This flag name has nothing to do w/ it's behavior, fix the name.
405For encryption, if this bit is not set the IV used to encrypt the packet
406will be written at the location pointed to by
407.Va crd_inject .
408The IV length is assumed to be equal to the blocksize of the
409encryption algorithm.
410For encryption, if this bit is set, nothing is done.
411For decryption, this flag has no meaning.
412Applications that do special
413.Dq "IV cooking" ,
414such as the half-IV mode in
415.Xr ipsec 4 ,
416can use this flag to indicate that the IV should not be written on the packet.
417This flag is typically used in conjunction with the
418.Dv CRD_F_IV_EXPLICIT
419flag.
420.It Dv CRD_F_IV_EXPLICIT
421This bit is set when the IV is explicitly
422provided by the consumer in the
423.Va crd_iv
424field.
425Otherwise, for encryption operations the IV is provided for by
426the driver used to perform the operation, whereas for decryption
427operations the offset of the IV is provided by the
428.Va crd_inject
429field.
430This flag is typically used when the IV is calculated
431.Dq "on the fly"
432by the consumer, and does not precede the data (some
433.Xr ipsec 4
434configurations, and the encrypted swap are two such examples).
435.It Dv CRD_F_KEY_EXPLICIT
436For encryption and authentication (MAC) algorithms, this bit is set when the key
437is explicitly provided by the consumer in the
438.Va crd_key
439field for the given operation.
440Otherwise, the key is taken at newsession time from the
441.Va cri_key
442field.
443As calculating the key schedule may take a while, it is recommended that often
444used keys are given their own session.
445.It Dv CRD_F_COMP
446For compression algorithms, this bit is set when compression is required (when
447not set, decompression is performed).
448.El
449.It Va CRD_INI
450This
451.Vt cryptoini
452structure will not be modified by the framework or the device drivers.
453Since this information accompanies every cryptographic
454operation request, drivers may re-initialize state on-demand
455(typically an expensive operation).
456Furthermore, the cryptographic
457framework may re-route requests as a result of full queues or hardware
458failure, as described above.
459.It Va crd_next
460Point to the next descriptor.
461Linked operations are useful in protocols such as
462.Xr ipsec 4 ,
463where multiple cryptographic transforms may be applied on the same
464block of data.
465.El
466.El
467.Pp
468.Fn crypto_getreq
469allocates a
470.Vt cryptop
471structure with a linked list of as many
472.Vt cryptodesc
473structures as were specified in the argument passed to it.
474.Pp
475.Fn crypto_freereq
476deallocates a structure
477.Vt cryptop
478and any
479.Vt cryptodesc
480structures linked to it.
481Note that it is the responsibility of the
482callback routine to do the necessary cleanups associated with the
483opaque field in the
484.Vt cryptop
485structure.
486.Pp
487.Fn crypto_kdispatch
488is called to perform a keying operation.
489The various fields in the
490.Vt cryptkop
491structure are:
492.Bl -tag -width ".Va krp_callback"
493.It Va krp_op
494Operation code, such as
495.Dv CRK_MOD_EXP .
496.It Va krp_status
497Return code.
498This
499.Va errno Ns -style
500variable indicates whether lower level reasons
501for operation failure.
502.It Va krp_iparams
503Number if input parameters to the specified operation.
504Note that each operation has a (typically hardwired) number of such parameters.
505.It Va krp_oparams
506Number if output parameters from the specified operation.
507Note that each operation has a (typically hardwired) number of such parameters.
508.It Va krp_kvp
509An array of kernel memory blocks containing the parameters.
510.It Va krp_hid
511Identifier specifying which low-level driver is being used.
512.It Va krp_callback
513Callback called on completion of a keying operation.
514.El
515.Sh DRIVER-SIDE API
516The
517.Fn crypto_get_driverid ,
518.Fn crypto_get_driver_session ,
519.Fn crypto_register ,
520.Fn crypto_kregister ,
521.Fn crypto_unregister ,
522.Fn crypto_unblock ,
523and
524.Fn crypto_done
525routines are used by drivers that provide support for cryptographic
526primitives to register and unregister with the kernel crypto services
527framework.
528.Pp
529Drivers must first use the
530.Fn crypto_get_driverid
531function to acquire a driver identifier, specifying the
532.Fa flags
533as an argument.
534One of
535.Dv CRYPTOCAP_F_SOFTWARE
536or
537.Dv CRYPTOCAP_F_HARDWARE
538must be specified.
539The
540.Dv CRYPTOCAP_F_SYNC
541may also be specified, and should be specified if the driver does all of
542it's operations synchronously.
543Drivers must pass the size of their session struct as the second argument.
544An appropriately sized memory will be allocated by the framework, zeroed, and
545passed to the driver's
546.Fn newsession
547method.
548.Pp
549For each algorithm the driver supports, it must then call
550.Fn crypto_register .
551The first two arguments are the driver and algorithm identifiers.
552The next two arguments specify the largest possible operator length (in bits,
553important for public key operations) and flags for this algorithm.
554The last four arguments must be provided in the first call to
555.Fn crypto_register
556and are ignored in all subsequent calls.
557They are pointers to three
558driver-provided functions that the framework may call to establish new
559cryptographic context with the driver, free already established
560context, and ask for a request to be processed (encrypt, decrypt,
561etc.); and an opaque parameter to pass when calling each of these routines.
562.Pp
563.Fn crypto_unregister
564is called by drivers that wish to withdraw support for an algorithm.
565The two arguments are the driver and algorithm identifiers, respectively.
566Typically, drivers for
567PCMCIA
568crypto cards that are being ejected will invoke this routine for all
569algorithms supported by the card.
570.Fn crypto_unregister_all
571will unregister all algorithms registered by a driver
572and the driver will be disabled (no new sessions will be allocated on
573that driver, and any existing sessions will be migrated to other
574drivers).
575The same will be done if all algorithms associated with a driver are
576unregistered one by one.
577After a call to
578.Fn crypto_unregister_all
579there will be no threads in either the newsession or freesession function
580of the driver.
581.Pp
582The calling convention for the driver-supplied routines are:
583.Pp
584.Bl -item -compact
585.It
586.Ft int
587.Fn \*[lp]*newsession\*[rp] "device_t" "crypto_session_t" "struct cryptoini *" ;
588.It
589.Ft void
590.Fn \*[lp]*freesession\*[rp] "device_t" "crypto_session_t" ;
591.It
592.Ft int
593.Fn \*[lp]*process\*[rp] "device_t" "struct cryptop *" "int" ;
594.It
595.Ft int
596.Fn \*[lp]*kprocess\*[rp] "device_t" "struct cryptkop *" "int" ;
597.El
598.Pp
599On invocation, the first argument to
600all routines is the
601.Fa device_t
602that was provided to
603.Fn crypto_get_driverid .
604The second argument to
605.Fn newsession
606is the opaque session handle for the new session.
607The third argument is identical to that of
608.Fn crypto_newsession .
609.Pp
610Drivers obtain a pointer to their session memory by invoking
611.Fn crypto_get_driver_session
612on the opaque
613.Vt crypto_session_t
614handle.
615.Pp
616The
617.Fn freesession
618routine takes as arguments the opaque data value and the session handle.
619It should clear any context associated with the session (clear hardware
620registers, memory, etc.).
621If no resources need to be released other than the contents of session memory,
622the method is optional.
623The
624.Nm
625framework will zero and release the allocated session memory (after running the
626.Fn freesession
627method, if one exists).
628.Pp
629The
630.Fn process
631routine is invoked with a request to perform crypto processing.
632This routine must not block or sleep, but should queue the request and return
633immediately or process the request to completion.
634In case of an unrecoverable error, the error indication must be placed in the
635.Va crp_etype
636field of the
637.Vt cryptop
638structure.
639When the request is completed, or an error is detected, the
640.Fn process
641routine must invoke
642.Fn crypto_done .
643Session migration may be performed, as mentioned previously.
644.Pp
645In case of a temporary resource exhaustion, the
646.Fn process
647routine may return
648.Er ERESTART
649in which case the crypto services will requeue the request, mark the driver
650as
651.Dq blocked ,
652and stop submitting requests for processing.
653The driver is then responsible for notifying the crypto services
654when it is again able to process requests through the
655.Fn crypto_unblock
656routine.
657This simple flow control mechanism should only be used for short-lived
658resource exhaustion as it causes operations to be queued in the crypto
659layer.
660Doing so is preferable to returning an error in such cases as
661it can cause network protocols to degrade performance by treating the
662failure much like a lost packet.
663.Pp
664The
665.Fn kprocess
666routine is invoked with a request to perform crypto key processing.
667This routine must not block, but should queue the request and return
668immediately.
669Upon processing the request, the callback routine should be invoked.
670In case of an unrecoverable error, the error indication must be placed in the
671.Va krp_status
672field of the
673.Vt cryptkop
674structure.
675When the request is completed, or an error is detected, the
676.Fn kprocess
677routine should invoked
678.Fn crypto_kdone .
679.Sh RETURN VALUES
680.Fn crypto_register ,
681.Fn crypto_kregister ,
682.Fn crypto_unregister ,
683.Fn crypto_newsession ,
684.Fn crypto_freesession ,
685and
686.Fn crypto_unblock
687return 0 on success, or an error code on failure.
688.Fn crypto_get_driverid
689returns a non-negative value on error, and \-1 on failure.
690.Fn crypto_getreq
691returns a pointer to a
692.Vt cryptop
693structure and
694.Dv NULL
695on failure.
696.Fn crypto_dispatch
697returns
698.Er EINVAL
699if its argument or the callback function was
700.Dv NULL ,
701and 0 otherwise.
702The callback is provided with an error code in case of failure, in the
703.Va crp_etype
704field.
705.Sh FILES
706.Bl -tag -width ".Pa sys/opencrypto/crypto.c"
707.It Pa sys/opencrypto/crypto.c
708most of the framework code
709.El
710.Sh SEE ALSO
711.Xr crypto 4 ,
712.Xr ipsec 4 ,
713.Xr crypto 7 ,
714.Xr malloc 9 ,
715.Xr sleep 9
716.Sh HISTORY
717The cryptographic framework first appeared in
718.Ox 2.7
719and was written by
720.An Angelos D. Keromytis Aq Mt angelos@openbsd.org .
721.Sh BUGS
722The framework currently assumes that all the algorithms in a
723.Fn crypto_newsession
724operation must be available by the same driver.
725If that is not the case, session initialization will fail.
726.Pp
727The framework also needs a mechanism for determining which driver is
728best for a specific set of algorithms associated with a session.
729Some type of benchmarking is in order here.
730.Pp
731Multiple instances of the same algorithm in the same session are not
732supported.
733