

#include <openssl/opensslconf.h>
#include "crypto/chacha.h"
#include "crypto/riscv_arch.h"

void ChaCha20_ctr32_zvkb(unsigned char *out, const unsigned char *inp,
                         size_t len, const unsigned int key[8],
                         const unsigned int counter[4]);

void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, size_t len,
                    const unsigned int key[8], const unsigned int counter[4])
{
    if (RISCV_HAS_ZVKB() && riscv_vlen() >= 128) {
        ChaCha20_ctr32_zvkb(out, inp, len, key, counter);
    } else {
        ChaCha20_ctr32_c(out, inp, len, key, counter);
    }
}
