Add support for 3DES ECB.
At least the linker can discard this function in the cases where nobody is calling it. Change-Id: I30050e918e6bc1dd9c97cc70f3a56408701abebc Reviewed-on: https://boringssl-review.googlesource.com/3724 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
7282738bad
commit
ca8feeb301
@ -638,6 +638,29 @@ void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||
tin[0] = tin[1] = 0;
|
||||
}
|
||||
|
||||
void DES_ecb3_encrypt(const DES_cblock *input, DES_cblock *output,
|
||||
const DES_key_schedule *ks1, const DES_key_schedule *ks2,
|
||||
const DES_key_schedule *ks3, int enc) {
|
||||
uint32_t l0, l1;
|
||||
uint32_t ll[2];
|
||||
const uint8_t *in = input->bytes;
|
||||
uint8_t *out = output->bytes;
|
||||
|
||||
c2l(in, l0);
|
||||
c2l(in, l1);
|
||||
ll[0] = l0;
|
||||
ll[1] = l1;
|
||||
if (enc) {
|
||||
DES_encrypt3(ll, ks1, ks2, ks3);
|
||||
} else {
|
||||
DES_decrypt3(ll, ks1, ks2, ks3);
|
||||
}
|
||||
l0 = ll[0];
|
||||
l1 = ll[1];
|
||||
l2c(l0, out);
|
||||
l2c(l1, out);
|
||||
}
|
||||
|
||||
void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||
const DES_key_schedule *ks1,
|
||||
const DES_key_schedule *ks2,
|
||||
|
@ -112,6 +112,15 @@ OPENSSL_EXPORT void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out,
|
||||
const DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
|
||||
/* DES_ecb3_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) a single
|
||||
* block (8 bytes) of data from |input| to |output| using 3DES. */
|
||||
OPENSSL_EXPORT void DES_ecb3_encrypt(const DES_cblock *input,
|
||||
DES_cblock *output,
|
||||
const DES_key_schedule *ks1,
|
||||
const DES_key_schedule *ks2,
|
||||
const DES_key_schedule *ks3,
|
||||
int enc);
|
||||
|
||||
/* DES_ede3_cbc_encrypt encrypts (or decrypts, if |enc| is |DES_DECRYPT|) |len|
|
||||
* bytes from |in| to |out| with 3DES in CBC mode. 3DES uses three keys, thus
|
||||
* the function takes three different |DES_key_schedule|s. */
|
||||
|
Loading…
Reference in New Issue
Block a user