12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OPENCRYPTO(9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> OPENCRYPTO(9)crypto_freesession() is called with the SID returned by crypto_newsession() to disestablish thesession.crypto_dispatch() is called to process a request. The various fields in the cryptop structure are:crp_sidcrp_ilencrp_olenContains the SID.Indicates the total length in bytes of the buffer to be processed.On return, contains the length of the result, not including crd_skip. For symmetriccrypto operations, this will be the same as the input length.crp_alloctypeIndicates the type of buffer, asused in the kernel malloc(9) routine. This will be used ifthe framework needs to allocate a new buffer for the result (or for re-formatting theinput).crp_callback This routine is invoked upon completion of the request, whether successful or not. It isinvoked through the crypto_done() routine. If the request was not successful, an errorcode is set in the crp_etype field. It is the responsibility of the callback routine to setthe appropriate spl(9) level.crp_etypecrp_flagscrp_bufcrp_opaquecrp_descContains the error type, if any errors were encountered, or zero if the request was successfullyprocessed. If the EAGAIN error code is returned, the SID has changed (and hasbeen recorded in the crp_sid field). The consumer should record the new SID and useit in all subsequent requests. In this case, the request may be re-submitted immediately.This mechanism is used by the framework to perform session migration (move a sessionfrom one driver toanother, because of availability, performance, or other considerations).Note that this field only makes sense when examined by the callback routine specified incrp_callback. Errors are returned to the invoker of crypto_process() only whenenough information is not present to call the callback routine (i.e., if the pointer passed isNULL or if no callback routine was specified).Is a bitmask of flags associated with this request. Currently defined flags are:CRYPTO_F_IMBUF The buffer pointed to by crp_buf is an mbuf chain.Points to the input buffer. Onreturn (when the callback is invoked), it contains the resultof the request. The input buffer may be an mbuf chain or a contiguous buffer (of a typeidentified by crp_alloctype), depending on crp_flags.This is passed through the crypto framework untouched and is intended for the invokingapplication’s use.This is a linked list of descriptors. Each descriptor provides information about what typeof cryptographic operation should be done on the input buffer. The various fields are:crd_skipcrd_lenThe offset in the input buffer where processing should start.How many bytes, after crd_skip, should be processed.crd_inject Offset from the beginning of the buffer to insert any results. For encryptionalgorithms, this is where the initialization vector (IV) will be insertedwhen encrypting or where it can be found when decrypting (subject tocrd_flags). For MAC algorithms, this is where the result of the keyedhash will be inserted.<strong>NetBSD</strong> 3.0 December 20, 2003 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!