aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2024-01-20 09:54:08 -0500
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-01-25 20:34:23 +0000
commit7f45053d42ae0b5f4d5d96fa471d671c6d1462e9 (patch)
treebbad12d4f0806b8abebb29a1596f73716be96805
parent89d18c7a880fe43a5cebe39837178c9e6161c3cb (diff)
downloadboringssl-7f45053d42ae0b5f4d5d96fa471d671c6d1462e9.zip
boringssl-7f45053d42ae0b5f4d5d96fa471d671c6d1462e9.tar.gz
boringssl-7f45053d42ae0b5f4d5d96fa471d671c6d1462e9.tar.bz2
Unexport uint32_t-based DES APIs
Per the header, these symbols were private and only exported for decrepit. But decrepit can include internal headers. Change-Id: I1155f4b98252004b80a53efb0a6009400a6c59ac Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65687 Auto-Submit: David Benjamin <davidben@google.com> Commit-Queue: Bob Beck <bbe@google.com> Reviewed-by: Bob Beck <bbe@google.com>
-rw-r--r--crypto/des/des.c38
-rw-r--r--crypto/des/internal.h14
-rw-r--r--include/openssl/des.h13
3 files changed, 34 insertions, 31 deletions
diff --git a/crypto/des/des.c b/crypto/des/des.c
index a608acc..9e5c97f 100644
--- a/crypto/des/des.c
+++ b/crypto/des/des.c
@@ -378,7 +378,8 @@ void DES_set_odd_parity(DES_cblock *key) {
}
}
-static void DES_encrypt1(uint32_t *data, const DES_key_schedule *ks, int enc) {
+static void DES_encrypt1(uint32_t data[2], const DES_key_schedule *ks,
+ int enc) {
uint32_t l, r, t, u;
r = data[0];
@@ -442,7 +443,8 @@ static void DES_encrypt1(uint32_t *data, const DES_key_schedule *ks, int enc) {
data[1] = r;
}
-static void DES_encrypt2(uint32_t *data, const DES_key_schedule *ks, int enc) {
+static void DES_encrypt2(uint32_t data[2], const DES_key_schedule *ks,
+ int enc) {
uint32_t l, r, t, u;
r = data[0];
@@ -499,7 +501,7 @@ static void DES_encrypt2(uint32_t *data, const DES_key_schedule *ks, int enc) {
data[1] = CRYPTO_rotr_u32(r, 3);
}
-void DES_encrypt3(uint32_t *data, const DES_key_schedule *ks1,
+void DES_encrypt3(uint32_t data[2], const DES_key_schedule *ks1,
const DES_key_schedule *ks2, const DES_key_schedule *ks3) {
uint32_t l, r;
@@ -508,9 +510,9 @@ void DES_encrypt3(uint32_t *data, const DES_key_schedule *ks1,
IP(l, r);
data[0] = l;
data[1] = r;
- DES_encrypt2((uint32_t *)data, ks1, DES_ENCRYPT);
- DES_encrypt2((uint32_t *)data, ks2, DES_DECRYPT);
- DES_encrypt2((uint32_t *)data, ks3, DES_ENCRYPT);
+ DES_encrypt2(data, ks1, DES_ENCRYPT);
+ DES_encrypt2(data, ks2, DES_DECRYPT);
+ DES_encrypt2(data, ks3, DES_ENCRYPT);
l = data[0];
r = data[1];
FP(r, l);
@@ -518,7 +520,7 @@ void DES_encrypt3(uint32_t *data, const DES_key_schedule *ks1,
data[1] = r;
}
-void DES_decrypt3(uint32_t *data, const DES_key_schedule *ks1,
+void DES_decrypt3(uint32_t data[2], const DES_key_schedule *ks1,
const DES_key_schedule *ks2, const DES_key_schedule *ks3) {
uint32_t l, r;
@@ -527,9 +529,9 @@ void DES_decrypt3(uint32_t *data, const DES_key_schedule *ks1,
IP(l, r);
data[0] = l;
data[1] = r;
- DES_encrypt2((uint32_t *)data, ks3, DES_DECRYPT);
- DES_encrypt2((uint32_t *)data, ks2, DES_ENCRYPT);
- DES_encrypt2((uint32_t *)data, ks1, DES_DECRYPT);
+ DES_encrypt2(data, ks3, DES_DECRYPT);
+ DES_encrypt2(data, ks2, DES_ENCRYPT);
+ DES_encrypt2(data, ks1, DES_DECRYPT);
l = data[0];
r = data[1];
FP(r, l);
@@ -576,7 +578,7 @@ void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin1 ^= tout1;
tin[1] = tin1;
- DES_encrypt1((uint32_t *)tin, schedule, DES_ENCRYPT);
+ DES_encrypt1(tin, schedule, DES_ENCRYPT);
tout0 = tin[0];
l2c(tout0, out);
tout1 = tin[1];
@@ -588,7 +590,7 @@ void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin1 ^= tout1;
tin[1] = tin1;
- DES_encrypt1((uint32_t *)tin, schedule, DES_ENCRYPT);
+ DES_encrypt1(tin, schedule, DES_ENCRYPT);
tout0 = tin[0];
l2c(tout0, out);
tout1 = tin[1];
@@ -605,7 +607,7 @@ void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
c2l(in, tin1);
tin[1] = tin1;
- DES_encrypt1((uint32_t *)tin, schedule, DES_DECRYPT);
+ DES_encrypt1(tin, schedule, DES_DECRYPT);
tout0 = tin[0] ^ xor0;
tout1 = tin[1] ^ xor1;
l2c(tout0, out);
@@ -618,7 +620,7 @@ void DES_ncbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
c2l(in, tin1);
tin[1] = tin1;
- DES_encrypt1((uint32_t *)tin, schedule, DES_DECRYPT);
+ DES_encrypt1(tin, schedule, DES_DECRYPT);
tout0 = tin[0] ^ xor0;
tout1 = tin[1] ^ xor1;
l2cn(tout0, tout1, out, len);
@@ -678,7 +680,7 @@ void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin[1] = tin1;
- DES_encrypt3((uint32_t *)tin, ks1, ks2, ks3);
+ DES_encrypt3(tin, ks1, ks2, ks3);
tout0 = tin[0];
tout1 = tin[1];
@@ -692,7 +694,7 @@ void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin[1] = tin1;
- DES_encrypt3((uint32_t *)tin, ks1, ks2, ks3);
+ DES_encrypt3(tin, ks1, ks2, ks3);
tout0 = tin[0];
tout1 = tin[1];
@@ -716,7 +718,7 @@ void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin[1] = tin1;
- DES_decrypt3((uint32_t *)tin, ks1, ks2, ks3);
+ DES_decrypt3(tin, ks1, ks2, ks3);
tout0 = tin[0];
tout1 = tin[1];
@@ -736,7 +738,7 @@ void DES_ede3_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
tin[0] = tin0;
tin[1] = tin1;
- DES_decrypt3((uint32_t *)tin, ks1, ks2, ks3);
+ DES_decrypt3(tin, ks1, ks2, ks3);
tout0 = tin[0];
tout1 = tin[1];
diff --git a/crypto/des/internal.h b/crypto/des/internal.h
index 2124fd5..d76f485 100644
--- a/crypto/des/internal.h
+++ b/crypto/des/internal.h
@@ -58,6 +58,7 @@
#define OPENSSL_HEADER_DES_INTERNAL_H
#include <openssl/base.h>
+#include <openssl/des.h>
#include "../internal.h"
@@ -231,6 +232,19 @@ how to use xors :-) I got it to its final state.
#define HALF_ITERATIONS 8
+// Private functions.
+//
+// These functions are only exported for use in |decrepit|.
+
+OPENSSL_EXPORT void DES_decrypt3(uint32_t data[2], const DES_key_schedule *ks1,
+ const DES_key_schedule *ks2,
+ const DES_key_schedule *ks3);
+
+OPENSSL_EXPORT void DES_encrypt3(uint32_t data[2], const DES_key_schedule *ks1,
+ const DES_key_schedule *ks2,
+ const DES_key_schedule *ks3);
+
+
#if defined(__cplusplus)
} // extern C
#endif
diff --git a/include/openssl/des.h b/include/openssl/des.h
index 539b2c5..2a73a41 100644
--- a/include/openssl/des.h
+++ b/include/openssl/des.h
@@ -163,19 +163,6 @@ OPENSSL_EXPORT void DES_ede3_cfb_encrypt(const uint8_t *in, uint8_t *out,
DES_cblock *ivec, int enc);
-// Private functions.
-//
-// These functions are only exported for use in |decrepit|.
-
-OPENSSL_EXPORT void DES_decrypt3(uint32_t *data, const DES_key_schedule *ks1,
- const DES_key_schedule *ks2,
- const DES_key_schedule *ks3);
-
-OPENSSL_EXPORT void DES_encrypt3(uint32_t *data, const DES_key_schedule *ks1,
- const DES_key_schedule *ks2,
- const DES_key_schedule *ks3);
-
-
#if defined(__cplusplus)
} // extern C
#endif