{
    "content": [
        {
            "type": "text",
            "text": "# EVP_RAND-TEST-RAND (man)\n\n## NAME\n\nEVPRAND-TEST-RAND - The test EVPRAND implementation\n\n## DESCRIPTION\n\nSupport for a test generator through the EVPRAND API. This generator is for test purposes\nonly, it does not generate random numbers.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION** (2 subsections)\n- **NOTES**\n- **EXAMPLES**\n- **SEE ALSO**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "EVP_RAND-TEST-RAND",
        "section": "",
        "mode": "man",
        "summary": "EVPRAND-TEST-RAND - The test EVPRAND implementation",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "EVPRAND *rand;",
            "EVPRANDCTX *rctx;",
            "unsigned char bytes[100];",
            "OSSLPARAM params[4], *p = params;",
            "unsigned char entropy[1000] = { ... };",
            "unsigned char nonce[20] = { ... };",
            "unsigned int strength = 48;",
            "rand = EVPRANDfetch(NULL, \"TEST-RAND\", NULL);",
            "rctx = EVPRANDCTXnew(rand, NULL);",
            "EVPRANDfree(rand);",
            "*p++ = OSSLPARAMconstructuint(OSSLRANDPARAMSTRENGTH, &strength);",
            "*p++ = OSSLPARAMconstructoctetstring(OSSLRANDPARAMTESTENTROPY,",
            "entropy, sizeof(entropy));",
            "*p++ = OSSLPARAMconstructoctetstring(OSSLRANDPARAMTESTNONCE,",
            "nonce, sizeof(nonce));",
            "*p = OSSLPARAMconstructend();",
            "EVPRANDinstantiate(rctx, strength, 0, NULL, 0, params);",
            "EVPRANDgenerate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);",
            "EVPRANDCTXfree(rctx);"
        ],
        "see_also": [
            {
                "name": "EVPRAND",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPRAND/3/json"
            },
            {
                "name": "EVPRAND",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPRAND/3/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": [
                    {
                        "name": "Identity",
                        "lines": 3
                    },
                    {
                        "name": "Supported parameters",
                        "lines": 28
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "EVPRAND-TEST-RAND - The test EVPRAND implementation\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Support for a test generator through the EVPRAND API. This generator is for test purposes\nonly, it does not generate random numbers.\n",
                "subsections": [
                    {
                        "name": "Identity",
                        "content": "\"TEST-RAND\" is the name for this implementation; it can be used with the EVPRANDfetch()\nfunction.\n"
                    },
                    {
                        "name": "Supported parameters",
                        "content": "The supported parameters are:\n\n\"state\" (OSSLRANDPARAMSTATE) <integer>\nThese parameter works as described in \"PARAMETERS\" in EVPRAND(3).\n\n\"strength\" (OSSLRANDPARAMSTRENGTH) <unsigned integer>\n\"reseedrequests\" (OSSLDRBGPARAMRESEEDREQUESTS) <unsigned integer>\n\"reseedtimeinterval\" (OSSLDRBGPARAMRESEEDTIMEINTERVAL) <integer>\n\"maxrequest\" (OSSLDRBGPARAMRESEEDREQUESTS) <unsigned integer>\n\"minentropylen\" (OSSLDRBGPARAMMINENTROPYLEN) <unsigned integer>\n\"maxentropylen\" (OSSLDRBGPARAMMAXENTROPYLEN) <unsigned integer>\n\"minnoncelen\" (OSSLDRBGPARAMMINNONCELEN) <unsigned integer>\n\"maxnoncelen\" (OSSLDRBGPARAMMAXNONCELEN) <unsigned integer>\n\"maxperslen\" (OSSLDRBGPARAMMAXPERSLEN) <unsigned integer>\n\"maxadinlen\" (OSSLDRBGPARAMMAXADINLEN) <unsigned integer>\n\"reseedcounter\" (OSSLDRBGPARAMRESEEDCOUNTER) <unsigned integer>\nThese parameters work as described in \"PARAMETERS\" in EVPRAND(3), except that they can\nall be set as well as read.\n\n\"testentropy\" (OSSLRANDPARAMTESTENTROPY) <octet string>\nSets the bytes returned when the test generator is sent an entropy request.  The current\nposition is remembered across generate calls.  If there are insufficient data present to\nsatisfy a call, an error is returned.\n\n\"testnonce\" (OSSLRANDPARAMTESTNONCE) <octet string>\nSets the bytes returned when the test generator is sent a nonce request.  Each nonce\nrequest will return all of the bytes.\n"
                    }
                ]
            },
            "NOTES": {
                "content": "A context for a test generator can be obtained by calling:\n\nEVPRAND *rand = EVPRANDfetch(NULL, \"TEST-RAND\", NULL);\nEVPRANDCTX *rctx = EVPRANDCTXnew(rand);\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "EVPRAND *rand;\nEVPRANDCTX *rctx;\nunsigned char bytes[100];\nOSSLPARAM params[4], *p = params;\nunsigned char entropy[1000] = { ... };\nunsigned char nonce[20] = { ... };\nunsigned int strength = 48;\n\nrand = EVPRANDfetch(NULL, \"TEST-RAND\", NULL);\nrctx = EVPRANDCTXnew(rand, NULL);\nEVPRANDfree(rand);\n\n*p++ = OSSLPARAMconstructuint(OSSLRANDPARAMSTRENGTH, &strength);\n*p++ = OSSLPARAMconstructoctetstring(OSSLRANDPARAMTESTENTROPY,\nentropy, sizeof(entropy));\n*p++ = OSSLPARAMconstructoctetstring(OSSLRANDPARAMTESTNONCE,\nnonce, sizeof(nonce));\n*p = OSSLPARAMconstructend();\nEVPRANDinstantiate(rctx, strength, 0, NULL, 0, params);\n\nEVPRANDgenerate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVPRANDCTXfree(rctx);\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "EVPRAND(3), \"PARAMETERS\" in EVPRAND(3)\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed under the Apache License 2.0 (the \"License\").  You may not use this file except in\ncompliance with the License.  You can obtain a copy in the file LICENSE in the source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n\n\n3.0.2                                        2026-06-02                     EVPRAND-TEST-RAND(7SSL)",
                "subsections": []
            }
        }
    }
}