/*
 * Copyright 2025-2026 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 sm2sig_get_ctx_params_list
static const OSSL_PARAM sm2sig_get_ctx_params_list[] = {
    OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_ALGORITHM_ID, NULL, 0),
    OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
    OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
    OSSL_PARAM_END
};
#endif

#ifndef sm2sig_get_ctx_params_st
struct sm2sig_get_ctx_params_st {
    OSSL_PARAM *algid;
    OSSL_PARAM *digest;
    OSSL_PARAM *size;
};
#endif

#ifndef sm2sig_get_ctx_params_decoder
static int sm2sig_get_ctx_params_decoder
    (const OSSL_PARAM *p, struct sm2sig_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 'a':
                if (ossl_likely(strcmp("lgorithm-id", s + 1) == 0)) {
                    /* OSSL_SIGNATURE_PARAM_ALGORITHM_ID */
                    if (ossl_unlikely(r->algid != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->algid = (OSSL_PARAM *)p;
                }
                break;
            case 'd':
                switch(s[1]) {
                default:
                    break;
                case 'i':
                    switch(s[2]) {
                    default:
                        break;
                    case 'g':
                        switch(s[3]) {
                        default:
                            break;
                        case 'e':
                            switch(s[4]) {
                            default:
                                break;
                            case 's':
                                switch(s[5]) {
                                default:
                                    break;
                                case 't':
                                    switch(s[6]) {
                                    default:
                                        break;
                                    case '-':
                                        if (ossl_likely(strcmp("size", s + 7) == 0)) {
                                            /* OSSL_SIGNATURE_PARAM_DIGEST_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;
                                        }
                                        break;
                                    case '\0':
                                        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;
                                    }
                                }
                            }
                        }
                    }
                }
            }
    return 1;
}
#endif
/* End of machine generated */

/* Machine generated by util/perl/OpenSSL/paramnames.pm */
#ifndef sm2sig_set_ctx_params_list
static const OSSL_PARAM sm2sig_set_ctx_params_list[] = {
    OSSL_PARAM_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE, NULL),
    OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
    OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_DIST_ID, NULL, 0),
    OSSL_PARAM_uint(OSSL_SIGNATURE_PARAM_TLS_VERSION, NULL),
    OSSL_PARAM_END
};
#endif

#ifndef sm2sig_set_ctx_params_st
struct sm2sig_set_ctx_params_st {
    OSSL_PARAM *digest;
    OSSL_PARAM *distid;
    OSSL_PARAM *size;
    OSSL_PARAM *tlsver;
};
#endif

#ifndef sm2sig_set_ctx_params_decoder
static int sm2sig_set_ctx_params_decoder
    (const OSSL_PARAM *p, struct sm2sig_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 'd':
                switch(s[1]) {
                default:
                    break;
                case 'i':
                    switch(s[2]) {
                    default:
                        break;
                    case 'g':
                        switch(s[3]) {
                        default:
                            break;
                        case 'e':
                            switch(s[4]) {
                            default:
                                break;
                            case 's':
                                switch(s[5]) {
                                default:
                                    break;
                                case 't':
                                    switch(s[6]) {
                                    default:
                                        break;
                                    case '-':
                                        if (ossl_likely(strcmp("size", s + 7) == 0)) {
                                            /* OSSL_SIGNATURE_PARAM_DIGEST_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;
                                        }
                                        break;
                                    case '\0':
                                        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 's':
                        if (ossl_likely(strcmp("tid", s + 3) == 0)) {
                            /* OSSL_PKEY_PARAM_DIST_ID */
                            if (ossl_unlikely(r->distid != NULL)) {
                                ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                               "param %s is repeated", s);
                                return 0;
                            }
                            r->distid = (OSSL_PARAM *)p;
                        }
                    }
                }
                break;
            case 't':
                if (ossl_likely(strcmp("ls-version", s + 1) == 0)) {
                    /* OSSL_SIGNATURE_PARAM_TLS_VERSION */
                    if (ossl_unlikely(r->tlsver != NULL)) {
                        ERR_raise_data(ERR_LIB_PROV, PROV_R_REPEATED_PARAMETER,
                                       "param %s is repeated", s);
                        return 0;
                    }
                    r->tlsver = (OSSL_PARAM *)p;
                }
            }
    return 1;
}
#endif
/* End of machine generated */
