This directory contains example programs demonstrating DSMIL OpenSSL features.
make
# Or specify OpenSSL location
make OPENSSL_PREFIX=/opt/openssl-dsmilPurpose: Check for PQC algorithm availability
Files: check-pqc.c
Usage:
./check-pqcOutput:
========================================
DSMIL PQC Algorithm Checker
========================================
ML-KEM (Key Encapsulation):
✓ ML-KEM-512 (KEM)
✓ ML-KEM-768 (KEM)
✓ ML-KEM-1024 (KEM)
ML-DSA (Digital Signatures):
✓ ML-DSA-44 (Signature)
✓ ML-DSA-65 (Signature)
✓ ML-DSA-87 (Signature)
Purpose: TLS client with profile support
Files: dsmil-client.c
Usage:
# With WORLD_COMPAT profile (public internet)
export OPENSSL_CONF=../configs/world.cnf
./dsmil-client google.com 443
# With DSMIL_SECURE profile (internal)
export OPENSSL_CONF=../configs/dsmil-secure.cnf
export THREATCON_LEVEL=NORMAL
./dsmil-client internal-server.local 443
# With ATOMAL profile (maximum security)
export OPENSSL_CONF=../configs/atomal.cnf
export THREATCON_LEVEL=HIGH
./dsmil-client high-security-server.local 443Features:
- Displays security profile in use
- Shows TLS version and cipher
- Detects hybrid vs classical crypto
- Identifies PQC certificates
- Color-coded output
Output:
DSMIL TLS Client Example
Connecting to google.com:443
=== DSMIL Configuration ===
Profile: WORLD_COMPAT
THREATCON: NORMAL
Config: configs/world.cnf
Performing TLS handshake...
✓ TLS handshake successful
=== TLS Connection Info ===
Protocol: TLSv1.3
Cipher: TLS_AES_256_GCM_SHA384
✓ Hybrid/PQC Key Exchange Detected
Server: CN=google.com
✓ Connection closed successfully
Purpose: TLS server example
Status: Planned for Phase 5
Planned features:
- Hybrid crypto server
- Profile enforcement
- Event logging
- Client certificate validation
gcc -o check-pqc check-pqc.c \
-I/opt/openssl-dsmil/include \
-L/opt/openssl-dsmil/lib64 \
-lssl -lcrypto \
-Wl,-rpath,/opt/openssl-dsmil/lib64gcc -o dsmil-client dsmil-client.c \
-I/opt/openssl-dsmil/include \
-L/opt/openssl-dsmil/lib64 \
-lssl -lcrypto \
-Wl,-rpath,/opt/openssl-dsmil/lib64Use case: Public internet, backwards compatible
Config: ../configs/world.cnf
Features:
- TLS 1.3 preferred
- Classical crypto baseline
- Opportunistic PQC
Example:
export OPENSSL_CONF=../configs/world.cnf
./dsmil-client public-website.com 443Use case: Internal services, trusted allies
Config: ../configs/dsmil-secure.cnf
Features:
- TLS 1.3 only
- Hybrid KEX mandatory
- Event telemetry
- THREATCON integration
Example:
export OPENSSL_CONF=../configs/dsmil-secure.cnf
export THREATCON_LEVEL=NORMAL
./dsmil-client internal-api.local 443Use case: Maximum security, classified data
Config: ../configs/atomal.cnf
Features:
- TLS 1.3 strict
- PQC/hybrid only
- ML-KEM-1024 + ML-DSA-87
- Hardware RNG only
- Constant-time enforcement
Example:
export OPENSSL_CONF=../configs/atomal.cnf
export THREATCON_LEVEL=HIGH
./dsmil-client classified-server.local 443Set via environment:
export THREATCON_LEVEL=NORMAL # Standard operation
export THREATCON_LEVEL=ELEVATED # Increased vigilance
export THREATCON_LEVEL=HIGH # High threat
export THREATCON_LEVEL=SEVERE # Maximum securityEffect varies by profile (see config files).
Solution:
# Check OpenSSL installation
ls /opt/openssl-dsmil/include/openssl/ssl.h
# Specify prefix
make OPENSSL_PREFIX=/opt/openssl-dsmilSolution:
# Add to LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/openssl-dsmil/lib64:$LD_LIBRARY_PATH
# Or rebuild with rpath (make does this automatically)
gcc ... -Wl,-rpath,/opt/openssl-dsmil/lib64Possible causes:
-
Profile mismatch
- DSMIL_SECURE/ATOMAL require hybrid crypto
- Server may not support PQC
- Solution: Use WORLD_COMPAT for public servers
-
THREATCON too high
- Higher levels = stricter policy
- Solution: Lower THREATCON or use appropriate profile
-
Certificate issues
- Missing CA certificates
- Solution: Check
/etc/ssl/certs/
SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION);
SSL *ssl = SSL_new(ctx);
SSL_set_fd(ssl, sockfd);
SSL_set_tlsext_host_name(ssl, hostname);
if (SSL_connect(ssl) == 1) {
printf("Connected!\n");
}const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
const char *cipher_name = SSL_CIPHER_get_name(cipher);
if (strstr(cipher_name, "ML-KEM") != NULL) {
printf("Hybrid/PQC key exchange\n");
}X509 *cert = SSL_get_peer_certificate(ssl);
if (cert != NULL) {
char subject[256];
X509_NAME_oneline(X509_get_subject_name(cert),
subject, sizeof(subject));
printf("Server: %s\n", subject);
X509_free(cert);
}| Profile | Handshake Time | Notes |
|---|---|---|
| WORLD (classical) | 1.0x | Baseline |
| WORLD (hybrid) | ~1.2x | ML-KEM-768 |
| DSMIL_SECURE | ~1.3x | Hybrid mandatory |
| ATOMAL | ~2.5x | ML-KEM-1024 + ML-DSA-87 |
- Connection reuse - Amortize handshake cost
- Session resumption - Use TLS 1.3 session tickets
- Hardware crypto - Ensure AES-NI enabled
- Create
example-name.c - Add to
Makefile:EXAMPLES = ... example-name example-name: example-name.c $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBS)
- Update this README
- Follow OpenSSL example style
- Add color output for better UX
- Include error handling
- Document usage in comments
- Documentation Index - Main documentation hub
- OPENSSL_SECURE_SPEC.md - Specification
- docs/TESTING.md - Testing guide
- OpenSSL Manual
DSMIL Security Team • 2025