Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 844748
Collapse All | Expand All

(-)a/.gitmodules (+4 lines)
Lines 1-3 Link Here
1
[submodule "third-party/arc4"]
2
	path = third-party/arc4
3
	url = https://github.com/transmission/arc4
4
	branch = v1.0.0
1
[submodule "third-party/dht"]
5
[submodule "third-party/dht"]
2
	path = third-party/dht
6
	path = third-party/dht
3
	url = https://github.com/transmission/dht
7
	url = https://github.com/transmission/dht
(-)a/CMakeLists.txt (+2 lines)
Lines 334-339 endif() Link Here
334
334
335
tr_add_external_auto_library(B64 libb64 b64)
335
tr_add_external_auto_library(B64 libb64 b64)
336
336
337
add_subdirectory(third-party/arc4)
338
337
if(WITH_INOTIFY)
339
if(WITH_INOTIFY)
338
    tr_get_required_flag(WITH_INOTIFY INOTIFY_IS_REQUIRED)
340
    tr_get_required_flag(WITH_INOTIFY INOTIFY_IS_REQUIRED)
339
341
(-)a/Transmission.xcodeproj/project.pbxproj (+109 lines)
Lines 359-364 Link Here
359
		C1639A791A55F56600E42033 /* cencode.c in Sources */ = {isa = PBXBuildFile; fileRef = C1639A771A55F56600E42033 /* cencode.c */; };
359
		C1639A791A55F56600E42033 /* cencode.c in Sources */ = {isa = PBXBuildFile; fileRef = C1639A771A55F56600E42033 /* cencode.c */; };
360
		C1639A7C1A55F57200E42033 /* cdecode.h in Headers */ = {isa = PBXBuildFile; fileRef = C1639A7A1A55F57200E42033 /* cdecode.h */; };
360
		C1639A7C1A55F57200E42033 /* cdecode.h in Headers */ = {isa = PBXBuildFile; fileRef = C1639A7A1A55F57200E42033 /* cdecode.h */; };
361
		C1639A7D1A55F57200E42033 /* cencode.h in Headers */ = {isa = PBXBuildFile; fileRef = C1639A7B1A55F57200E42033 /* cencode.h */; };
361
		C1639A7D1A55F57200E42033 /* cencode.h in Headers */ = {isa = PBXBuildFile; fileRef = C1639A7B1A55F57200E42033 /* cencode.h */; };
362
		C1A7517526ED048C0038B90A /* libarc4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C1A7516426ED03140038B90A /* libarc4.a */; };
363
		C1A751E526ED09A30038B90A /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = C1A751E326ED09A30038B90A /* arc4.c */; };
364
		C1A751E626ED09A30038B90A /* arc4.h in Headers */ = {isa = PBXBuildFile; fileRef = C1A751E426ED09A30038B90A /* arc4.h */; };
362
		C1BF7BA81F2A3CB7008E88A7 /* upnpdev.c in Sources */ = {isa = PBXBuildFile; fileRef = C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */; };
365
		C1BF7BA81F2A3CB7008E88A7 /* upnpdev.c in Sources */ = {isa = PBXBuildFile; fileRef = C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */; };
363
		C1BF7BAA1F2A3CCE008E88A7 /* upnpdev.h in Headers */ = {isa = PBXBuildFile; fileRef = C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */; };
366
		C1BF7BAA1F2A3CCE008E88A7 /* upnpdev.h in Headers */ = {isa = PBXBuildFile; fileRef = C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */; };
364
		C1F690FD1AD0627500D95CF0 /* daemon-posix.c in Sources */ = {isa = PBXBuildFile; fileRef = C1F690FC1AD0627500D95CF0 /* daemon-posix.c */; };
367
		C1F690FD1AD0627500D95CF0 /* daemon-posix.c in Sources */ = {isa = PBXBuildFile; fileRef = C1F690FC1AD0627500D95CF0 /* daemon-posix.c */; };
Lines 458-463 Link Here
458
			remoteGlobalIDString = C1639A6E1A55F4D600E42033;
461
			remoteGlobalIDString = C1639A6E1A55F4D600E42033;
459
			remoteInfo = b64;
462
			remoteInfo = b64;
460
		};
463
		};
464
		C1A751C726ED06390038B90A /* PBXContainerItemProxy */ = {
465
			isa = PBXContainerItemProxy;
466
			containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
467
			proxyType = 1;
468
			remoteGlobalIDString = C1A7516326ED03140038B90A;
469
			remoteInfo = arc4;
470
		};
