Ejemplo n.º 1
0
static struct crypto_instance *crypto_gcm_base_alloc(struct rtattr **tb)
{
	int err;
	const char *ctr_name;
	char full_name[CRYPTO_MAX_ALG_NAME];

	ctr_name = crypto_attr_alg_name(tb[1]);
	err = PTR_ERR(ctr_name);
	if (IS_ERR(ctr_name))
		return ERR_PTR(err);

	if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "gcm_base(%s)",
		     ctr_name) >= CRYPTO_MAX_ALG_NAME)
		return ERR_PTR(-ENAMETOOLONG);

	return crypto_gcm_alloc_common(tb, full_name, ctr_name);
}
Ejemplo n.º 2
0
static struct crypto_instance *crypto_gcm_alloc(struct rtattr **tb)
{
    const char *cipher_name;
    char ctr_name[CRYPTO_MAX_ALG_NAME];
    char full_name[CRYPTO_MAX_ALG_NAME];

    cipher_name = crypto_attr_alg_name(tb[1]);
    if (IS_ERR(cipher_name))
        return ERR_CAST(cipher_name);

    if (snprintf(ctr_name, CRYPTO_MAX_ALG_NAME, "ctr(%s)", cipher_name) >=
            CRYPTO_MAX_ALG_NAME)
        return ERR_PTR(-ENAMETOOLONG);

    if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, "gcm(%s)", cipher_name) >=
            CRYPTO_MAX_ALG_NAME)
        return ERR_PTR(-ENAMETOOLONG);

    return crypto_gcm_alloc_common(tb, full_name, ctr_name, "ghash");
}