linux/crypto/eseqiv.c
<<
ptio v2/spa v2/form v2a ptio v href="../linux+v" .3/crypto/eseqiv.c">ptio v2img src="../.static/gfx/right.png" alt=">>">pt2/spa pt2spa class="lxr_search">ptioptio v2input typtiohidden" namtionavtarget" ptio v2input typtiotext" namtiosearch" idiosearch">ptio v2butt2.6typtiosubmit">Searchptio vPrefs v2/a>pt2/spa io v v2/div io v v2form ac5" ="ajax+*" method="post" onsubmit="return false;">pt2input typtiohidden" namtioajax_lookup" idioajax_lookup" pio v v2/form pio v v2div class="headingbott2m">
2div idiofile_contents"
v v12/a>2spa	 class="comment">/*2/spa	  v v22/a>2spa	 class="comment"> * eseqiv: Encrypted Sequence Number IV Generator2/spa	  v v32/a>2spa	 class="comment"> *2/spa	  v v42/a>2spa	 class="comment"> * This generator generates a	 IV based 2.6a sequence number by xoring it2/spa	  v v52/a>2spa	 class="comment"> * with6a salt a	d then encrypting it with6the same key as used to encrypt2/spa	  v v62/a>2spa	 class="comment"> * the plai.6text.  This algorithm requires that the block size be equal2/spa	  v v72/a>2spa	 class="comment"> * to the IV size.  It is mai.ly useful for CBC.2/spa	  v v82/a>2spa	 class="comment"> *2/spa	  v v92/a>2spa	 class="comment"> * Copyright (c) 2007 Herbert Xu <herbert@gondor.apa	a.org.au>2/spa	  v 	  >a>2spa	 class="comment"> *2/spa	  v 112/a>2spa	 class="comment"> * This program is free software; you ca	 redistribute it a	d/or modify it2/spa	  v 122/a>2spa	 class="comment"> * under the terms of the GNU General Public License as published by the Free2/spa	  v 132/a>2spa	 class="comment"> * Software Founda5"
	; either vers22.62 of the License, or (at your 2.5"
	)2/spa	  v 142/a>2spa	 class="comment"> * any later vers22..2/spa	  v 152/a>2spa	 class="comment"> *2/spa	  v 162/a>2spa	 class="comment"> */2/spa	  v 172/a> v 182/a>#include <crypto/internal/skcipher.h2/a>> v 192/a>#include <crypto/rng.h2/a>> v 202/a>#include <crypto/scatterwalk.h2/a>> v 212/a>#include <linux/err.h2/a>> v 222/a>#include <linux/init.h2/a>> v 232/a>#include <linux/kernel.h2/a>> v 242/a>#include <linux/mm.h2/a>> v 252/a>#include <linux/module.h2/a>> v 262/a>#include <linux/scatterlist.h2/a>> v 272/a>#include <linux/spi.lock.h2/a>> v 282/a>#include <linux/string.h2/a>> v 292/a> v 302/a>structv2a href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctx2/a> { v 312/a>        structv2a href="+code=scatterlist" class="sref">scatterlist2/a> 2a href="+code=src" class="sref">src2/a>[2]; v 322/a>        structv2a href="+code=scatterlist" class="sref">scatterlist2/a> 2a href="+code=dst" class="sref">dst2/a>[2]; v 332/a>        char 2a href="+code=tail" class="sref">tail2/a>[]; v 342/a>}; v 352/a> v 362/a>structv2a href="+code=eseqiv_ctx" class="sref">eseqiv_ctx2/a> { v 372/a>        2a href="+code=spi.lock_t" class="sref">spi.lock_t2/a> 2a href="+code=lock" class="sref">lock2/a>; v 382/a>        unsigned int 2a href="+code=reqoff" class="sref">reqoff2/a>; v 392/a>        char 2a href="+code=salt" class="sref">salt2/a>[]; v 402/a>}; v 412/a> v 422/a>static voidv2a href="+code=eseqiv_complete2" class="sref">eseqiv_complete22/a>(structv2a href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_request2/a> *2a href="+code=req" class="sref">req2/a>) v 432/a>{ v 442/a>        structv2a href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipher2/a> *2a href="+code=geniv" class="sref">geniv2/a> =v2a href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfm2/a>(2a href="+code=req" class="sref">req2/a>); v 452/a>        structv2a href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctx2/a> *2a href="+code=reqctx" class="sref">reqctx2/a> =v2a href="+code=skcipher_givcrypt_reqctx" class="sref">skcipher_givcrypt_reqctx2/a>(2a href="+code=req" class="sref">req2/a>); v 462/a> v 472/a>        2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=req" class="sref">req2/a>->2a href="+code=giv" class="sref">giv2/a>, 2a href="+code=PTR_ALIGN" class="sref">PTR_ALIGN2/a>((2a href="+code=u8" class="sref">u82/a> *)2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=tail" class="sref">tail2/a>, v 482/a>                         2a href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmask2/a>(2a href="+code=geniv" class="sref">geniv2/a>) + 1), v 492/a>               2a href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsize2/a>(2a href="+code=geniv" class="sref">geniv2/a>)); v 502/a>} v 512/a> v 522/a>static voidv2a href="+code=eseqiv_complete" class="sref">eseqiv_complete2/a>(structv2a href="+code=crypto_async_request" class="sref">crypto_async_request2/a> *2a href="+code=base" class="sref">base2/a>, int 2a href="+code=err" class="sref">err2/a>) v 532/a>{ v 542/a>        structv2a href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_request2/a> *2a href="+code=req" class="sref">req2/a> =v2a href="+code=base" class="sref">base2/a>->2a href="+code=data" class="sref">data2/a>; v 552/a> v 562/a>        if (2a href="+code=err" class="sref">err2/a>) v 572/a>                gotov2a href="+code=out" class="sref">out2/a>; v 582/a> v 592/a>        2a href="+code=eseqiv_complete2" class="sref">eseqiv_complete22/a>(2a href="+code=req" class="sref">req2/a>); v 602/a> v 612/a>2a href="+code=out" class="sref">out2/a>: v 622/a>        2a href="+code=skcipher_givcrypt_complete" class="sref">skcipher_givcrypt_complete2/a>(2a href="+code=req" class="sref">req2/a>, 2a href="+code=err" class="sref">err2/a>); v 632/a>} v 642/a> v 652/a>static int 2a href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencrypt2/a>(structv2a href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_request2/a> *2a href="+code=req" class="sref">req2/a>) v 662/a>{ v 672/a>        structv2a href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipher2/a> *2a href="+code=geniv" class="sref">geniv2/a> =v2a href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfm2/a>(2a href="+code=req" class="sref">req2/a>); v 682/a>        structv2a href="+code=eseqiv_ctx" class="sref">eseqiv_ctx2/a> *2a href="+code=ctx" class="sref">ctx2/a> =v2a href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctx2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v 692/a>        structv2a href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctx2/a> *2a href="+code=reqctx" class="sref">reqctx2/a> =v2a href="+code=skcipher_givcrypt_reqctx" class="sref">skcipher_givcrypt_reqctx2/a>(2a href="+code=req" class="sref">req2/a>); v 702/a>        structv2a href="+code=ablkcipher_request" class="sref">ablkcipher_request2/a> *2a href="+code=subreq" class="sref">subreq2/a>; v 712/a>        2a href="+code=crypto_completion_t" class="sref">crypto_completion_t2/a> 2a href="+code=complete" class="sref">complete2/a>; v 722/a>        voidv*2a href="+code=data" class="sref">data2/a>; v 732/a>        structv2a href="+code=scatterlist" class="sref">scatterlist2/a> *2a href="+code=osrc" class="sref">osrc2/a>, *2a href="+code=odst" class="sref">odst2/a>; v 742/a>        structv2a href="+code=scatterlist" class="sref">scatterlist2/a> *2a href="+code=dst" class="sref">dst2/a>; v 752/a>        structv2a href="+code=page" class="sref">page2/a> *2a href="+code=srcp" class="sref">srcp2/a>; v 762/a>        structv2a href="+code=page" class="sref">page2/a> *2a href="+code=dstp" class="sref">dstp2/a>; v 772/a>        2a href="+code=u8" class="sref">u82/a> *2a href="+code=giv" class="sref">giv2/a>; v 782/a>        2a href="+code=u8" class="sref">u82/a> *2a href="+code=vsrc" class="sref">vsrc2/a>; v 792/a>        2a href="+code=u8" class="sref">u82/a> *2a href="+code=vdst" class="sref">vdst2/a>; v 802/a>        2a href="+code=__be64" class="sref">__be642/a> 2a href="+code=seq" class="sref">seq2/a>; v 812/a>        unsigned int 2a href="+code=ivsize" class="sref">ivsize2/a>; v 822/a>        unsigned int 2a href="+code=len" class="sref">len2/a>; v 832/a>        int 2a href="+code=err" class="sref">err2/a>; v 842/a> v 852/a>        2a href="+code=subreq" class="sref">subreq2/a> =v(voidv*)(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=tail" class="sref">tail2/a> + 2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=reqoff" class="sref">reqoff2/a>); v 862/a>        2a href="+code=ablkcipher_request_set_tfm" class="sref">ablkcipher_request_set_tfm2/a>(2a href="+code=subreq" class="sref">subreq2/a>, 2a href="+code=skcipher_geniv_cipher" class="sref">skcipher_geniv_cipher2/a>(2a href="+code=geniv" class="sref">geniv2/a>)); v 872/a> v 882/a>        2a href="+code=giv" class="sref">giv2/a> =v2a href="+code=req" class="sref">req2/a>->2a href="+code=giv" class="sref">giv2/a>; v 892/a>        2a href="+code=complete" class="sref">complete2/a> =v2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=base" class="sref">base2/a>.2a href="+code=complete" class="sref">complete2/a>; v 902/a>        2a href="+code=data" class="sref">data2/a> =v2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=base" class="sref">base2/a>.2a href="+code=data" class="sref">data2/a>; v 912/a> v 922/a>        2a href="+code=osrc" class="sref">osrc2/a> =v2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=src" class="sref">src2/a>; v 932/a>        2a href="+code=odst" class="sref">odst2/a> =v2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=dst" class="sref">dst2/a>; v 942/a>        2a href="+code=srcp" class="sref">srcp2/a> =v2a href="+code=sg_page" class="sref">sg_page2/a>(2a href="+code=osrc" class="sref">osrc2/a>); v 952/a>        2a href="+code=dstp" class="sref">dstp2/a> =v2a href="+code=sg_page" class="sref">sg_page2/a>(2a href="+code=odst" class="sref">odst2/a>); v 962/a>        2a href="+code=vsrc" class="sref">vsrc2/a> =v2a href="+code=PageHighMem" class="sref">PageHighMem2/a>(2a href="+code=srcp" class="sref">srcp2/a>) ?v2a href="+code=NULL" class="sref">NULL2/a> :v2a href="+code=page_address" class="sref">page_address2/a>(2a href="+code=srcp" class="sref">srcp2/a>) + 2a href="+code=osrc" class="sref">osrc2/a>->2a href="+code=offset" class="sref">offset2/a>; v 972/a>        2a href="+code=vdst" class="sref">vdst2/a> =v2a href="+code=PageHighMem" class="sref">PageHighMem2/a>(2a href="+code=dstp" class="sref">dstp2/a>) ?v2a href="+code=NULL" class="sref">NULL2/a> :v2a href="+code=page_address" class="sref">page_address2/a>(2a href="+code=dstp" class="sref">dstp2/a>) + 2a href="+code=odst" class="sref">odst2/a>->2a href="+code=offset" class="sref">offset2/a>; v 982/a> v 992/a>        2a href="+code=ivsize" class="sref">ivsize2/a> =v2a href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsize2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v1002/a> v1012/a>        if (2a href="+code=vsrc" class="sref">vsrc2/a> !=v2a href="+code=giv" class="sref">giv2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a> && 2a href="+code=vdst" class="sref">vdst2/a> !=v2a href="+code=giv" class="sref">giv2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a>) { v1022/a>                2a href="+code=giv" class="sref">giv2/a> =v2a href="+code=PTR_ALIGN" class="sref">PTR_ALIGN2/a>((2a href="+code=u8" class="sref">u82/a> *)2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=tail" class="sref">tail2/a>, v1032/a>                                2a href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmask2/a>(2a href="+code=geniv" class="sref">geniv2/a>) + 1); v1042/a>                2a href="+code=complete" class="sref">complete2/a> =v2a href="+code=eseqiv_complete" class="sref">eseqiv_complete2/a>; v1052/a>                2a href="+code=data" class="sref">data2/a> =v2a href="+code=req" class="sref">req2/a>; v1062/a>        } v1072/a> v1082/a>        2a href="+code=ablkcipher_request_set_callback" class="sref">ablkcipher_request_set_callback2/a>(2a href="+code=subreq" class="sref">subreq2/a>, 2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=base" class="sref">base2/a>.2a href="+code=flags" class="sref">flags2/a>, 2a href="+code=complete" class="sref">complete2/a>, v1092/a>                                        2a href="+code=data" class="sref">data2/a>); v1102/a> v1112/a>        2a href="+code=sg_init_table" class="sref">sg_init_table2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=src" class="sref">src2/a>, 2); v1122/a>        2a href="+code=sg_set_buf" class="sref">sg_set_buf2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=src" class="sref">src2/a>, 2a href="+code=giv" class="sref">giv2/a>, 2a href="+code=ivsize" class="sref">ivsize2/a>); v1132/a>        2a href="+code=scatterwalk_crypto_chain" class="sref">scatterwalk_crypto_chain2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=src" class="sref">src2/a>, 2a href="+code=osrc" class="sref">osrc2/a>, 2a href="+code=vsrc" class="sref">vsrc2/a> ==v2a href="+code=giv" class="sref">giv2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a>, 2); v1142/a> v1152/a>        2a href="+code=dst" class="sref">dst2/a> =v2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=src" class="sref">src2/a>; v1162/a>        if (2a href="+code=osrc" class="sref">osrc2/a> !=v2a href="+code=odst" class="sref">odst2/a>) { v1172/a>                2a href="+code=sg_init_table" class="sref">sg_init_table2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=dst" class="sref">dst2/a>, 2); v1182/a>                2a href="+code=sg_set_buf" class="sref">sg_set_buf2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=dst" class="sref">dst2/a>, 2a href="+code=giv" class="sref">giv2/a>, 2a href="+code=ivsize" class="sref">ivsize2/a>); v1192/a>                2a href="+code=scatterwalk_crypto_chain" class="sref">scatterwalk_crypto_chain2/a>(2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=dst" class="sref">dst2/a>, 2a href="+code=odst" class="sref">odst2/a>, 2a href="+code=vdst" class="sref">vdst2/a> ==v2a href="+code=giv" class="sref">giv2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a>, 2); v1202/a> v1212/a>                2a href="+code=dst" class="sref">dst2/a> =v2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=dst" class="sref">dst2/a>; v1222/a>        } v1232/a> v1242/a>        2a href="+code=ablkcipher_request_set_crypt" class="sref">ablkcipher_request_set_crypt2/a>(2a href="+code=subreq" class="sref">subreq2/a>, 2a href="+code=reqctx" class="sref">reqctx2/a>->2a href="+code=src" class="sref">src2/a>, 2a href="+code=dst" class="sref">dst2/a>, v1252/a>                                     2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=nbytes" class="sref">nbytes2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a>, v1262/a>                                     2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=info" class="sref">info2/a>); v1272/a> v1282/a>        2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=req" class="sref">req2/a>->2a href="+code=creq" class="sref">creq2/a>.2a href="+code=info" class="sref">info2/a>, 2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=salt" class="sref">salt2/a>, 2a href="+code=ivsize" class="sref">ivsize2/a>); v1292/a> v1302/a>        2a href="+code=len" class="sref">len2/a> =v2a href="+code=ivsize" class="sref">ivsize2/a>; v1312/a>        if (2a href="+code=ivsize" class="sref">ivsize2/a> > sizeof(2a href="+code=u64" class="sref">u642/a>)) { v1322/a>                2a href="+code=memset" class="sref">memset2/a>(2a href="+code=req" class="sref">req2/a>->2a href="+code=giv" class="sref">giv2/a>, 0, 2a href="+code=ivsize" class="sref">ivsize2/a> - sizeof(2a href="+code=u64" class="sref">u642/a>)); v1332/a>                2a href="+code=len" class="sref">len2/a> =vsizeof(2a href="+code=u64" class="sref">u642/a>); v1342/a>        } v1352/a>        2a href="+code=seq" class="sref">seq2/a> =v2a href="+code=cpu_to_be64" class="sref">cpu_to_be642/a>(2a href="+code=req" class="sref">req2/a>->2a href="+code=seq" class="sref">seq2/a>); v1362/a>        2a href="+code=memcpy" class="sref">memcpy2/a>(2a href="+code=req" class="sref">req2/a>->2a href="+code=giv" class="sref">giv2/a> + 2a href="+code=ivsize" class="sref">ivsize2/a> - 2a href="+code=len" class="sref">len2/a>, &2a href="+code=seq" class="sref">seq2/a>, 2a href="+code=len" class="sref">len2/a>); v1372/a> v1382/a>        2a href="+code=err" class="sref">err2/a> =v2a href="+code=crypto_ablkcipher_encrypt" class="sref">crypto_ablkcipher_encrypt2/a>(2a href="+code=subreq" class="sref">subreq2/a>); v1392/a>        if (2a href="+code=err" class="sref">err2/a>) v1402/a>                gotov2a href="+code=out" class="sref">out2/a>; v1412/a> v1422/a>        if (2a href="+code=giv" class="sref">giv2/a> !=v2a href="+code=req" class="sref">req2/a>->2a href="+code=giv" class="sref">giv2/a>) v1432/a>                2a href="+code=eseqiv_complete2" class="sref">eseqiv_complete22/a>(2a href="+code=req" class="sref">req2/a>); v1442/a> v1452/a>2a href="+code=out" class="sref">out2/a>: v1462/a>        return 2a href="+code=err" class="sref">err2/a>; v1472/a>} v1482/a> v1492/a>static int 2a href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_first2/a>(structv2a href="+code=skcipher_givcrypt_request" class="sref">skcipher_givcrypt_request2/a> *2a href="+code=req" class="sref">req2/a>) v1502/a>{ v1512/a>        structv2a href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipher2/a> *2a href="+code=geniv" class="sref">geniv2/a> =v2a href="+code=skcipher_givcrypt_reqtfm" class="sref">skcipher_givcrypt_reqtfm2/a>(2a href="+code=req" class="sref">req2/a>); v1522/a>        structv2a href="+code=eseqiv_ctx" class="sref">eseqiv_ctx2/a> *2a href="+code=ctx" class="sref">ctx2/a> =v2a href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctx2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v1532/a>        int 2a href="+code=err" class="sref">err2/a> =v0; v1542/a> v1552/a>        2a href="+code=spin_lock_bh" class="sref">spin_lock_bh2/a>(&2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=lock" class="sref">lock2/a>); v1562/a>        if (2a href="+code=crypto_ablkcipher_crt" class="sref">crypto_ablkcipher_crt2/a>(2a href="+code=geniv" class="sref">geniv2/a>)->2a href="+code=givencrypt" class="sref">givencrypt2/a> !=v2a href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_first2/a>) v1572/a>                gotov2a href="+code=unlock" class="sref">unlock2/a>; v1582/a> v1592/a>        2a href="+code=crypto_ablkcipher_crt" class="sref">crypto_ablkcipher_crt2/a>(2a href="+code=geniv" class="sref">geniv2/a>)->2a href="+code=givencrypt" class="sref">givencrypt2/a> =v2a href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencrypt2/a>; v1602/a>        2a href="+code=err" class="sref">err2/a> =v2a href="+code=crypto_rng_get_bytes" class="sref">crypto_rng_get_bytes2/a>(2a href="+code=crypto_default_rng" class="sref">crypto_default_rng2/a>, 2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=salt" class="sref">salt2/a>, v1612/a>                                   2a href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsize2/a>(2a href="+code=geniv" class="sref">geniv2/a>)); v1622/a> v1632/a>2a href="+code=unlock" class="sref">unlock2/a>: v1642/a>        2a href="+code=spin_unlock_bh" class="sref">spin_unlock_bh2/a>(&2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=lock" class="sref">lock2/a>); v1652/a> v1662/a>        if (2a href="+code=err" class="sref">err2/a>) v1672/a>                return 2a href="+code=err" class="sref">err2/a>; v1682/a> v1692/a>        return 2a href="+code=eseqiv_givencrypt" class="sref">eseqiv_givencrypt2/a>(2a href="+code=req" class="sref">req2/a>); v1702/a>} v1712/a> v1722/a>static int 2a href="+code=eseqiv_init" class="sref">eseqiv_init2/a>(structv2a href="+code=crypto_tfm" class="sref">crypto_tfm2/a> *2a href="+code=tfm" class="sref">tfm2/a>) v1732/a>{ v1742/a>        structv2a href="+code=crypto_ablkcipher" class="sref">crypto_ablkcipher2/a> *2a href="+code=geniv" class="sref">geniv2/a> =v2a href="+code=__crypto_ablkcipher_cast" class="sref">__crypto_ablkcipher_cast2/a>(2a href="+code=tfm" class="sref">tfm2/a>); v1752/a>        structv2a href="+code=eseqiv_ctx" class="sref">eseqiv_ctx2/a> *2a href="+code=ctx" class="sref">ctx2/a> =v2a href="+code=crypto_ablkcipher_ctx" class="sref">crypto_ablkcipher_ctx2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v1762/a>        unsigned long 2a href="+code=alignmask" class="sref">alignmask2/a>; v1772/a>        unsigned int 2a href="+code=reqsize" class="sref">reqsize2/a>; v1782/a> v1792/a>        2a href="+code=spin_lock_init" class="sref">spin_lock_init2/a>(&2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=lock" class="sref">lock2/a>); v1802/a> v1812/a>        2a href="+code=alignmask" class="sref">alignmask2/a> =v2a href="+code=crypto_tfm_ctx_alignment" class="sref">crypto_tfm_ctx_alignment2/a>() - 1; v1822/a>        2a href="+code=reqsize" class="sref">reqsize2/a> =vsizeof(structv2a href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctx2/a>); v1832/a> v1842/a>        if (2a href="+code=alignmask" class="sref">alignmask2/a> & 2a href="+code=reqsize" class="sref">reqsize2/a>) { v1852/a>                2a href="+code=alignmask" class="sref">alignmask2/a> &=v2a href="+code=reqsize" class="sref">reqsize2/a>; v1862/a>                2a href="+code=alignmask" class="sref">alignmask2/a>--; v1872/a>        } v1882/a> v1892/a>        2a href="+code=alignmask" class="sref">alignmask2/a> =v~2a href="+code=alignmask" class="sref">alignmask2/a>; v1902/a>        2a href="+code=alignmask" class="sref">alignmask2/a> &=v2a href="+code=crypto_ablkcipher_alignmask" class="sref">crypto_ablkcipher_alignmask2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v1912/a> v1922/a>        2a href="+code=reqsize" class="sref">reqsize2/a> +=v2a href="+code=alignmask" class="sref">alignmask2/a>; v1932/a>        2a href="+code=reqsize" class="sref">reqsize2/a> +=v2a href="+code=crypto_ablkcipher_ivsize" class="sref">crypto_ablkcipher_ivsize2/a>(2a href="+code=geniv" class="sref">geniv2/a>); v1942/a>        2a href="+code=reqsize" class="sref">reqsize2/a> =v2a href="+code=ALIGN" class="sref">ALIGN2/a>(2a href="+code=reqsize" class="sref">reqsize2/a>, 2a href="+code=crypto_tfm_ctx_alignment" class="sref">crypto_tfm_ctx_alignment2/a>()); v1952/a> v1962/a>        2a href="+code=ctx" class="sref">ctx2/a>->2a href="+code=reqoff" class="sref">reqoff2/a> =v2a href="+code=reqsize" class="sref">reqsize2/a> -vsizeof(structv2a href="+code=eseqiv_request_ctx" class="sref">eseqiv_request_ctx2/a>); v1972/a> v1982/a>        2a href="+code=tfm" class="sref">tfm2/a>->2a href="+code=crt_ablkcipher" class="sref">crt_ablkcipher2/a>.2a href="+code=reqsize" class="sref">reqsize2/a> =v2a href="+code=reqsize" class="sref">reqsize2/a> + v1992/a>                                      sizeof(structv2a href="+code=ablkcipher_request" class="sref">ablkcipher_request2/a>); v2002/a> v2012/a>        return 2a href="+code=skcipher_geniv_init" class="sref">skcipher_geniv_init2/a>(2a href="+code=tfm" class="sref">tfm2/a>); v2022/a>} v2032/a> v2042/a>static structv2a href="+code=crypto_template" class="sref">crypto_template2/a> 2a href="+code=eseqiv_tmpl" class="sref">eseqiv_tmpl2/a>; v2052/a> v2062/a>static structv2a href="+code=crypto_instance" class="sref">crypto_instance2/a> *2a href="+code=eseqiv_alloc" class="sref">eseqiv_alloc2/a>(structv2a href="+code=rtattr" class="sref">rtattr2/a> **2a href="+code=tb" class="sref">tb2/a>) v2072/a>{ v2082/a>        structv2a href="+code=crypto_instance" class="sref">crypto_instance2/a> *2a href="+code=inst" class="sref">inst2/a>; v2092/a>        int 2a href="+code=err" class="sref">err2/a>; v2102/a> v2112/a>        2a href="+code=err" class="sref">err2/a> =v2a href="+code=crypto_get_default_rng" class="sref">crypto_get_default_rng2/a>(); v2122/a>        if (2a href="+code=err" class="sref">err2/a>) v2132/a>                return 2a href="+code=ERR_PTR" class="sref">ERR_PTR2/a>(2a href="+code=err" class="sref">err2/a>); v2142/a> v2152/a>        2a href="+code=inst" class="sref">inst2/a> =v2a href="+code=skcipher_geniv_alloc" class="sref">skcipher_geniv_alloc2/a>(&2a href="+code=eseqiv_tmpl" class="sref">eseqiv_tmpl2/a>, 2a href="+code=tb" class="sref">tb2/a>, 0, 0); v2162/a>        if (2a href="+code=IS_ERR" class="sref">IS_ERR2/a>(2a href="+code=inst" class="sref">inst2/a>)) v2172/a>                gotov2a href="+code=put_rng" class="sref">put_rng2/a>; v2182/a> v2192/a>        2a href="+code=err" class="sref">err2/a> =v-2a href="+code=EINVAL" class="sref">EINVAL2/a>; v2202/a>        if (2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_ablkcipher" class="sref">cra_ablkcipher2/a>.2a href="+code=ivsize" class="sref">ivsize2/a> !=v2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_blocksize" class="sref">cra_blocksize2/a>) v2212/a>                gotov2a href="+code=free_inst" class="sref">free_inst2/a>; v2222/a> v2232/a>        2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_ablkcipher" class="sref">cra_ablkcipher2/a>.2a href="+code=givencrypt" class="sref">givencrypt2/a> =v2a href="+code=eseqiv_givencrypt_first" class="sref">eseqiv_givencrypt_first2/a>; v2242/a> v2252/a>        2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_init" class="sref">cra_init2/a> =v2a href="+code=eseqiv_init" class="sref">eseqiv_init2/a>; v2262/a>        2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_exit" class="sref">cra_exit2/a> =v2a href="+code=skcipher_geniv_exit" class="sref">skcipher_geniv_exit2/a>; v2272/a> v2282/a>        2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_ctxsize" class="sref">cra_ctxsize2/a> =vsizeof(structv2a href="+code=eseqiv_ctx" class="sref">eseqiv_ctx2/a>); v2292/a>        2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_ctxsize" class="sref">cra_ctxsize2/a> +=v2a href="+code=inst" class="sref">inst2/a>->2a href="+code=alg" class="sref">alg2/a>.2a href="+code=cra_ablkcipher" class="sref">cra_ablkcipher2/a>.2a href="+code=ivsize" class="sref">ivsize2/a>; v2302/a> v2312/a>2a href="+code=out" class="sref">out2/a>: v2322/a>        return 2a href="+code=inst" class="sref">inst2/a>; v2332/a> v2342/a>2a href="+code=free_inst" class="sref">free_inst2/a>: v2352/a>        2a href="+code=skcipher_geniv_free" class="sref">skcipher_geniv_free2/a>(2a href="+code=inst" class="sref">inst2/a>); v2362/a>        2a href="+code=inst" class="sref">inst2/a> =v2a href="+code=ERR_PTR" class="sref">ERR_PTR2/a>(2a href="+code=err" class="sref">err2/a>); v2372/a>2a href="+code=put_rng" class="sref">put_rng2/a>: v2382/a>        2a href="+code=crypto_put_default_rng" class="sref">crypto_put_default_rng2/a>(); v2392/a>        gotov2a href="+code=out" class="sref">out2/a>; v2402/a>} v2412/a> v2422/a>static voidv2a href="+code=eseqiv_free" class="sref">eseqiv_free2/a>(structv2a href="+code=crypto_instance" class="sref">crypto_instance2/a> *2a href="+code=inst" class="sref">inst2/a>) v2432/a>{ v2442/a>        2a href="+code=skcipher_geniv_free" class="sref">skcipher_geniv_free2/a>(2a href="+code=inst" class="sref">inst2/a>); v2452/a>        2a href="+code=crypto_put_default_rng" class="sref">crypto_put_default_rng2/a>(); v2462/a>} v2472/a> v2482/a>static structv2a href="+code=crypto_template" class="sref">crypto_template2/a> 2a href="+code=eseqiv_tmpl" class="sref">eseqiv_tmpl2/a> =v{ v2492/a>        .2a href="+code=namt" class="sref">namt2/a> =v2span class="string">"eseqiv", v2502/a>        .2a href="+code=alloc" class="sref">alloc2/a> =v2a href="+code=eseqiv_alloc" class="sref">eseqiv_alloc2/a>, v2512/a>        .2a href="+code=free" class="sref">free2/a> =v2a href="+code=eseqiv_free" class="sref">eseqiv_free2/a>, v2522/a>        .2a href="+code=module" class="sref">module2/a> =v2a href="+code=THIS_MODULE" class="sref">THIS_MODULE2/a>, v2532/a>}; v2542/a> v2552/a>static int 2a href="+code=__init" class="sref">__init2/a> 2a href="+code=eseqiv_module_init" class="sref">eseqiv_module_init2/a>(void) v2562/a>{ v2572/a>        return 2a href="+code=crypto_register_template" class="sref">crypto_register_template2/a>(&2a href="+code=eseqiv_tmpl" class="sref">eseqiv_tmpl2/a>); v2582/a>} v2592/a> v2602/a>static voidv2a href="+code=__exit" class="sref">__exit2/a> 2a href="+code=eseqiv_module_exit" class="sref">eseqiv_module_exit2/a>(void) v2612/a>{ v2622/a>        2a href="+code=crypto_unregister_template" class="sref">crypto_unregister_template2/a>(&2a href="+code=eseqiv_tmpl" class="sref">eseqiv_tmpl2/a>); v2632/a>} v2642/a> v2652/a>2a href="+code=module_init" class="sref">module_init2/a>(2a href="+code=eseqiv_module_init" class="sref">eseqiv_module_init2/a>); v2662/a>2a href="+code=module_exit" class="sref">module_exit2/a>(2a href="+code=eseqiv_module_exit" class="sref">eseqiv_module_exit2/a>); v2672/a> v2682/a>2a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE2/a>(2span class="string">"GPL"); v2692/a>2a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION2/a>(2span class="string">"Encrypted Sequence Number IV Generator"); v2702/a>
lxr.linux.no kindly hosted by Redpill Linpro AS2/a>, provider of Linux consulting and operations services since 1995.