461
/* End PBXContainerItemProxy section */
471
/* End PBXContainerItemProxy section */
462
472
463
/* Begin PBXCopyFilesBuildPhase section */
473
/* Begin PBXCopyFilesBuildPhase section */
Lines 1009-1014 Link Here
1009
		C1639A771A55F56600E42033 /* cencode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cencode.c; path = src/cencode.c; sourceTree = "<group>"; };
1019
		C1639A771A55F56600E42033 /* cencode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cencode.c; path = src/cencode.c; sourceTree = "<group>"; };
1010
		C1639A7A1A55F57200E42033 /* cdecode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cdecode.h; path = include/b64/cdecode.h; sourceTree = "<group>"; };
1020
		C1639A7A1A55F57200E42033 /* cdecode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cdecode.h; path = include/b64/cdecode.h; sourceTree = "<group>"; };
1011
		C1639A7B1A55F57200E42033 /* cencode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cencode.h; path = include/b64/cencode.h; sourceTree = "<group>"; };
1021
		C1639A7B1A55F57200E42033 /* cencode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cencode.h; path = include/b64/cencode.h; sourceTree = "<group>"; };
1022
		C1A7516426ED03140038B90A /* libarc4.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libarc4.a; sourceTree = BUILT_PRODUCTS_DIR; };
1023
		C1A751E326ED09A30038B90A /* arc4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = arc4.c; path = "third-party/arc4/src/arc4.c"; sourceTree = SOURCE_ROOT; };
1024
		C1A751E426ED09A30038B90A /* arc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = arc4.h; path = "third-party/arc4/src/arc4.h"; sourceTree = SOURCE_ROOT; };
1012
		C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = upnpdev.c; sourceTree = "<group>"; };
1025
		C1BF7BA71F2A3CB7008E88A7 /* upnpdev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = upnpdev.c; sourceTree = "<group>"; };
1013
		C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = upnpdev.h; sourceTree = "<group>"; };
1026
		C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = upnpdev.h; sourceTree = "<group>"; };
1014
		C1F690FC1AD0627500D95CF0 /* daemon-posix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "daemon-posix.c"; sourceTree = "<group>"; };
1027
		C1F690FC1AD0627500D95CF0 /* daemon-posix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "daemon-posix.c"; sourceTree = "<group>"; };
Lines 1115-1120 Link Here
1115
			isa = PBXFrameworksBuildPhase;
1128
			isa = PBXFrameworksBuildPhase;
1116
			buildActionMask = 2147483647;
1129
			buildActionMask = 2147483647;
1117
			files = (
1130
			files = (
1131
				C1A7517526ED048C0038B90A /* libarc4.a in Frameworks */,
1118
				C1639A741A55F4E000E42033 /* libb64.a in Frameworks */,
1132
				C1639A741A55F4E000E42033 /* libb64.a in Frameworks */,
1119
				A22CFCCB0FC24FDA0009BD3E /* libdht.a in Frameworks */,
1133
				A22CFCCB0FC24FDA0009BD3E /* libdht.a in Frameworks */,
1120
				A267927C130DFF2700CB7464 /* libutp.a in Frameworks */,
1134
				A267927C130DFF2700CB7464 /* libutp.a in Frameworks */,
Lines 1159-1164 Link Here
1159
			);
1173
			);
1160
			runOnlyForDeploymentPostprocessing = 0;
1174
			runOnlyForDeploymentPostprocessing = 0;
1161
		};
1175
		};
1176
		C1A7516226ED03140038B90A /* Frameworks */ = {
1177
			isa = PBXFrameworksBuildPhase;
1178
			buildActionMask = 2147483647;
1179
			files = (
1180
			);
1181
			runOnlyForDeploymentPostprocessing = 0;
1182
		};
1162
/* End PBXFrameworksBuildPhase section */
1183
/* End PBXFrameworksBuildPhase section */
1163
1184
1164
/* Begin PBXGroup section */
1185
/* Begin PBXGroup section */
Lines 1268-1273 Link Here
1268
				A2E38544130DFEE3001F501B /* libutp.a */,
1289
				A2E38544130DFEE3001F501B /* libutp.a */,
1269
				A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */,
1290
				A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */,
1270
				C1639A6F1A55F4D600E42033 /* libb64.a */,
1291
				C1639A6F1A55F4D600E42033 /* libb64.a */,
1292
				C1A7516426ED03140038B90A /* libarc4.a */,
1271
			);
1293
			);
1272
			name = Products;
1294
			name = Products;
1273
			sourceTree = "<group>";
1295
			sourceTree = "<group>";
Lines 1282-1287 Link Here
1282
				4DDBB71F09E16BFE00284745 /* CLI */,
1304
				4DDBB71F09E16BFE00284745 /* CLI */,
1283
				BEFC1C0B0C07754700B0BB3C /* daemon */,
1305
				BEFC1C0B0C07754700B0BB3C /* daemon */,
1284
				C15E58AC219A37C600AB292F /* utils */,
1306
				C15E58AC219A37C600AB292F /* utils */,
1307
				C1A7518626ED04EC0038B90A /* arc4 */,
1285
				A22CFCB50FC24F630009BD3E /* dht */,
1308
				A22CFCB50FC24F630009BD3E /* dht */,
1286
				A2E384BF130DFA49001F501B /* libutp */,
1309
				A2E384BF130DFA49001F501B /* libutp */,
1287
				BE75C3570C72A0D600DBEFE0 /* libevent */,
1310
				BE75C3570C72A0D600DBEFE0 /* libevent */,
Lines 1732-1737 Link Here
1732
			path = "third-party/libb64";
1755
			path = "third-party/libb64";
1733
			sourceTree = "<group>";
1756
			sourceTree = "<group>";
1734
		};
1757
		};
1758
		C1A7518626ED04EC0038B90A /* arc4 */ = {
1759
			isa = PBXGroup;
1760
			children = (
1761
				C1A751E326ED09A30038B90A /* arc4.c */,
1762
				C1A751E426ED09A30038B90A /* arc4.h */,
1763
			);
1764
			path = arc4;
1765
			sourceTree = "<group>";
1766
		};
