EVP_RC2_CBC(3)
π EVP_RC2_CBC(3) β Rivest Cipher 2 in the EVP framework π
Okay bestie, welcome to the EVP_RC2_CBC(3) page from the Library Functions Manual. Itβs giving βvintage cipher, very specific setup steps,β and weβre gonna get through it together. π
β¨ NAME β¨
EVP_rc2_cbc,EVP_rc2_ecb,EVP_rc2_cfb64,EVP_rc2_cfb,EVP_rc2_ofb,EVP_rc2_40_cbc,EVP_rc2_64_cbcβ Rivest Cipher 2 in the EVP framework.
π SYNOPSIS π
library βlibcryptoβ #include <openssl/evp.h>
const EVP_CIPHER *
EVP_rc2_cbc(void);
const EVP_CIPHER *
EVP_rc2_ecb(void);
const EVP_CIPHER *
EVP_rc2_cfb64(void);
const EVP_CIPHER *
EVP_rc2_cfb(void);
const EVP_CIPHER *
EVP_rc2_ofb(void);
const EVP_CIPHER *
EVP_rc2_40_cbc(void);
const EVP_CIPHER *
EVP_rc2_64_cbc(void);
#include <openssl/rc2.h>
#define RC2_BLOCK 8
#define RC2_KEY_LENGTH 16
π DESCRIPTION π
RC2 is a block cipher operating on blocks of RC2_BLOCK = 8 bytes, equivalent to 64 bits, using a variable key length with an additional parameter called βeffective key bitsβ or βeffective key length.β
EVP_rc2_cbc(), EVP_rc2_ecb(), EVP_rc2_cfb64(), and EVP_rc2_ofb() provide the RC2 encryption algorithm in CBC, ECB, CFB and OFB mode, respectively. EVP_rc2_cfb() is an alias for EVP_rc2_cfb64(), implemented as a macro.
By default, these functions set both the key length and the effective key length to RC2_KEY_LENGTH = 16 bytes, which is not a very useful value because it is quite short. π«
Configuring normally requires a multi-step process:
- Create a new, empty
EVP_CIPHER_CTXobject withEVP_CIPHER_CTX_new(3). - Select the operation mode by calling
EVP_EncryptInit(3)with the desiredtypeargument, passingNULLpointers for thekeyandivarguments. - Select the key length by passing the desired number of bytes to
EVP_CIPHER_CTX_set_key_length(3). Doing so overrides the default key length ofRC2_KEY_LENGTH = 16. Valid values forkeylenare positive and less than or equal to128. - Select the effective key length by calling
EVP_CIPHER_CTX_ctrl(3)with atypeargument ofEVP_CTRL_SET_RC2_KEY_BITS, passing the desired number of bits inarg. Doing so overrides the default effective key length of128bits. Valid values forargare positive and less than or equal to1024. Theptrargument is ignored; passingNULLis recommended. - Call
EVP_EncryptInit(3)a second time, this time passingNULLfor thetypeargument. Thekeyargument points to an array containing the number of bytes that was passed toEVP_CIPHER_CTX_set_key_length(3), and theivargument points to an array of eight bytes. - Finally,
EVP_EncryptUpdate(3)andEVP_EncryptFinal(3)can be used in the normal way.
Once a ctx object is fully configured, calling EVP_CIPHER_CTX_ctrl(3) with a type argument of EVP_CTRL_GET_RC2_KEY_BITS interprets ptr as a pointer to int and stores the effective key length in bits at that location. In this case, arg is ignored and passing 0 is recommended.
In the CFB and OFB modes, the minimum required total length in bytes of the output buffer is equal to the total number of input bytes to be encoded. In the CBC and ECB modes, the minimum required total length of the output buffer has to be rounded up to the next multiple of the block size of eight bytes. π§
EVP_rc2_40_cbc() and EVP_rc2_64_cbc() are obsolete functions that provide the RC2 algorithm in CBC mode with a key length and an effective key length of 40 and 64 bits, respectively. Not me calling them obsolete, thatβs literally the page. π
π«Ά RETURN VALUES π«Ά
With the EVP_CIPHER objects documented in the present manual page, EVP_CIPHER_CTX_ctrl() returns 1 for success or 0 if an error occurs.
π₯ SEE ALSO π₯
evp(3), EVP_CIPHER_CTX_set_key_length(3), EVP_EncryptInit(3), RC2_encrypt(3)
π HISTORY π
EVP_rc2_cbc(),EVP_rc2_ecb(),EVP_rc2_cfb(), andEVP_rc2_ofb()first appeared in SSLeay0.5.2and have been available since OpenBSD2.4.EVP_rc2_40_cbc()andEVP_rc2_64_cbc()first appeared in SSLeay0.9.1and have been available since OpenBSD2.6.EVP_rc2_cfb64()first appeared in OpenSSL0.9.7eand has been available since OpenBSD3.8.
Thatβs the whole page, bestie. Cute sign-off energy: Debian, June 8, 2025, and the manual name EVP_RC2_CBC(3) β love that for us. πβ¨π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2024 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms