Changeset View
Changeset View
Standalone View
Standalone View
sys/crypto/chacha20/chacha-sw.c
Show All 33 Lines | |||||
static void | static void | ||||
chacha20_xform_crypt_last(void *ctx, const uint8_t *in, uint8_t *out, | chacha20_xform_crypt_last(void *ctx, const uint8_t *in, uint8_t *out, | ||||
size_t len) | size_t len) | ||||
{ | { | ||||
chacha_encrypt_bytes(ctx, in, out, len); | chacha_encrypt_bytes(ctx, in, out, len); | ||||
} | } | ||||
struct enc_xform enc_xform_chacha20 = { | const struct enc_xform enc_xform_chacha20 = { | ||||
.type = CRYPTO_CHACHA20, | .type = CRYPTO_CHACHA20, | ||||
.name = "chacha20", | .name = "chacha20", | ||||
.ctxsize = sizeof(struct chacha_ctx), | .ctxsize = sizeof(struct chacha_ctx), | ||||
.blocksize = 1, | .blocksize = 1, | ||||
.native_blocksize = CHACHA_BLOCKLEN, | .native_blocksize = CHACHA_BLOCKLEN, | ||||
.ivsize = CHACHA_NONCELEN + CHACHA_CTRLEN, | .ivsize = CHACHA_NONCELEN + CHACHA_CTRLEN, | ||||
.minkey = CHACHA_MINKEYLEN, | .minkey = CHACHA_MINKEYLEN, | ||||
.maxkey = 32, | .maxkey = 32, | ||||
.encrypt = chacha20_xform_crypt, | .encrypt = chacha20_xform_crypt, | ||||
.decrypt = chacha20_xform_crypt, | .decrypt = chacha20_xform_crypt, | ||||
.setkey = chacha20_xform_setkey, | .setkey = chacha20_xform_setkey, | ||||
.reinit = chacha20_xform_reinit, | .reinit = chacha20_xform_reinit, | ||||
.encrypt_last = chacha20_xform_crypt_last, | .encrypt_last = chacha20_xform_crypt_last, | ||||
.decrypt_last = chacha20_xform_crypt_last, | .decrypt_last = chacha20_xform_crypt_last, | ||||
}; | }; |