1735
		E1B6FBF80C0D719B0015FE4D /* Info Window */ = {
1767
		E1B6FBF80C0D719B0015FE4D /* Info Window */ = {
1736
			isa = PBXGroup;
1768
			isa = PBXGroup;
1737
			children = (
1769
			children = (
Lines 1942-1947 Link Here
1942
			);
1974
			);
1943
			runOnlyForDeploymentPostprocessing = 0;
1975
			runOnlyForDeploymentPostprocessing = 0;
1944
		};
1976
		};
1977
		C1A7516026ED03140038B90A /* Headers */ = {
1978
			isa = PBXHeadersBuildPhase;
1979
			buildActionMask = 2147483647;
1980
			files = (
1981
				C1A751E626ED09A30038B90A /* arc4.h in Headers */,
1982
			);
1983
			runOnlyForDeploymentPostprocessing = 0;
1984
		};
1945
/* End PBXHeadersBuildPhase section */
1985
/* End PBXHeadersBuildPhase section */
1946
1986
1947
/* Begin PBXNativeTarget section */
1987
/* Begin PBXNativeTarget section */
Lines 1974-1979 Link Here
1974
			buildRules = (
2014
			buildRules = (
1975
			);
2015
			);
1976
			dependencies = (
2016
			dependencies = (
2017
				C1A751C826ED06390038B90A /* PBXTargetDependency */,
1977
				A226FDB10D0CDF6E005A7F71 /* PBXTargetDependency */,
2018
				A226FDB10D0CDF6E005A7F71 /* PBXTargetDependency */,
1978
				BE1183760CE161040002D0F3 /* PBXTargetDependency */,
2019
				BE1183760CE161040002D0F3 /* PBXTargetDependency */,
1979
				BE75C34F0C729ED300DBEFE0 /* PBXTargetDependency */,
2020
				BE75C34F0C729ED300DBEFE0 /* PBXTargetDependency */,
Lines 2167-2172 Link Here
2167
			productReference = C1639A6F1A55F4D600E42033 /* libb64.a */;
2208
			productReference = C1639A6F1A55F4D600E42033 /* libb64.a */;
2168
			productType = "com.apple.product-type.library.static";
2209
			productType = "com.apple.product-type.library.static";
2169
		};
2210
		};
2211
		C1A7516326ED03140038B90A /* arc4 */ = {
2212
			isa = PBXNativeTarget;
2213
			buildConfigurationList = C1A7516826ED03140038B90A /* Build configuration list for PBXNativeTarget "arc4" */;
2214
			buildPhases = (
2215
				C1A7516026ED03140038B90A /* Headers */,
2216
				C1A7516126ED03140038B90A /* Sources */,
2217
				C1A7516226ED03140038B90A /* Frameworks */,
2218
			);
2219
			buildRules = (
2220
			);
2221
			dependencies = (
2222
			);
2223
			name = arc4;
2224
			productName = arc4;
2225
			productReference = C1A7516426ED03140038B90A /* libarc4.a */;
2226
			productType = "com.apple.product-type.library.static";
2227
		};
2170
/* End PBXNativeTarget section */
2228
/* End PBXNativeTarget section */
2171
2229
2172
/* Begin PBXProject section */
2230
/* Begin PBXProject section */
Lines 2221-2226 Link Here
2221
				BE1183470CE160960002D0F3 /* miniupnp */,
2279
				BE1183470CE160960002D0F3 /* miniupnp */,
2222
				3C7A118C0D0B2EB800B5701F /* natpmp */,
2280
				3C7A118C0D0B2EB800B5701F /* natpmp */,
2223
				C1639A6E1A55F4D600E42033 /* b64 */,
2281
				C1639A6E1A55F4D600E42033 /* b64 */,
2282
				C1A7516326ED03140038B90A /* arc4 */,
2224
			);
2283
			);
2225
		};
2284
		};
2226
/* End PBXProject section */
2285
/* End PBXProject section */
Lines 2637-2642 Link Here
2637
			);
2696
			);
2638
			runOnlyForDeploymentPostprocessing = 0;
2697
			runOnlyForDeploymentPostprocessing = 0;
2639
		};
2698
		};
2699
		C1A7516126ED03140038B90A /* Sources */ = {
2700
			isa = PBXSourcesBuildPhase;
2701
			buildActionMask = 2147483647;
2702
			files = (
2703
				C1A751E526ED09A30038B90A /* arc4.c in Sources */,
2704
			);
2705
			runOnlyForDeploymentPostprocessing = 0;
2706
		};
2640
/* End PBXSourcesBuildPhase section */
2707
/* End PBXSourcesBuildPhase section */
2641
2708
2642
/* Begin PBXTargetDependency section */
2709
/* Begin PBXTargetDependency section */
Lines 2700-2705 Link Here
2700
			target = C1639A6E1A55F4D600E42033 /* b64 */;
2767
			target = C1639A6E1A55F4D600E42033 /* b64 */;
2701
			targetProxy = C165AB8C1A55FAA900D37711 /* PBXContainerItemProxy */;
2768
			targetProxy = C165AB8C1A55FAA900D37711 /* PBXContainerItemProxy */;
2702
		};
2769
		};
