\hypertarget{g__eli__privacy_8c_source}{}\doxysection{g\+\_\+eli\+\_\+privacy.\+c}
\label{g__eli__privacy_8c_source}\index{geom/eli/g\_eli\_privacy.c@{geom/eli/g\_eli\_privacy.c}}
\mbox{\hyperlink{g__eli__privacy_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2005-\/2011 Pawel Jakub Dawidek <pawel@dawidek.net>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00030}\mbox{\hyperlink{g__eli__privacy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00030}} \mbox{\hyperlink{g__eli__privacy_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/linker.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/kthread.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/sched.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/smp.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/vnode.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <vm/uma.h>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{g__eli_8h}{geom/eli/g\_eli.h}}>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{pkcs5v2_8h}{geom/eli/pkcs5v2.h}}>}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00054}00054 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00055}00055 \textcolor{comment}{ * Code paths:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00056}00056 \textcolor{comment}{ * BIO\_READ:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00057}00057 \textcolor{comment}{ *      g\_eli\_start -\/> g\_eli\_crypto\_read -\/> g\_io\_request -\/> g\_eli\_read\_done -\/> g\_eli\_crypto\_run -\/> g\_eli\_crypto\_read\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00058}00058 \textcolor{comment}{ * BIO\_WRITE:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00059}00059 \textcolor{comment}{ *      g\_eli\_start -\/> g\_eli\_crypto\_run -\/> g\_eli\_crypto\_write\_done -\/> g\_io\_request -\/> g\_eli\_write\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00060}00060 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00062}00062 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00063}00063 \textcolor{comment}{ * Copy data from a (potentially unmapped) bio to a kernelspace buffer.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00064}00064 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00065}00065 \textcolor{comment}{ * The buffer must have at least as much room as bp-\/>bio\_length.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00066}00066 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00067}00067 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00068}\mbox{\hyperlink{g__eli__privacy_8c_a12d04dd560a490a8673e9dde6d3c1e39}{00068}} \mbox{\hyperlink{g__eli__privacy_8c_a12d04dd560a490a8673e9dde6d3c1e39}{g\_eli\_bio\_copyin}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{keywordtype}{void} *kaddr)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00069}00069 \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00070}00070         \textcolor{keyword}{struct }uio uio;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00071}00071         \textcolor{keyword}{struct }iovec iov[1];}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00073}00073         iov[0].iov\_base = kaddr;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00074}00074         iov[0].iov\_len = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00075}00075         uio.uio\_iov = iov;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00076}00076         uio.uio\_iovcnt = 1;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00077}00077         uio.uio\_offset = 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00078}00078         uio.uio\_resid = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00079}00079         uio.uio\_segflg = UIO\_SYSSPACE;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00080}00080         uio.uio\_rw = UIO\_READ;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00081}00081         uiomove\_fromphys(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_ma, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_ma\_offset, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length, \&uio);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00082}00082 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00084}00084 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00085}00085 \textcolor{comment}{ * The function is called after we read and decrypt data.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00086}00086 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00087}00087 \textcolor{comment}{ * g\_eli\_start -\/> g\_eli\_crypto\_read -\/> g\_io\_request -\/> g\_eli\_read\_done -\/> g\_eli\_crypto\_run -\/> G\_ELI\_CRYPTO\_READ\_DONE -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00088}00088 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00089}00089 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00090}\mbox{\hyperlink{g__eli__privacy_8c_a4b525caf5da428b0843cc3dfb85ac32c}{00090}} \mbox{\hyperlink{g__eli__privacy_8c_a4b525caf5da428b0843cc3dfb85ac32c}{g\_eli\_crypto\_read\_done}}(\textcolor{keyword}{struct} cryptop *crp)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00091}00091 \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00092}00092         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__eli__softc}{g\_eli\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00093}00093         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00095}00095         \textcolor{keywordflow}{if} (crp-\/>crp\_etype == EAGAIN) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00096}00096                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__eli_8c_a579b00aa63d80fcd91e1b8da3e8e5515}{g\_eli\_crypto\_rerun}}(crp) == 0)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00097}00097                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00098}00098         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00099}00099         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = (\textcolor{keyword}{struct }bio *)crp-\/>crp\_opaque;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00100}00100         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed++;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00101}00101         if (crp-\/>crp\_etype == 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00102}00102                 \mbox{\hyperlink{g__eli_8h_ad99f556222c6099625689315eadadd9d}{G\_ELI\_DEBUG}}(3, \textcolor{stringliteral}{"{}Crypto READ request done (\%d/\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00103}00103                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00104}00104                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_completed += crp-\/>crp\_payload\_length;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00105}00105         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00106}00106                 \mbox{\hyperlink{g__eli_8h_ad99f556222c6099625689315eadadd9d}{G\_ELI\_DEBUG}}(1, \textcolor{stringliteral}{"{}Crypto READ request failed (\%d/\%d) error=\%d."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00107}00107                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children, crp-\/>crp\_etype);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00108}00108                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error == 0)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00109}00109                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error = crp-\/>crp\_etype;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00110}00110         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00111}00111         sc = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>geom-\/>softc;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00112}00112         \textcolor{keywordflow}{if} (sc != NULL \&\& crp-\/>crp\_cipher\_key != NULL)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00113}00113                 \mbox{\hyperlink{g__eli_8h_a6f8aafc6ae8883d71c46a348b8856b28}{g\_eli\_key\_drop}}(sc, \_\_DECONST(\textcolor{keywordtype}{void} *, crp-\/>crp\_cipher\_key));}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00114}00114         crypto\_freereq(crp);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00115}00115         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00116}00116 \textcolor{comment}{         * Do we have all sectors already?}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00117}00117 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00118}00118         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed < \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00119}00119                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00121}00121         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00122}00122                 \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Crypto READ request failed (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00123}00123                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00124}00124                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_completed = 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00125}00125         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00126}00126         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00127}00127 \textcolor{comment}{         * Read is finished, send it up.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00128}00128 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00129}00129         \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00130}00130         \textcolor{keywordflow}{if} (sc != NULL)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00131}00131                 atomic\_subtract\_int(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a239cdf3f405f19bdfe897bd9d1de8a37}{sc\_inflight}}, 1);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00132}00132         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00133}00133 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00134}00134 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00135}00135 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00136}00136 \textcolor{comment}{ * The function is called after data encryption.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00137}00137 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00138}00138 \textcolor{comment}{ * g\_eli\_start -\/> g\_eli\_crypto\_run -\/> G\_ELI\_CRYPTO\_WRITE\_DONE -\/> g\_io\_request -\/> g\_eli\_write\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00139}00139 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00140}00140 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00141}\mbox{\hyperlink{g__eli__privacy_8c_ac9be89e41813c7fc725c8b14374d4f0d}{00141}} \mbox{\hyperlink{g__eli__privacy_8c_ac9be89e41813c7fc725c8b14374d4f0d}{g\_eli\_crypto\_write\_done}}(\textcolor{keyword}{struct} cryptop *crp)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00142}00142 \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00143}00143         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__eli__softc}{g\_eli\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00144}00144         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00145}00145         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00146}00146         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *cbp;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00147}00147 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00148}00148         \textcolor{keywordflow}{if} (crp-\/>crp\_etype == EAGAIN) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00149}00149                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__eli_8c_a579b00aa63d80fcd91e1b8da3e8e5515}{g\_eli\_crypto\_rerun}}(crp) == 0)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00150}00150                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00151}00151         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00152}00152         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = (\textcolor{keyword}{struct }bio *)crp-\/>crp\_opaque;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00153}00153         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed++;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00154}00154         if (crp-\/>crp\_etype == 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00155}00155                 \mbox{\hyperlink{g__eli_8h_ad99f556222c6099625689315eadadd9d}{G\_ELI\_DEBUG}}(3, \textcolor{stringliteral}{"{}Crypto WRITE request done (\%d/\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00156}00156                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00157}00157         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00158}00158                 \mbox{\hyperlink{g__eli_8h_ad99f556222c6099625689315eadadd9d}{G\_ELI\_DEBUG}}(1, \textcolor{stringliteral}{"{}Crypto WRITE request failed (\%d/\%d) error=\%d."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00159}00159                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children, crp-\/>crp\_etype);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00160}00160                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error == 0)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00161}00161                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error = crp-\/>crp\_etype;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00162}00162         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00163}00163         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>geom;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00164}00164         sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00165}00165         \textcolor{keywordflow}{if} (crp-\/>crp\_cipher\_key != NULL)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00166}00166                 \mbox{\hyperlink{g__eli_8h_a6f8aafc6ae8883d71c46a348b8856b28}{g\_eli\_key\_drop}}(sc, \_\_DECONST(\textcolor{keywordtype}{void} *, crp-\/>crp\_cipher\_key));}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00167}00167         crypto\_freereq(crp);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00168}00168         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00169}00169 \textcolor{comment}{         * All sectors are already encrypted?}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00170}00170 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00171}00171         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed < \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00172}00172                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00173}00173         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed = 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00174}00174         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children = 1;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00175}00175         cbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00176}00176         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1 = NULL;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00177}00177         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00178}00178                 \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Crypto WRITE request failed (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00179}00179                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00180}00180                 \mbox{\hyperlink{g__eli_8c_a85cfec789b20d2d3959b02285e818978}{g\_eli\_free\_data}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00181}00181                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(cbp);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00182}00182                 \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00183}00183                 atomic\_subtract\_int(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a239cdf3f405f19bdfe897bd9d1de8a37}{sc\_inflight}}, 1);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00184}00184                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00185}00185         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00186}00186         cbp-\/>bio\_data = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver2;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00187}00187         \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00188}00188 \textcolor{comment}{         * Clear BIO\_UNMAPPED, which was inherited from where we cloned the bio}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00189}00189 \textcolor{comment}{         * in g\_eli\_start, because we manually set bio\_data}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00190}00190 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00191}00191         cbp-\/>bio\_flags \&= \string~BIO\_UNMAPPED;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00192}00192         cbp-\/>bio\_done = \mbox{\hyperlink{g__eli_8c_a8eded9348395aad2b5271730e10bbff1}{g\_eli\_write\_done}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00193}00193         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = LIST\_FIRST(\&\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>consumer);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00194}00194         cbp-\/>bio\_to = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00195}00195         \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(2, cbp, \textcolor{stringliteral}{"{}Sending request."{}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00196}00196         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00197}00197 \textcolor{comment}{         * Send encrypted data to the provider.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00198}00198 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00199}00199         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(cbp, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00200}00200         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00201}00201 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00203}00203 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00204}00204 \textcolor{comment}{ * The function is called to read encrypted data.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00205}00205 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00206}00206 \textcolor{comment}{ * g\_eli\_start -\/> G\_ELI\_CRYPTO\_READ -\/> g\_io\_request -\/> g\_eli\_read\_done -\/> g\_eli\_crypto\_run -\/> g\_eli\_crypto\_read\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00207}00207 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00208}00208 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00209}\mbox{\hyperlink{g__eli_8h_a1123e9dfa9a2097f498b75477f1af88c}{00209}} \mbox{\hyperlink{g__eli__privacy_8c_a1123e9dfa9a2097f498b75477f1af88c}{g\_eli\_crypto\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__eli__softc}{g\_eli\_softc}} *sc, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, boolean\_t fromworker)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00210}00210 \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00211}00211         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00212}00212         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00213}00213 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00214}00214         \textcolor{keywordflow}{if} (!fromworker) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00215}00215                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00216}00216 \textcolor{comment}{                 * We are not called from the worker thread, so check if}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00217}00217 \textcolor{comment}{                 * device is suspended.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00218}00218 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00219}00219                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a972ab3f6da1b3d16ead41a4c2cc5a574}{sc\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00220}00220                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__eli__softc_a94876b8cf2ed7da3eb3a3e1858171ef2}{sc\_flags}} \& \mbox{\hyperlink{g__eli_8h_a5d55b57a8415e1d89dcde37fe842a9f8}{G\_ELI\_FLAG\_SUSPEND}}) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00221}00221                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00222}00222 \textcolor{comment}{                         * If device is suspended, we place the request onto}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00223}00223 \textcolor{comment}{                         * the queue, so it can be handled after resume.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00224}00224 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00225}00225                         \mbox{\hyperlink{g__eli_8h_ad99f556222c6099625689315eadadd9d}{G\_ELI\_DEBUG}}(0, \textcolor{stringliteral}{"{}device suspended, move onto queue"{}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00226}00226                         bioq\_insert\_tail(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a382b39bbf7408a27d7970dbb32bcdbcc}{sc\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00227}00227                         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a972ab3f6da1b3d16ead41a4c2cc5a574}{sc\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00228}00228                         wakeup(sc);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00229}00229                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00230}00230                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00231}00231                 atomic\_add\_int(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a239cdf3f405f19bdfe897bd9d1de8a37}{sc\_inflight}}, 1);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00232}00232                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a972ab3f6da1b3d16ead41a4c2cc5a574}{sc\_queue\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00233}00233         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00234}00234         \mbox{\hyperlink{g__eli_8h_af68c35f19b3961e7bbc34727a802c574}{G\_ELI\_SETWORKER}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags, 0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00235}00235         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver2 = NULL;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00236}00236         cbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00237}00237         cbp-\/>bio\_done = \mbox{\hyperlink{g__eli_8c_a9ee20b44afe1f7147fddfa6ea9725efd}{g\_eli\_read\_done}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00238}00238         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = LIST\_FIRST(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a899949202205997147c78c52b32b9843}{sc\_geom}}-\/>consumer);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00239}00239         cbp-\/>bio\_to = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00240}00240         \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(2, cbp, \textcolor{stringliteral}{"{}Sending request."{}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00241}00241         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00242}00242 \textcolor{comment}{         * Read encrypted data from provider.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00243}00243 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00244}00244         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(cbp, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00245}00245 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00247}00247 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00248}00248 \textcolor{comment}{ * This is the main function responsible for cryptography (ie. communication}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00249}00249 \textcolor{comment}{ * with crypto(9) subsystem).}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00250}00250 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00251}00251 \textcolor{comment}{ * BIO\_READ:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00252}00252 \textcolor{comment}{ *      g\_eli\_start -\/> g\_eli\_crypto\_read -\/> g\_io\_request -\/> g\_eli\_read\_done -\/> G\_ELI\_CRYPTO\_RUN -\/> g\_eli\_crypto\_read\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00253}00253 \textcolor{comment}{ * BIO\_WRITE:}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00254}00254 \textcolor{comment}{ *      g\_eli\_start -\/> G\_ELI\_CRYPTO\_RUN -\/> g\_eli\_crypto\_write\_done -\/> g\_io\_request -\/> g\_eli\_write\_done -\/> g\_io\_deliver}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00255}00255 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00256}00256 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00257}\mbox{\hyperlink{g__eli_8h_aac374e76e8e4f30d0e3db0cadddb15cb}{00257}} \mbox{\hyperlink{g__eli__privacy_8c_aac374e76e8e4f30d0e3db0cadddb15cb}{g\_eli\_crypto\_run}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__eli__worker}{g\_eli\_worker}} *wr, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00258}00258 \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00259}00259         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__eli__softc}{g\_eli\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00260}00260         \textcolor{keyword}{struct }cryptopq crpq;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00261}00261         \textcolor{keyword}{struct }cryptop *crp;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00262}00262         vm\_page\_t *pages;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00263}00263         u\_int i, nsec, secsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00264}00264         off\_t dstoff;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00265}00265         u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00266}00266         \textcolor{keywordtype}{int} error \mbox{\hyperlink{g__bde_8h_aabb5ad70c88f55209cff7ec5684d13c1}{\_\_diagused}}, pages\_offset;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00267}00267         \textcolor{keywordtype}{bool} batch;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00269}00269         \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(3, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}\%s"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00271}00271         \mbox{\hyperlink{g__eli_8h_af68c35f19b3961e7bbc34727a802c574}{G\_ELI\_SETWORKER}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags, wr-\/>\mbox{\hyperlink{structg__eli__worker_a5fce4959d9d95297e1b5802b03654fdd}{w\_number}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00272}00272         sc = wr-\/>\mbox{\hyperlink{structg__eli__worker_a529a3f8b3a7f2e96b3715b8f5d507495}{w\_softc}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00273}00273         secsize = LIST\_FIRST(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a899949202205997147c78c52b32b9843}{sc\_geom}}-\/>provider)-\/>sectorsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00274}00274         nsec = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length / secsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00275}00275 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00276}00276         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_inbed = 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00277}00277         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_children = nsec;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00279}00279         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00280}00280 \textcolor{comment}{         * If we write the data we cannot destroy current bio\_data content,}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00281}00281 \textcolor{comment}{         * so we need to allocate more memory for encrypted data.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00282}00282 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00283}00283         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd == BIO\_WRITE) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00284}00284                 \textcolor{keywordflow}{if} (!\mbox{\hyperlink{g__eli_8c_ab1b19822f161973052c0245e98781fbb}{g\_eli\_alloc\_data}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length)) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00285}00285                         \mbox{\hyperlink{g__eli_8h_a779a345687882e70738352745e022c14}{G\_ELI\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Crypto request failed (ENOMEM)."{}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00286}00286                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1 != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00287}00287                                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00288}00288                                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver1 = NULL;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00289}00289                         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00290}00290                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error = ENOMEM;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00291}00291                         \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00292}00292                         \textcolor{keywordflow}{if} (sc != NULL)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00293}00293                                 atomic\_subtract\_int(\&sc-\/>\mbox{\hyperlink{structg__eli__softc_a239cdf3f405f19bdfe897bd9d1de8a37}{sc\_inflight}}, 1);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00294}00294                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00295}00295                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00296}00296                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_driver2;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00297}00297                 \textcolor{comment}{/* }}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00298}00298 \textcolor{comment}{                 * This copy could be eliminated by using crypto's output}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00299}00299 \textcolor{comment}{                 * buffer, instead of using a single overwriting buffer.}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00300}00300 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00301}00301                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_flags \& BIO\_UNMAPPED) != 0)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00302}00302                         \mbox{\hyperlink{g__eli__privacy_8c_a12d04dd560a490a8673e9dde6d3c1e39}{g\_eli\_bio\_copyin}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00303}00303                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00304}00304                         bcopy(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00305}00305         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00306}00306                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_flags \& BIO\_UNMAPPED) != 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00307}00307                         pages = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_ma;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00308}00308                         pages\_offset = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_ma\_offset;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00309}00309                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00310}00310                         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00311}00311                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00312}00312         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00313}00313 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00314}00314         TAILQ\_INIT(\&crpq);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00315}00315         batch = atomic\_load\_int(\&\mbox{\hyperlink{g__eli_8c_a4bd2c4ca8397244a2841fcc2627d3d31}{g\_eli\_batch}}) != 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00316}00316 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00317}00317         \textcolor{keywordflow}{for} (i = 0, dstoff = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset; i < nsec; i++, dstoff += secsize) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00318}00318                 crp = crypto\_getreq(wr-\/>\mbox{\hyperlink{structg__eli__worker_a4955ad236cfa9a87082d550fe7f7c061}{w\_sid}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00319}00319 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00320}00320                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00321}00321                         crypto\_use\_buf(crp, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, secsize);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00322}00322                         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += secsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00323}00323                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00324}00324                         MPASS(pages != NULL);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00325}00325                         crypto\_use\_vmpage(crp, pages, secsize, pages\_offset);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00326}00326                         pages\_offset += secsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00327}00327                         pages += pages\_offset >> PAGE\_SHIFT;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00328}00328                         pages\_offset \&= PAGE\_MASK;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00329}00329                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00330}00330                 crp-\/>crp\_opaque = (\textcolor{keywordtype}{void} *)\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00331}00331                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd == BIO\_WRITE) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00332}00332                         crp-\/>crp\_op = CRYPTO\_OP\_ENCRYPT;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00333}00333                         crp-\/>crp\_callback = \mbox{\hyperlink{g__eli__privacy_8c_ac9be89e41813c7fc725c8b14374d4f0d}{g\_eli\_crypto\_write\_done}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00334}00334                 \} \textcolor{keywordflow}{else} \textcolor{comment}{/* if (bp-\/>bio\_cmd == BIO\_READ) */} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00335}00335                         crp-\/>crp\_op = CRYPTO\_OP\_DECRYPT;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00336}00336                         crp-\/>crp\_callback = \mbox{\hyperlink{g__eli__privacy_8c_a4b525caf5da428b0843cc3dfb85ac32c}{g\_eli\_crypto\_read\_done}};}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00337}00337                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00338}00338                 crp-\/>crp\_flags = CRYPTO\_F\_CBIFSYNC;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00339}00339                 crp-\/>crp\_payload\_start = 0;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00340}00340                 crp-\/>crp\_payload\_length = secsize;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00341}00341                 \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__eli__softc_a94876b8cf2ed7da3eb3a3e1858171ef2}{sc\_flags}} \& \mbox{\hyperlink{g__eli_8h_a0440d24008eaa5fe7620843804fecc7a}{G\_ELI\_FLAG\_SINGLE\_KEY}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00342}00342                         crp-\/>crp\_cipher\_key = \mbox{\hyperlink{g__eli_8h_a0271575799ad05ec5fb7adc0b414e137}{g\_eli\_key\_hold}}(sc, dstoff,}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00343}00343                             secsize);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00344}00344                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00345}00345                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__eli_8h_a9759c32a5d088af02c42c2acf1513ee9}{g\_eli\_ivlen}}(sc-\/>\mbox{\hyperlink{structg__eli__softc_aecc6e7e7b1b2e05b9ded85a9ab763d74}{sc\_ealgo}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00346}00346                         crp-\/>crp\_flags |= CRYPTO\_F\_IV\_SEPARATE;}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00347}00347                         \mbox{\hyperlink{g__eli_8h_ab07921ca3b88d093ec9b2b33a0d8d226}{g\_eli\_crypto\_ivgen}}(sc, dstoff, crp-\/>crp\_iv,}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00348}00348                             \textcolor{keyword}{sizeof}(crp-\/>crp\_iv));}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00349}00349                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00351}00351                 \textcolor{keywordflow}{if} (batch) \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00352}00352                         TAILQ\_INSERT\_TAIL(\&crpq, crp, crp\_next);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00353}00353                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00354}00354                         error = crypto\_dispatch(crp);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00355}00355                         KASSERT(error == 0,}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00356}00356                             (\textcolor{stringliteral}{"{}crypto\_dispatch() failed (error=\%d)"{}}, error));}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00357}00357                 \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00358}00358         \}}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00360}00360         \textcolor{keywordflow}{if} (batch)}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00361}00361                 crypto\_dispatch\_batch(\&crpq, 0);}
\DoxyCodeLine{\Hypertarget{g__eli__privacy_8c_source_l00362}00362 \}}

\end{DoxyCode}
