linux/crypto/api.c
<<
>>
Prefs
   1/*
   2 * Scatterlist Cryptographic API.
   3 *
   4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
   5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)
   6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
   7 *
   8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
   9 * and Nettle, by Niels Möller.
  10 *
  11 * This program is free software; you can redistribute it and/or modify it
  12 * under the terms of the GNU General Public License as published by the Free
  13 * Software Foundation; either version 2 of the License, or (at your option)
  14 * any later version.
  15 *
  16 */
  17
  18#include <linux/err.h>
  19#include <linux/errno.h>
  20#include <linux/kernel.h>
  21#include <linux/kmod.h>
  22#include <linux/module.h>
  23#include <linux/param.h>
  24#include <linux/sched.h>
  25#include <linux/slab.h>
  26#include <linux/string.h>
  27#include "internal.h"
  28
  29LIST_HEAD(crypto_alg_list);
  30EXPORT_SYMBOL_GPL(crypto_alg_list);
  31DECLARE_RWSEM(crypto_alg_sem);
  32EXPORT_SYMBOL_GPL(crypto_alg_sem);
  33
  34BLOCKING_NOTIFIER_HEAD(crypto_chain);
  35EXPORT_SYMBOL_GPL(crypto_chain);
  36
  37static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
  38{
  39        atomic_inc(&alg->cra_refcnt);
  40        return alg;
  41}
  42
  43struct crypto_alg *crypto_mod_get(struct crypto_alg *alg)
  44{
  45        return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL;
  46}
  47EXPORT_SYMBOL_GPL(crypto_mod_get);
  48
  49void crypto_mod_put(struct crypto_alg *alg)
  50{
  51        struct module *module = alg->cra_module;
  52
  53        crypto_alg_put(alg);
  54        module_put(module);
  55}
  56EXPORT_SYMBOL_GPL(crypto_mod_put);
  57
  58static inline int crypto_is_test_larval(struct crypto_larval *larval)
  59{
  60        return larval->alg.cra_driver_name[0];
  61}
  62
  63static struct crypto_alg *__crypto_alg_lookup(const char *name, u32 type,
  64                                              u32 mask)
  65{
  66        struct crypto_alg *q, *alg = NULL;
  67        int best = -2;
  68
  69        list_for_each_entry(q, &crypto_alg_list, cra_list) {
  70                int exact, fuzzy;
  71
  72                if (crypto_is_moribund(q))
  73                        continue;
  74
  75                if ((q->cra_flags ^ type) & mask)
  76                        continue;
  77
  78                if (crypto_is_larval(q) &&
  79                    !crypto_is_test_larval((struct crypto_larval *)q) &&
  80                    ((struct crypto_larval *)q)->mask != mask)
  81                        continue;
  82
  83                exact = !strcmp(q->cra_driver_name, name);
  84                fuzzy = !strcmp(q->cra_name, name);
  85                if (!exact && !(fuzzy && q->cra_priority > best))
  86                        continue;
  87
  88                if (unlikely(!crypto_mod_get(q)))
  89                        continue;
  90
  91                best = q->cra_priority;
  92                if (alg)
  93                        crypto_mod_put(alg);
  94                alg = q;
  95
  96                if (exact)
  97                        break;
  98        }
  99
 100        return alg;
 101}
 102
 103static void crypto_larval_destroy(struct crypto_alg *alg)
 104{
 105        struct crypto_larval *larval = (void *)alg;
 106
 107        BUG_ON(!crypto_is_larval(alg));
 108        if (larval->adult)
 109                crypto_mod_put(larval->adult);
 110        kfree(larval);
 111}
 112
 113struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask)
 114{
 115        struct crypto_larval *larval;
 116
 117        larval = kzalloc(sizeof(*larval), GFP_KERNEL);
 118        if (!larval)
 119                return ERR_PTR(-ENOMEM);
 120
 121        larval->mask = mask;
 122        larval->alg.cra_flags = CRYPTO_ALG_LARVAL | type;
 123        larval->alg.cra_priority = -1;
 124        larval->alg.cra_destroy = crypto_larval_destroy;
 125
 126        strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME);
 127        init_completion(&larval->completion);
 128
 129        return larval;
 130}
 131EXPORT_SYMBOL_GPL(crypto_larval_alloc);
 132
 133static struct crypto_alg *crypto_larval_add(const char *name, u32 type,
 134                                            u32 mask)
 135{
 136        struct crypto_alg *alg;
 137        struct crypto_larval *larval;
 138
 139        larval = crypto_larval_alloc(name, type, mask);
 140        if (IS_ERR(larval))
 141                return ERR_CAST(larval);
 142
 143        atomic_set(&larval->alg.cra_refcnt, 2);
 144
 145        down_write(&crypto_alg_sem);
 146        alg = __crypto_alg_lookup(name, type, mask);
 147        if (!alg) {
 148                alg = &larval->alg;
 149                list_add(&alg->cra_list, &crypto_alg_list);
 150        }
 151        up_write(&crypto_alg_sem);
 152
 153        if (alg != &larval->alg)
 154                kfree(larval);
 155
 156        return alg;
 157}
 158
 159void crypto_larval_kill(struct crypto_alg *alg)
 160{
 161        struct crypto_larval *larval = (void *)alg;
 162
 163        down_write(&crypto_alg_sem);
 164        list_del(&alg->cra_list);
 165        up_write(&crypto_alg_sem);
 166        complete_all(&larval->completion);
 167        crypto_alg_put(alg);
 168}
 169EXPORT_SYMBOL_GPL(crypto_larval_kill);
 170
 171static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
 172{
 173        struct crypto_larval *larval = (void *)alg;
 174        long timeout;
 175
 176        timeout = wait_for_completion_interruptible_timeout(
 177                &larval->completion, 60 * HZ);
 178
 179        alg = larval->adult;
 180        if (timeout < 0)
 181                alg = ERR_PTR(-EINTR);
 182        else if (!timeout)
 183                alg = ERR_PTR(-ETIMEDOUT);
 184        else if (!alg)
 185                alg = ERR_PTR(-ENOENT);
 186        else if (crypto_is_test_larval(larval) &&
 187                 !(alg->cra_flags & CRYPTO_ALG_TESTED))
 188                alg = ERR_PTR(-EAGAIN);
 189        else if (!crypto_mod_get(alg))
 190                alg = ERR_PTR(-EAGAIN);
 191        crypto_mod_put(&larval->alg);
 192
 193        return alg;
 194}
 195
 196struct crypto_alg *crypto_alg_lookup(const char *name, u32 type, u32 mask)
 197{
 198        struct crypto_alg *alg;
 199
 200        down_read(&crypto_alg_sem);
 201        alg = __crypto_alg_lookup(name, type, mask);
 202        up_read(&crypto_alg_sem);
 203
 204        return alg;
 205}
 206EXPORT_SYMBOL_GPL(crypto_alg_lookup);
 207
 208struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
 209{
 210        struct crypto_alg *alg;
 211
 212        if (!name)
 213                return ERR_PTR(-ENOENT);
 214
 215        mask &= ~(CRYPTO_ALG_LARVAL | CRYPTO_ALG_DEAD);
 216        type &= mask;
 217
 218        alg = crypto_alg_lookup(name, type, mask);
 219        if (!alg) {
 220                request_module("%s", name);
 221
 222                if (!((type ^ CRYPTO_ALG_NEED_FALLBACK) & mask &
 223                      CRYPTO_ALG_NEED_FALLBACK))
 224                        request_module("%s-all", name);
 225
 226                alg = crypto_alg_lookup(name, type, mask);
 227        }
 228
 229        if (alg)
 230                return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg;
 231
 232        return crypto_larval_add(name, type, mask);
 233}
 234EXPORT_SYMBOL_GPL(crypto_larval_lookup);
 235
 236int crypto_probing_notify(unsigned long val, void *v)
 237{
 238        int ok;
 239
 240        ok = blocking_notifier_call_chain(&crypto_chain, val, v);
 241        if (ok == NOTIFY_DONE) {
 242                request_module("cryptomgr");
 243                ok = blocking_notifier_call_chain(&crypto_chain, val, v);
 244        YMBOL_GPL( 142classcrypto/apgn09"> 2frypto/apgn09"> 2frypto/ap2228" id="L228" class="line" nam722"L235"> 235code=cr=crypto_alg_sem" class="sref">crypto_alg_sem);
 165(&);
 165->a2g2> 194}
ERR5" class="line" name="L225"> 225>ERR5" claypto/api.c#L208" id="L208" class="line" name="L208"> 208struct crypto_alg *crypto_larval_lookup(const char *name, <">cra_lis2, &v);
 12125241"> 241href="+code=mask" class="sref">mask)
 209{
up_write(& *mask)
alg;
 123        if (v)
 154            2   kf2ee(name);
 187f">v);
 12525+code=crypto_is_test_e" class="sref">name);
 187 152 25href="+code=cra_flags" class="sref">name="L222"> 222        ="L122" class="line" name="L1 id="L187" class="line" name="L187"> 187alg;
 2frypto/apgn09"> 2fryp="+code=c2ypto_larval_kill" class=2sref"26EXPORT_SYMBOL_GPL" class="sre2 href="+c2de=crypto_alg" class="sr2f">cr26(-ENOMEM);
 207
 231
 232        return  * 2, type,  229        if (, mask);
2arval26a href="crypto/api.c#L212" id="L212" class=de=alg" class="sref">alg;
 163    263                return   2     list_del(&odule" class="sref">request_module(crypto_larval_lookup);
 2>alg)
 12526a>        struct c2mplete_all" class="sref">crypto_chain, vaSTOP>, name, cra_flags &  230                return alg)
2rypto26alg" class="sref">">v);
 169 230e=larval" class="sref">larval->adult)
alg)
EXPORT_2YMBOL_GPL( 180        if (timeout < 0)
name)
 *9"> 2frypto/apgn09"> 2fryp href="+c2de=crypto_alg" class="sr2f">cr27a> = (void *) 230   L157"> 157}