2770
		C1A751C826ED06390038B90A /* PBXTargetDependency */ = {
2771
			isa = PBXTargetDependency;
2772
			target = C1A7516326ED03140038B90A /* arc4 */;
2773
			targetProxy = C1A751C726ED06390038B90A /* PBXContainerItemProxy */;
2774
		};
2703
/* End PBXTargetDependency section */
2775
/* End PBXTargetDependency section */
2704
2776
2705
/* Begin PBXVariantGroup section */
2777
/* Begin PBXVariantGroup section */
Lines 2951-2956 Link Here
2951
				CLANG_ENABLE_OBJC_ARC = NO;
3023
				CLANG_ENABLE_OBJC_ARC = NO;
2952
				HEADER_SEARCH_PATHS = (
3024
				HEADER_SEARCH_PATHS = (
2953
					"$(inherited)",
3025
					"$(inherited)",
3026
					"third-party/arc4/src",
2954
					"third-party/dht",
3027
					"third-party/dht",
2955
					"third-party/libb64/include",
3028
					"third-party/libb64/include",
2956
					"third-party/libevent/include",
3029
					"third-party/libevent/include",
Lines 3127-3132 Link Here
3127
				CLANG_ENABLE_OBJC_ARC = NO;
3200
				CLANG_ENABLE_OBJC_ARC = NO;
3128
				HEADER_SEARCH_PATHS = (
3201
				HEADER_SEARCH_PATHS = (
3129
					"$(inherited)",
3202
					"$(inherited)",
3203
					"third-party/arc4/src",
3130
					"third-party/dht",
3204
					"third-party/dht",
3131
					"third-party/libb64/include",
3205
					"third-party/libb64/include",
3132
					"third-party/libevent/include",
3206
					"third-party/libevent/include",
Lines 3356-3361 Link Here
3356
				CLANG_ENABLE_OBJC_ARC = NO;
3430
				CLANG_ENABLE_OBJC_ARC = NO;
3357
				HEADER_SEARCH_PATHS = (
3431
				HEADER_SEARCH_PATHS = (
3358
					"$(inherited)",
3432
					"$(inherited)",
3433
					"third-party/arc4/src",
3359
					"third-party/dht",
3434
					"third-party/dht",
3360
					"third-party/libb64/include",
3435
					"third-party/libb64/include",
3361
					"third-party/libevent/include",
3436
					"third-party/libevent/include",
Lines 3590-3595 Link Here
3590
			};
3665
			};
3591
			name = Release;
3666
			name = Release;
3592
		};
3667
		};
3668
		C1A7516526ED03140038B90A /* Debug */ = {
3669
			isa = XCBuildConfiguration;
3670
			buildSettings = {
3671
				CLANG_ENABLE_OBJC_ARC = NO;
3672
				PRODUCT_NAME = "$(TARGET_NAME)";
3673
			};
3674
			name = Debug;
3675
		};
3676
		C1A7516626ED03140038B90A /* Release - Debug */ = {
3677
			isa = XCBuildConfiguration;
3678
			buildSettings = {
3679
				CLANG_ENABLE_OBJC_ARC = NO;
3680
				PRODUCT_NAME = "$(TARGET_NAME)";
3681
			};
3682
			name = "Release - Debug";
3683
		};
3684
		C1A7516726ED03140038B90A /* Release */ = {
3685
			isa = XCBuildConfiguration;
3686
			buildSettings = {
3687
				CLANG_ENABLE_OBJC_ARC = NO;
3688
				PRODUCT_NAME = "$(TARGET_NAME)";
3689
			};
3690
			name = Release;
3691
		};
3593
/* End XCBuildConfiguration section */
3692
/* End XCBuildConfiguration section */
3594
3693
3595
/* Begin XCConfigurationList section */
3694
/* Begin XCConfigurationList section */
Lines 3723-3728 Link Here
3723
			defaultConfigurationIsVisible = 0;
3822
			defaultConfigurationIsVisible = 0;
3724
			defaultConfigurationName = Debug;
3823
			defaultConfigurationName = Debug;
3725
		};
3824
		};
3825
		C1A7516826ED03140038B90A /* Build configuration list for PBXNativeTarget "arc4" */ = {
3826
			isa = XCConfigurationList;
3827
			buildConfigurations = (
3828
				C1A7516526ED03140038B90A /* Debug */,
3829
				C1A7516626ED03140038B90A /* Release - Debug */,
3830
				C1A7516726ED03140038B90A /* Release */,
3831
			);
3832
			defaultConfigurationIsVisible = 0;
3833
			defaultConfigurationName = Debug;
3834
		};
3726
/* End XCConfigurationList section */
3835
/* End XCConfigurationList section */
3727
	};
3836
	};
3728
	rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
3837
	rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
