linux/crypto/eseqiv.c
<<
lue=/op/spa.4. /op/form4. /opa lue=/o href="../linux+v3.8.1/crypto/eseqiv.c">lue=/opimg src="../.static/gfx/right.png" alt=">>">lup/spa.4.lupspa. class="lxr_search">lue=lue=/opinput typlue=/opinput typlue=/opbutt> typSearch 4. /op/form4. p/spa.4.lupspa. class="lxr_prefs"4. /opa href="+prefs?return=crypto/eseqiv.c"lue=/o onclick="return ajax_prefs();">lue=/oPrefs. /op/a>lup/spa.4.e=/o op/div4.e=/o opform ac v3.="ajax+*" method="post" onsubmit="return false;">lupinput typle=/o op/form4.le=/o opdiv class="headingbott>m">. pdiv idopfile_contents"4
o o1p/a>pspa. class="comment">/*p/spa.4.o o2p/a>pspa. class="comment"> * eseqiv: Encrypted Sequence Number IV Generatorp/spa.4.o o3p/a>pspa. class="comment"> *p/spa.4.o o4p/a>pspa. class="comment"> * This generator generates a. IV based >
 a sequence number by xoring itp/spa.4.o o5p/a>pspa. class="comment"> * with a salt a.d then encrypting it with the same key as used to encryptp/spa.4.o o6p/a>pspa. class="comment"> * the plai
 text.  This algorithm requires that the block size be equalp/spa.4.o o7p/a>pspa. class="comment"> * to the IV size.  It is mai
ly useful for CBC.p/spa.4.o o8p/a>pspa. class="comment"> *p/spa.4.o o9p/a>pspa. class="comment"> * Copyright (c) 2007 Herbert Xu <herbert@gondor.apa.a.org.au>p/spa.4.o 	  >a>pspa. class="comment"> *p/spa.4.o 11p/a>pspa. class="comment"> * This program is free software; you ca. redistribute it a.d/or modify itp/spa.4.o 12p/a>pspa. class="comment"> * under the terms of the GNU General Public License as published by the Freep/spa.4.o 13p/a>pspa. class="comment"> * Software Founda v3.; either versn>
 2 of the License, or (at your 
  v3.)p/spa.4.o 14p/a>pspa. class="comment"> * any later versn>
.p/spa.4.o 15p/a>pspa. class="comment"> *p/spa.4.o 16p/a>pspa. class="comment"> */p/spa.4.o 17p/a>.o 18p/a>#include <crypto/internal/skcipher.hp/a>>.o 19p/a>#include <crypto/rng.hp/a>>.o 20p/a>#include <crypto/scatterwalk.hp/a>>.o 21p/a>#include <linux/err.hp/a>>.o 22p/a>#include <linux/init.hp/a>>.o 23p/a>#include <linux/kernel.hp/a>>.o 24p/a>#include <linux/mm.hp/a>>.o 25p/a>#include <linux/module.hp/a>>.o 26p/a>#include <linux/scatterlist.hp/a>>.o 27p/a>#include <linux/spi
lock.hp/a>>.o 28p/a>#include <linux/string.hp/a>>.o 29p/a>.o 30p/a>structopa href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctxp/a> {.o 31p/a>        structopa href="+code=scatterlist" class="sref">scatterlistp/a> pa href="+code=src" class="sref">srcp/a>[2];.o 32p/a>        structopa href="+code=scatterlist" class="sref">scatterlistp/a> pa href="+code=dst" class="sref">dstp/a>[2];.o 33p/a>        char pa href="+code=tail" class="sref">tailp/a>[];.o 34p/a>};.o 35p/a>.o 36p/a>structopa href="+code=eseqiv_ctx" class="sref">eseqiv_ctxp/a> {.o 37p/a>        pa href="+code=spi
lock_t" class="sref">spi
lock_tp/a> pa href="+code=lock" class="sref">lockp/a>;.o 38p/a>        unsigned int pa href="+code=reqoff" class="sref">reqoffp/a>;.o 39p/a>        char pa href="+code=salt" class="sref">saltp/a>[];.o 40p/a>};.o 41p/a>.o 42p/a>static voidopa href="+code=eseqiv_complete2" class="sref">eseqiv_complete2p/a>(structopa href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_requestp/a> *pa href="+code=req" class="sref">reqp/a>).o 43p/a>{.o 44p/a>        structopa href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipherp/a> *pa href="+code=geniv" class="sref">genivp/a> =opa href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfmp/a>(pa href="+code=req" class="sref">reqp/a>);.o 45p/a>        structopa href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctxp/a> *pa href="+code=reqctx" class="sref">reqctxp/a> =opa href="+code=skcipher_givcrypt_reqctx" class="sref">skcipher_givcrypt_reqctxp/a>(pa href="+code=req" class="sref">reqp/a>);.o 46p/a>.o 47p/a>        pa href="+code=memcpy" class="sref">memcpyp/a>(pa href="+code=req" class="sref">reqp/a>->pa href="+code=giv" class="sref">givp/a>, pa href="+code=PTR_ALIGN" class="sref">PTR_ALIGNp/a>((pa href="+code=u8" class="sref">u8p/a> *)pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=tail" class="sref">tailp/a>,.o 48p/a>                         pa href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmaskp/a>(pa href="+code=geniv" class="sref">genivp/a>) + 1),.o 49p/a>               pa href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsizep/a>(pa href="+code=geniv" class="sref">genivp/a>));.o 50p/a>}.o 51p/a>.o 52p/a>static voidopa href="+code=eseqiv_complete" class="sref">eseqiv_completep/a>(structopa href="+code=crypto_async_request" class="sref">crypto_async_requestp/a> *pa href="+code=base" class="sref">basep/a>, int pa href="+code=err" class="sref">errp/a>).o 53p/a>{.o 54p/a>        structopa href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_requestp/a> *pa href="+code=req" class="sref">reqp/a> =opa href="+code=base" class="sref">basep/a>->pa href="+code=data" class="sref">datap/a>;.o 55p/a>.o 56p/a>        if (pa href="+code=err" class="sref">errp/a>).o 57p/a>                gotoopa href="+code=out" class="sref">outp/a>;.o 58p/a>.o 59p/a>        pa href="+code=eseqiv_complete2" class="sref">eseqiv_complete2p/a>(pa href="+code=req" class="sref">reqp/a>);.o 60p/a>.o 61p/a>pa href="+code=out" class="sref">outp/a>:.o 62p/a>        pa href="+code=skcipher_givcrypt_complete" class="sref">skcipher_givcrypt_completep/a>(pa href="+code=req" class="sref">reqp/a>, pa href="+code=err" class="sref">errp/a>);.o 63p/a>}.o 64p/a>.o 65p/a>static int pa href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencryptp/a>(structopa href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_requestp/a> *pa href="+code=req" class="sref">reqp/a>).o 66p/a>{.o 67p/a>        structopa href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipherp/a> *pa href="+code=geniv" class="sref">genivp/a> =opa href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfmp/a>(pa href="+code=req" class="sref">reqp/a>);.o 68p/a>        structopa href="+code=eseqiv_ctx" class="sref">eseqiv_ctxp/a> *pa href="+code=ctx" class="sref">ctxp/a> =opa href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctxp/a>(pa href="+code=geniv" class="sref">genivp/a>);.o 69p/a>        structopa href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctxp/a> *pa href="+code=reqctx" class="sref">reqctxp/a> =opa href="+code=skcipher_givcrypt_reqctx" class="sref">skcipher_givcrypt_reqctxp/a>(pa href="+code=req" class="sref">reqp/a>);.o 70p/a>        structopa href="+code=ablkcipher_request" class="sref">ablkcipher_requestp/a> *pa href="+code=subreq" class="sref">subreqp/a>;.o 71p/a>        pa href="+code=crypto_completion_t" class="sref">crypto_completion_tp/a> pa href="+code=complete" class="sref">completep/a>;.o 72p/a>        voido*pa href="+code=data" class="sref">datap/a>;.o 73p/a>        structopa href="+code=scatterlist" class="sref">scatterlistp/a> *pa href="+code=osrc" class="sref">osrcp/a>, *pa href="+code=odst" class="sref">odstp/a>;.o 74p/a>        structopa href="+code=scatterlist" class="sref">scatterlistp/a> *pa href="+code=dst" class="sref">dstp/a>;.o 75p/a>        structopa href="+code=page" class="sref">pagep/a> *pa href="+code=srcp" class="sref">srcpp/a>;.o 76p/a>        structopa href="+code=page" class="sref">pagep/a> *pa href="+code=dstp" class="sref">dstpp/a>;.o 77p/a>        pa href="+code=u8" class="sref">u8p/a> *pa href="+code=giv" class="sref">givp/a>;.o 78p/a>        pa href="+code=u8" class="sref">u8p/a> *pa href="+code=vsrc" class="sref">vsrcp/a>;.o 79p/a>        pa href="+code=u8" class="sref">u8p/a> *pa href="+code=vdst" class="sref">vdstp/a>;.o 80p/a>        pa href="+code=__be64" class="sref">__be64p/a> pa href="+code=seq" class="sref">seqp/a>;.o 81p/a>        unsigned int pa href="+code=ivsize" class="sref">ivsizep/a>;.o 82p/a>        unsigned int pa href="+code=len" class="sref">lenp/a>;.o 83p/a>        int pa href="+code=err" class="sref">errp/a>;.o 84p/a>.o 85p/a>        pa href="+code=subreq" class="sref">subreqp/a> =o(voido*)(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=tail" class="sref">tailp/a> + pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=reqoff" class="sref">reqoffp/a>);.o 86p/a>        pa href="+code=ablkcipher_request_set_tfm" class="sref">ablkcipher_request_set_tfmp/a>(pa href="+code=subreq" class="sref">subreqp/a>, pa href="+code=skcipher_geniv_cipher" class="sref">skcipher_geniv_cipherp/a>(pa href="+code=geniv" class="sref">genivp/a>));.o 87p/a>.o 88p/a>        pa href="+code=giv" class="sref">givp/a> =opa href="+code=req" class="sref">reqp/a>->pa href="+code=giv" class="sref">givp/a>;.o 89p/a>        pa href="+code=complete" class="sref">completep/a> =opa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=base" class="sref">basep/a>.pa href="+code=complete" class="sref">completep/a>;.o 90p/a>        pa href="+code=data" class="sref">datap/a> =opa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=base" class="sref">basep/a>.pa href="+code=data" class="sref">datap/a>;.o 91p/a>.o 92p/a>        pa href="+code=osrc" class="sref">osrcp/a> =opa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=src" class="sref">srcp/a>;.o 93p/a>        pa href="+code=odst" class="sref">odstp/a> =opa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=dst" class="sref">dstp/a>;.o 94p/a>        pa href="+code=srcp" class="sref">srcpp/a> =opa href="+code=sg_page" class="sref">sg_pagep/a>(pa href="+code=osrc" class="sref">osrcp/a>);.o 95p/a>        pa href="+code=dstp" class="sref">dstpp/a> =opa href="+code=sg_page" class="sref">sg_pagep/a>(pa href="+code=odst" class="sref">odstp/a>);.o 96p/a>        pa href="+code=vsrc" class="sref">vsrcp/a> =opa href="+code=PageHighMem" class="sref">PageHighMemp/a>(pa href="+code=srcp" class="sref">srcpp/a>) ?opa href="+code=NULL" class="sref">NULLp/a> :opa href="+code=page_address" class="sref">page_addressp/a>(pa href="+code=srcp" class="sref">srcpp/a>) + pa href="+code=osrc" class="sref">osrcp/a>->pa href="+code=offset" class="sref">offsetp/a>;.o 97p/a>        pa href="+code=vdst" class="sref">vdstp/a> =opa href="+code=PageHighMem" class="sref">PageHighMemp/a>(pa href="+code=dstp" class="sref">dstpp/a>) ?opa href="+code=NULL" class="sref">NULLp/a> :opa href="+code=page_address" class="sref">page_addressp/a>(pa href="+code=dstp" class="sref">dstpp/a>) + pa href="+code=odst" class="sref">odstp/a>->pa href="+code=offset" class="sref">offsetp/a>;.o 98p/a>.o 99p/a>        pa href="+code=ivsize" class="sref">ivsizep/a> =opa href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsizep/a>(pa href="+code=geniv" class="sref">genivp/a>);.o100p/a>.o101p/a>        if (pa href="+code=vsrc" class="sref">vsrcp/a> !=opa href="+code=giv" class="sref">givp/a> + pa href="+code=ivsize" class="sref">ivsizep/a> && pa href="+code=vdst" class="sref">vdstp/a> !=opa href="+code=giv" class="sref">givp/a> + pa href="+code=ivsize" class="sref">ivsizep/a>) {.o102p/a>                pa href="+code=giv" class="sref">givp/a> =opa href="+code=PTR_ALIGN" class="sref">PTR_ALIGNp/a>((pa href="+code=u8" class="sref">u8p/a> *)pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=tail" class="sref">tailp/a>,.o103p/a>                                pa href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmaskp/a>(pa href="+code=geniv" class="sref">genivp/a>) + 1);.o104p/a>                pa href="+code=complete" class="sref">completep/a> =opa href="+code=eseqiv_complete" class="sref">eseqiv_completep/a>;.o105p/a>                pa href="+code=data" class="sref">datap/a> =opa href="+code=req" class="sref">reqp/a>;.o106p/a>        }.o107p/a>.o108p/a>        pa href="+code=ablkcipher_request_set_callback" class="sref">ablkcipher_request_set_callbackp/a>(pa href="+code=subreq" class="sref">subreqp/a>, pa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=base" class="sref">basep/a>.pa href="+code=flags" class="sref">flagsp/a>, pa href="+code=complete" class="sref">completep/a>,.o109p/a>                                        pa href="+code=data" class="sref">datap/a>);.o110p/a>.o111p/a>        pa href="+code=sg_init_table" class="sref">sg_init_tablep/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=src" class="sref">srcp/a>, 2);.o112p/a>        pa href="+code=sg_set_buf" class="sref">sg_set_bufp/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=src" class="sref">srcp/a>, pa href="+code=giv" class="sref">givp/a>, pa href="+code=ivsize" class="sref">ivsizep/a>);.o113p/a>        pa href="+code=scatterwalk_crypto_chain" class="sref">scatterwalk_crypto_chainp/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=src" class="sref">srcp/a>, pa href="+code=osrc" class="sref">osrcp/a>, pa href="+code=vsrc" class="sref">vsrcp/a> ==opa href="+code=giv" class="sref">givp/a> + pa href="+code=ivsize" class="sref">ivsizep/a>, 2);.o114p/a>.o115p/a>        pa href="+code=dst" class="sref">dstp/a> =opa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=src" class="sref">srcp/a>;.o116p/a>        if (pa href="+code=osrc" class="sref">osrcp/a> !=opa href="+code=odst" class="sref">odstp/a>) {.o117p/a>                pa href="+code=sg_init_table" class="sref">sg_init_tablep/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=dst" class="sref">dstp/a>, 2);.o118p/a>                pa href="+code=sg_set_buf" class="sref">sg_set_bufp/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=dst" class="sref">dstp/a>, pa href="+code=giv" class="sref">givp/a>, pa href="+code=ivsize" class="sref">ivsizep/a>);.o119p/a>                pa href="+code=scatterwalk_crypto_chain" class="sref">scatterwalk_crypto_chainp/a>(pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=dst" class="sref">dstp/a>, pa href="+code=odst" class="sref">odstp/a>, pa href="+code=vdst" class="sref">vdstp/a> ==opa href="+code=giv" class="sref">givp/a> + pa href="+code=ivsize" class="sref">ivsizep/a>, 2);.o120p/a>.o121p/a>                pa href="+code=dst" class="sref">dstp/a> =opa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=dst" class="sref">dstp/a>;.o122p/a>        }.o123p/a>.o124p/a>        pa href="+code=ablkcipher_request_set_crypt" class="sref">ablkcipher_request_set_cryptp/a>(pa href="+code=subreq" class="sref">subreqp/a>, pa href="+code=reqctx" class="sref">reqctxp/a>->pa href="+code=src" class="sref">srcp/a>, pa href="+code=dst" class="sref">dstp/a>,.o125p/a>                                     pa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=nbytes" class="sref">nbytesp/a> + pa href="+code=ivsize" class="sref">ivsizep/a>,.o126p/a>                                     pa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=info" class="sref">infop/a>);.o127p/a>.o128p/a>        pa href="+code=memcpy" class="sref">memcpyp/a>(pa href="+code=req" class="sref">reqp/a>->pa href="+code=creq" class="sref">creqp/a>.pa href="+code=info" class="sref">infop/a>, pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=salt" class="sref">saltp/a>, pa href="+code=ivsize" class="sref">ivsizep/a>);.o129p/a>.o130p/a>        pa href="+code=len" class="sref">lenp/a> =opa href="+code=ivsize" class="sref">ivsizep/a>;.o131p/a>        if (pa href="+code=ivsize" class="sref">ivsizep/a> > sizeof(pa href="+code=u64" class="sref">u64p/a>)) {.o132p/a>                pa href="+code=memset" class="sref">memsetp/a>(pa href="+code=req" class="sref">reqp/a>->pa href="+code=giv" class="sref">givp/a>, 0, pa href="+code=ivsize" class="sref">ivsizep/a> - sizeof(pa href="+code=u64" class="sref">u64p/a>));.o133p/a>                pa href="+code=len" class="sref">lenp/a> =osizeof(pa href="+code=u64" class="sref">u64p/a>);.o134p/a>        }.o135p/a>        pa href="+code=seq" class="sref">seqp/a> =opa href="+code=cpu_to_be64" class="sref">cpu_to_be64p/a>(pa href="+code=req" class="sref">reqp/a>->pa href="+code=seq" class="sref">seqp/a>);.o136p/a>        pa href="+code=memcpy" class="sref">memcpyp/a>(pa href="+code=req" class="sref">reqp/a>->pa href="+code=giv" class="sref">givp/a> + pa href="+code=ivsize" class="sref">ivsizep/a> - pa href="+code=len" class="sref">lenp/a>, &pa href="+code=seq" class="sref">seqp/a>, pa href="+code=len" class="sref">lenp/a>);.o137p/a>.o138p/a>        pa href="+code=err" class="sref">errp/a> =opa href="+code=crypto_ablkcipher_encrypt" class="sref">crypto_ablkcipher_encryptp/a>(pa href="+code=subreq" class="sref">subreqp/a>);.o139p/a>        if (pa href="+code=err" class="sref">errp/a>).o140p/a>                gotoopa href="+code=out" class="sref">outp/a>;.o141p/a>.o142p/a>        if (pa href="+code=giv" class="sref">givp/a> !=opa href="+code=req" class="sref">reqp/a>->pa href="+code=giv" class="sref">givp/a>).o143p/a>                pa href="+code=eseqiv_complete2" class="sref">eseqiv_complete2p/a>(pa href="+code=req" class="sref">reqp/a>);.o144p/a>.o145p/a>pa href="+code=out" class="sref">outp/a>:.o146p/a>        return pa href="+code=err" class="sref">errp/a>;.o147p/a>}.o148p/a>.o149p/a>static int pa href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_firstp/a>(structopa href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_requestp/a> *pa href="+code=req" class="sref">reqp/a>).o150p/a>{.o151p/a>        structopa href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipherp/a> *pa href="+code=geniv" class="sref">genivp/a> =opa href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfmp/a>(pa href="+code=req" class="sref">reqp/a>);.o152p/a>        structopa href="+code=eseqiv_ctx" class="sref">eseqiv_ctxp/a> *pa href="+code=ctx" class="sref">ctxp/a> =opa href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctxp/a>(pa href="+code=geniv" class="sref">genivp/a>);.o153p/a>        int pa href="+code=err" class="sref">errp/a> =o0;.o154p/a>.o155p/a>        pa href="+code=spin_lock_bh" class="sref">spin_lock_bhp/a>(&pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=lock" class="sref">lockp/a>);.o156p/a>        if (pa href="+code=crypto_ablkcipher_crt" class="sref">crypto_ablkcipher_crtp/a>(pa href="+code=geniv" class="sref">genivp/a>)->pa href="+code=givencrypt" class="sref">givencryptp/a> !=opa href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_firstp/a>).o157p/a>                gotoopa href="+code=unlock" class="sref">unlockp/a>;.o158p/a>.o159p/a>        pa href="+code=crypto_ablkcipher_crt" class="sref">crypto_ablkcipher_crtp/a>(pa href="+code=geniv" class="sref">genivp/a>)->pa href="+code=givencrypt" class="sref">givencryptp/a> =opa href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencryptp/a>;.o160p/a>        pa href="+code=err" class="sref">errp/a> =opa href="+code=crypto_rng_get_bytes" class="sref">crypto_rng_get_bytesp/a>(pa href="+code=crypto_default_rng" class="sref">crypto_default_rngp/a>, pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=salt" class="sref">saltp/a>,.o161p/a>                                   pa href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsizep/a>(pa href="+code=geniv" class="sref">genivp/a>));.o162p/a>.o163p/a>pa href="+code=unlock" class="sref">unlockp/a>:.o164p/a>        pa href="+code=spin_unlock_bh" class="sref">spin_unlock_bhp/a>(&pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=lock" class="sref">lockp/a>);.o165p/a>.o166p/a>        if (pa href="+code=err" class="sref">errp/a>).o167p/a>                return pa href="+code=err" class="sref">errp/a>;.o168p/a>.o169p/a>        return pa href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencryptp/a>(pa href="+code=req" class="sref">reqp/a>);.o170p/a>}.o171p/a>.o172p/a>static int pa href="+code=eseqiv_init" class="sref">eseqiv_initp/a>(structopa href="+code=crypto_tfm" class="sref">crypto_tfmp/a> *pa href="+code=tfm" class="sref">tfmp/a>).o173p/a>{.o174p/a>        structopa href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipherp/a> *pa href="+code=geniv" class="sref">genivp/a> =opa href="+code=__crypto_ablkcipher_cast" class="sref">__crypto_ablkcipher_castp/a>(pa href="+code=tfm" class="sref">tfmp/a>);.o175p/a>        structopa href="+code=eseqiv_ctx" class="sref">eseqiv_ctxp/a> *pa href="+code=ctx" class="sref">ctxp/a> =opa href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctxp/a>(pa href="+code=geniv" class="sref">genivp/a>);.o176p/a>        unsigned long pa href="+code=alignmask" class="sref">alignmaskp/a>;.o177p/a>        unsigned int pa href="+code=reqsize" class="sref">reqsizep/a>;.o178p/a>.o179p/a>        pa href="+code=spin_lock_init" class="sref">spin_lock_initp/a>(&pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=lock" class="sref">lockp/a>);.o180p/a>.o181p/a>        pa href="+code=alignmask" class="sref">alignmaskp/a> =opa href="+code=crypto_tfm_ctx_alignment" class="sref">crypto_tfm_ctx_alignmentp/a>() - 1;.o182p/a>        pa href="+code=reqsize" class="sref">reqsizep/a> =osizeof(structopa href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctxp/a>);.o183p/a>.o184p/a>        if (pa href="+code=alignmask" class="sref">alignmaskp/a> & pa href="+code=reqsize" class="sref">reqsizep/a>) {.o185p/a>                pa href="+code=alignmask" class="sref">alignmaskp/a> &=opa href="+code=reqsize" class="sref">reqsizep/a>;.o186p/a>                pa href="+code=alignmask" class="sref">alignmaskp/a>--;.o187p/a>        }.o188p/a>.o189p/a>        pa href="+code=alignmask" class="sref">alignmaskp/a> =o~pa href="+code=alignmask" class="sref">alignmaskp/a>;.o190p/a>        pa href="+code=alignmask" class="sref">alignmaskp/a> &=opa href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmaskp/a>(pa href="+code=geniv" class="sref">genivp/a>);.o191p/a>.o192p/a>        pa href="+code=reqsize" class="sref">reqsizep/a> +=opa href="+code=alignmask" class="sref">alignmaskp/a>;.o193p/a>        pa href="+code=reqsize" class="sref">reqsizep/a> +=opa href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsizep/a>(pa href="+code=geniv" class="sref">genivp/a>);.o194p/a>        pa href="+code=reqsize" class="sref">reqsizep/a> =opa href="+code=ALIGN" class="sref">ALIGNp/a>(pa href="+code=reqsize" class="sref">reqsizep/a>, pa href="+code=crypto_tfm_ctx_alignment" class="sref">crypto_tfm_ctx_alignmentp/a>());.o195p/a>.o196p/a>        pa href="+code=ctx" class="sref">ctxp/a>->pa href="+code=reqoff" class="sref">reqoffp/a> =opa href="+code=reqsize" class="sref">reqsizep/a> -osizeof(structopa href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctxp/a>);.o197p/a>.o198p/a>        pa href="+code=tfm" class="sref">tfmp/a>->pa href="+code=crt_ablkcipher" class="sref">crt_ablkcipherp/a>.pa href="+code=reqsize" class="sref">reqsizep/a> =opa href="+code=reqsize" class="sref">reqsizep/a> +.o199p/a>                                      sizeof(structopa href="+code=ablkcipher_request" class="sref">ablkcipher_requestp/a>);.o200p/a>.o201p/a>        return pa href="+code=skcipher_geniv_init" class="sref">skcipher_geniv_initp/a>(pa href="+code=tfm" class="sref">tfmp/a>);.o202p/a>}.o203p/a>.o204p/a>static structopa href="+code=crypto_template" class="sref">crypto_templatep/a> pa href="+code=eseqiv_tmpl" class="sref">eseqiv_tmplp/a>;.o205p/a>.o206p/a>static structopa href="+code=crypto_instance" class="sref">crypto_instancep/a> *pa href="+code=eseqiv_alloc" class="sref">eseqiv_allocp/a>(structopa href="+code=rtattr" class="sref">rtattrp/a> **pa href="+code=tb" class="sref">tbp/a>).o207p/a>{.o208p/a>        structopa href="+code=crypto_instance" class="sref">crypto_instancep/a> *pa href="+code=inst" class="sref">instp/a>;.o209p/a>        int pa href="+code=err" class="sref">errp/a>;.o210p/a>.o211p/a>        pa href="+code=err" class="sref">errp/a> =opa href="+code=crypto_get_default_rng" class="sref">crypto_get_default_rngp/a>();.o212p/a>        if (pa href="+code=err" class="sref">errp/a>).o213p/a>                return pa href="+code=ERR_PTR" class="sref">ERR_PTRp/a>(pa href="+code=err" class="sref">errp/a>);.o214p/a>.o215p/a>        pa href="+code=inst" class="sref">instp/a> =opa href="+code=skcipher_geniv_alloc" class="sref">skcipher_geniv_allocp/a>(&pa href="+code=eseqiv_tmpl" class="sref">eseqiv_tmplp/a>, pa href="+code=tb" class="sref">tbp/a>, 0, 0);.o216p/a>        if (pa href="+code=IS_ERR" class="sref">IS_ERRp/a>(pa href="+code=inst" class="sref">instp/a>)).o217p/a>                gotoopa href="+code=put_rng" class="sref">put_rngp/a>;.o218p/a>.o219p/a>        pa href="+code=err" class="sref">errp/a> =o-pa href="+code=EINVAL" class="sref">EINVALp/a>;.o220p/a>        if (pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_ablkcipher" class="sref">cra_ablkcipherp/a>.pa href="+code=ivsize" class="sref">ivsizep/a> !=opa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_blocksize" class="sref">cra_blocksizep/a>).o221p/a>                gotoopa href="+code=free_inst" class="sref">free_instp/a>;.o222p/a>.o223p/a>        pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_ablkcipher" class="sref">cra_ablkcipherp/a>.pa href="+code=givencrypt" class="sref">givencryptp/a> =opa href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_firstp/a>;.o224p/a>.o225p/a>        pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_init" class="sref">cra_initp/a> =opa href="+code=eseqiv_init" class="sref">eseqiv_initp/a>;.o226p/a>        pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_exit" class="sref">cra_exitp/a> =opa href="+code=skcipher_geniv_exit" class="sref">skcipher_geniv_exitp/a>;.o227p/a>.o228p/a>        pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_ctxsize" class="sref">cra_ctxsizep/a> =osizeof(structopa href="+code=eseqiv_ctx" class="sref">eseqiv_ctxp/a>);.o229p/a>        pa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_ctxsize" class="sref">cra_ctxsizep/a> +=opa href="+code=inst" class="sref">instp/a>->pa href="+code=alg" class="sref">algp/a>.pa href="+code=cra_ablkcipher" class="sref">cra_ablkcipherp/a>.pa href="+code=ivsize" class="sref">ivsizep/a>;.o230p/a>.o231p/a>pa href="+code=out" class="sref">outp/a>:.o232p/a>        return pa href="+code=inst" class="sref">instp/a>;.o233p/a>.o234p/a>pa href="+code=free_inst" class="sref">free_instp/a>:.o235p/a>        pa href="+code=skcipher_geniv_free" class="sref">skcipher_geniv_freep/a>(pa href="+code=inst" class="sref">instp/a>);.o236p/a>        pa href="+code=inst" class="sref">instp/a> =opa href="+code=ERR_PTR" class="sref">ERR_PTRp/a>(pa href="+code=err" class="sref">errp/a>);.o237p/a>pa href="+code=put_rng" class="sref">put_rngp/a>:.o238p/a>        pa href="+code=crypto_put_default_rng" class="sref">crypto_put_default_rngp/a>();.o239p/a>        gotoopa href="+code=out" class="sref">outp/a>;.o240p/a>}.o241p/a>.o242p/a>static voidopa href="+code=eseqiv_free" class="sref">eseqiv_freep/a>(structopa href="+code=crypto_instance" class="sref">crypto_instancep/a> *pa href="+code=inst" class="sref">instp/a>).o243p/a>{.o244p/a>        pa href="+code=skcipher_geniv_free" class="sref">skcipher_geniv_freep/a>(pa href="+code=inst" class="sref">instp/a>);.o245p/a>        pa href="+code=crypto_put_default_rng" class="sref">crypto_put_default_rngp/a>();.o246p/a>}.o247p/a>.o248p/a>static structopa href="+code=crypto_template" class="sref">crypto_templatep/a> pa href="+code=eseqiv_tmpl" class="sref">eseqiv_tmplp/a> =o{.o249p/a>        .pa href="+code=nam<" class="sref">nam

=opspan class="string">"eseqiv",.o250p/a> .pa href="+code=alloc" class="sref">allocp/a> =opa href="+code=eseqiv_alloc" class="sref">eseqiv_allocp/a>,.o251p/a> .pa href="+code=free" class="sref">freep/a> =opa href="+code=eseqiv_free" class="sref">eseqiv_freep/a>,.o252p/a> .pa href="+code=module" class="sref">modulep/a> =opa href="+code=THIS_MODULE" class="sref">THIS_MODULEp/a>,.o253p/a>};.o254p/a>.o255p/a>static int pa href="+code=__init" class="sref">__initp/a> pa href="+code=eseqiv_Ep/a>,_init" class="sref">eseqiv_=eseqiv_Ep/p/a>(r"de=__init" class="sref">__initp/c=skciphelass="line" namo253p/a>}s+code=len" clas=skciphelass="line" namo253p/a>}s+ode=len" clas=skciphelass="line" namo253p/a>}s+ode=len" clas/c=skciphcode=alg" class="sref">algp/a>.piv.c#L158" idopL158" class="2ine" 2amo15ref="crypto/eseqiv.c#Line" naregist245249" idopL249" class="line" naregist245249" ido/eseqiv.c#L216" idopL216" class="line" namo216p/a> e" namo247p/a>.o248p/a>static s>(pa href2"+code=geniv" class="sre2">gen25opa href="+code=ivsize" class="s2tes" clas2="sref">crypto_rng_get_b2tesp/2>(pa hstancep/a> *pa href="+code=_rypto/eseqiv.c#L228"_ss="line" opL253">o253p/a>}s+code=len" ypto/eseqiv.c#L228">}s+code=len" ypto253p/a>}s+ode=len" clas=skciphelass="lsref">cry2to_ablkcipher_ivsizep/a>2pa hr2f="+coiphcode=alg" class="sref">alg"+code=un2ock" class="sref">unlock2/a>:.26ypto/eseqiv.c#L193" idopL193ine" naunregist245249" idopL249" class="line" naunregist245249" ido/eseqiv.c#L216" idopL216" class="line" namo216p/a> e" namo247p/a>.o162p/a> 2 namo248p/a>static s="+code=c2x" class="sref">ctxp/a>-2gt;pa26nitp/a> pa href="+code=eseqiv_Ep/if (pa hr2f="+code=err" class="sre2">err26eturn pa href="+codee=len" clas=skciphelass="lmo253p/opL253">o253p/a>}s+code=len" clas=skciphelass="line" namo253pe" namo247p/a>.o162p/a> pa href="+codee=len" ypto/eseqiv.c#L228"e=len" ypto253p/opL253">o253p/a>}s+code=len" ypto/eseqiv.c#L228">}s+code=len" ypto253pe" namo247p/a>..piv.c8" idopL168" class="line2 nam<26s="sref">crypto_templatep/a> pa hreturn pa2href="+code=eseqiv_given2rypt"2class=opL253">o253p/aclass=_LICENSiv.c#L254" idopLclass=_LICENSi253p/opa href="+code=alloc" clasGPLf">allocp/a> e" namo247p/a>.2eqp/a2);.o253p/aclass=_DESCRIPTIOcrypto_tfm_ctx_aclass=_DESCRIPTIOc253p/opa href="+code=alloc" clasE25" cled Slassa h Number IV Generatorf">allocp/a> e" namo247p/a>.

The original LXR software by the namLXR commu">oivsiz, this experilassal version by namlx4@72"ux.no href
lx4.72"ux.no kindly hosled by namRedpill L2"pro ASvsiz, provider of L2"ux cons" call and operations services sia h 1995.