adult)
alg)
crypto_alg_sem);
alg;2 1742     27     return alg;
 225>ERR5" clayptosref">alg)
tim27ine" name="L216"> 216              2 &cryf="+coplass="sref">larval">cryf="+copl/api.a href="+code=alg" class="sretfe=mask" class="sref">matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi.>struct crypto_alg *crypto_larval_lookup(const char *name,  179        _obj *cryte">mask)
cryte">mapi.api.ref">alg)
adult;
crypto_larva181"> 1812/a>                 2t/a>_obj *name, EINTR);
ct/a>_obj * 232        return     2                           return ETIMEDOUT 225t/a> * 225t/a>/api.c#L205" id="L20tfe=mask" class="stfeapi.a>f">v);
 185                122" class="line" name="L1 YPE_CIPHEtimeout" class="e" name="L1 YPE_CIPHEtlg" :>v);
        else if (<2 href2"+code=crypto_is_test_.c#L229" id="L229" class="line="+coiphercoplass="sref">larval">cryf="+coiphercopl/api.c#L205" id="L20tfe=mask" class="stfeapi.a="+code=crypto_larval_add"3        2lg" class="sref">alg2><28  188                122" class="line" name="L1 YPE_COMPRESSimeout" class="e" name="L1 YPE_COMPRESSlg" :>v);
 182        else if (!.c#L229" id="L229" class="line="+coompresscoplass="sref">larval">cryf="+coompresscopl/api.c#L205" id="L20tfe=mask" class="stfeapi.a="+code=crypto_larval_add"0"> 190                crypto_larva        *default:>v);
l29pto/api.c#L182" id="Lbreak="+code=crypto_larval_add"0    2ss="line" name="L192"> 12229=crypto_chain" class="sref">crypto_chaiL193" cla2s="line" name="L193"> 192 2      return alg;
u32 29+code=crypto_.c#L229t < 0)
alg)
 167         198        struct 3a href="+3ode=crypto_alg" class="s3ef">c300ypto_aval_k157" id="L157" class="line"ex"+coplass="sref">larval">cryex"+copl/api.a href="+code=alg" class="sretfe=mask" class="sref">matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi." class="sref">name, 3200" clas3="line" name="L200"> 2003/a>  30_alg_">v);
__crypto_alg_lookupe);
cryte">mask)
cryte">mapi.api.ref">alg)
3202        up_read(& 2t/a>e);
v);
 23330ref="crypto/api.c#L18 2tfe=mask" class="stfeapi.name, 326203" cl3sef">alg;
 206crypto_cha3a href="+3ode=u32" class="sref">u33 30L198"> 198        struct 3>type3 u32  = v);
