/*
 * Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the \"License\").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */



/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef sshkdf_set_ctx_params_list
static const OSSL_PARAM sshkdf_set_ctx_params_list[] = {
    OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_PROPERTIES, NULL, 0),
    OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_DIGEST, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_SECRET, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_KEY, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_UKM, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_ACVPINFO, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_PARTYUINFO, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_PARTYVINFO, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_SUPP_PUBINFO, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_KDF_PARAM_X942_SUPP_PRIVINFO, NULL, 0),
    OSSL_PARAM_int(OSSL_KDF_PARAM_X942_USE_KEYBITS, NULL),
    OSSL_PARAM_utf8_string(OSSL_KDF_PARAM_CEK_ALG, NULL, 0),
# if defined(FIPS_MODULE)
    OSSL_PARAM_int(OSSL_KDF_PARAM_FIPS_KEY_CHECK, NULL),
# endif
    OSSL_PARAM_END
};
#endif

#ifndef sshkdf_set_ctx_params_st
struct sshkdf_set_ctx_params_st {
    OSSL_PARAM *acvp;
    OSSL_PARAM *cekalg;
    OSSL_PARAM *digest;
# if defined(FIPS_MODULE)
    OSSL_PARAM *ind_k;
# endif
    OSSL_PARAM *kbits;
    OSSL_PARAM *priv;
    OSSL_PARAM *propq;
    OSSL_PARAM *pub;
    OSSL_PARAM *secret;
    OSSL_PARAM *uinfo;
    OSSL_PARAM *vinfo;
};
#endif

