Re: [PATCH]crypto: Fix algorithm and driver duplicate registered

From: Herbert Xu
Date: Tue Nov 24 2009 - 22:12:54 EST


On Wed, Nov 25, 2009 at 05:35:16AM -0500, Youquan,Song wrote:
>
> For example:
>
> struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32
> mask)
>
> The parameter "name", sometime it is "alg->cra_name" while sometime it
> become "alg->cra_driver_name". What's to lookup, algorithm or driver, depends on
> the context of parameter, So it need confirm no duplicate name exists between
> cra_driver_name and cra_name. Therefore, there are some werid checking needed,
> such as following:
>
> if (!strcmp(q->cra_driver_name, alg->cra_name) ||
> !strcmp(q->cra_name, alg->cra_driver_name))
>
>
> I wonder, Can we define two functions: one lookup algorithm other lookup
> driver? It will be more clear.

No that would defeat the whole point of having algorithm names
vs. driver names. When you perform a lookup, we will look for
both algorithm matches AND driver matches. Exactly which one
takes precedence when two matches are present is determined by
the priority.

Anyway, none of this matters to you if you're just working with
driver implementations so don't even worry about this.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/