[PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs
David Marchand
david.marchand at redhat.com
Thu Oct 24 15:30:18 CEST 2024
On Thu, Oct 24, 2024 at 3:17 PM David Marchand
<david.marchand at redhat.com> wrote:
> @@ -1209,14 +1195,16 @@ process_openssl_cipher_des3ctr(struct rte_mbuf
> *mbuf_src, uint8_t *dst,
> l = rte_pktmbuf_data_len(m) - offset;
>
> memcpy(ctr, iv, 8);
> + host_ctr = rte_be_64_to_cpu(ctr);
>
> for (n = 0; n < srclen; n++) {
> if (n % 8 == 0) {
> + ctr = rte_cpu_to_be_64(host_ctr);
Moving this here adds one uneeded extra conversion on the first iteration.
So I would keep the conversion around the host_ctr variable increment,
if you get the idea.
> if (EVP_EncryptUpdate(ctx,
> (unsigned char *)&ebuf, &unused,
> (const unsigned char *)&ctr, 8) <= 0)
> goto process_cipher_des3ctr_err;
> - ctr_inc(ctr);
> + host_ctr++;
> }
> dst[n] = *(src++) ^ ebuf[n % 8];
--
David Marchand
More information about the dev
mailing list