122" class="line" name="L1 YPE_CIPHEtimeout" class="e" name="L1 YPE_CIPHEtlg" :>v);
c31241"> 241        if (cryex"+coiphercoplass="sref">larval">cryex"+coiphercoplapi..c#L205" id="L20tfe=mask" class="stfeapi.a="+code=crypto_larval_add3"L211" cl3ss="line" name="L211"> 2313 313                return <3 href="+c3de=ERR_PTR" class="sref"3ERR_P3R(-122" class="line" name="L1 YPE_COMPRESSimeout" class="e" name="L1 YPE_COMPRESSlg" :>v);
mask &= ~(cryex"+coompresscoplass="sref">larval">cryex"+coompresscoplapi..c#L205" id="L20tfe=mask" class="stfeapi.a="+code=crypto_larval_add3"="line" 3o/api.c#L216" id="L216" 3lass=31+code=crypto_is_test_break="+code=crypto_larval_add318"line" 3="+code=type" class="sre3">typ31 crypto_alg_lookupmask3/a>);3crypto_cha3/a>("!s&qu3t;crypto_cha3/L211" cl3s="sref">type ^ cryctxsiz> */api.a href="+code=alg" class="sre">mask)
struct crypto_alg *crypto_larval_lookup(const char *name, 3         3a href="+code=request_mo3ule" 32                              3"%s-3ll&qu3t;, _obj *crypto_is_test_larval(api.ref">alg)
crypto_alg_lookup 243  leLapi.ref">alg)
t3pemask3/a>);
 243  leLapi.     if (crypto_is_test_larval( 143        <="sretfe>ctxaal35"te">/api.a - 1a="+code=crypto_larval_add3id="L228"3class="line" name="L228"3 228<33e=alg" class="sref">alg = _obj *name, 3>alg)3?  140        if ( 243  leLapi. +" class="sref">ct/a>_obj * *struct  232        return crypto_mod_put(&3 class="s3ef">crypto_larval_add * = crypto_is_test_larval(larval) &&
) & v);
v);
 234(122" class="line" name="L1 YPE_CIPHEtimeout" class="e" name="L1 YPE_CIPHEtlg" :>v);
"eL243"> 243  leLapi. +f="+code=CRYPTO_A id="L2oiphercctxsiz> */api.L209" id="L209" class="line" name="L209"a="+code=crypto_larval_add3Pef">mask3 class="line" name="L2373> 23733=alg" class="sref">albreak="+code=crypto_larval_add3" id="L233" class="line" name="L233"> 2334EXPORT_SYMBOL_GPL" class="sre3otifier_c3ll_chain(&122" class="line" name="L1 YPE_COMPRESSimeout" class="e" name="L1 YPE_COMPRESSlg" :>v);
 241        if ( 243  leLapi. +f="+code=CRYPTO_A id="L2oompresscctxsiz> */api.L209" id="L209" class="line" name="L209"a="+code=crypto_larval_add3242" clas3="line" name="L242"> 2423/a>  3             , (&crypto_cha3n, 3al, v3/a>);
 243  leLapi.ref">alg)
 142clas3crypt3/apgn09"> 2frypto/apgn09"> 2fry3to/ap22283 id="L228" class="line" 3am72234 );
 34i.c#L157" id="L157" class="line"shoote">mask)
