aboutsummaryrefslogtreecommitdiffstats
path: root/lib/notifier-error-inject.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:34:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 11:34:38 -0400
commitdf8edfa9af5b2160549ed1a79b72e3ed13b6c7e2 (patch)
treec61b836ee22594de97cca58f018585dbe05f61a1 /lib/notifier-error-inject.h
parent874f6d1be7699b5d1873283b4737712cbabd7754 (diff)
parent1077c932db63ecc571c31df1c24d4a44e30928e5 (diff)
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpuid changes from Ingo Molnar: "The biggest change is x86 CPU bug handling refactoring and cleanups, by Borislav Petkov" * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, CPU, AMD: Drop useless label x86, AMD: Correct {rd,wr}msr_amd_safe warnings x86: Fold-in trivial check_config function x86, cpu: Convert AMD Erratum 400 x86, cpu: Convert AMD Erratum 383 x86, cpu: Convert Cyrix coma bug detection x86, cpu: Convert FDIV bug detection x86, cpu: Convert F00F bug detection x86, cpu: Expand cpufeature facility to include cpu bugs
Diffstat (limited to 'lib/notifier-error-inject.h')
0 files changed, 0 insertions, 0 deletions
= ndigits; if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits, (const u8 *)params.key, params.key_size) < 0) return -EINVAL; memcpy(ctx->private_key, params.key, params.key_size); return 0; } static int ecdh_compute_value(struct kpp_request *req) { int ret = 0; struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); struct ecdh_ctx *ctx = ecdh_get_ctx(tfm); size_t copied, nbytes; void *buf; nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; if (req->src) { copied = sg_copy_to_buffer(req->src, 1, ctx->public_key, 2 * nbytes); if (copied != 2 * nbytes) return -EINVAL; ret = crypto_ecdh_shared_secret(ctx->curve_id, ctx->ndigits, (const u8 *)ctx->private_key, nbytes, (const u8 *)ctx->public_key, 2 * nbytes, (u8 *)ctx->shared_secret, nbytes); buf = ctx->shared_secret; } else { ret = ecdh_make_pub_key(ctx->curve_id, ctx->ndigits, (const u8 *)ctx->private_key, nbytes, (u8 *)ctx->public_key, sizeof(ctx->public_key)); buf = ctx->public_key; /* Public part is a point thus it has both coordinates */ nbytes *= 2; } if (ret < 0) return ret; copied = sg_copy_from_buffer(req->dst, 1, buf, nbytes); if (copied != nbytes) return -EINVAL; return ret; } static int ecdh_max_size(struct crypto_kpp *tfm) { struct ecdh_ctx *ctx = ecdh_get_ctx(tfm); int nbytes = ctx->ndigits << ECC_DIGITS_TO_BYTES_SHIFT; /* Public key is made of two coordinates */ return 2 * nbytes; } static void no_exit_tfm(struct crypto_kpp *tfm) { return; } static struct kpp_alg ecdh = { .set_secret = ecdh_set_secret, .generate_public_key = ecdh_compute_value, .compute_shared_secret = ecdh_compute_value, .max_size = ecdh_max_size, .exit = no_exit_tfm, .base = { .cra_name = "ecdh", .cra_driver_name = "ecdh-generic", .cra_priority = 100, .cra_module = THIS_MODULE, .cra_ctxsize = sizeof(struct ecdh_ctx), }, }; static int ecdh_init(void) { return crypto_register_kpp(&ecdh); } static void ecdh_exit(void) { crypto_unregister_kpp(&ecdh); } module_init(ecdh_init); module_exit(ecdh_exit); MODULE_ALIAS_CRYPTO("ecdh"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("ECDH generic algorithm");