Skip to content

Commit 38baeda

Browse files
committed
Minor comment improvements
1 parent 52c759b commit 38baeda

9 files changed

+15
-21
lines changed

aes_gcm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ to help you with making an AES key generator for your key.
2525
#define TAG_BYTES 16
2626

2727
int main(void)
28-
{
28+
{
2929
mbedtls_ctr_drbg_context ctr_drbg;
3030
mbedtls_entropy_context entropy;
3131
mbedtls_gcm_context gcm;
@@ -156,6 +156,5 @@ int main(void)
156156
// Free the GCM context and underlying cipher sub-context
157157
mbedtls_gcm_free(&gcm);
158158

159-
// TODO: Perform any cleanup of mbed TLS resources necessary
160159
return ret;
161160
}

aes_gcm_cryptography.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
Additional means of verifying integrity such as HMAC are not necessary.
1111
1212
NOTE: There is a better way to do AES-GCM in Cryptography version 2.0 or newer using the AES-GCM construction which is
13-
composed of the AES block cipher utilizing GCM mode. But Debian 9 comes with Cryptograhpy 1.7.
14-
The way presented here is compatible with both versions.
13+
composed of the AES block cipher utilizing GCM mode. This version is intended to be compatible with version 1.7
14+
or newer of the Cryptography module.
1515
"""
1616
import os
1717

aesgcm_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
22
* AES-256 file encryption program using Galois Counter Mode (GCM)
33
*
4-
* It has been greatly simplified in the interests of readability at the cost of not being cross-platform compatible.
4+
* It has been greatly simplified in the interests of readability at the cost of not necessarily being cross-platform
5+
* compatible to ARM platforms. Tis code is intended to work on Windows, macOS, and Linux.
56
*/
67
#if !defined(MBEDTLS_CONFIG_FILE)
78
#include "mbedtls/config.h"
@@ -403,7 +404,6 @@ int main( int argc, char *argv[] )
403404
// Free the GCM context and underlying cipher sub-context
404405
mbedtls_gcm_free(&gcm_ctx);
405406

406-
407407
return( ret );
408408

409409
}

aesgcm_file.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
Additional means of verifying integrity such as HMAC are not necessary.
1111
1212
NOTE: There is a better way to do AES-GCM in Cryptography version 2.0 or newer using the AES-GCM construction which is
13-
composed of the AES block cipher utilizing GCM mode. But Debian 9 comes with Cryptograhpy 1.7.
14-
The way presented here is compatible with both versions.
13+
composed of the AES block cipher utilizing GCM mode. This should be compatible with Cryptograhpy 1.7 or newer.
1514
1615
This is intended to be used in conjunction with teh "aesgcm_file.c" example code for demonstrating interoperability
1716
between Python's Cryptography module and the mbed TLS C library for AES-256 in GCM mode.

ecdh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Curve25519 is very fast, but only uses 256 bits (128 bits of security) even though it is highly respected as being
77
* safe by pretty much everyone. This curve is suitable for an asymmetric ECDH key exchange used to derive a 128-bit
8-
* key for use with a symmetric cipher such as AES-128.Python's Cryptography module doesn't have support for curve25519
8+
* key for use with a symmetric cipher such as AES-128. Python's Cryptography module doesn't have support for curve25519
99
* until version 2.0 and even then it only supports it with a bleeding-edge version of OpenSSL.
1010
*
1111
* Elliptic Curve SECP384R1 is a 384-bit NIST curve over a prime field. This is a curve with intermediate performance
@@ -304,7 +304,7 @@ int main( int argc, char *argv[] )
304304
}
305305
mbedtls_printf( " ok\n" );
306306

307-
// TODO: Use a Key Derivation Function (KDF) to derive a 256-bit AES key from the 521-bit shared secret
307+
// TODO: Use a Key Derivation Function (KDF) to derive a 256-bit AES key and an IV from the 521-bit shared secret
308308

309309

310310
exit:

kdf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* v2.0, also published as Internet Engineering Task Force's RFC 2898. It supercedes PBKDF1, which could only produce
1010
* keys up to 160 bits long.
1111
*
12-
* There are better KDF functions availble which address weaknesses in PBDKF2, but PBKDF2 is widely available in most
12+
* There are better KDF functions available which address weaknesses in PBDKF2, but PBKDF2 is widely available in most
1313
* libraries.
1414
*
1515
* PBKDF2 applies a pseudorandom function, such as a hash-based message authentication code (HMAC), to the input

kdf.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
#!/usr/bin/env python3
22
# coding=utf-8
33
"""
4-
This is a simple example of doing an elliptic curve Diffie-Hellman ECDH) key exchange.
5-
6-
It allows two parties to jointly agree on a shared secret using an insecure channel.
7-
8-
NOTE: Cryptography version 2.0 in combination with very new versions of OpenSSL support a simpler
9-
interface to use Curve25519 via from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
4+
This is a simple Key Derivation Function (KDF) example using Python's cryptography module.
105
"""
116
import sys
127

nacl_symmetric_gen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
* These routines use the XSalsa20 stream cipher for encryption and the Poly1305 MAC for authentication
88
* in pre-packaged set of routines for doing authenticated encryption using symmetric keys.
99
*
10-
* NOTE: This is NOT an AEAD (Authenticated Encryption with Additional Data) mode because the MAC computation
11-
* is done over the encrypted ciphertext and does not include any additional data.
10+
* NOTE: While this is an AE (Authenticated Encryption) mode, this is NOT an AEAD (Authenticated Encryption with
11+
Additional Data) mode because the MAC computation is just done over the encrypted ciphertext and does not include any
12+
additional data.
1213
*
1314
* XSalsa20 is a stream cipher based upon Salsa20 but with a much longer nonce: 192 bits instead of 64 bits.
1415
*

sodium/ed25519_sodium_pynacl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Round trip unit test of using libsodium Ed25519 digital signature code along with PyNacl digital signature code
22
*
3-
* 0) Uses a hard-coded signing key seed generated by PyNacl to reconstruct signaing and verifying keys in libsodium
3+
* 0) Uses a hard-coded signing key seed generated by PyNacl to reconstruct signing and verifying keys in libsodium
44
* 1) Reconstructs the signing and verifying keys from this in libsodium
55
* 2) Signs a test message
66
* 3) Verifies the signature of this test message
@@ -86,4 +86,4 @@ int main(int argc, char *argv[])
8686
}
8787

8888
return ret;
89-
}
89+
}

0 commit comments

Comments
 (0)