From 091e8355b4ac2cdc815b980f2403fd7444f98845 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Fri, 9 Jan 2004 22:47:23 +0100
Subject: [PATCH] Expanded the comment describing the file format.

Rev: src/nettle/ChangeLog:1.220
Rev: src/nettle/examples/rsa-encrypt.c:1.2
---
 ChangeLog              | 11 +++++++++++
 examples/rsa-encrypt.c | 13 ++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd859f9e..9de5550e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-09  Niels Möller  <nisse@harpo.hack.org>
+
+	* examples/rsa-encrypt.c: Expanded the comment describing the file
+	format. 
+
+	* examples/rsa-decrypt.c (process_file): Finished this function.
+	(main): Initialize x. Check the size of the session key after rsa
+	decryption. 
+
+	* examples/io.c (write_string): Treat short item count as an error.
+
 2004-01-08  Niels Möller  <niels@s3.kth.se>
 
 	* index.html: Added instruction for CVS access.
diff --git a/examples/rsa-encrypt.c b/examples/rsa-encrypt.c
index c597f997..0e9ab59c 100644
--- a/examples/rsa-encrypt.c
+++ b/examples/rsa-encrypt.c
@@ -25,12 +25,12 @@
 /* Encryption program using the following file format:
 
      uint32_t version = 1;
-     uint32_t nsize;
-     uint8_t x[nsize];
+     uint32_t xsize;
+     uint8_t x[xsize];
      uint8_t encrypted[n];
      uint8_t hmac[SHA1_DIGEST_SIZE];
 
-   where x is the data
+   "x" is the data
 
      uint32_t version = 1;
      uint8_t aes_key[AES_KEY_SIZE];
@@ -39,6 +39,13 @@
 
    of size (4 + AES_KEY_SIZE + AES_BLOCK_SIZE + SHA1_DIGEST_SIZE) = 72
    bytes, encrypted using rsa-pkcs1.
+
+   "encrypted" is the cleartext processed with aes-cbc. The final block is padded as
+
+     | data | random octets | padding length |
+
+   where the last octet is the padding length, a number between 1 and
+   AES_BLOCK_SIZE (inclusive).
 */
    
 #if HAVE_CONFIG_H
-- 
GitLab