From 1eeb8a725ec7c49c033c7e6210ecf104f7e4ce16 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Mon, 10 Sep 2018 11:34:31 +0200 Subject: [PATCH] Fix typos --- README.md | 12 ++++++------ src/sample.c | 8 ++++---- tests/dopenssl/bn.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a47fb47..06070c2 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ Examples The following source code can be copied and pasted in a test file, say `test.c`. This sample shows how dOpenSSL can be used to generate cryptographic keys --- -in this case 2048-bit RSA keys --- in a deterministic way i.e based on a given +in this case 2048-bit RSA keys --- in a deterministic way i.e. based on a given passphrase. The program therefore assures that, given the same passphrase, the exact same RSA key will be generated. @@ -179,14 +179,14 @@ int main(int argc, char **argv) char const* passphrase = argv[1]; unsigned int const length = strlen(passphrase); unsigned int const size = bits / 8; - unsigned int const occurences = size / length + 1; + unsigned int const occurrences = size / length + 1; - unsigned char* seed = malloc(occurences * length + 1); - memset(seed, 0x0, occurences * length + 1); + unsigned char* seed = malloc(occurrences * length + 1); + memset(seed, 0x0, occurrences * length + 1); /* Concatenate the passphrase so as to create a 256-byte buffer */ unsigned int i; - for (i = 0; i < occurences; i++) + for (i = 0; i < occurrences; i++) strncpy(seed + (i * length), passphrase, length); /* Initialize the deterministic random generator */ @@ -227,7 +227,7 @@ $> gcc -I $HOME/local/include -L $HOME/local/lib -ldopenssl -lcrypto test.c -o t ``` Note that you may need to add the library directory where OpenSSL has been -installed e.g `/usr/lib/`, `/opt/local/lib/` etc. +installed e.g. `/usr/lib/`, `/opt/local/lib/` etc. ```Shell $> gcc -I $HOME/local/include -L $HOME/local/lib -L /opt/local/lib -ldopenssl -lcrypto test.c -o test diff --git a/src/sample.c b/src/sample.c index f96bfd1..a29000b 100644 --- a/src/sample.c +++ b/src/sample.c @@ -18,14 +18,14 @@ int main(int argc, char **argv) char const* passphrase = argv[1]; unsigned int const length = strlen(passphrase); unsigned int const size = bits / 8; - unsigned int const occurences = size / length + 1; + unsigned int const occurrences = size / length + 1; - unsigned char* seed = malloc(occurences * length + 1); - memset(seed, 0x0, occurences * length + 1); + unsigned char* seed = malloc(occurrences * length + 1); + memset(seed, 0x0, occurrences * length + 1); /* Concatenate the passphrase so as to create a 256-byte buffer */ unsigned int i; - for (i = 0; i < occurences; i++) + for (i = 0; i < occurrences; i++) strncpy(seed + (i * length), passphrase, length); /* Initialize the deterministic random generator */ diff --git a/tests/dopenssl/bn.c b/tests/dopenssl/bn.c index 6bce81e..3ad7d79 100644 --- a/tests/dopenssl/bn.c +++ b/tests/dopenssl/bn.c @@ -30,7 +30,7 @@ test_generate_prime() { DOPENSSL_CHECK(dRAND_init() == 1); - // Undeterministically randomly generate numbers should should therefore + // Undeterministically randomly generate numbers should therefore // all be different, with high probability. { BIGNUM* n1 = BN_new(); @@ -54,7 +54,7 @@ test_generate_prime() BN_clear_free(n1); } - // Generate numbers in a deterministic (but probabilist) way, by resetting the + // Generate numbers in a deterministic (but probabilistic) way, by resetting the // seed for every random generation. // // Since based on the same seed, all the generated numbers should be equal.