#ifndef sshkdf_set_ctx_params_decoder
static int sshkdf_set_ctx_params_decoder
    (const OSSL_PARAM *p, struct sshkdf_set_ctx_params_st *r)
{
    const char *s;

    memset(r, 0, sizeof(*r));
    if (p != NULL)
        for (; (s = p->key) != NULL; p++)
            switch(s[0]) {
            default:
                break;
            case 'a':
                if (ossl_likely(strcmp("cvp-info", s + 1) == 0)) {
                    /* OSSL_KDF_PARAM_X942_ACVPINFO */
                    if (ossl_unlikely(r->acvp != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->acvp = (OSSL_PARAM *)p;
                }
                break;
            case 'c':
                if (ossl_likely(strcmp("ekalg", s + 1) == 0)) {
                    /* OSSL_KDF_PARAM_CEK_ALG */
                    if (ossl_unlikely(r->cekalg != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->cekalg = (OSSL_PARAM *)p;
                }
                break;
            case 'd':
                if (ossl_likely(strcmp("igest", s + 1) == 0)) {
                    /* OSSL_KDF_PARAM_DIGEST */
                    if (ossl_unlikely(r->digest != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->digest = (OSSL_PARAM *)p;
                }
                break;
            case 'k':
                switch(s[1]) {
                default:
                    break;
                case 'e':
                    switch(s[2]) {
                    default:
                        break;
                    case 'y':
                        switch(s[3]) {
                        default:
                            break;
                        case '-':
# if defined(FIPS_MODULE)
                            if (ossl_likely(strcmp("check", s + 4) == 0)) {
                                /* OSSL_KDF_PARAM_FIPS_KEY_CHECK */
                                if (ossl_unlikely(r->ind_k != NULL)) {
                                    ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                   "param %s is repeated", s);
                                    return 0;
                                }
                                r->ind_k = (OSSL_PARAM *)p;
                            }
# endif
                            break;
                        case '\0':
                            if (ossl_unlikely(r->secret != NULL)) {
                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                               "param %s is repeated", s);
                                return 0;
                            }
                            r->secret = (OSSL_PARAM *)p;
                        }
                    }
                }
                break;
            case 'p':
                switch(s[1]) {
                default:
                    break;
                case 'a':
                    switch(s[2]) {
                    default:
                        break;
                    case 'r':
                        switch(s[3]) {
                        default:
                            break;
                        case 't':
                            switch(s[4]) {
                            default:
                                break;
                            case 'y':
                                switch(s[5]) {
                                default:
                                    break;
                                case 'u':
                                    if (ossl_likely(strcmp("-info", s + 6) == 0)) {
                                        /* OSSL_KDF_PARAM_X942_PARTYUINFO */
                                        if (ossl_unlikely(r->uinfo != NULL)) {
                                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                           "param %s is repeated", s);
                                            return 0;
                                        }
                                        r->uinfo = (OSSL_PARAM *)p;
                                    }
                                    break;
                                case 'v':
                                    if (ossl_likely(strcmp("-info", s + 6) == 0)) {
                                        /* OSSL_KDF_PARAM_X942_PARTYVINFO */
                                        if (ossl_unlikely(r->vinfo != NULL)) {
                                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                           "param %s is repeated", s);
                                            return 0;
                                        }
                                        r->vinfo = (OSSL_PARAM *)p;
                                    }
                                }
                            }
                        }
                    }
                    break;
                case 'r':
                    if (ossl_likely(strcmp("operties", s + 2) == 0)) {
                        /* OSSL_KDF_PARAM_PROPERTIES */
                        if (ossl_unlikely(r->propq != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->propq = (OSSL_PARAM *)p;
                    }
                }
                break;
            case 's':
                switch(s[1]) {
                default:
                    break;
                case 'e':
                    if (ossl_likely(strcmp("cret", s + 2) == 0)) {
                        /* OSSL_KDF_PARAM_SECRET */
                        if (ossl_unlikely(r->secret != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->secret = (OSSL_PARAM *)p;
                    }
                    break;
                case 'u':
                    switch(s[2]) {
                    default:
                        break;
                    case 'p':
                        switch(s[3]) {
                        default:
                            break;
                        case 'p':
                            switch(s[4]) {
                            default:
                                break;
                            case '-':
                                switch(s[5]) {
                                default:
                                    break;
                                case 'p':
                                    switch(s[6]) {
                                    default:
                                        break;
                                    case 'r':
                                        if (ossl_likely(strcmp("ivinfo", s + 7) == 0)) {
                                            /* OSSL_KDF_PARAM_X942_SUPP_PRIVINFO */
                                            if (ossl_unlikely(r->priv != NULL)) {
                                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                               "param %s is repeated", s);
                                                return 0;
                                            }
                                            r->priv = (OSSL_PARAM *)p;
                                        }
                                        break;
                                    case 'u':
                                        if (ossl_likely(strcmp("binfo", s + 7) == 0)) {
                                            /* OSSL_KDF_PARAM_X942_SUPP_PUBINFO */
                                            if (ossl_unlikely(r->pub != NULL)) {
                                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                               "param %s is repeated", s);
                                                return 0;
                                            }
                                            r->pub = (OSSL_PARAM *)p;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 'u':
                switch(s[1]) {
                default:
                    break;
                case 'k':
                    if (ossl_likely(strcmp("m", s + 2) == 0)) {
                        /* OSSL_KDF_PARAM_UKM */
                        if (ossl_unlikely(r->uinfo != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->uinfo = (OSSL_PARAM *)p;
                    }
                    break;
                case 's':
                    if (ossl_likely(strcmp("e-keybits", s + 2) == 0)) {
                        /* OSSL_KDF_PARAM_X942_USE_KEYBITS */
                        if (ossl_unlikely(r->kbits != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->kbits = (OSSL_PARAM *)p;
                    }
                }
            }
    return 1;
}
#endif
/* End of machine generated */

/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef sshkdf_get_ctx_params_list
static const OSSL_PARAM sshkdf_get_ctx_params_list[] = {
    OSSL_PARAM_size_t(OSSL_KDF_PARAM_SIZE, NULL),
# if defined(FIPS_MODULE)
    OSSL_PARAM_int(OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR, NULL),
# endif
    OSSL_PARAM_END
};
#endif

#ifndef sshkdf_get_ctx_params_st
struct sshkdf_get_ctx_params_st {
# if defined(FIPS_MODULE)
    OSSL_PARAM *ind;
# endif
    OSSL_PARAM *size;
};
#endif

#ifndef sshkdf_get_ctx_params_decoder
static int sshkdf_get_ctx_params_decoder
    (const OSSL_PARAM *p, struct sshkdf_get_ctx_params_st *r)
{
    const char *s;

    memset(r, 0, sizeof(*r));
    if (p != NULL)
        for (; (s = p->key) != NULL; p++)
            switch(s[0]) {
            default:
                break;
            case 'f':
# if defined(FIPS_MODULE)
                if (ossl_likely(strcmp("ips-indicator", s + 1) == 0)) {
                    /* OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR */
                    if (ossl_unlikely(r->ind != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->ind = (OSSL_PARAM *)p;
                }
# endif
                break;
            case 's':
                if (ossl_likely(strcmp("ize", s + 1) == 0)) {
                    /* OSSL_KDF_PARAM_SIZE */
                    if (ossl_unlikely(r->size != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->size = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */
