---
name: "crypto_blkcipher_encrypt"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/crypto_blkcipher_encrypt"
---

# crypto\_blkcipher\_encrypt(9)

encrypt plaintext

## NAME

crypto\_blkcipher\_encrypt - encrypt plaintext

## SYNOPSIS

**int crypto\_blkcipher\_encrypt(struct blkcipher\_desc \*** *desc***, struct scatterlist \*** *dst***, struct scatterlist \*** *src***, unsigned int** *nbytes***);**

## ARGUMENTS

*desc*

reference to the block cipher handle with meta data

*dst*

scatter/gather list that is filled by the cipher operation with the ciphertext

*src*

scatter/gather list that holds the plaintext

*nbytes*

number of bytes of the plaintext to encrypt.

## DESCRIPTION

Encrypt plaintext data using the IV set by the caller with a preceding call of crypto\_blkcipher\_set\_iv.

The blkcipher\_desc data structure must be filled by the caller and can reside on the stack. The caller must fill desc as follows: desc.tfm is filled with the block cipher handle; desc.flags is filled with either CRYPTO\_TFM\_REQ\_MAY\_SLEEP or 0.

## RETURN

0 if the cipher operation was successful; \< 0 if an error occurred

## AUTHORS

**Stephan Mueller** \<smueller@chronox.de\>

Author.

**Marek Vasut** \<marek@denx.de\>

Author.

## COPYRIGHT