(-)a/libtransmission/CMakeLists.txt (+1 lines)
Lines 274-279 target_link_libraries(${TR_NAME} Link Here
274
    ${LIBINTL_LIBRARY}
274
    ${LIBINTL_LIBRARY}
275
    ${LIBM_LIBRARY}
275
    ${LIBM_LIBRARY}
276
    ${TR_NETWORK_LIBRARIES}
276
    ${TR_NETWORK_LIBRARIES}
277
    arc4::arc4
277
)
278
)
278
279
279
if(ICONV_FOUND)
280
if(ICONV_FOUND)
(-)a/libtransmission/crypto-test-ref.h (-15 lines)
Lines 16-22 Link Here
16
#define KEY_LEN KEY_LEN_
16
#define KEY_LEN KEY_LEN_
17
17
18
#define tr_sha1_ctx_t tr_sha1_ctx_t_
18
#define tr_sha1_ctx_t tr_sha1_ctx_t_
19
#define tr_rc4_ctx_t tr_rc4_ctx_t_
20
#define tr_dh_ctx_t tr_dh_ctx_t_
19
#define tr_dh_ctx_t tr_dh_ctx_t_
21
#define tr_dh_secret_t tr_dh_secret_t_
20
#define tr_dh_secret_t tr_dh_secret_t_
22
#define tr_ssl_ctx_t tr_ssl_ctx_t_
21
#define tr_ssl_ctx_t tr_ssl_ctx_t_
Lines 39-48 Link Here
39
#define tr_sha1_init tr_sha1_init_
38
#define tr_sha1_init tr_sha1_init_
40
#define tr_sha1_update tr_sha1_update_
39
#define tr_sha1_update tr_sha1_update_
41
#define tr_sha1_final tr_sha1_final_
40
#define tr_sha1_final tr_sha1_final_
42
#define tr_rc4_new tr_rc4_new_
43
#define tr_rc4_free tr_rc4_free_
44
#define tr_rc4_set_key tr_rc4_set_key_
45
#define tr_rc4_process tr_rc4_process_
46
#define tr_dh_new tr_dh_new_
41
#define tr_dh_new tr_dh_new_
47
#define tr_dh_free tr_dh_free_
42
#define tr_dh_free tr_dh_free_
48
#define tr_dh_make_key tr_dh_make_key_
43
#define tr_dh_make_key tr_dh_make_key_
Lines 80-86 Link Here
80
#undef KEY_LEN_
75
#undef KEY_LEN_
81
76
82
#undef tr_sha1_ctx_t
77
#undef tr_sha1_ctx_t
83
#undef tr_rc4_ctx_t
84
#undef tr_dh_ctx_t
78
#undef tr_dh_ctx_t
85
#undef tr_dh_secret_t
79
#undef tr_dh_secret_t
86
#undef tr_ssl_ctx_t
80
#undef tr_ssl_ctx_t
Lines 103-112 Link Here
103
#undef tr_sha1_init
97
#undef tr_sha1_init
104
#undef tr_sha1_update
98
#undef tr_sha1_update
105
#undef tr_sha1_final
99
#undef tr_sha1_final
106
#undef tr_rc4_new
107
#undef tr_rc4_free
108
#undef tr_rc4_set_key
109
#undef tr_rc4_process
110
#undef tr_dh_new
100
#undef tr_dh_new
111
#undef tr_dh_free
101
#undef tr_dh_free
112
#undef tr_dh_make_key
102
#undef tr_dh_make_key
Lines 137-143 Link Here
137
#define KEY_LEN_ KEY_LEN
127
#define KEY_LEN_ KEY_LEN
138
128
139
#define tr_sha1_ctx_t_ tr_sha1_ctx_t
129
#define tr_sha1_ctx_t_ tr_sha1_ctx_t
140
#define tr_rc4_ctx_t_ tr_rc4_ctx_t
141
#define tr_dh_ctx_t_ tr_dh_ctx_t
130
#define tr_dh_ctx_t_ tr_dh_ctx_t
142
#define tr_dh_secret_t_ tr_dh_secret_t
131
#define tr_dh_secret_t_ tr_dh_secret_t
143
#define tr_ssl_ctx_t_ tr_ssl_ctx_t
132
#define tr_ssl_ctx_t_ tr_ssl_ctx_t
Lines 160-169 Link Here
160
#define tr_sha1_init_ tr_sha1_init
149
#define tr_sha1_init_ tr_sha1_init
161
#define tr_sha1_update_ tr_sha1_update
150
#define tr_sha1_update_ tr_sha1_update
162
#define tr_sha1_final_ tr_sha1_final
151
#define tr_sha1_final_ tr_sha1_final
163
#define tr_rc4_new_ tr_rc4_new
164
#define tr_rc4_free_ tr_rc4_free
165
#define tr_rc4_set_key_ tr_rc4_set_key
166
#define tr_rc4_process_ tr_rc4_process
167
#define tr_dh_new_ tr_dh_new
152
#define tr_dh_new_ tr_dh_new
168
#define tr_dh_free_ tr_dh_free
153
#define tr_dh_free_ tr_dh_free
169
#define tr_dh_make_key_ tr_dh_make_key
154
#define tr_dh_make_key_ tr_dh_make_key
(-)a/libtransmission/crypto-utils-cyassl.c (-38 lines)
Lines 19-25 Link Here
19
#define API_VERSION_HEX LIBCYASSL_VERSION_HEX
19
#define API_VERSION_HEX LIBCYASSL_VERSION_HEX
20
#endif
20
#endif
21
21
22
#include API_HEADER_CRYPT(arc4.h)
23
#include API_HEADER_CRYPT(dh.h)
22
#include API_HEADER_CRYPT(dh.h)
24
#include API_HEADER_CRYPT(error-crypt.h)
23
#include API_HEADER_CRYPT(error-crypt.h)
25
#include API_HEADER_CRYPT(random.h)
24
#include API_HEADER_CRYPT(random.h)
Lines 167-209 bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) Link Here
167
****
166
****
168
***/
167
***/
169
168
170
tr_rc4_ctx_t tr_rc4_new(void)
171
{
172
    return tr_new0(Arc4, 1);
173
}
174
175
void tr_rc4_free(tr_rc4_ctx_t handle)
176
{
177
    tr_free(handle);
178
}
179
180
void tr_rc4_set_key(tr_rc4_ctx_t handle, uint8_t const* key, size_t key_length)
181
{
182
    TR_ASSERT(handle != NULL);
183
    TR_ASSERT(key != NULL);
184
185
    API(Arc4SetKey)(handle, key, key_length);
186
}
187
188
void tr_rc4_process(tr_rc4_ctx_t handle, void const* input, void* output, size_t length)
189
{
190
    TR_ASSERT(handle != NULL);
191
192
    if (length == 0)
193
    {
194
        return;
195
    }
196
197
    TR_ASSERT(input != NULL);
198
    TR_ASSERT(output != NULL);
199
200
    API(Arc4Process)(handle, output, input, length);
201
}
202
203
/***
204
****
205
***/
206
207
tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num,
169
tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num,
208
    size_t generator_num_length)
