• Home
  • Raw
  • Download

Lines Matching refs:ctx

74 	struct ecrdsa_ctx *ctx = akcipher_tfm_ctx(tfm);  in ecrdsa_verify()  local
92 if (!ctx->curve || in ecrdsa_verify()
93 !ctx->digest || in ecrdsa_verify()
95 !ctx->pub_key.x || in ecrdsa_verify()
96 req->dst_len != ctx->digest_len || in ecrdsa_verify()
97 req->dst_len != ctx->curve->g.ndigits * sizeof(u64) || in ecrdsa_verify()
98 ctx->pub_key.ndigits != ctx->curve->g.ndigits || in ecrdsa_verify()
116 vli_cmp(r, ctx->curve->n, ndigits) >= 0 || in ecrdsa_verify()
118 vli_cmp(s, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify()
124 if (vli_cmp(e, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify()
125 vli_sub(e, e, ctx->curve->n, ndigits); in ecrdsa_verify()
130 vli_mod_inv(v, e, ctx->curve->n, ndigits); in ecrdsa_verify()
133 vli_mod_mult_slow(z1, s, v, ctx->curve->n, ndigits); in ecrdsa_verify()
134 vli_sub(_r, ctx->curve->n, r, ndigits); in ecrdsa_verify()
135 vli_mod_mult_slow(z2, _r, v, ctx->curve->n, ndigits); in ecrdsa_verify()
138 ecc_point_mult_shamir(&cc, z1, &ctx->curve->g, z2, &ctx->pub_key, in ecrdsa_verify()
139 ctx->curve); in ecrdsa_verify()
140 if (vli_cmp(cc.x, ctx->curve->n, ndigits) >= 0) in ecrdsa_verify()
141 vli_sub(cc.x, cc.x, ctx->curve->n, ndigits); in ecrdsa_verify()
153 struct ecrdsa_ctx *ctx = context; in ecrdsa_param_curve() local
155 ctx->curve_oid = look_up_OID(value, vlen); in ecrdsa_param_curve()
156 if (!ctx->curve_oid) in ecrdsa_param_curve()
158 ctx->curve = get_curve_by_oid(ctx->curve_oid); in ecrdsa_param_curve()
166 struct ecrdsa_ctx *ctx = context; in ecrdsa_param_digest() local
169 if (digest_oid != ctx->digest_oid) in ecrdsa_param_digest()
177 struct ecrdsa_ctx *ctx = context; in ecrdsa_parse_pub_key() local
179 ctx->key = value; in ecrdsa_parse_pub_key()
180 ctx->key_len = vlen; in ecrdsa_parse_pub_key()
194 struct ecrdsa_ctx *ctx = akcipher_tfm_ctx(tfm); in ecrdsa_set_pub_key() local
200 err = asn1_ber_decoder(&ecrdsa_pub_key_decoder, ctx, key, keylen); in ecrdsa_set_pub_key()
209 ctx->digest = "streebog256"; in ecrdsa_set_pub_key()
210 ctx->digest_oid = OID_gost2012Digest256; in ecrdsa_set_pub_key()
211 ctx->digest_len = 256 / 8; in ecrdsa_set_pub_key()
213 ctx->digest = "streebog512"; in ecrdsa_set_pub_key()
214 ctx->digest_oid = OID_gost2012Digest512; in ecrdsa_set_pub_key()
215 ctx->digest_len = 512 / 8; in ecrdsa_set_pub_key()
218 ctx->algo_oid = algo; in ecrdsa_set_pub_key()
221 err = asn1_ber_decoder(&ecrdsa_params_decoder, ctx, params, paramlen); in ecrdsa_set_pub_key()
228 if (!ctx->curve || in ecrdsa_set_pub_key()
229 ctx->curve->g.ndigits * sizeof(u64) != ctx->digest_len) in ecrdsa_set_pub_key()
235 if ((ctx->key_len != (2 * 256 / 8) && in ecrdsa_set_pub_key()
236 ctx->key_len != (2 * 512 / 8)) || in ecrdsa_set_pub_key()
237 ctx->key_len != ctx->curve->g.ndigits * sizeof(u64) * 2) in ecrdsa_set_pub_key()
240 ndigits = ctx->key_len / sizeof(u64) / 2; in ecrdsa_set_pub_key()
241 ctx->pub_key = ECC_POINT_INIT(ctx->_pubp[0], ctx->_pubp[1], ndigits); in ecrdsa_set_pub_key()
242 vli_from_le64(ctx->pub_key.x, ctx->key, ndigits); in ecrdsa_set_pub_key()
243 vli_from_le64(ctx->pub_key.y, ctx->key + ndigits * sizeof(u64), in ecrdsa_set_pub_key()
246 if (ecc_is_pubkey_valid_partial(ctx->curve, &ctx->pub_key)) in ecrdsa_set_pub_key()
254 struct ecrdsa_ctx *ctx = akcipher_tfm_ctx(tfm); in ecrdsa_max_size() local
260 return ctx->pub_key.ndigits * sizeof(u64); in ecrdsa_max_size()