/* In case of error the return value is an error pointer.  */
struct crypto_tfm* crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
/* In case of error the return value is an error pointer.  */
struct crypto_tfm* crypto_alloc_base(const char *alg_name, u32 type, u32 mask)
{
	struct crypto_tfm *tfm;
	int err;
	for (;;) {
		struct crypto_alg *alg;
		alg = crypto_alg_mod_lookup(alg_name, type, mask);
		if (IS_ERR(alg)) {
			err = PTR_ERR(alg);
			goto err;
		}
		tfm = __crypto_alloc_tfm(alg, type, mask);
		if (!IS_ERR(tfm))
			return tfm;
		crypto_mod_put(alg);
		err = PTR_ERR(tfm);
err:
		if (err != -EAGAIN)
			break;
		if (signal_pending(current)) {
			err = -EINTR;
			break;
		}
	}
	return ERR_PTR(err);
}