170
    size_t generator_num_length)
209
{
171
{
(-)a/libtransmission/crypto-utils-openssl.c (-53 lines)
Lines 182-240 static void openssl_evp_cipher_context_free(EVP_CIPHER_CTX* handle) Link Here
182
182
183
#endif
183
#endif
184
184
185
tr_rc4_ctx_t tr_rc4_new(void)
186
{
187
    EVP_CIPHER_CTX* handle = EVP_CIPHER_CTX_new();
188
189
    if (check_result(EVP_CipherInit_ex(handle, EVP_rc4(), NULL, NULL, NULL, -1)))
190
    {
191
        return handle;
192
    }
193
194
    EVP_CIPHER_CTX_free(handle);
195
    return NULL;
196
}
197
198
void tr_rc4_free(tr_rc4_ctx_t handle)
199
{
200
    if (handle == NULL)
201
    {
202
        return;
203
    }
204
205
    EVP_CIPHER_CTX_free(handle);
206
}
207
208
void tr_rc4_set_key(tr_rc4_ctx_t handle, uint8_t const* key, size_t key_length)
209
{
210
    TR_ASSERT(handle != NULL);
211
    TR_ASSERT(key != NULL);
212
213
    if (!check_result(EVP_CIPHER_CTX_set_key_length(handle, key_length)))
214
    {
215
        return;
216
    }
217
218
    check_result(EVP_CipherInit_ex(handle, NULL, NULL, key, NULL, -1));
219
}
220
221
void tr_rc4_process(tr_rc4_ctx_t handle, void const* input, void* output, size_t length)
222
{
223
    TR_ASSERT(handle != NULL);
224
225
    if (length == 0)
226
    {
227
        return;
228
    }
229
230
    TR_ASSERT(input != NULL);
231
    TR_ASSERT(output != NULL);
232
233
    int output_length;
234
235
    check_result(EVP_CipherUpdate(handle, output, &output_length, input, length));
236
}
237
238
/***
185
/***
239
****
186
****
240
***/
187
***/
(-)a/libtransmission/crypto-utils-polarssl.c (-49 lines)
Lines 18-24 Link Here
18
#endif
18
#endif
19
/* *INDENT-ON* */
19
/* *INDENT-ON* */
20
20
21
#include API_HEADER(arc4.h)
22
#include API_HEADER(base64.h)
21
#include API_HEADER(base64.h)
23
#include API_HEADER(ctr_drbg.h)
22
#include API_HEADER(ctr_drbg.h)
24
#include API_HEADER(dhm.h)
23
#include API_HEADER(dhm.h)
Lines 45-51 Link Here
45
44
46
typedef API (ctr_drbg_context) api_ctr_drbg_context;
45
typedef API (ctr_drbg_context) api_ctr_drbg_context;
47
typedef API (sha1_context) api_sha1_context;
46
typedef API (sha1_context) api_sha1_context;
48
typedef API (arc4_context) api_arc4_context;
49
typedef API (dhm_context) api_dhm_context;
47
typedef API (dhm_context) api_dhm_context;
50
48
51
static void log_polarssl_error(int error_code, char const* file, int line)
49
static void log_polarssl_error(int error_code, char const* file, int line)
Lines 186-238 bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) Link Here
186
****
184
****
187
***/
185
***/
188
186
189
tr_rc4_ctx_t tr_rc4_new(void)
190
{
191
    api_arc4_context* handle = tr_new0(api_arc4_context, 1);
192
193
#if API_VERSION_NUMBER >= 0x01030800
194
    API(arc4_init)(handle);
195
#endif
196
197
    return handle;
198
}
199
200
void tr_rc4_free(tr_rc4_ctx_t handle)
201
{
202
#if API_VERSION_NUMBER >= 0x01030800
203
    API(arc4_free)(handle);
204
#endif
205
206
    tr_free(handle);
207
}
208
209
void tr_rc4_set_key(tr_rc4_ctx_t handle, uint8_t const* key, size_t key_length)
210
{
211
    TR_ASSERT(handle != NULL);
212
    TR_ASSERT(key != NULL);
213
214
    API(arc4_setup)(handle, key, key_length);
215
}
216
217
void tr_rc4_process(tr_rc4_ctx_t handle, void const* input, void* output, size_t length)
218
{
219
    TR_ASSERT(handle != NULL);
220
221
    if (length == 0)
222
    {
223
        return;
224
    }
225
226
    TR_ASSERT(input != NULL);
227
    TR_ASSERT(output != NULL);
228
229
    API(arc4_crypt)(handle, length, input, output);
230
}
231
232
/***
233
****
234
***/
235
236
tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num,
187
tr_dh_ctx_t tr_dh_new(uint8_t const* prime_num, size_t prime_num_length, uint8_t const* generator_num,
237
    size_t generator_num_length)
188
    size_t generator_num_length)
