diff options
-rw-r--r-- | src/util/crypto_symmetric.c | 16 | ||||
-rw-r--r-- | src/util/test_crypto_symmetric.c | 9 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c index 3cc546652..97e2a4cfb 100644 --- a/src/util/crypto_symmetric.c +++ b/src/util/crypto_symmetric.c | |||
@@ -121,11 +121,11 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, | |||
121 | * @returns the size of the encrypted block, -1 for errors | 121 | * @returns the size of the encrypted block, -1 for errors |
122 | */ | 122 | */ |
123 | ssize_t | 123 | ssize_t |
124 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, | 124 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, |
125 | const struct GNUNET_CRYPTO_SymmetricSessionKey * | 125 | size_t len, |
126 | sessionkey, | 126 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
127 | const struct GNUNET_CRYPTO_SymmetricInitializationVector * | 127 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
128 | iv, void *result) | 128 | void *result) |
129 | { | 129 | { |
130 | gcry_cipher_hd_t handle; | 130 | gcry_cipher_hd_t handle; |
131 | char tmp[len]; | 131 | char tmp[len]; |
@@ -156,9 +156,9 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, | |||
156 | */ | 156 | */ |
157 | ssize_t | 157 | ssize_t |
158 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, | 158 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, |
159 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, | 159 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
160 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 160 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
161 | void *result) | 161 | void *result) |
162 | { | 162 | { |
163 | gcry_cipher_hd_t handle; | 163 | gcry_cipher_hd_t handle; |
164 | char tmp[size]; | 164 | char tmp[size]; |
diff --git a/src/util/test_crypto_symmetric.c b/src/util/test_crypto_symmetric.c index 90214a4b5..b0321e8ef 100644 --- a/src/util/test_crypto_symmetric.c +++ b/src/util/test_crypto_symmetric.c | |||
@@ -107,9 +107,10 @@ verifyCrypto () | |||
107 | memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH); | 107 | memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH); |
108 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != | 108 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != |
109 | GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, | 109 | GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, |
110 | (const struct | 110 | (const struct |
111 | GNUNET_CRYPTO_SymmetricInitializationVector *) | 111 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
112 | "testtesttesttest", result)) | 112 | "testtesttesttesttesttesttesttest", |
113 | result)) | ||
113 | { | 114 | { |
114 | printf ("Wrong return value from encrypt block.\n"); | 115 | printf ("Wrong return value from encrypt block.\n"); |
115 | ret = 1; | 116 | ret = 1; |
@@ -131,7 +132,7 @@ verifyCrypto () | |||
131 | GNUNET_CRYPTO_symmetric_decrypt (result, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, | 132 | GNUNET_CRYPTO_symmetric_decrypt (result, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, |
132 | (const struct | 133 | (const struct |
133 | GNUNET_CRYPTO_SymmetricInitializationVector *) | 134 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
134 | "testtesttesttest", res)) | 135 | "testtesttesttesttesttesttesttest", res)) |
135 | { | 136 | { |
136 | printf ("Wrong return value from decrypt block.\n"); | 137 | printf ("Wrong return value from decrypt block.\n"); |
137 | ret = 1; | 138 | ret = 1; |