m/api.a href="+code=alg" class="sre">mask)
name, 3"clasal->a3g35rypto_larval_kill(struct <3">cra_lis3, &alg;
 162
 13135f="+code=name" class="sref">f">crypto_is_test_larval(larval) &&="L122" class="line" name="L1DYING=mask" class="se" name="L1DYINGapi.ref">alg)
up_write(& = (void *)alg->cra_list);
 133        if (alg;
mask)
m/apiref="crypto/api.c#L165" id3""sref">v3="+code=kfree" class="sr3f">kf35a>        struct  13535+codea href="+code=alg" class="sretfe=mask" class="sref">matfeapi.c#L209" id="L209">crypto_alglocetfe=mask" class="s>crypto_alglocetfe/api.a href="+code=alg" class="sre">mask)
struct crypto_alg * 153 35href="+code=cra_flagsssssssssssssssssssssssarval_lookup" class="sref">crypto_larval_lookup(const char *name, 3pk5mealg;
u32 matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi.     if (algNULsapi.ref">alg)
cr36(-siz>api.ref">alg)
 *<_lookup" class="srerr=mask" class="serrapi.   t < 0)
alg;odMEMapi.ref">alg)
3arval36         163    364> = (void *)siz>api.   siz>of(#L209" id="L209"tfe=mask" class="stfeapi." +" class="sref">cef">cryctxsiz> */api.L209" id="L209" class="line" name="L209">struct  232        return list_del(&tfe=mask" class="stfeapi.     if (siz>api.e" name="L232"> 2GFP_KERNEs="sref">algGFP_KERNEs href="+code=crypto_larval_add31"sref">v3ss="line" name="L165"> 13536e((&tfe=mask" class="stfeapi.      if (algNULsapi." class="sref">name, 3href="+co3e=complete_all" class="s3ef">c36+code=crypto_is_test_gotoist_del(&out_err=mask" class="sout_errapi.ref">alg)
3rypto36l *cryte">mask)
cryte">mapi.     if (crypto_is_test_larvalalg)
 169EXPORT_3YMBOL_GPL(cef">cryf="+coplass="sref">larval">cryf="+copl/api.f="+code=larvaltfe=mask" class="stfeapi.>struct  232        return  * 2err=mask" class="serrapi." class="sref">name, 3 href="+c3de=crypto_alg" class="sr3f">cr37            alg)
                return <3="+code=a3g" class="sref">alg;3 * = f">crypto_is_test_larval( 2err=mask" class="serrapi.     if (crypto_is_test_larval(name, 3 "sref">v3ne" name="L174"> 1743     37;, ;
alg)
tim37ine" name="L216"> 216    3         3 &alg)
 198        struct 3 name="L139"> 179        ;
v);
adult;
alg = larval">cryex"+copl/api.c#L205" id="L20tfe=mask" class="stfeapi.aref">alg)
 1813/a>                EINTR);
 2err=mask" class="serrapi.    ef">alg))
 223 id="L157" class="line"shoote">mask)