238
{
189
{
(-)a/libtransmission/crypto-utils.c (+1 lines)
Lines 10-15 Link Here
10
#include <stdlib.h> /* abs(), srand(), rand() */
10
#include <stdlib.h> /* abs(), srand(), rand() */
11
#include <string.h> /* memcpy(), memmove(), memset(), strcmp(), strlen() */
11
#include <string.h> /* memcpy(), memmove(), memset(), strcmp(), strlen() */
12
12
13
#include <arc4.h>
13
#include <b64/cdecode.h>
14
#include <b64/cdecode.h>
14
#include <b64/cencode.h>
15
#include <b64/cencode.h>
15
16
(-)a/libtransmission/crypto-utils.h (-22 lines)
Lines 27-34 extern "C" Link Here
27
27
28
/** @brief Opaque SHA1 context type. */
28
/** @brief Opaque SHA1 context type. */
29
typedef void* tr_sha1_ctx_t;
29
typedef void* tr_sha1_ctx_t;
30
/** @brief Opaque RC4 context type. */
31
typedef void* tr_rc4_ctx_t;
32
/** @brief Opaque DH context type. */
30
/** @brief Opaque DH context type. */
33
typedef void* tr_dh_ctx_t;
31
typedef void* tr_dh_ctx_t;
34
/** @brief Opaque DH secret key type. */
32
/** @brief Opaque DH secret key type. */
Lines 60-85 bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length); Link Here
60
 */
58
 */
61
bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash);
59
bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash);
62
60
63
/**
64
 * @brief Allocate and initialize new RC4 cipher context.
65
 */
66
tr_rc4_ctx_t tr_rc4_new(void);
67
68
/**
69
 * @brief Free RC4 cipher context.
70
 */
71
void tr_rc4_free(tr_rc4_ctx_t handle);
72
73
/**
74
 * @brief Set RC4 cipher key.
75
 */
76
void tr_rc4_set_key(tr_rc4_ctx_t handle, uint8_t const* key, size_t key_length);
77
78
/**
79
 * @brief Process memory block with RC4 cipher.
80
 */
81
void tr_rc4_process(tr_rc4_ctx_t handle, void const* input, void* output, size_t length);
82
83
/**
61
/**
84
 * @brief Allocate and initialize new Diffie-Hellman (DH) key exchange context.
62
 * @brief Allocate and initialize new Diffie-Hellman (DH) key exchange context.
85
 */
63
 */
(-)a/libtransmission/crypto.c (-35 / +23 lines)
Lines 8-13 Link Here
8
8
9
#include <string.h> /* memcpy(), memmove(), memset() */
9
#include <string.h> /* memcpy(), memmove(), memset() */
10
10
11
#include <arc4.h>
12
11
#include "transmission.h"
13
#include "transmission.h"
12
#include "crypto.h"
14
#include "crypto.h"
13
#include "crypto-utils.h"
15
#include "crypto-utils.h"
Lines 64-71 void tr_cryptoDestruct(tr_crypto* crypto) Link Here
64
{
66
{
65
    tr_dh_secret_free(crypto->mySecret);
67
    tr_dh_secret_free(crypto->mySecret);
66
    tr_dh_free(crypto->dh);
68
    tr_dh_free(crypto->dh);
67
    tr_rc4_free(crypto->enc_key);
69
    tr_free(crypto->enc_key);
68
    tr_rc4_free(crypto->dec_key);
70
    tr_free(crypto->dec_key);
69
}
71
}
70
72
71
/**
73
/**
Lines 90-125 uint8_t const* tr_cryptoGetMyPublicKey(tr_crypto const* crypto, int* setme_len) Link Here
90
***
92
***
91
**/
93
**/
92
94
93
static void initRC4(tr_crypto* crypto, tr_rc4_ctx_t* setme, char const* key)
95
static void init_rc4(tr_crypto const* crypto, struct arc4_context** setme, char const* key)
94
{
96
{
95
    TR_ASSERT(crypto->torrentHashIsSet);
97
    TR_ASSERT(crypto->torrentHashIsSet);
96
98
97
    if (*setme == NULL)
99
    if (*setme == NULL)
98
    {
100
    {
99
        *setme = tr_rc4_new();
101
        *setme = tr_new0(struct arc4_context, 1);
100
    }
102
    }
101
103
102
    uint8_t buf[SHA_DIGEST_LENGTH];
104
    uint8_t buf[SHA_DIGEST_LENGTH];
103
105
104
    if (tr_cryptoSecretKeySha1(crypto, key, 4, crypto->torrentHash, SHA_DIGEST_LENGTH, buf))
106
    if (tr_cryptoSecretKeySha1(crypto, key, 4, crypto->torrentHash, SHA_DIGEST_LENGTH, buf))
105
    {
107
    {
106
        tr_rc4_set_key(*setme, buf, SHA_DIGEST_LENGTH);
108
        arc4_init(*setme, buf, SHA_DIGEST_LENGTH);
109
        arc4_discard(*setme, 1024);
107
    }
110
    }
108
}
111
}
109
112
110
void tr_cryptoDecryptInit(tr_crypto* crypto)
113
static void crypt_rc4(struct arc4_context* key, size_t buf_len, void const* buf_in, void* buf_out)
111
{
112
    uint8_t discard[1024];
113
    char const* txt = crypto->isIncoming ? "keyA" : "keyB";
114
115
    initRC4(crypto, &crypto->dec_key, txt);
116
    tr_rc4_process(crypto->dec_key, discard, discard, sizeof(discard));
117
}
118
119
void tr_cryptoDecrypt(tr_crypto* crypto, size_t buf_len, void const* buf_in, void* buf_out)
120
{
114
{
121
    /* FIXME: someone calls this function with uninitialized key */
115
    if (key == NULL)
122
    if (crypto->dec_key == NULL)
123
    {
116
    {
124
        if (buf_in != buf_out)
117
        if (buf_in != buf_out)
125
        {
118
        {
Lines 129-160 void tr_cryptoDecrypt(tr_crypto* crypto, size_t buf_len, void const* buf_in, voi Link Here
129
        return;
122
        return;
130
    }
123
    }
131
124
132
    tr_rc4_process(crypto->dec_key, buf_in, buf_out, buf_len);
125
    arc4_process(key, buf_in, buf_out, buf_len);
133
}
126
}
134
127
135
void tr_cryptoEncryptInit(tr_crypto* crypto)
128
void tr_cryptoDecryptInit(tr_crypto* crypto)
136
{
129
{
137
    uint8_t discard[1024];
130
    init_rc4(crypto, &crypto->dec_key, crypto->isIncoming ? "keyA" : "keyB"); // lgtm[cpp/weak-cryptographic-algorithm]
138
    char const* txt = crypto->isIncoming ? "keyB" : "keyA";
139
140
    initRC4(crypto, &crypto->enc_key, txt);
141
    tr_rc4_process(crypto->enc_key, discard, discard, sizeof(discard));
142
}
131
}
143
132
144
void tr_cryptoEncrypt(tr_crypto* crypto, size_t buf_len, void const* buf_in, void* buf_out)
133
void tr_cryptoDecrypt(tr_crypto* crypto, size_t buf_len, void const* buf_in, void* buf_out)
145
{
134
{
146
    /* FIXME: someone calls this function with uninitialized key */
135
    crypt_rc4(crypto->dec_key, buf_len, buf_in, buf_out); // lgtm[cpp/weak-cryptographic-algorithm]
147
    if (crypto->enc_key == NULL)
136
}
148
    {
149
        if (buf_in != buf_out)
150
        {
151
            memmove(buf_out, buf_in, buf_len);
152
        }
153
137
154
        return;
138
void tr_cryptoEncryptInit(tr_crypto* crypto)
155
    }
139
{
140
    init_rc4(crypto, &crypto->enc_key, crypto->isIncoming ? "keyB" : "keyA"); // lgtm[cpp/weak-cryptographic-algorithm]
141
}
156
142
157
    tr_rc4_process(crypto->enc_key, buf_in, buf_out, buf_len);
143
void tr_cryptoEncrypt(tr_crypto* crypto, size_t buf_len, void const* buf_in, void* buf_out)
144
{
145
    crypt_rc4(crypto->enc_key, buf_len, buf_in, buf_out); // lgtm[cpp/weak-cryptographic-algorithm]
158
}
146
}
159
147
160
bool tr_cryptoSecretKeySha1(tr_crypto const* crypto, void const* prepend_data, size_t prepend_data_size,
148
bool tr_cryptoSecretKeySha1(tr_crypto const* crypto, void const* prepend_data, size_t prepend_data_size,
(-)a/libtransmission/crypto.h (-2 / +2 lines)
Lines 31-38 enum Link Here
31
/** @brief Holds state information for encrypted peer communications */
31
/** @brief Holds state information for encrypted peer communications */
32
typedef struct
32
typedef struct
33
{
33
{
34
    tr_rc4_ctx_t dec_key;
34
    struct arc4_context* dec_key;
35
    tr_rc4_ctx_t enc_key;
35
    struct arc4_context* enc_key;
36
    tr_dh_ctx_t dh;
36
    tr_dh_ctx_t dh;
37
    uint8_t myPublicKey[KEY_LEN];
37
    uint8_t myPublicKey[KEY_LEN];
38
    tr_dh_secret_t mySecret;
38
    tr_dh_secret_t mySecret;
(-)a/third-party/arc4 (-1 / +1 lines)
Line 0 Link Here
0
- 
1
Subproject commit 6c8a5dd7e5e3fafcf0afef74cdf71f9d20cb9a54

Return to bug 844748