Skip to content

Commit bea98b4

Browse files
committed
Remove Diffie-Hellman examples
These examples rely on the NET module, which we want to remove. In theory we could remove just the dependency, but we decided to remove the whole example because: - They showcase some bad crypto: custom, undocumented protocol (not obviously broken though, apart from authenticating only one side); hard-coded limit of 512-bit size for the DH modulus (2048 is the recommended minimum these days); direct use of the shared secret as a key (instead of applying a KDF); encryption with ECB, custom parameters and the client not having the ability to verify them. - The programs use the DH API in the same way that TLS does, so they have limited demonstration value. - The programs only show finite-field DH, which is not used all that much these days. What people want to see is mostly ECDH.
1 parent a78c958 commit bea98b4

File tree

9 files changed

+2
-1068
lines changed

9 files changed

+2
-1068
lines changed

programs/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ hash/hello
99
hash/md5sum
1010
hash/sha1sum
1111
hash/sha2sum
12-
pkey/dh_client
1312
pkey/dh_genprime
14-
pkey/dh_server
1513
pkey/ecdsa
1614
pkey/ecdh_curve25519
1715
pkey/gen_key

programs/Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ endif
4949

5050
APPS = aes/aescrypt2$(EXEXT) aes/crypt_and_hash$(EXEXT) \
5151
hash/hello$(EXEXT) hash/generic_sum$(EXEXT) \
52-
pkey/dh_client$(EXEXT) \
53-
pkey/dh_genprime$(EXEXT) pkey/dh_server$(EXEXT) \
52+
pkey/dh_genprime$(EXEXT) \
5453
pkey/ecdh_curve25519$(EXEXT) \
5554
pkey/ecdsa$(EXEXT) pkey/gen_key$(EXEXT) \
5655
pkey/key_app$(EXEXT) pkey/key_app_writer$(EXEXT) \
@@ -123,18 +122,10 @@ hash/generic_sum$(EXEXT): hash/generic_sum.c $(DEP)
123122
echo " CC hash/generic_sum.c"
124123
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) hash/generic_sum.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
125124

126-
pkey/dh_client$(EXEXT): pkey/dh_client.c $(DEP)
127-
echo " CC pkey/dh_client.c"
128-
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_client.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
129-
130125
pkey/dh_genprime$(EXEXT): pkey/dh_genprime.c $(DEP)
131126
echo " CC pkey/dh_genprime.c"
132127
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_genprime.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
133128

134-
pkey/dh_server$(EXEXT): pkey/dh_server.c $(DEP)
135-
echo " CC pkey/dh_server.c"
136-
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/dh_server.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
137-
138129
pkey/ecdh_curve25519$(EXEXT): pkey/ecdh_curve25519.c $(DEP)
139130
echo " CC pkey/ecdh_curve25519.c"
140131
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) pkey/ecdh_curve25519.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@

programs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ This subdirectory mostly contains sample programs that illustrate specific featu
4444

4545
### Diffie-Hellman key exchange examples
4646

47-
* [`pkey/dh_client.c`](pkey/dh_client.c), [`pkey/dh_server.c`](pkey/dh_server.c): secure channel demonstrators (client, server). This pair of programs illustrates how to set up a secure channel using RSA for authentication and Diffie-Hellman to generate a shared AES session key.
48-
4947
* [`pkey/ecdh_curve25519.c`](pkey/ecdh_curve25519.c): demonstration of a elliptic curve Diffie-Hellman (ECDH) key agreement.
5048

5149
### Bignum (`mpi`) usage examples

programs/pkey/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
add_executable(dh_client dh_client.c)
2-
target_link_libraries(dh_client mbedtls)
3-
41
add_executable(dh_genprime dh_genprime.c)
52
target_link_libraries(dh_genprime mbedtls)
63

7-
add_executable(dh_server dh_server.c)
8-
target_link_libraries(dh_server mbedtls)
9-
104
add_executable(ecdh_curve25519 ecdh_curve25519.c)
115
target_link_libraries(ecdh_curve25519 mbedtls)
126

@@ -58,6 +52,6 @@ target_link_libraries(pk_encrypt mbedtls)
5852
add_executable(pk_decrypt pk_decrypt.c)
5953
target_link_libraries(pk_decrypt mbedtls)
6054

61-
install(TARGETS dh_client dh_genprime dh_server key_app mpi_demo rsa_genkey rsa_sign rsa_verify rsa_encrypt rsa_decrypt pk_encrypt pk_decrypt pk_sign pk_verify gen_key
55+
install(TARGETS dh_genprime key_app mpi_demo rsa_genkey rsa_sign rsa_verify rsa_encrypt rsa_decrypt pk_encrypt pk_decrypt pk_sign pk_verify gen_key
6256
DESTINATION "bin"
6357
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

programs/pkey/dh_client.c

Lines changed: 0 additions & 325 deletions
This file was deleted.

0 commit comments

Comments
 (0)