m/api.L209" id="L209" class="line" name="L209"a="+code=crypto_larval_add3IMEDOUT" 3lass="sref">ETIMEDOUTlist_del(&kfree=mask" class="skfree/api.c#L205" id="L20tfe=mask" class="stfeapi.aref">alg)
v3>                (&tfe=mask" class="stfeapi.     if (timeou name="L232"> 2err=mask" class="serrapi."ref">alg)
alg3><38235"> 235code=cr=cryout=mask" class="soutval<:>v);
ctfe=mask" class="stfeapi.ref">alg)
 183  f="crypto/api.c#L193" id=30"> 190                 < 0)
alg;
alg)
crypto_mod_put(&3"TR" clas3="+code=larval" class="s3ef">l39pto/aTIFY_DONE" clcomte"> >/*
crypto_mod_put(&3"" class=3ss="line" name="L192"> 13239=crypTIFY_DONE" clcomte"> > *ass="srypto_alglocebaf">- Locate ="Lorithm and lglocate transform
crypto_mod_put(&3"MEDOUT" 3s="line" name="L193"> 193 3      TIFY_DONE" clcomte"> > *ass="s@93">: N3"> of ="Lorithm
crypto_mod_put(&3""sref">v3ref">alg;
 > *ass="s@ass=: Tss= of ="Lorithm
crypto_mod_put(&3"ref="+co3ode=u32" class="sref">u33 39+codeTIFY_DONE" clcomte"> > *ass="s@n crypto_mod_put(&3"        3 TIFY_DONE" clcomte"> > *
crypto_mod_put(&3"k5me > *ass="sThis function should not be used by new ="Lorithm ass=s.
crypto_mod_put(&4a href="+4ode=crypto_alg" class="s4ef">c400yptoTIFY_DONE" clcomte"> > *ass="sPlesae use rypto_alglocetfe instead.
crypto_mod_put(&4a1href="+4o                  40_alg_TIFY_DONE" clcomte"> > *
crypto_mod_put(&4lass="sre4">__crypto_alg_lookup > *ass="srypto_alglocebaf"() will first attempt toilocate Y_Daltypeyiloadeavaa hreef">crypto_mod_put(&4l3ss="sre4""+code=larval" class="s4202 > *ass="s="Lorithm.  If that fails and the kernel supports dylasiyptoyiloadabcodea hreef">crypto_mod_put(&4l4ss="sre4"s="line" name="L192"> 14href=40=crypTIFY_DONE" clcomte"> > *ass="sf="+cos, it will then attempt toiload lsf="+co of the s3"> n3"> ordea hreef">crypto_mod_put(&4l5ss="sre4"="line" name="L193"> 194340     TIFY_DONE" clcomte"> > *ass="salias.  If that fails it will send l query toianyiloadeasrypto_ managerdea hreef">crypto_mod_put(&4l6ss="sre4"ef">alg;
 > *ass="so_ api.cef="+Y_DalLorithm on the fly.  Aslgfcount is grabbeason thedea hreef">crypto_mod_put(&4l7ss="sre4"de=u32" class="sref">u34f="+c40+codeTIFY_DONE" clcomte"> > *ass="salLorithm which is then associated with the new transform.
crypto_mod_put(&4a8ss="sre4"TIFY_DONE" clcomte"> > *
crypto_mod_put(&4a href="+4ode=u32" class="sref">u34 40L198"TIFY_DONE" clcomte"> > *ass="sTheslg_semed transform is of = non-determinate tss=.  Most peopcodea hreef">crypto_mod_put(&4>type4  > *ass="sshould use ono of the more specific lglocation functions such asdea hreef">crypto_mod_put(&4>1href="+40" id="L210" class="line4 name41_alg_TIFY_DONE" clcomte"> > *ass="srypto_algloceblkcipher.
crypto_mod_put(&4a href="+4ode=crypto_alg" class="s4ef">c41f="+cTIFY_DONE" clcomte"> > *
crypto_mod_put(&4a3ss="sre4ss="line" name="L211"> 24141pto/aTIFY_DONE" clcomte"> > *ass="sIn0caf">of error aheslg_sem value is Y_Derror pointer.
crypto_mod_put(&4a4ss="sre413" class="line" name="L413"> 41=crypTIFY_DONE" clcomte"> > */
crypto_mod_put(&4a5ss="sre4de=ERR_PTR" class="sref"4ERR_P4R(href="+code=mask" class="sreftfe=mask" class="sref">matfeapi.c#L209" id="L209"rypto_alglocebaf"ask)
93">ass="line" name="L>93">209">struct crypto_alg *crypto_larval_lookup(const char *name, 4class="sr4f">mask &= ~(matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi.ref">alg)
typ41>val, void *alg)
crypto_alg_lookup 198        struct 4ref="+cod4=mask" class="sref">mask4/a>);4v);
 140  href="+code=mask" class="sref">mask)
 209{
""s&qu42s="sref">crypto_mod_put(&4/L211" cl4s="sref">type ^  225>ERR5" claypto/id="L208" class93">ass="line" name="L>93">209">struct  232        return  223  2, typef">v);
, "%s-4ll&qu4t;, alg)
crypto_alg_lookupt4pemask4/a>);
alst_del(&tfe=mask" class="stfeapi.     if (struct  232        return 
type 140          lg_sem" class="sref">ctfe=mask" class="stfeapi.ref">alg)
crypto_mod_put(&4 class="s4ef">crypto_larval_addlarval-> 223 id="L157" classerr=mask" class="serrapi.     if (, /api.L209" id="L209"tfe=mask" class="stfeapi.aref">alg)
 234E4PORT_SYMB4L_GPL( 2err=mask" class="serrapi. !  ef">alg))
mask4 class="line" name="L2374> 23743=alg" class="sref">al 2235"al_pend="srcrypto/api.c#L235"al_pend="s/api.L209" id="L209"curre"> 143        urre">209"a>f">v);
 2344>
alg)
 140          break="+code=crypto_larval_add4api.c#L244" id="L241" class="line"4name=4L241"> 241        f="crypto/api.c#L193" id=4242" clas4="line" name="L242"> 2424/a>  4             , (&44ref="crypto/alg_sem" class="sref">c+code=timeout" class="sref">timeou name="L232"> 2err=mask" class="serrapi."ref">alg)
v4/a>);
 142clas4crypt4/apgn0 < 0)
alg;
)
alg)
);
 44i.c#L157" #L209" id="L209"rypto_acreateftfe=mask" class="srypto_acreateftfe/api.a href="+code=alg" class="sre">mask)
ref="+code=mask" class="4"clasal->a4g45>
v);
cra_lis4, &v);
 14145f="+code=nameL208" id="L208" classmt" class="sref">cmeeapi.ref">alg)
