/*
 * 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 ossl_cipher_generic_get_params_list
static const OSSL_PARAM ossl_cipher_generic_get_params_list[] = {
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_MODE, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_BLOCK_SIZE, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_AEAD, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_CUSTOM_IV, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_CTS, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_HAS_RAND_KEY, NULL),
    OSSL_PARAM_int(OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC, NULL),
    OSSL_PARAM_END
};
#endif

#ifndef ossl_cipher_generic_get_params_st
struct ossl_cipher_generic_get_params_st {
    OSSL_PARAM *aead;
    OSSL_PARAM *bsize;
    OSSL_PARAM *cts;
    OSSL_PARAM *custiv;
    OSSL_PARAM *etm;
    OSSL_PARAM *ivlen;
    OSSL_PARAM *keylen;
    OSSL_PARAM *mb;
    OSSL_PARAM *mode;
    OSSL_PARAM *rand;
};
#endif

#ifndef ossl_cipher_generic_get_params_decoder
static int ossl_cipher_generic_get_params_decoder
    (const OSSL_PARAM *p, struct ossl_cipher_generic_get_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("ead", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_AEAD */
                    if (ossl_unlikely(r->aead != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->aead = (OSSL_PARAM *)p;
                }
                break;
            case 'b':
                if (ossl_likely(strcmp("locksize", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_BLOCK_SIZE */
                    if (ossl_unlikely(r->bsize != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->bsize = (OSSL_PARAM *)p;
                }
                break;
            case 'c':
                switch(s[1]) {
                default:
                    break;
                case 't':
                    if (ossl_likely(strcmp("s", s + 2) == 0)) {
                        /* OSSL_CIPHER_PARAM_CTS */
                        if (ossl_unlikely(r->cts != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->cts = (OSSL_PARAM *)p;
                    }
                    break;
                case 'u':
                    if (ossl_likely(strcmp("stom-iv", s + 2) == 0)) {
                        /* OSSL_CIPHER_PARAM_CUSTOM_IV */
                        if (ossl_unlikely(r->custiv != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->custiv = (OSSL_PARAM *)p;
                    }
                }
                break;
            case 'e':
                if (ossl_likely(strcmp("ncrypt-then-mac", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_ENCRYPT_THEN_MAC */
                    if (ossl_unlikely(r->etm != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->etm = (OSSL_PARAM *)p;
                }
                break;
            case 'h':
                if (ossl_likely(strcmp("as-randkey", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_HAS_RAND_KEY */
                    if (ossl_unlikely(r->rand != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->rand = (OSSL_PARAM *)p;
                }
                break;
            case 'i':
                if (ossl_likely(strcmp("vlen", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_IVLEN */
                    if (ossl_unlikely(r->ivlen != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->ivlen = (OSSL_PARAM *)p;
                }
                break;
            case 'k':
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_KEYLEN */
                    if (ossl_unlikely(r->keylen != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->keylen = (OSSL_PARAM *)p;
                }
                break;
            case 'm':
                if (ossl_likely(strcmp("ode", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_MODE */
                    if (ossl_unlikely(r->mode != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->mode = (OSSL_PARAM *)p;
                }
                break;
            case 't':
                if (ossl_likely(strcmp("ls-multi", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK */
                    if (ossl_unlikely(r->mb != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->mb = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */

/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef cipher_generic_get_ctx_params_list
static const OSSL_PARAM cipher_generic_get_ctx_params_list[] = {
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_IVLEN, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_PADDING, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_NUM, NULL),
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_IV, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_UPDATED_IV, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_CIPHER_PARAM_TLS_MAC, NULL, 0),
    OSSL_PARAM_END
};
#endif

#ifndef cipher_generic_get_ctx_params_st
struct cipher_generic_get_ctx_params_st {
    OSSL_PARAM *iv;
    OSSL_PARAM *ivlen;
    OSSL_PARAM *keylen;
    OSSL_PARAM *num;
    OSSL_PARAM *pad;
    OSSL_PARAM *tlsmac;
    OSSL_PARAM *updiv;
};
#endif

#ifndef cipher_generic_get_ctx_params_decoder
static int cipher_generic_get_ctx_params_decoder
    (const OSSL_PARAM *p, struct cipher_generic_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 'i':
                switch(s[1]) {
                default:
                    break;
                case 'v':
                    switch(s[2]) {
                    default:
                        break;
                    case 'l':
                        if (ossl_likely(strcmp("en", s + 3) == 0)) {
                            /* OSSL_CIPHER_PARAM_IVLEN */
                            if (ossl_unlikely(r->ivlen != NULL)) {
                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                               "param %s is repeated", s);
                                return 0;
                            }
                            r->ivlen = (OSSL_PARAM *)p;
                        }
                        break;
                    case '\0':
                        if (ossl_unlikely(r->iv != NULL)) {
                            ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                           "param %s is repeated", s);
                            return 0;
                        }
                        r->iv = (OSSL_PARAM *)p;
                    }
                }
                break;
            case 'k':
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_KEYLEN */
                    if (ossl_unlikely(r->keylen != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->keylen = (OSSL_PARAM *)p;
                }
                break;
            case 'n':
                if (ossl_likely(strcmp("um", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_NUM */
                    if (ossl_unlikely(r->num != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->num = (OSSL_PARAM *)p;
                }
                break;
            case 'p':
                if (ossl_likely(strcmp("adding", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_PADDING */
                    if (ossl_unlikely(r->pad != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->pad = (OSSL_PARAM *)p;
                }
                break;
            case 't':
                if (ossl_likely(strcmp("ls-mac", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_TLS_MAC */
                    if (ossl_unlikely(r->tlsmac != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->tlsmac = (OSSL_PARAM *)p;
                }
                break;
            case 'u':
                if (ossl_likely(strcmp("pdated-iv", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_UPDATED_IV */
                    if (ossl_unlikely(r->updiv != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->updiv = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */

/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef cipher_generic_set_ctx_params_list
static const OSSL_PARAM cipher_generic_set_ctx_params_list[] = {
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_PADDING, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_NUM, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_USE_BITS, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_TLS_VERSION, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_TLS_MAC_SIZE, NULL),
    OSSL_PARAM_END
};
#endif

#ifndef cipher_generic_set_ctx_params_st
struct cipher_generic_set_ctx_params_st {
    OSSL_PARAM *bits;
    OSSL_PARAM *num;
    OSSL_PARAM *pad;
    OSSL_PARAM *tlsmacsize;
    OSSL_PARAM *tlsvers;
};
#endif

#ifndef cipher_generic_set_ctx_params_decoder
static int cipher_generic_set_ctx_params_decoder
    (const OSSL_PARAM *p, struct cipher_generic_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 'n':
                if (ossl_likely(strcmp("um", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_NUM */
                    if (ossl_unlikely(r->num != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->num = (OSSL_PARAM *)p;
                }
                break;
            case 'p':
                if (ossl_likely(strcmp("adding", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_PADDING */
                    if (ossl_unlikely(r->pad != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->pad = (OSSL_PARAM *)p;
                }
                break;
            case 't':
                switch(s[1]) {
                default:
                    break;
                case 'l':
                    switch(s[2]) {
                    default:
                        break;
                    case 's':
                        switch(s[3]) {
                        default:
                            break;
                        case '-':
                            switch(s[4]) {
                            default:
                                break;
                            case 'm':
                                if (ossl_likely(strcmp("ac-size", s + 5) == 0)) {
                                    /* OSSL_CIPHER_PARAM_TLS_MAC_SIZE */
                                    if (ossl_unlikely(r->tlsmacsize != NULL)) {
                                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                       "param %s is repeated", s);
                                        return 0;
                                    }
                                    r->tlsmacsize = (OSSL_PARAM *)p;
                                }
                                break;
                            case 'v':
                                if (ossl_likely(strcmp("ersion", s + 5) == 0)) {
                                    /* OSSL_CIPHER_PARAM_TLS_VERSION */
                                    if (ossl_unlikely(r->tlsvers != NULL)) {
                                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                       "param %s is repeated", s);
                                        return 0;
                                    }
                                    r->tlsvers = (OSSL_PARAM *)p;
                                }
                            }
                        }
                    }
                }
                break;
            case 'u':
                if (ossl_likely(strcmp("se-bits", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_USE_BITS */
                    if (ossl_unlikely(r->bits != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->bits = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */

/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef cipher_var_keylen_set_ctx_params_list
static const OSSL_PARAM cipher_var_keylen_set_ctx_params_list[] = {
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_PADDING, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_NUM, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_USE_BITS, NULL),
    OSSL_PARAM_uint(OSSL_CIPHER_PARAM_TLS_VERSION, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_TLS_MAC_SIZE, NULL),
    OSSL_PARAM_size_t(OSSL_CIPHER_PARAM_KEYLEN, NULL),
    OSSL_PARAM_END
};
#endif

#ifndef cipher_var_keylen_set_ctx_params_st
struct cipher_var_keylen_set_ctx_params_st {
    OSSL_PARAM *bits;
    OSSL_PARAM *keylen;
    OSSL_PARAM *num;
    OSSL_PARAM *pad;
    OSSL_PARAM *tlsmacsize;
    OSSL_PARAM *tlsvers;
};
#endif

#ifndef cipher_var_keylen_set_ctx_params_decoder
static int cipher_var_keylen_set_ctx_params_decoder
    (const OSSL_PARAM *p, struct cipher_var_keylen_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 'k':
                if (ossl_likely(strcmp("eylen", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_KEYLEN */
                    if (ossl_unlikely(r->keylen != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->keylen = (OSSL_PARAM *)p;
                }
                break;
            case 'n':
                if (ossl_likely(strcmp("um", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_NUM */
                    if (ossl_unlikely(r->num != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->num = (OSSL_PARAM *)p;
                }
                break;
            case 'p':
                if (ossl_likely(strcmp("adding", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_PADDING */
                    if (ossl_unlikely(r->pad != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->pad = (OSSL_PARAM *)p;
                }
                break;
            case 't':
                switch(s[1]) {
                default:
                    break;
                case 'l':
                    switch(s[2]) {
                    default:
                        break;
                    case 's':
                        switch(s[3]) {
                        default:
                            break;
                        case '-':
                            switch(s[4]) {
                            default:
                                break;
                            case 'm':
                                if (ossl_likely(strcmp("ac-size", s + 5) == 0)) {
                                    /* OSSL_CIPHER_PARAM_TLS_MAC_SIZE */
                                    if (ossl_unlikely(r->tlsmacsize != NULL)) {
                                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                       "param %s is repeated", s);
                                        return 0;
                                    }
                                    r->tlsmacsize = (OSSL_PARAM *)p;
                                }
                                break;
                            case 'v':
                                if (ossl_likely(strcmp("ersion", s + 5) == 0)) {
                                    /* OSSL_CIPHER_PARAM_TLS_VERSION */
                                    if (ossl_unlikely(r->tlsvers != NULL)) {
                                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                                       "param %s is repeated", s);
                                        return 0;
                                    }
                                    r->tlsvers = (OSSL_PARAM *)p;
                                }
                            }
                        }
                    }
                }
                break;
            case 'u':
                if (ossl_likely(strcmp("se-bits", s + 1) == 0)) {
                    /* OSSL_CIPHER_PARAM_USE_BITS */
                    if (ossl_unlikely(r->bits != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->bits = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */
