Lines Matching defs:alg
183 /* mapping from alg type to protocol number, as per RFC 2407 */
2217 * Process a SPD_ALGLIST request. The caller expects separate alg entries
2349 ipsec_alginfo_t *alg =
2351 uint_t minbits = alg->alg_minbits;
2352 uint_t maxbits = alg->alg_maxbits;
2353 uint_t defbits = alg->alg_default_bits;
2354 uint_t incr = alg->alg_increment;
2400 ipsec_alginfo_t *alg;
2427 alg = ipss->ipsec_alglists[algtype][algid];
2429 (ATTRPERALG + alg->alg_nkey_sizes +
2430 alg->alg_nblock_sizes + alg->alg_nparams) +
2491 alg = ipss->ipsec_alglists[algtype][algid];
2499 EMIT(SPD_ATTR_ALG_INCRBITS, alg->alg_increment);
2500 EMIT(SPD_ATTR_ALG_NKEYSIZES, alg->alg_nkey_sizes);
2501 for (i = 0; i < alg->alg_nkey_sizes; i++)
2503 alg->alg_key_sizes[i]);
2505 EMIT(SPD_ATTR_ALG_NBLOCKSIZES, alg->alg_nblock_sizes);
2506 for (i = 0; i < alg->alg_nblock_sizes; i++)
2508 alg->alg_block_sizes[i]);
2510 EMIT(SPD_ATTR_ALG_NPARAMS, alg->alg_nparams);
2511 for (i = 0; i < alg->alg_nparams; i++)
2513 alg->alg_params[i]);
2515 EMIT(SPD_ATTR_ALG_FLAGS, alg->alg_flags);
2518 bcopy(alg->alg_mech_name, attr, CRYPTO_MAX_MECH_NAME);
2551 ipsec_alginfo_t *alg = NULL;
2573 alg = kmem_zalloc(sizeof (*alg), KM_SLEEP);
2593 ipsec_alg_free(alg);
2596 spds->spds_algs[alg_type][alg->alg_id]);
2597 spds->spds_algs[alg_type][alg->alg_id] =
2598 alg;
2600 alg = kmem_zalloc(sizeof (*alg), KM_SLEEP);
2606 "invalid alg id %d\n",
2611 alg->alg_id = attr->spd_attr_value;
2615 /* find the alg type */
2625 alg->alg_increment = attr->spd_attr_value;
2629 if (alg->alg_key_sizes != NULL) {
2630 kmem_free(alg->alg_key_sizes,
2631 ALG_KEY_SIZES(alg));
2633 alg->alg_nkey_sizes = attr->spd_attr_value;
2638 alg->alg_key_sizes = kmem_zalloc(ALG_KEY_SIZES(alg),
2644 if (alg->alg_key_sizes == NULL ||
2645 cur_key >= alg->alg_nkey_sizes) {
2651 alg->alg_key_sizes[cur_key++] = attr->spd_attr_value;
2661 alg->alg_flags |= (uint8_t)attr->spd_attr_value;
2665 if (alg->alg_block_sizes != NULL) {
2666 kmem_free(alg->alg_block_sizes,
2667 ALG_BLOCK_SIZES(alg));
2669 alg->alg_nblock_sizes = attr->spd_attr_value;
2674 alg->alg_block_sizes = kmem_zalloc(ALG_BLOCK_SIZES(alg),
2680 if (alg->alg_block_sizes == NULL ||
2681 cur_block >= alg->alg_nblock_sizes) {
2687 alg->alg_block_sizes[cur_block++] =
2692 if (alg->alg_params != NULL) {
2693 kmem_free(alg->alg_params,
2694 ALG_PARAM_SIZES(alg));
2696 alg->alg_nparams = attr->spd_attr_value;
2701 alg->alg_params = kmem_zalloc(ALG_PARAM_SIZES(alg),
2707 if (alg->alg_params == NULL ||
2708 cur_block >= alg->alg_nparams) {
2718 alg->alg_params[cur_block++] =
2732 bcopy(mech_name, alg->alg_mech_name,
2734 alg->alg_mech_name[CRYPTO_MAX_MECH_NAME-1] = '\0';
2772 ipsec_alg_free(alg);
3634 ipsec_alginfo_t *alg, *oalg;
3658 alg = spds->spds_algs[algtype][algid];
3659 if (alg == NULL)
3667 if (alg->alg_id == SADB_EALG_NULL) {
3668 alg->alg_mech_type = CRYPTO_MECHANISM_INVALID;
3669 alg->alg_flags |= ALG_FLAG_VALID;
3674 if (strncmp(alg->alg_mech_name, mechs[mech_idx],
3676 mt = crypto_mech2id(alg->alg_mech_name);
3682 alg->alg_mech_type = mt;
3683 alg->alg_flags |= algflags;
3714 alg = spds->spds_algs[algtype][algid];
3715 if (alg == NULL)
3724 ipsec_alg_reg(algtype, alg, ns);
3730 ipsec_alg_fix_min_max(alg, algtype, ns);
3731 ipss->ipsec_alglists[algtype][algid] = alg;