up_write(& *matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi.     if (algNULsapi.ref">alg)
 143        if (api.ref">alg)
adultotclapi.ref">alg)
v4="+code=kfree" class="sr4f">kf4ee(alg;odMEMapi.ref">alg)
 14545ine" name="L216"> 216    4"o/ap22284s="line" name="L156"> 154 45href="+code=cokup" class="srtfesiz> *(api.ref">alg)
alg;
adultotclapi./    if (api. + siz>of(#L209" id="L209"tfe=mask" class="stfeapi." +" class="sref">cfrontend *(t;cr46(-cmeeapi.     if (adultotclapi.e" name="L232"> 2GFP_KERNEs="sref">algGFP_KERNEs href="+code=crypto_larval_add4 L151" cl4 href="+code=crypto_larv4l" cl46pto_alg * 2mt" class="sref">cmeeapi.      if (algNULsapi." class="sref">name, 4 class="s4de=larval" class="sref">4arval46a href="crypto/api.c#gotoist_del(&out_err=mask" class="sout_errapi.ref">alg)
 163    463                return <4164  4     list_del(&tfe=mask" class="stfeapi.   .a href="+code=alg" class="sretfe=mask" class="sref">matfeapi.c#)h name="L232"> 2mt" class="sref">cmeeapi. +" class="sref">ctfesiz> *v4ss="line" name="L165"> 14546ode=CRYPTO_ALG_LARVAL" classtfe=mask" class="stfeapi.mask)
cryte">mapi.     if (crypto_is_test_larvalalg)
c46ine" name="L216"> 216    4 o/ap22284" id="L167" class="line"4name=46href="+code=cokup" class="srerr=mask" class="serrapi.     if (alg)
4rypto46l * 2err=mask" class="serrapi." class="sref">name, 4"line" na4e="L169"> 169alg)
EXPORT_4YMBOL_GPL(crypto_larv4="+code=c4ypto_larval_wait" class=4sref"47pto_alg * = f">crypto_is_test_larval( 2err=mask" class="serrapi.     if (crypto_is_test_larval(name, 4 href="+c4de=crypto_alg" class="sr4f">cr47            ;
alg)
                return <4="+code=a4g" class="sref">alg;4 *gotoist_del(&out=mask" class="soutvalalg)
v4ne" name="L174"> 1744     47a>        struct tim47apgn0 < 0)
;
v);
maex"+coplass="sref">larval">cryex"+copl/api.c#L205" id="L20tfe=mask" class="stfeapi.aref">alg)
(&out_freeftfe=mask" class="sout_freeftfeval<:>v);
 179        alg = alg))
adult;
 140  okup" class="srref">mashoote">mask)
m/api.L209" id="L209" class="line" name="L209"a="+code=crypto_larval_add4181"> 1814/a>                cmeeapi.a="+code=crypto_larval_add41href="+c4="sref">EINTR);
 = (void *)cmeeapi.     if (timeou name="L232"> 2err=mask" class="serrapi."ref">alg)
ETIMEDOUTv4>                cmeeapi.ref">alg)
        else if (<4 href48apgn09"> 2frypto/apgn09"> 2fry41        4lg" class="sref">alg4><48235"> 235code=cr=cry +code=alg" class="sref">alg;
alg)
 198        struct 4" id="L184" class="line" name="L184"> 18490ypto_ahref="+code=alg" class="sre">mask)
mask)
m/api.api.c#L208" id="L208" class93">ass="line" name="L>93">209">> 198        struct 4"lt" clas4>                 140                     api.c#a href="+code=alg" class="sret/a> *api.c#L209" id="L209"frontend *> 198        struct 4"81"> 1814href="+code=crypto_mod_p4t" cl49241"> 241                           L209" id="L209"+code=crypto_alg" class="sref">crypto_alg *crypto_larval_lookup(const char *name, 4"TR" clas4="+code=larval" class="s4ef">l49pto/a">v);
 14249=crypto_chain_ahref="+code=alg" class="sre">mask)
ass="line" name93">209">struct crypto_alg *crypto_larval_lookup(const char *v);
 194 49ref="crypto/api.c#L184" id="L184" cl25" id="L22>ERR5" class="line" name="L225"> 225>ERR5" clayptoref">alg)
v4ref">alg;
u34 49+code=crypto_"sref">alg = v);
t/a>e);
alg)
alst_del(&t char *alg)
c50a href="crypto/api.c#L219" id="L219"t/a>e);
e);
alg)
  50ame="L140"> 140  okup" class="srt char *alg)
