static int pkcs1pad_set_priv_key(struct crypto_akcipher *tfm, const void *key, unsigned int keylen) { struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); int err, size; err = crypto_akcipher_set_priv_key(ctx->child, key, keylen); if (!err) { /* Find out new modulus size from rsa implementation */ size = crypto_akcipher_maxsize(ctx->child); ctx->key_size = size > 0 ? size : 0; if (size <= 0) err = size; } return err; }
static int pkcs1pad_set_priv_key(struct crypto_akcipher *tfm, const void *key, unsigned int keylen) { struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); int err; ctx->key_size = 0; err = crypto_akcipher_set_priv_key(ctx->child, key, keylen); if (err) return err; /* Find out new modulus size from rsa implementation */ err = crypto_akcipher_maxsize(ctx->child); if (err > PAGE_SIZE) return -ENOTSUPP; ctx->key_size = err; return 0; }