diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-30 11:32:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-30 11:32:30 +0000 |
commit | 45b5c1f11144bc14fae34c991ae9db89d6ba8913 (patch) | |
tree | f4a2fbe70573e0d9bb56d4ccb8be29fcf0c50c55 | |
parent | 05ef63d9f8cf65561b7ed2234efdc80e3fb40bd0 (diff) | |
download | gnunet-45b5c1f11144bc14fae34c991ae9db89d6ba8913.tar.gz gnunet-45b5c1f11144bc14fae34c991ae9db89d6ba8913.zip |
-rename files/symbols from _aes to _symmetric
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 42 | ||||
-rw-r--r-- | src/fs/fs_download.c | 18 | ||||
-rw-r--r-- | src/fs/fs_publish_ublock.c | 16 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 6 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_indexing.c | 6 | ||||
-rwxr-xr-x | src/fs/test_gnunet_fs_idx.py.in | 4 | ||||
-rwxr-xr-x | src/fs/test_gnunet_fs_psd.py.in | 6 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 34 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 12 | ||||
-rw-r--r-- | src/namestore/namestore_api_common.c | 20 | ||||
-rw-r--r-- | src/util/Makefile.am | 18 | ||||
-rw-r--r-- | src/util/crypto_hash.c | 14 | ||||
-rw-r--r-- | src/util/crypto_symmetric.c (renamed from src/util/crypto_aes.c) | 34 | ||||
-rw-r--r-- | src/util/perf_crypto_symmetric.c (renamed from src/util/perf_crypto_aes.c) | 12 | ||||
-rw-r--r-- | src/util/test_crypto_hash.c | 4 | ||||
-rw-r--r-- | src/util/test_crypto_symmetric.c (renamed from src/util/test_crypto_aes.c) | 26 |
16 files changed, 136 insertions, 136 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index bf5e9a5fa..675ac83a6 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -311,13 +311,13 @@ struct GSC_KeyExchangeInfo | |||
311 | * Key we use to encrypt our messages for the other peer | 311 | * Key we use to encrypt our messages for the other peer |
312 | * (initialized by us when we do the handshake). | 312 | * (initialized by us when we do the handshake). |
313 | */ | 313 | */ |
314 | struct GNUNET_CRYPTO_AesSessionKey encrypt_key; | 314 | struct GNUNET_CRYPTO_SymmetricSessionKey encrypt_key; |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * Key we use to decrypt messages from the other peer | 317 | * Key we use to decrypt messages from the other peer |
318 | * (given to us by the other peer during the handshake). | 318 | * (given to us by the other peer during the handshake). |
319 | */ | 319 | */ |
320 | struct GNUNET_CRYPTO_AesSessionKey decrypt_key; | 320 | struct GNUNET_CRYPTO_SymmetricSessionKey decrypt_key; |
321 | 321 | ||
322 | /** | 322 | /** |
323 | * At what time did the other peer generate the decryption key? | 323 | * At what time did the other peer generate the decryption key? |
@@ -425,13 +425,13 @@ static GNUNET_SCHEDULER_TaskIdentifier rekey_task; | |||
425 | */ | 425 | */ |
426 | static void | 426 | static void |
427 | derive_auth_key (struct GNUNET_CRYPTO_AuthKey *akey, | 427 | derive_auth_key (struct GNUNET_CRYPTO_AuthKey *akey, |
428 | const struct GNUNET_CRYPTO_AesSessionKey *skey, uint32_t seed) | 428 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, uint32_t seed) |
429 | { | 429 | { |
430 | static const char ctx[] = "authentication key"; | 430 | static const char ctx[] = "authentication key"; |
431 | 431 | ||
432 | GNUNET_CRYPTO_hmac_derive_key (akey, skey, | 432 | GNUNET_CRYPTO_hmac_derive_key (akey, skey, |
433 | &seed, sizeof (seed), | 433 | &seed, sizeof (seed), |
434 | skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 434 | skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
435 | ctx, sizeof (ctx), | 435 | ctx, sizeof (ctx), |
436 | NULL); | 436 | NULL); |
437 | } | 437 | } |
@@ -446,13 +446,13 @@ derive_auth_key (struct GNUNET_CRYPTO_AuthKey *akey, | |||
446 | * @param identity identity of the other peer to use | 446 | * @param identity identity of the other peer to use |
447 | */ | 447 | */ |
448 | static void | 448 | static void |
449 | derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 449 | derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
450 | const struct GNUNET_CRYPTO_AesSessionKey *skey, uint32_t seed, | 450 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, uint32_t seed, |
451 | const struct GNUNET_PeerIdentity *identity) | 451 | const struct GNUNET_PeerIdentity *identity) |
452 | { | 452 | { |
453 | static const char ctx[] = "initialization vector"; | 453 | static const char ctx[] = "initialization vector"; |
454 | 454 | ||
455 | GNUNET_CRYPTO_aes_derive_iv (iv, skey, &seed, sizeof (seed), | 455 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), |
456 | &identity->hashPubKey.bits, | 456 | &identity->hashPubKey.bits, |
457 | sizeof (identity->hashPubKey.bits), ctx, | 457 | sizeof (identity->hashPubKey.bits), ctx, |
458 | sizeof (ctx), NULL); | 458 | sizeof (ctx), NULL); |
@@ -469,13 +469,13 @@ derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | |||
469 | * @param identity identity of the other peer to use | 469 | * @param identity identity of the other peer to use |
470 | */ | 470 | */ |
471 | static void | 471 | static void |
472 | derive_pong_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 472 | derive_pong_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
473 | const struct GNUNET_CRYPTO_AesSessionKey *skey, uint32_t seed, | 473 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, uint32_t seed, |
474 | uint32_t challenge, const struct GNUNET_PeerIdentity *identity) | 474 | uint32_t challenge, const struct GNUNET_PeerIdentity *identity) |
475 | { | 475 | { |
476 | static const char ctx[] = "pong initialization vector"; | 476 | static const char ctx[] = "pong initialization vector"; |
477 | 477 | ||
478 | GNUNET_CRYPTO_aes_derive_iv (iv, skey, &seed, sizeof (seed), | 478 | GNUNET_CRYPTO_symmetric_derive_iv (iv, skey, &seed, sizeof (seed), |
479 | &identity->hashPubKey.bits, | 479 | &identity->hashPubKey.bits, |
480 | sizeof (identity->hashPubKey.bits), &challenge, | 480 | sizeof (identity->hashPubKey.bits), &challenge, |
481 | sizeof (challenge), ctx, sizeof (ctx), NULL); | 481 | sizeof (challenge), ctx, sizeof (ctx), NULL); |
@@ -494,11 +494,11 @@ static void | |||
494 | derive_aes_key (const struct GNUNET_PeerIdentity *sender, | 494 | derive_aes_key (const struct GNUNET_PeerIdentity *sender, |
495 | const struct GNUNET_PeerIdentity *receiver, | 495 | const struct GNUNET_PeerIdentity *receiver, |
496 | const struct GNUNET_HashCode *key_material, | 496 | const struct GNUNET_HashCode *key_material, |
497 | struct GNUNET_CRYPTO_AesSessionKey *skey) | 497 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey) |
498 | { | 498 | { |
499 | static const char ctx[] = "aes key generation vector"; | 499 | static const char ctx[] = "aes key generation vector"; |
500 | 500 | ||
501 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 501 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
502 | ctx, sizeof (ctx), | 502 | ctx, sizeof (ctx), |
503 | key_material, sizeof (struct GNUNET_HashCode), | 503 | key_material, sizeof (struct GNUNET_HashCode), |
504 | sender, sizeof (struct GNUNET_PeerIdentity), | 504 | sender, sizeof (struct GNUNET_PeerIdentity), |
@@ -520,7 +520,7 @@ derive_aes_key (const struct GNUNET_PeerIdentity *sender, | |||
520 | */ | 520 | */ |
521 | static int | 521 | static int |
522 | do_encrypt (struct GSC_KeyExchangeInfo *kx, | 522 | do_encrypt (struct GSC_KeyExchangeInfo *kx, |
523 | const struct GNUNET_CRYPTO_AesInitializationVector *iv, | 523 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
524 | const void *in, void *out, size_t size) | 524 | const void *in, void *out, size_t size) |
525 | { | 525 | { |
526 | if (size != (uint16_t) size) | 526 | if (size != (uint16_t) size) |
@@ -529,7 +529,7 @@ do_encrypt (struct GSC_KeyExchangeInfo *kx, | |||
529 | return GNUNET_NO; | 529 | return GNUNET_NO; |
530 | } | 530 | } |
531 | GNUNET_assert (size == | 531 | GNUNET_assert (size == |
532 | GNUNET_CRYPTO_aes_encrypt (in, (uint16_t) size, | 532 | GNUNET_CRYPTO_symmetric_encrypt (in, (uint16_t) size, |
533 | &kx->encrypt_key, iv, out)); | 533 | &kx->encrypt_key, iv, out)); |
534 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# bytes encrypted"), size, | 534 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# bytes encrypted"), size, |
535 | GNUNET_NO); | 535 | GNUNET_NO); |
@@ -561,7 +561,7 @@ do_encrypt (struct GSC_KeyExchangeInfo *kx, | |||
561 | */ | 561 | */ |
562 | static int | 562 | static int |
563 | do_decrypt (struct GSC_KeyExchangeInfo *kx, | 563 | do_decrypt (struct GSC_KeyExchangeInfo *kx, |
564 | const struct GNUNET_CRYPTO_AesInitializationVector *iv, | 564 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
565 | const void *in, void *out, size_t size) | 565 | const void *in, void *out, size_t size) |
566 | { | 566 | { |
567 | if (size != (uint16_t) size) | 567 | if (size != (uint16_t) size) |
@@ -576,7 +576,7 @@ do_decrypt (struct GSC_KeyExchangeInfo *kx, | |||
576 | return GNUNET_SYSERR; | 576 | return GNUNET_SYSERR; |
577 | } | 577 | } |
578 | if (size != | 578 | if (size != |
579 | GNUNET_CRYPTO_aes_decrypt (in, (uint16_t) size, &kx->decrypt_key, iv, | 579 | GNUNET_CRYPTO_symmetric_decrypt (in, (uint16_t) size, &kx->decrypt_key, iv, |
580 | out)) | 580 | out)) |
581 | { | 581 | { |
582 | GNUNET_break (0); | 582 | GNUNET_break (0); |
@@ -635,7 +635,7 @@ setup_fresh_ping (struct GSC_KeyExchangeInfo *kx) | |||
635 | { | 635 | { |
636 | struct PingMessage pp; | 636 | struct PingMessage pp; |
637 | struct PingMessage *pm; | 637 | struct PingMessage *pm; |
638 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 638 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
639 | 639 | ||
640 | pm = &kx->ping; | 640 | pm = &kx->ping; |
641 | pm->header.size = htons (sizeof (struct PingMessage)); | 641 | pm->header.size = htons (sizeof (struct PingMessage)); |
@@ -911,7 +911,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, | |||
911 | struct PingMessage t; | 911 | struct PingMessage t; |
912 | struct PongMessage tx; | 912 | struct PongMessage tx; |
913 | struct PongMessage tp; | 913 | struct PongMessage tp; |
914 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 914 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
915 | uint16_t msize; | 915 | uint16_t msize; |
916 | 916 | ||
917 | msize = ntohs (msg->size); | 917 | msize = ntohs (msg->size); |
@@ -1056,7 +1056,7 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, | |||
1056 | { | 1056 | { |
1057 | const struct PongMessage *m; | 1057 | const struct PongMessage *m; |
1058 | struct PongMessage t; | 1058 | struct PongMessage t; |
1059 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 1059 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
1060 | uint16_t msize; | 1060 | uint16_t msize; |
1061 | 1061 | ||
1062 | msize = ntohs (msg->size); | 1062 | msize = ntohs (msg->size); |
@@ -1214,7 +1214,7 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | |||
1214 | char cbuf[used]; /* ciphertext */ | 1214 | char cbuf[used]; /* ciphertext */ |
1215 | struct EncryptedMessage *em; /* encrypted message */ | 1215 | struct EncryptedMessage *em; /* encrypted message */ |
1216 | struct EncryptedMessage *ph; /* plaintext header */ | 1216 | struct EncryptedMessage *ph; /* plaintext header */ |
1217 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 1217 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
1218 | struct GNUNET_CRYPTO_AuthKey auth_key; | 1218 | struct GNUNET_CRYPTO_AuthKey auth_key; |
1219 | 1219 | ||
1220 | ph = (struct EncryptedMessage *) pbuf; | 1220 | ph = (struct EncryptedMessage *) pbuf; |
@@ -1281,7 +1281,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1281 | struct GNUNET_HashCode ph; | 1281 | struct GNUNET_HashCode ph; |
1282 | uint32_t snum; | 1282 | uint32_t snum; |
1283 | struct GNUNET_TIME_Absolute t; | 1283 | struct GNUNET_TIME_Absolute t; |
1284 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 1284 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
1285 | struct GNUNET_CRYPTO_AuthKey auth_key; | 1285 | struct GNUNET_CRYPTO_AuthKey auth_key; |
1286 | struct DeliverMessageContext dmc; | 1286 | struct DeliverMessageContext dmc; |
1287 | uint16_t size = ntohs (msg->size); | 1287 | uint16_t size = ntohs (msg->size); |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 2b67dc31e..282198cd3 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -234,12 +234,12 @@ encrypt_existing_match (struct GNUNET_FS_DownloadContext *dc, | |||
234 | { | 234 | { |
235 | struct ProcessResultClosure prc; | 235 | struct ProcessResultClosure prc; |
236 | char enc[len]; | 236 | char enc[len]; |
237 | struct GNUNET_CRYPTO_AesSessionKey sk; | 237 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; |
238 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 238 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
239 | struct GNUNET_HashCode query; | 239 | struct GNUNET_HashCode query; |
240 | 240 | ||
241 | GNUNET_CRYPTO_hash_to_aes_key (&chk->key, &sk, &iv); | 241 | GNUNET_CRYPTO_hash_to_aes_key (&chk->key, &sk, &iv); |
242 | if (-1 == GNUNET_CRYPTO_aes_encrypt (block, len, &sk, &iv, enc)) | 242 | if (-1 == GNUNET_CRYPTO_symmetric_encrypt (block, len, &sk, &iv, enc)) |
243 | { | 243 | { |
244 | GNUNET_break (0); | 244 | GNUNET_break (0); |
245 | return GNUNET_SYSERR; | 245 | return GNUNET_SYSERR; |
@@ -434,8 +434,8 @@ try_match_block (struct GNUNET_FS_DownloadContext *dc, | |||
434 | char enc[DBLOCK_SIZE]; | 434 | char enc[DBLOCK_SIZE]; |
435 | struct ContentHashKey chks[CHK_PER_INODE]; | 435 | struct ContentHashKey chks[CHK_PER_INODE]; |
436 | struct ContentHashKey in_chk; | 436 | struct ContentHashKey in_chk; |
437 | struct GNUNET_CRYPTO_AesSessionKey sk; | 437 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; |
438 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 438 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
439 | size_t dlen; | 439 | size_t dlen; |
440 | struct DownloadRequest *drc; | 440 | struct DownloadRequest *drc; |
441 | struct GNUNET_DISK_FileHandle *fh; | 441 | struct GNUNET_DISK_FileHandle *fh; |
@@ -473,7 +473,7 @@ try_match_block (struct GNUNET_FS_DownloadContext *dc, | |||
473 | } | 473 | } |
474 | GNUNET_CRYPTO_hash (&data[dr->offset], dlen, &in_chk.key); | 474 | GNUNET_CRYPTO_hash (&data[dr->offset], dlen, &in_chk.key); |
475 | GNUNET_CRYPTO_hash_to_aes_key (&in_chk.key, &sk, &iv); | 475 | GNUNET_CRYPTO_hash_to_aes_key (&in_chk.key, &sk, &iv); |
476 | if (-1 == GNUNET_CRYPTO_aes_encrypt (&data[dr->offset], dlen, &sk, &iv, enc)) | 476 | if (-1 == GNUNET_CRYPTO_symmetric_encrypt (&data[dr->offset], dlen, &sk, &iv, enc)) |
477 | { | 477 | { |
478 | GNUNET_break (0); | 478 | GNUNET_break (0); |
479 | return; | 479 | return; |
@@ -945,8 +945,8 @@ process_result_with_request (void *cls, const struct GNUNET_HashCode * key, | |||
945 | struct GNUNET_FS_DownloadContext *dc = prc->dc; | 945 | struct GNUNET_FS_DownloadContext *dc = prc->dc; |
946 | struct DownloadRequest *drc; | 946 | struct DownloadRequest *drc; |
947 | struct GNUNET_DISK_FileHandle *fh = NULL; | 947 | struct GNUNET_DISK_FileHandle *fh = NULL; |
948 | struct GNUNET_CRYPTO_AesSessionKey skey; | 948 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
949 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 949 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
950 | char pt[prc->size]; | 950 | char pt[prc->size]; |
951 | struct GNUNET_FS_ProgressInfo pi; | 951 | struct GNUNET_FS_ProgressInfo pi; |
952 | uint64_t off; | 952 | uint64_t off; |
@@ -991,7 +991,7 @@ process_result_with_request (void *cls, const struct GNUNET_HashCode * key, | |||
991 | } | 991 | } |
992 | 992 | ||
993 | GNUNET_CRYPTO_hash_to_aes_key (&dr->chk.key, &skey, &iv); | 993 | GNUNET_CRYPTO_hash_to_aes_key (&dr->chk.key, &skey, &iv); |
994 | if (-1 == GNUNET_CRYPTO_aes_decrypt (prc->data, prc->size, &skey, &iv, pt)) | 994 | if (-1 == GNUNET_CRYPTO_symmetric_decrypt (prc->data, prc->size, &skey, &iv, pt)) |
995 | { | 995 | { |
996 | GNUNET_break (0); | 996 | GNUNET_break (0); |
997 | dc->emsg = GNUNET_strdup (_("internal error decrypting content")); | 997 | dc->emsg = GNUNET_strdup (_("internal error decrypting content")); |
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index 1c46f0d29..c84b21ba8 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c | |||
@@ -43,8 +43,8 @@ | |||
43 | * @param pub public key to use for key derivation | 43 | * @param pub public key to use for key derivation |
44 | */ | 44 | */ |
45 | static void | 45 | static void |
46 | derive_ublock_encryption_key (struct GNUNET_CRYPTO_AesSessionKey *skey, | 46 | derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
47 | struct GNUNET_CRYPTO_AesInitializationVector *iv, | 47 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
48 | const char *label, | 48 | const char *label, |
49 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) | 49 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) |
50 | { | 50 | { |
@@ -77,12 +77,12 @@ GNUNET_FS_ublock_decrypt_ (const void *input, | |||
77 | const char *label, | 77 | const char *label, |
78 | void *output) | 78 | void *output) |
79 | { | 79 | { |
80 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 80 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
81 | struct GNUNET_CRYPTO_AesSessionKey skey; | 81 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
82 | 82 | ||
83 | derive_ublock_encryption_key (&skey, &iv, | 83 | derive_ublock_encryption_key (&skey, &iv, |
84 | label, ns); | 84 | label, ns); |
85 | GNUNET_CRYPTO_aes_decrypt (input, input_len, | 85 | GNUNET_CRYPTO_symmetric_decrypt (input, input_len, |
86 | &skey, &iv, | 86 | &skey, &iv, |
87 | output); | 87 | output); |
88 | } | 88 | } |
@@ -167,8 +167,8 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, | |||
167 | { | 167 | { |
168 | struct GNUNET_FS_PublishUblockContext *uc; | 168 | struct GNUNET_FS_PublishUblockContext *uc; |
169 | struct GNUNET_HashCode query; | 169 | struct GNUNET_HashCode query; |
170 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 170 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
171 | struct GNUNET_CRYPTO_AesSessionKey skey; | 171 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
172 | struct GNUNET_CRYPTO_EccPrivateKey *nsd; | 172 | struct GNUNET_CRYPTO_EccPrivateKey *nsd; |
173 | struct GNUNET_CRYPTO_EccPublicSignKey pub; | 173 | struct GNUNET_CRYPTO_EccPublicSignKey pub; |
174 | char *uris; | 174 | char *uris; |
@@ -232,7 +232,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, | |||
232 | 232 | ||
233 | /* encrypt ublock */ | 233 | /* encrypt ublock */ |
234 | ub_enc = GNUNET_malloc (size); | 234 | ub_enc = GNUNET_malloc (size); |
235 | GNUNET_CRYPTO_aes_encrypt (&ub_plain[1], | 235 | GNUNET_CRYPTO_symmetric_encrypt (&ub_plain[1], |
236 | ulen + slen + mdsize, | 236 | ulen + slen + mdsize, |
237 | &skey, &iv, | 237 | &skey, &iv, |
238 | &ub_enc[1]); | 238 | &ub_enc[1]); |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index b9dd894f5..4e0ef8c5b 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -336,8 +336,8 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) | |||
336 | uint16_t pt_size; | 336 | uint16_t pt_size; |
337 | char iob[DBLOCK_SIZE]; | 337 | char iob[DBLOCK_SIZE]; |
338 | char enc[DBLOCK_SIZE]; | 338 | char enc[DBLOCK_SIZE]; |
339 | struct GNUNET_CRYPTO_AesSessionKey sk; | 339 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; |
340 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 340 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
341 | unsigned int off; | 341 | unsigned int off; |
342 | 342 | ||
343 | GNUNET_assert (GNUNET_NO == te->in_next); | 343 | GNUNET_assert (GNUNET_NO == te->in_next); |
@@ -383,7 +383,7 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) | |||
383 | mychk = &te->chk_tree[te->current_depth * CHK_PER_INODE + off]; | 383 | mychk = &te->chk_tree[te->current_depth * CHK_PER_INODE + off]; |
384 | GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); | 384 | GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); |
385 | GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); | 385 | GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); |
386 | GNUNET_CRYPTO_aes_encrypt (pt_block, pt_size, &sk, &iv, enc); | 386 | GNUNET_CRYPTO_symmetric_encrypt (pt_block, pt_size, &sk, &iv, enc); |
387 | GNUNET_CRYPTO_hash (enc, pt_size, &mychk->query); | 387 | GNUNET_CRYPTO_hash (enc, pt_size, &mychk->query); |
388 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 388 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
389 | "TE calculates query to be `%s', stored at %u\n", | 389 | "TE calculates query to be `%s', stored at %u\n", |
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index 1baab4c67..c8e9d636e 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c | |||
@@ -508,8 +508,8 @@ GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t s | |||
508 | { | 508 | { |
509 | const struct OnDemandBlock *odb; | 509 | const struct OnDemandBlock *odb; |
510 | struct GNUNET_HashCode nkey; | 510 | struct GNUNET_HashCode nkey; |
511 | struct GNUNET_CRYPTO_AesSessionKey skey; | 511 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
512 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 512 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
513 | struct GNUNET_HashCode query; | 513 | struct GNUNET_HashCode query; |
514 | ssize_t nsize; | 514 | ssize_t nsize; |
515 | char ndata[DBLOCK_SIZE]; | 515 | char ndata[DBLOCK_SIZE]; |
@@ -566,7 +566,7 @@ GNUNET_FS_handle_on_demand_block (const struct GNUNET_HashCode * key, uint32_t s | |||
566 | GNUNET_DISK_file_close (fh); | 566 | GNUNET_DISK_file_close (fh); |
567 | GNUNET_CRYPTO_hash (ndata, nsize, &nkey); | 567 | GNUNET_CRYPTO_hash (ndata, nsize, &nkey); |
568 | GNUNET_CRYPTO_hash_to_aes_key (&nkey, &skey, &iv); | 568 | GNUNET_CRYPTO_hash_to_aes_key (&nkey, &skey, &iv); |
569 | GNUNET_CRYPTO_aes_encrypt (ndata, nsize, &skey, &iv, edata); | 569 | GNUNET_CRYPTO_symmetric_encrypt (ndata, nsize, &skey, &iv, edata); |
570 | GNUNET_CRYPTO_hash (edata, nsize, &query); | 570 | GNUNET_CRYPTO_hash (edata, nsize, &query); |
571 | if (0 != memcmp (&query, key, sizeof (struct GNUNET_HashCode))) | 571 | if (0 != memcmp (&query, key, sizeof (struct GNUNET_HashCode))) |
572 | { | 572 | { |
diff --git a/src/fs/test_gnunet_fs_idx.py.in b/src/fs/test_gnunet_fs_idx.py.in index 0f8343057..a116c4e06 100755 --- a/src/fs/test_gnunet_fs_idx.py.in +++ b/src/fs/test_gnunet_fs_idx.py.in | |||
@@ -54,10 +54,10 @@ try: | |||
54 | pub = pexpect () | 54 | pub = pexpect () |
55 | 55 | ||
56 | pub.spawn (None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 56 | pub.spawn (None, [publish, '-c', 'test_gnunet_fs_idx_data.conf', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
57 | pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.FPEBEAL6HCABM5LMFNNJOPPLKAF5TLUC86A11EIS1HLMIUBP8VEUTU7FT50OLF9ESKP7GTBUE7GDN392J2VKL6JKM1VT1KB4C7Q1U48\.17822'\.\r?\n")) | 57 | pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.49BQ3R5C10JA1695IF71FCQ8VVG4IKIPH04BD9CQ22O6JEK915A7CEPQ17OD0NUQHTR5K4HHEGIKEVPFODB7IAUC0EKIAL2R781E9DG\.17822'\.\r?\n")) |
58 | 58 | ||
59 | down = pexpect () | 59 | down = pexpect () |
60 | down.spawn (None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO.FPEBEAL6HCABM5LMFNNJOPPLKAF5TLUC86A11EIS1HLMIUBP8VEUTU7FT50OLF9ESKP7GTBUE7GDN392J2VKL6JKM1VT1KB4C7Q1U48.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 60 | down.spawn (None, [download, '-c', 'test_gnunet_fs_idx_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO.49BQ3R5C10JA1695IF71FCQ8VVG4IKIPH04BD9CQ22O6JEK915A7CEPQ17OD0NUQHTR5K4HHEGIKEVPFODB7IAUC0EKIAL2R781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
61 | down.expect ("stdout", re.compile (r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) | 61 | down.expect ("stdout", re.compile (r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) |
62 | os.remove ("test_gnunet_fs_rec_data.tar.gz") | 62 | os.remove ("test_gnunet_fs_rec_data.tar.gz") |
63 | 63 | ||
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in index ab23da42a..513582f33 100755 --- a/src/fs/test_gnunet_fs_psd.py.in +++ b/src/fs/test_gnunet_fs_psd.py.in | |||
@@ -57,16 +57,16 @@ try: | |||
57 | pub = pexpect () | 57 | pub = pexpect () |
58 | pub.spawn (None, [publish, '-c', 'test_gnunet_fs_psd_data.conf', '-n', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 58 | pub.spawn (None, [publish, '-c', 'test_gnunet_fs_psd_data.conf', '-n', '-m', "description:Test archive", '-k', 'tst', 'test_gnunet_fs_rec_data.tgz'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
59 | pub.expect ("stdout", re.compile (r"Publishing `.+test_gnunet_fs_rec_data.tgz' done\.\r?\n")) | 59 | pub.expect ("stdout", re.compile (r"Publishing `.+test_gnunet_fs_rec_data.tgz' done\.\r?\n")) |
60 | pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.FPEBEAL6HCABM5LMFNNJOPPLKAF5TLUC86A11EIS1HLMIUBP8VEUTU7FT50OLF9ESKP7GTBUE7GDN392J2VKL6JKM1VT1KB4C7Q1U48\.17822'\.\r?\n")) | 60 | pub.expect ("stdout", re.compile (r"URI is `gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.49BQ3R5C10JA1695IF71FCQ8VVG4IKIPH04BD9CQ22O6JEK915A7CEPQ17OD0NUQHTR5K4HHEGIKEVPFODB7IAUC0EKIAL2R781E9DG\.17822'\.\r?\n")) |
61 | 61 | ||
62 | s = pexpect () | 62 | s = pexpect () |
63 | s.spawn (None, [search, '-V', '-t', '1000 ms', '-N', '1', '-c', 'test_gnunet_fs_psd_data.conf', 'tst'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 63 | s.spawn (None, [search, '-V', '-t', '1000 ms', '-N', '1', '-c', 'test_gnunet_fs_psd_data.conf', 'tst'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
64 | s.expect ("stdout", re.compile (r'#0:\r?\n')) | 64 | s.expect ("stdout", re.compile (r'#0:\r?\n')) |
65 | s.expect ("stdout", re.compile (r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.FPEBEAL6HCABM5LMFNNJOPPLKAF5TLUC86A11EIS1HLMIUBP8VEUTU7FT50OLF9ESKP7GTBUE7GDN392J2VKL6JKM1VT1KB4C7Q1U48\.17822\r?\n')) | 65 | s.expect ("stdout", re.compile (r'gnunet-download -o "test_gnunet_fs_rec_data.tgz" gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO\.49BQ3R5C10JA1695IF71FCQ8VVG4IKIPH04BD9CQ22O6JEK915A7CEPQ17OD0NUQHTR5K4HHEGIKEVPFODB7IAUC0EKIAL2R781E9DG\.17822\r?\n')) |
66 | s.expect ("stdout", re.compile (r"\s*description: Test archive\r?\n")) | 66 | s.expect ("stdout", re.compile (r"\s*description: Test archive\r?\n")) |
67 | 67 | ||
68 | down = pexpect () | 68 | down = pexpect () |
69 | down.spawn (None, [download, '-c', 'test_gnunet_fs_psd_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO.FPEBEAL6HCABM5LMFNNJOPPLKAF5TLUC86A11EIS1HLMIUBP8VEUTU7FT50OLF9ESKP7GTBUE7GDN392J2VKL6JKM1VT1KB4C7Q1U48.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 69 | down.spawn (None, [download, '-c', 'test_gnunet_fs_psd_data.conf', '-o', 'test_gnunet_fs_rec_data.tar.gz', 'gnunet://fs/chk/2VKHJMR74CB6GB1GFJNOO95BTINA2PEO25FL48GAS7SPBMA0GDEK5U74R1VIHK0LA6919QRS376BHQFDOE3OUP0JOU92K1NIRJMHFCO.49BQ3R5C10JA1695IF71FCQ8VVG4IKIPH04BD9CQ22O6JEK915A7CEPQ17OD0NUQHTR5K4HHEGIKEVPFODB7IAUC0EKIAL2R781E9DG.17822'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
70 | down.expect ("stdout", re.compile (r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) | 70 | down.expect ("stdout", re.compile (r"Downloading `test_gnunet_fs_rec_data.tar.gz' done (.*).\r?\n")) |
71 | os.remove ("test_gnunet_fs_rec_data.tar.gz") | 71 | os.remove ("test_gnunet_fs_rec_data.tar.gz") |
72 | 72 | ||
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index b8e38a2a2..1d000c29a 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -209,7 +209,7 @@ struct GNUNET_CRYPTO_EccPrivateKey | |||
209 | /** | 209 | /** |
210 | * @brief type for session keys | 210 | * @brief type for session keys |
211 | */ | 211 | */ |
212 | struct GNUNET_CRYPTO_AesSessionKey | 212 | struct GNUNET_CRYPTO_SymmetricSessionKey |
213 | { | 213 | { |
214 | /** | 214 | /** |
215 | * Actual key for AES. | 215 | * Actual key for AES. |
@@ -231,7 +231,7 @@ GNUNET_NETWORK_STRUCT_END | |||
231 | * NOTE: must be smaller (!) in size than the | 231 | * NOTE: must be smaller (!) in size than the |
232 | * `struct GNUNET_HashCode`. | 232 | * `struct GNUNET_HashCode`. |
233 | */ | 233 | */ |
234 | struct GNUNET_CRYPTO_AesInitializationVector | 234 | struct GNUNET_CRYPTO_SymmetricInitializationVector |
235 | { | 235 | { |
236 | unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; | 236 | unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; |
237 | 237 | ||
@@ -352,7 +352,7 @@ GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n); | |||
352 | * @param key key to initialize | 352 | * @param key key to initialize |
353 | */ | 353 | */ |
354 | void | 354 | void |
355 | GNUNET_CRYPTO_aes_create_session_key (struct GNUNET_CRYPTO_AesSessionKey *key); | 355 | GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
356 | 356 | ||
357 | 357 | ||
358 | /** | 358 | /** |
@@ -367,9 +367,9 @@ GNUNET_CRYPTO_aes_create_session_key (struct GNUNET_CRYPTO_AesSessionKey *key); | |||
367 | * @return the size of the encrypted block, -1 for errors | 367 | * @return the size of the encrypted block, -1 for errors |
368 | */ | 368 | */ |
369 | ssize_t | 369 | ssize_t |
370 | GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len, | 370 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, |
371 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 371 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
372 | const struct GNUNET_CRYPTO_AesInitializationVector | 372 | const struct GNUNET_CRYPTO_SymmetricInitializationVector |
373 | *iv, void *result); | 373 | *iv, void *result); |
374 | 374 | ||
375 | 375 | ||
@@ -385,9 +385,9 @@ GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len, | |||
385 | * @return -1 on failure, size of decrypted block on success | 385 | * @return -1 on failure, size of decrypted block on success |
386 | */ | 386 | */ |
387 | ssize_t | 387 | ssize_t |
388 | GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size, | 388 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, |
389 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 389 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
390 | const struct GNUNET_CRYPTO_AesInitializationVector | 390 | const struct GNUNET_CRYPTO_SymmetricInitializationVector |
391 | *iv, void *result); | 391 | *iv, void *result); |
392 | 392 | ||
393 | 393 | ||
@@ -401,8 +401,8 @@ GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size, | |||
401 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL | 401 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL |
402 | */ | 402 | */ |
403 | void | 403 | void |
404 | GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 404 | GNUNET_CRYPTO_symmetric_derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
405 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 405 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
406 | const void *salt, size_t salt_len, ...); | 406 | const void *salt, size_t salt_len, ...); |
407 | 407 | ||
408 | 408 | ||
@@ -415,8 +415,8 @@ GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | |||
415 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL | 415 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL |
416 | */ | 416 | */ |
417 | void | 417 | void |
418 | GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 418 | GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
419 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 419 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
420 | const void *salt, size_t salt_len, va_list argp); | 420 | const void *salt, size_t salt_len, va_list argp); |
421 | 421 | ||
422 | 422 | ||
@@ -610,8 +610,8 @@ GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_Ha | |||
610 | */ | 610 | */ |
611 | void | 611 | void |
612 | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc, | 612 | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc, |
613 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 613 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
614 | struct GNUNET_CRYPTO_AesInitializationVector | 614 | struct GNUNET_CRYPTO_SymmetricInitializationVector |
615 | *iv); | 615 | *iv); |
616 | 616 | ||
617 | 617 | ||
@@ -685,7 +685,7 @@ GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode * h1, | |||
685 | */ | 685 | */ |
686 | void | 686 | void |
687 | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, | 687 | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, |
688 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 688 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
689 | const void *salt, size_t salt_len, | 689 | const void *salt, size_t salt_len, |
690 | va_list argp); | 690 | va_list argp); |
691 | 691 | ||
@@ -701,7 +701,7 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, | |||
701 | */ | 701 | */ |
702 | void | 702 | void |
703 | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, | 703 | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, |
704 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 704 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
705 | const void *salt, size_t salt_len, ...); | 705 | const void *salt, size_t salt_len, ...); |
706 | 706 | ||
707 | 707 | ||
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index e682f5b60..323da4cb6 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -685,12 +685,12 @@ struct MeshTunnel2 | |||
685 | /** | 685 | /** |
686 | * Encryption ("our") key. | 686 | * Encryption ("our") key. |
687 | */ | 687 | */ |
688 | struct GNUNET_CRYPTO_AesSessionKey e_key; | 688 | struct GNUNET_CRYPTO_SymmetricSessionKey e_key; |
689 | 689 | ||
690 | /** | 690 | /** |
691 | * Decryption ("their") key. | 691 | * Decryption ("their") key. |
692 | */ | 692 | */ |
693 | struct GNUNET_CRYPTO_AesSessionKey d_key; | 693 | struct GNUNET_CRYPTO_SymmetricSessionKey d_key; |
694 | 694 | ||
695 | /** | 695 | /** |
696 | * Paths that are actively used to reach the destination peer. | 696 | * Paths that are actively used to reach the destination peer. |
@@ -4221,15 +4221,15 @@ tunnel_new (void) | |||
4221 | // } | 4221 | // } |
4222 | 4222 | ||
4223 | // char salt[] = "salt"; | 4223 | // char salt[] = "salt"; |
4224 | // GNUNET_CRYPTO_kdf (&t->e_key, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 4224 | // GNUNET_CRYPTO_kdf (&t->e_key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
4225 | // salt, sizeof (salt), | 4225 | // salt, sizeof (salt), |
4226 | // &t->e_key, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 4226 | // &t->e_key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
4227 | // &my_full_id, sizeof (struct GNUNET_PeerIdentity), | 4227 | // &my_full_id, sizeof (struct GNUNET_PeerIdentity), |
4228 | // GNUNET_PEER_resolve2 (t->peer->id), sizeof (struct GNUNET_PeerIdentity), | 4228 | // GNUNET_PEER_resolve2 (t->peer->id), sizeof (struct GNUNET_PeerIdentity), |
4229 | // NULL); | 4229 | // NULL); |
4230 | // GNUNET_CRYPTO_kdf (&t->d_key, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 4230 | // GNUNET_CRYPTO_kdf (&t->d_key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
4231 | // salt, sizeof (salt), | 4231 | // salt, sizeof (salt), |
4232 | // &t->d_key, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 4232 | // &t->d_key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
4233 | // GNUNET_PEER_resolve2 (t->peer->id), sizeof (struct GNUNET_PeerIdentity), | 4233 | // GNUNET_PEER_resolve2 (t->peer->id), sizeof (struct GNUNET_PeerIdentity), |
4234 | // &my_full_id, sizeof (struct GNUNET_PeerIdentity), | 4234 | // &my_full_id, sizeof (struct GNUNET_PeerIdentity), |
4235 | // NULL); | 4235 | // NULL); |
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 55c9055ff..d54dc3e7f 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -321,20 +321,20 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, | |||
321 | * @param pub public key to use for KDF | 321 | * @param pub public key to use for KDF |
322 | */ | 322 | */ |
323 | static void | 323 | static void |
324 | derive_block_aes_key (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 324 | derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
325 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 325 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
326 | const char *label, | 326 | const char *label, |
327 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) | 327 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) |
328 | { | 328 | { |
329 | static const char ctx_key[] = "gns-aes-ctx-key"; | 329 | static const char ctx_key[] = "gns-aes-ctx-key"; |
330 | static const char ctx_iv[] = "gns-aes-ctx-iv"; | 330 | static const char ctx_iv[] = "gns-aes-ctx-iv"; |
331 | 331 | ||
332 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 332 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
333 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 333 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
334 | label, strlen (label), | 334 | label, strlen (label), |
335 | ctx_key, strlen (ctx_key), | 335 | ctx_key, strlen (ctx_key), |
336 | NULL, 0); | 336 | NULL, 0); |
337 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector), | 337 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), |
338 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 338 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
339 | label, strlen (label), | 339 | label, strlen (label), |
340 | ctx_iv, strlen (ctx_iv), | 340 | ctx_iv, strlen (ctx_iv), |
@@ -364,8 +364,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
364 | struct GNUNET_NAMESTORE_Block *block; | 364 | struct GNUNET_NAMESTORE_Block *block; |
365 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; | 365 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
366 | struct GNUNET_CRYPTO_EccPrivateKey *dkey; | 366 | struct GNUNET_CRYPTO_EccPrivateKey *dkey; |
367 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 367 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
368 | struct GNUNET_CRYPTO_AesSessionKey skey; | 368 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
369 | uint32_t rd_count_nbo; | 369 | uint32_t rd_count_nbo; |
370 | 370 | ||
371 | if (payload_len > GNUNET_NAMESTORE_MAX_VALUE_SIZE) | 371 | if (payload_len > GNUNET_NAMESTORE_MAX_VALUE_SIZE) |
@@ -391,7 +391,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
391 | &pkey); | 391 | &pkey); |
392 | derive_block_aes_key (&iv, &skey, label, &pkey); | 392 | derive_block_aes_key (&iv, &skey, label, &pkey); |
393 | GNUNET_break (payload_len + sizeof (uint32_t) == | 393 | GNUNET_break (payload_len + sizeof (uint32_t) == |
394 | GNUNET_CRYPTO_aes_encrypt (payload, payload_len + sizeof (uint32_t), | 394 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len + sizeof (uint32_t), |
395 | &skey, &iv, | 395 | &skey, &iv, |
396 | &block[1])); | 396 | &block[1])); |
397 | if (GNUNET_OK != | 397 | if (GNUNET_OK != |
@@ -447,8 +447,8 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, | |||
447 | size_t payload_len = ntohl (block->purpose.size) - | 447 | size_t payload_len = ntohl (block->purpose.size) - |
448 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) - | 448 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) - |
449 | sizeof (struct GNUNET_TIME_AbsoluteNBO); | 449 | sizeof (struct GNUNET_TIME_AbsoluteNBO); |
450 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 450 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
451 | struct GNUNET_CRYPTO_AesSessionKey skey; | 451 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
452 | 452 | ||
453 | if (ntohl (block->purpose.size) < | 453 | if (ntohl (block->purpose.size) < |
454 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 454 | sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
@@ -463,7 +463,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, | |||
463 | uint32_t rd_count; | 463 | uint32_t rd_count; |
464 | 464 | ||
465 | GNUNET_break (payload_len == | 465 | GNUNET_break (payload_len == |
466 | GNUNET_CRYPTO_aes_decrypt (&block[1], payload_len, | 466 | GNUNET_CRYPTO_symmetric_decrypt (&block[1], payload_len, |
467 | &skey, &iv, | 467 | &skey, &iv, |
468 | payload)); | 468 | payload)); |
469 | memcpy (&rd_count, | 469 | memcpy (&rd_count, |
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 6c1d8d785..934385663 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -75,7 +75,7 @@ libgnunetutil_la_SOURCES = \ | |||
75 | container_multihashmap.c \ | 75 | container_multihashmap.c \ |
76 | container_multihashmap32.c \ | 76 | container_multihashmap32.c \ |
77 | container_slist.c \ | 77 | container_slist.c \ |
78 | crypto_aes.c \ | 78 | crypto_symmetric.c \ |
79 | crypto_crc.c \ | 79 | crypto_crc.c \ |
80 | crypto_ecc.c \ | 80 | crypto_ecc.c \ |
81 | crypto_hash.c \ | 81 | crypto_hash.c \ |
@@ -189,7 +189,7 @@ libgnunet_plugin_test_la_LDFLAGS = \ | |||
189 | if HAVE_BENCHMARKS | 189 | if HAVE_BENCHMARKS |
190 | BENCHMARKS = \ | 190 | BENCHMARKS = \ |
191 | perf_crypto_hash \ | 191 | perf_crypto_hash \ |
192 | perf_crypto_aes \ | 192 | perf_crypto_symmetric \ |
193 | perf_malloc | 193 | perf_malloc |
194 | endif | 194 | endif |
195 | 195 | ||
@@ -206,7 +206,7 @@ check_PROGRAMS = \ | |||
206 | test_container_multihashmap32 \ | 206 | test_container_multihashmap32 \ |
207 | test_container_heap \ | 207 | test_container_heap \ |
208 | test_container_slist \ | 208 | test_container_slist \ |
209 | test_crypto_aes \ | 209 | test_crypto_symmetric \ |
210 | test_crypto_crc \ | 210 | test_crypto_crc \ |
211 | test_crypto_ecc \ | 211 | test_crypto_ecc \ |
212 | test_crypto_hash \ | 212 | test_crypto_hash \ |
@@ -320,9 +320,9 @@ test_container_slist_SOURCES = \ | |||
320 | test_container_slist_LDADD = \ | 320 | test_container_slist_LDADD = \ |
321 | $(top_builddir)/src/util/libgnunetutil.la | 321 | $(top_builddir)/src/util/libgnunetutil.la |
322 | 322 | ||
323 | test_crypto_aes_SOURCES = \ | 323 | test_crypto_symmetric_SOURCES = \ |
324 | test_crypto_aes.c | 324 | test_crypto_symmetric.c |
325 | test_crypto_aes_LDADD = \ | 325 | test_crypto_symmetric_LDADD = \ |
326 | $(top_builddir)/src/util/libgnunetutil.la | 326 | $(top_builddir)/src/util/libgnunetutil.la |
327 | 327 | ||
328 | test_crypto_crc_SOURCES = \ | 328 | test_crypto_crc_SOURCES = \ |
@@ -494,9 +494,9 @@ perf_crypto_hash_SOURCES = \ | |||
494 | perf_crypto_hash_LDADD = \ | 494 | perf_crypto_hash_LDADD = \ |
495 | $(top_builddir)/src/util/libgnunetutil.la | 495 | $(top_builddir)/src/util/libgnunetutil.la |
496 | 496 | ||
497 | perf_crypto_aes_SOURCES = \ | 497 | perf_crypto_symmetric_SOURCES = \ |
498 | perf_crypto_aes.c | 498 | perf_crypto_symmetric.c |
499 | perf_crypto_aes_LDADD = \ | 499 | perf_crypto_symmetric_LDADD = \ |
500 | $(top_builddir)/src/util/libgnunetutil.la | 500 | $(top_builddir)/src/util/libgnunetutil.la |
501 | 501 | ||
502 | perf_malloc_SOURCES = \ | 502 | perf_malloc_SOURCES = \ |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 47baf660f..e1997c3bb 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -395,16 +395,16 @@ GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_Ha | |||
395 | */ | 395 | */ |
396 | void | 396 | void |
397 | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc, | 397 | GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc, |
398 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 398 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
399 | struct GNUNET_CRYPTO_AesInitializationVector *iv) | 399 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) |
400 | { | 400 | { |
401 | GNUNET_assert (GNUNET_YES == | 401 | GNUNET_assert (GNUNET_YES == |
402 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 402 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
403 | "Hash key derivation", strlen ("Hash key derivation"), | 403 | "Hash key derivation", strlen ("Hash key derivation"), |
404 | hc, sizeof (struct GNUNET_HashCode), | 404 | hc, sizeof (struct GNUNET_HashCode), |
405 | NULL, 0)); | 405 | NULL, 0)); |
406 | GNUNET_assert (GNUNET_YES == | 406 | GNUNET_assert (GNUNET_YES == |
407 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector), | 407 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), |
408 | "Initialization vector derivation", strlen ("Initialization vector derivation"), | 408 | "Initialization vector derivation", strlen ("Initialization vector derivation"), |
409 | hc, sizeof (struct GNUNET_HashCode), | 409 | hc, sizeof (struct GNUNET_HashCode), |
410 | NULL, 0)); | 410 | NULL, 0)); |
@@ -521,7 +521,7 @@ GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode *h1, | |||
521 | */ | 521 | */ |
522 | void | 522 | void |
523 | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, | 523 | GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, |
524 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 524 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
525 | const void *salt, size_t salt_len, ...) | 525 | const void *salt, size_t salt_len, ...) |
526 | { | 526 | { |
527 | va_list argp; | 527 | va_list argp; |
@@ -542,13 +542,13 @@ GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, | |||
542 | */ | 542 | */ |
543 | void | 543 | void |
544 | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, | 544 | GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, |
545 | const struct GNUNET_CRYPTO_AesSessionKey *rkey, | 545 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
546 | const void *salt, size_t salt_len, | 546 | const void *salt, size_t salt_len, |
547 | va_list argp) | 547 | va_list argp) |
548 | { | 548 | { |
549 | GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), | 549 | GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), |
550 | salt, salt_len, | 550 | salt, salt_len, |
551 | rkey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 551 | rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
552 | argp); | 552 | argp); |
553 | } | 553 | } |
554 | 554 | ||
diff --git a/src/util/crypto_aes.c b/src/util/crypto_symmetric.c index 91c578ab8..3e4f9d748 100644 --- a/src/util/crypto_aes.c +++ b/src/util/crypto_symmetric.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file util/crypto_aes.c | 22 | * @file util/crypto_symmetric.c |
23 | * @brief Symmetric encryption services; combined cipher AES+TWOFISH (256-bit each) | 23 | * @brief Symmetric encryption services; combined cipher AES+TWOFISH (256-bit each) |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Ioana Patrascu | 25 | * @author Ioana Patrascu |
@@ -38,7 +38,7 @@ | |||
38 | * @param key session key to initialize | 38 | * @param key session key to initialize |
39 | */ | 39 | */ |
40 | void | 40 | void |
41 | GNUNET_CRYPTO_aes_create_session_key (struct GNUNET_CRYPTO_AesSessionKey *key) | 41 | GNUNET_CRYPTO_symmetric_create_session_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key) |
42 | { | 42 | { |
43 | gcry_randomize (key->aes_key, | 43 | gcry_randomize (key->aes_key, |
44 | GNUNET_CRYPTO_AES_KEY_LENGTH, | 44 | GNUNET_CRYPTO_AES_KEY_LENGTH, |
@@ -59,8 +59,8 @@ GNUNET_CRYPTO_aes_create_session_key (struct GNUNET_CRYPTO_AesSessionKey *key) | |||
59 | */ | 59 | */ |
60 | static int | 60 | static int |
61 | setup_cipher_aes (gcry_cipher_hd_t *handle, | 61 | setup_cipher_aes (gcry_cipher_hd_t *handle, |
62 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 62 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
63 | const struct GNUNET_CRYPTO_AesInitializationVector *iv) | 63 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) |
64 | { | 64 | { |
65 | int rc; | 65 | int rc; |
66 | 66 | ||
@@ -89,8 +89,8 @@ setup_cipher_aes (gcry_cipher_hd_t *handle, | |||
89 | */ | 89 | */ |
90 | static int | 90 | static int |
91 | setup_cipher_twofish (gcry_cipher_hd_t *handle, | 91 | setup_cipher_twofish (gcry_cipher_hd_t *handle, |
92 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 92 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
93 | const struct GNUNET_CRYPTO_AesInitializationVector *iv) | 93 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) |
94 | { | 94 | { |
95 | int rc; | 95 | int rc; |
96 | 96 | ||
@@ -122,10 +122,10 @@ setup_cipher_twofish (gcry_cipher_hd_t *handle, | |||
122 | * @returns the size of the encrypted block, -1 for errors | 122 | * @returns the size of the encrypted block, -1 for errors |
123 | */ | 123 | */ |
124 | ssize_t | 124 | ssize_t |
125 | GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len, | 125 | GNUNET_CRYPTO_symmetric_encrypt (const void *block, size_t len, |
126 | const struct GNUNET_CRYPTO_AesSessionKey * | 126 | const struct GNUNET_CRYPTO_SymmetricSessionKey * |
127 | sessionkey, | 127 | sessionkey, |
128 | const struct GNUNET_CRYPTO_AesInitializationVector * | 128 | const struct GNUNET_CRYPTO_SymmetricInitializationVector * |
129 | iv, void *result) | 129 | iv, void *result) |
130 | { | 130 | { |
131 | gcry_cipher_hd_t handle; | 131 | gcry_cipher_hd_t handle; |
@@ -156,9 +156,9 @@ GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len, | |||
156 | * @return -1 on failure, size of decrypted block on success | 156 | * @return -1 on failure, size of decrypted block on success |
157 | */ | 157 | */ |
158 | ssize_t | 158 | ssize_t |
159 | GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size, | 159 | GNUNET_CRYPTO_symmetric_decrypt (const void *block, size_t size, |
160 | const struct GNUNET_CRYPTO_AesSessionKey *sessionkey, | 160 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
161 | const struct GNUNET_CRYPTO_AesInitializationVector *iv, | 161 | const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
162 | void *result) | 162 | void *result) |
163 | { | 163 | { |
164 | gcry_cipher_hd_t handle; | 164 | gcry_cipher_hd_t handle; |
@@ -187,14 +187,14 @@ GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size, | |||
187 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL | 187 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL |
188 | */ | 188 | */ |
189 | void | 189 | void |
190 | GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 190 | GNUNET_CRYPTO_symmetric_derive_iv (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
191 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 191 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
192 | const void *salt, size_t salt_len, ...) | 192 | const void *salt, size_t salt_len, ...) |
193 | { | 193 | { |
194 | va_list argp; | 194 | va_list argp; |
195 | 195 | ||
196 | va_start (argp, salt_len); | 196 | va_start (argp, salt_len); |
197 | GNUNET_CRYPTO_aes_derive_iv_v (iv, skey, salt, salt_len, argp); | 197 | GNUNET_CRYPTO_symmetric_derive_iv_v (iv, skey, salt, salt_len, argp); |
198 | va_end (argp); | 198 | va_end (argp); |
199 | } | 199 | } |
200 | 200 | ||
@@ -209,8 +209,8 @@ GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, | |||
209 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL | 209 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL |
210 | */ | 210 | */ |
211 | void | 211 | void |
212 | GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 212 | GNUNET_CRYPTO_symmetric_derive_iv_v (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
213 | const struct GNUNET_CRYPTO_AesSessionKey *skey, | 213 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
214 | const void *salt, size_t salt_len, va_list argp) | 214 | const void *salt, size_t salt_len, va_list argp) |
215 | { | 215 | { |
216 | char aes_salt[salt_len + 4]; | 216 | char aes_salt[salt_len + 4]; |
diff --git a/src/util/perf_crypto_aes.c b/src/util/perf_crypto_symmetric.c index f02335afe..9f4e2a938 100644 --- a/src/util/perf_crypto_aes.c +++ b/src/util/perf_crypto_symmetric.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | * @file util/perf_crypto_aes.c | 23 | * @file util/perf_crypto_symmetric.c |
24 | * @brief measure performance of encryption function | 24 | * @brief measure performance of encryption function |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
@@ -35,19 +35,19 @@ perfEncrypt () | |||
35 | unsigned int i; | 35 | unsigned int i; |
36 | char buf[64 * 1024]; | 36 | char buf[64 * 1024]; |
37 | char rbuf[64 * 1024]; | 37 | char rbuf[64 * 1024]; |
38 | struct GNUNET_CRYPTO_AesSessionKey sk; | 38 | struct GNUNET_CRYPTO_SymmetricSessionKey sk; |
39 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 39 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
40 | 40 | ||
41 | GNUNET_CRYPTO_aes_create_session_key (&sk); | 41 | GNUNET_CRYPTO_symmetric_create_session_key (&sk); |
42 | 42 | ||
43 | memset (buf, 1, sizeof (buf)); | 43 | memset (buf, 1, sizeof (buf)); |
44 | for (i = 0; i < 1024; i++) | 44 | for (i = 0; i < 1024; i++) |
45 | { | 45 | { |
46 | memset (&iv, (int8_t) i, sizeof (iv)); | 46 | memset (&iv, (int8_t) i, sizeof (iv)); |
47 | GNUNET_CRYPTO_aes_encrypt (buf, sizeof (buf), | 47 | GNUNET_CRYPTO_symmetric_encrypt (buf, sizeof (buf), |
48 | &sk, &iv, | 48 | &sk, &iv, |
49 | rbuf); | 49 | rbuf); |
50 | GNUNET_CRYPTO_aes_decrypt (rbuf, sizeof (buf), | 50 | GNUNET_CRYPTO_symmetric_decrypt (rbuf, sizeof (buf), |
51 | &sk, &iv, | 51 | &sk, &iv, |
52 | buf); | 52 | buf); |
53 | } | 53 | } |
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c index 2a5d6d773..9e10702ce 100644 --- a/src/util/test_crypto_hash.c +++ b/src/util/test_crypto_hash.c | |||
@@ -69,8 +69,8 @@ testArithmetic () | |||
69 | struct GNUNET_HashCode h2; | 69 | struct GNUNET_HashCode h2; |
70 | struct GNUNET_HashCode d; | 70 | struct GNUNET_HashCode d; |
71 | struct GNUNET_HashCode s; | 71 | struct GNUNET_HashCode s; |
72 | struct GNUNET_CRYPTO_AesSessionKey skey; | 72 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
73 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 73 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
74 | 74 | ||
75 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h1); | 75 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h1); |
76 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h2); | 76 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h2); |
diff --git a/src/util/test_crypto_aes.c b/src/util/test_crypto_symmetric.c index a5d49063a..b350e9efe 100644 --- a/src/util/test_crypto_aes.c +++ b/src/util/test_crypto_symmetric.c | |||
@@ -20,7 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | * @file util/test_crypto_aes.c | 23 | * @file util/test_crypto_symmetric.c |
24 | * @brief test for AES ciphers | 24 | * @brief test for AES ciphers |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
@@ -33,16 +33,16 @@ | |||
33 | static int | 33 | static int |
34 | testSymcipher () | 34 | testSymcipher () |
35 | { | 35 | { |
36 | struct GNUNET_CRYPTO_AesSessionKey key; | 36 | struct GNUNET_CRYPTO_SymmetricSessionKey key; |
37 | char result[100]; | 37 | char result[100]; |
38 | int size; | 38 | int size; |
39 | char res[100]; | 39 | char res[100]; |
40 | 40 | ||
41 | GNUNET_CRYPTO_aes_create_session_key (&key); | 41 | GNUNET_CRYPTO_symmetric_create_session_key (&key); |
42 | size = | 42 | size = |
43 | GNUNET_CRYPTO_aes_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &key, | 43 | GNUNET_CRYPTO_symmetric_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &key, |
44 | (const struct | 44 | (const struct |
45 | GNUNET_CRYPTO_AesInitializationVector *) | 45 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
46 | INITVALUE, result); | 46 | INITVALUE, result); |
47 | if (size == -1) | 47 | if (size == -1) |
48 | { | 48 | { |
@@ -50,9 +50,9 @@ testSymcipher () | |||
50 | return 1; | 50 | return 1; |
51 | } | 51 | } |
52 | size = | 52 | size = |
53 | GNUNET_CRYPTO_aes_decrypt (result, size, &key, | 53 | GNUNET_CRYPTO_symmetric_decrypt (result, size, &key, |
54 | (const struct | 54 | (const struct |
55 | GNUNET_CRYPTO_AesInitializationVector *) | 55 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
56 | INITVALUE, res); | 56 | INITVALUE, res); |
57 | if (strlen (TESTSTRING) + 1 != size) | 57 | if (strlen (TESTSTRING) + 1 != size) |
58 | { | 58 | { |
@@ -72,7 +72,7 @@ testSymcipher () | |||
72 | static int | 72 | static int |
73 | verifyCrypto () | 73 | verifyCrypto () |
74 | { | 74 | { |
75 | struct GNUNET_CRYPTO_AesSessionKey key; | 75 | struct GNUNET_CRYPTO_SymmetricSessionKey key; |
76 | char result[GNUNET_CRYPTO_AES_KEY_LENGTH]; | 76 | char result[GNUNET_CRYPTO_AES_KEY_LENGTH]; |
77 | char *res; | 77 | char *res; |
78 | int ret; | 78 | int ret; |
@@ -107,9 +107,9 @@ verifyCrypto () | |||
107 | memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH); | 107 | memcpy (key.aes_key, raw_key_aes, GNUNET_CRYPTO_AES_KEY_LENGTH); |
108 | memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH); | 108 | memcpy (key.twofish_key, raw_key_twofish, GNUNET_CRYPTO_AES_KEY_LENGTH); |
109 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != | 109 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != |
110 | GNUNET_CRYPTO_aes_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, | 110 | GNUNET_CRYPTO_symmetric_encrypt (plain, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, |
111 | (const struct | 111 | (const struct |
112 | GNUNET_CRYPTO_AesInitializationVector *) | 112 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
113 | "testtesttesttest", result)) | 113 | "testtesttesttest", result)) |
114 | { | 114 | { |
115 | printf ("Wrong return value from encrypt block.\n"); | 115 | printf ("Wrong return value from encrypt block.\n"); |
@@ -129,9 +129,9 @@ verifyCrypto () | |||
129 | 129 | ||
130 | res = GNUNET_malloc (GNUNET_CRYPTO_AES_KEY_LENGTH); | 130 | res = GNUNET_malloc (GNUNET_CRYPTO_AES_KEY_LENGTH); |
131 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != | 131 | if (GNUNET_CRYPTO_AES_KEY_LENGTH != |
132 | GNUNET_CRYPTO_aes_decrypt (result, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, | 132 | GNUNET_CRYPTO_symmetric_decrypt (result, GNUNET_CRYPTO_AES_KEY_LENGTH, &key, |
133 | (const struct | 133 | (const struct |
134 | GNUNET_CRYPTO_AesInitializationVector *) | 134 | GNUNET_CRYPTO_SymmetricInitializationVector *) |
135 | "testtesttesttest", res)) | 135 | "testtesttesttest", res)) |
136 | { | 136 | { |
137 | printf ("Wrong return value from decrypt block.\n"); | 137 | printf ("Wrong return value from decrypt block.\n"); |
@@ -156,7 +156,7 @@ main (int argc, char *argv[]) | |||
156 | 156 | ||
157 | GNUNET_log_setup ("test-crypto-aes", "WARNING", NULL); | 157 | GNUNET_log_setup ("test-crypto-aes", "WARNING", NULL); |
158 | GNUNET_assert (strlen (INITVALUE) > | 158 | GNUNET_assert (strlen (INITVALUE) > |
159 | sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); | 159 | sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector)); |
160 | failureCount += testSymcipher (); | 160 | failureCount += testSymcipher (); |
161 | failureCount += verifyCrypto (); | 161 | failureCount += verifyCrypto (); |
162 | 162 | ||