crypto_mod_put(&5l3ss="sre5""+code=larval" class="s5202alg = (crypto_mod_put(&5l4ss="sre5"s="line" name="L192"> 15href=50name="L223"> 223 40  okup" class="sr5" class="line" name=5" claypto     if (alg)
 195350ref="crypto/a9"> 2frypto/apgn09"> 2fry5l6ss="sre5"ef">alg;
u35f="+c50+code=crypto_lass="line" name="L244l" class="line" name=5" claypto/id="L208" class93">ass="line" name="L>93">209">struct  232        return 9"> 2frypto/apgn09"> 2fry5l9ss="sre5"" id="L198" class="line5 50L198"st_del(& +code=alg" class="sref">alg;
mask)
m/apif="+code=crypto_larval_add5>type5  >/*
crypto_mod_put(&5a href="+5ode=crypto_alg" class="s5ef">c51f="+cTIFY_DONE" clcomte"> > *rypto_rypto_alglocetfe>- Locate ="Lorithm and lglocate transform
crypto_mod_put(&5a3ss="sre5ss="line" name="L211"> 25151pto/aTIFY_DONE" clcomte"> > *ass="s@93">: N3"> of ="Lorithm
crypto_mod_put(&5a4ss="sre513" class="line" name="L513"> 51=crypTIFY_DONE" clcomte"> > *ass="s@frontend: Frontend ="Lorithm ass=
crypto_mod_put(&5a5ss="sre5de=ERR_PTR" class="sref"5ERR_P51     TIFY_DONE" clcomte"> > *ass="s@ass=: Tss= of ="Lorithm
crypto_mod_put(&5class="sr5f">mask &= ~( > *ass="s@n crypto_mod_put(&5"="line" 5o/api.c#L216" id="L216" 5lass=51+codeTIFY_DONE" clcomte"> > *
crypto_mod_put(&5"8ss="sre5="+code=type" class="sre5">typ51167">TIFY_DONE" clcomte"> > *rypto_rypto_alglocetfe() will first attempt toilocate Y_Daltypeyiloadeavaa hreef">crypto_mod_put(&51 href="+5ef">crypto_alg_lookup > *ass="s="Lorithm.  If that fails and the kernel supports dylasiyptoyiloadabcodea hreef">crypto_mod_put(&5ref="+cod5=mask" class="sref">mask5/a>);520yptoTIFY_DONE" clcomte"> > *ass="sf="+cos, it will then attempt toiload lsf="+co of the s3"> n3"> ordea hreef">crypto_mod_put(&5         5    > *ass="salias.  If that fails it will send l query toianyiloadeasrypto_ managerdea hreef">crypto_mod_put(&5/a>("#s&qu52f="+cTIFY_DONE" clcomte"> > *rypto_o_ api.cef="+Y_DalLorithm on the fly.  Aslgfcount is grabbeason thedea hreef">crypto_mod_put(&5/L211" cl5s="sref">type ^  > *ass="s="Lorithm which is then associated with the new transform.
crypto_mod_put(&5crypto/ap5.c#L223" id="L223" class5"line52=crypTIFY_DONE" clcomte"> > *
crypto_mod_put(&5c5ss="sre5a href="+code=request_mo5ule" 52     TIFY_DONE" clcomte"> > *ass="sTheslg_semed transform is of = non-determinate tss=.  Most peopcodea hreef">crypto_mod_put(&5"%s-5ll&qu52ode=CTIFY_DONE" clcomte"> > *ass="sshould use ono of the more specific lglocation functions such asdea hreef">crypto_mod_put(&5 class="s5ef">crypto_alg_lookup > *ass="sf="cryptoloceblkcipher.
crypto_mod_put(&5 8"line" 5ode=type" class="sref">t5peTIFY_DONE" clcomte"> > *
crypto_mod_put(&5ref">mask5/a>);
 > *ass="sIn0caf">of error aheslg_sem value is Y_Derror pointer.
crypto_mod_put(&5id="L228"5class="line" name="L228"5 228<530yptoTIFY_DONE" clcomte"> > */
crypto_mod_put(&5i        5? 93">ass="line" name="L>93">209">> 198        struct 5l_wait 241               api.c#a href="+code=alg" class="sret/a> *api.c#L209" id="L209"frontend *struct crypto_alg *crypto_larval_lookup(const char * 198        struct 5lL211" cl5ef">crypto_larval_addv);
 157" #L209" id="L209"tfe=mask" class="stfeapi.ref">alg)
 234alg)
        struct v);
mask)
 209{
mask5 class="line" name="L2375> 23753L198"> 198        struct 5" id="L235" class="line" name="L235"> 2354>
mask)
m/api.id="L208" class93">ass="line" name="L>93">209">struct  232        return  140   2, typef">v);
 241        ypto/apiL209" id="L209"err=mask" class="serrapi.     if (, /api.L209" id="L209" class="line" name="L209"a="+code=crypto_larval_add5242" clas5="line" name="L242"> 2425/a>  5             (&err=mask" class="serrapi.ref">alg)
 223 9"> 2frypto/apgn09"> 2fry5n, 5al, v5/a>);
struct alg)
 142clas5crypt54+code=crypto_is_test_ = , typectfe=mask" class="stfeapi.ref">alg)
);
 54L198"> 198        struct 5"clasal->a5g55>
larval->cra_lis5, & 140  okup" class="srerr=mask" class="serrapi.     if (, /api.L209" id="L209"tfe=mask" class="stfeapi.aref">alg)
 15155s="sref">crypto_mod_put(&5 class="s5ef">up_write(&(&err=mask" class="serrapi.:>v);
 153        if ( 223  2err=mask" class="serrapi. !  ef">alg))
v5="+code=kfree" class="sr5f">kf55;,  2235"al_pend="srcrypto/api.c#L235"al_pend="s/api.L209" id="L209"curre"> 143        urre">209"a>f">v);
 15555+code=crypto_is_test_40  okup" class="srerr=mask" class="serrapi.   t < 0)
alg)
 155 55href="+code=cra_flagsssssssssbreak="+code=crypto_larval_add5pk5mealg;
al9"> 2frypto/apgn09"> 2fry5="+code=c5ypto_larval_kill" class=5sref"56">u32  2frypto/apgn09"> 2fry5=>cra_lis5de=crypto_alg" class="sr5f">cr56ait" class="sref">crypto_larv5 L151" cl5 href="+code=crypto_larv5l" cl56pto_alg *lg_sem" class="sref">c+code=timeout" class="sref">timeou name="L232"> 2err=mask" class="serrapi."ref">alg)
5arval56a hre9"> 2frypto/apgn09"> 2fry5=L153"> 15line" name="L163"> 163    563st_del(& +code=alg" class="sref">alg;
alg)
, v5ss="line" name="L165"> 15556ode=CTIFY_DONE" clcomte"> >/*
crypto_mod_put(&5href="+co5e=complete_all" class="s5ef">c56+codeTIFY_DONE" clcomte"> > *ass="sf="crypdestroyetfe>- Free rypto_ transform
crypto_mod_put(&5 o/ap22285" id="L167" class="line"5name=56167">TIFY_DONE" clcomte"> > *rypto_@mem: Start of tfe>slab
crypto_mod_put(&5 k5me5rypto56L198"TIFY_DONE" clcomte"> > *ass="s@tfe: Transform o_ free/aa hreef">crypto_mod_put(&5"line" na5e="L169"> 169 > */aa hreef">crypto_mod_put(&5">cra_lis5YMBOL_GPL( > *ass="sThis function frees up ahestransform and lny associated resources,/aa hreef">crypto_mod_put(&5"L151" cl5ypto_larval_wait" class=5sref"57f="+cTIFY_DONE" clcomte"> > *rypto_ohen drops aheslgfcount on the associated ="Lorithm./aa hreef">crypto_mod_put(&5"class="s5de=crypto_alg" class="sr5f">cr57pto/aTIFY_DONE" clcomte"> > */
crypto_mod_put(&5"" class=5 href="+code=crypto_larv5l" cl573157" c#L205" id="L20rypto_adestroyetfe=mask" class="srypto_adestroyetfe/api.157" #L209" id="L209"mt" class="sref">cmeeapi.,matfeapi.c#L209" id="L209"tfe=mask" class="stfeapi.1>v);
alg;5v);
v5ne" name="L174"> 1745     57;, mask)
 209{
tim57ine" name="L216"> 216    5         5 & 2unlikelys="sref">crypto_nlikely/api.g = cmeeapi.a1>v);
allg_sem> 209{
 179        adult;
alg =  class="line" name="L209"f="crypto/api.c#L2tfe=mask" class="stfeapi.mask)
cryte">mapi.> 209{
                crypto_mod_put(&51href="+c5="sref">EINTR);
f">crypto_is_test_larval(v);
 223 id="L157" classf">crypto_is_test_larval(alg)
ETIMEDOUTlist_del(&f="crypex"+coplass="sref">larval">cryex"+copl/api.c#L205" id="L20tfe=mask" class="stfeapi.aref">alg)
v5>                larval->        else if (<5 href5"+code=crypto_st_del(&kzfree=mask" class="skzfree/api.c#L205" id="L20mt" class="sref">cmeeapi.a="+code=crypto_larval_add51        5lg" class="sref">alg5><58167">9"> 2frypto/apgn09"> 2fry5Ik5me                (& +code=alg" class="sref">alg;
 1859EXPORT_SYMBOL_GPL" class="sre5"lt" clas5>                mask)
m/api.api.c#L208" id="L208" class93">ass="line" name93">209">struct crypto_alg *crypto_larval_lookup(const char *">v);
l59pto/api.c#L18< * 15259=crypto_chain_ahref="+code=alg" class="sre">mask)
 225>ERR5" claypto/id="L208" class93">ass="line" name93">209">struct  232        return  195 59l, v5ref">alg;
typef">v);
u35 59+code=crypto_is_test_G_LARVAL" class25" id=e=larval" class="sref">larval->ret=mask" class="sretyptof="1="+code=crypto_larval_add5"k5me 2frypto/apgn09"> 2fry6a href="+6ode=crypto_alg" class="s6ef">c60EXPORT_SYMBOL_GPL" class="sre6a1href="+6o                  60ame="L140"> 1lg_sem" class="sref">cret=mask" class="sretypto="+code=crypto_larval_add6a2href="+6oref="+code=crypto_mod_p6( 2frypto/apgn09"> 2fry6a3href="+6o"+code=larval" class="s6202(& +code=alg" class="sref">alg;
mask)
m/apia="+code=crypto_larval_add6l4ss="sre6"s="line" name="L192"> 16href=603                return <6a5ss="sre6"="line" name="L193"> 196360e="L1 < 0)
alg;
u36f="+c60+codeT/preeT/div>


T/div>


Thesoriginal LXR software by the +code=cryhttp://sourceforge.net/projects/lxr">LXR comtunity"line"this experite">al version by +code=crymailto:lxr@assux.no">lxr@assux.no"lin.
T/div>

lxr.assux.no kindly hosted by +code=cryhttp://www.redpill-asspro.no">Redpill Lsspro AS"line"provider of Lssux api.ult="s and operations services since 1995.
T/div>