Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
bb75b142
Commit
bb75b142
authored
21 years ago
by
Roger Dingledine
Browse files
Options
Downloads
Patches
Plain Diff
remove obsolete test code
svn:r261
parent
8a94dd60
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/or/test_config.c
+0
-30
0 additions, 30 deletions
src/or/test_config.c
src/or/test_onion.c
+0
-177
0 additions, 177 deletions
src/or/test_onion.c
with
0 additions
and
207 deletions
src/or/test_config.c
deleted
100644 → 0
+
0
−
30
View file @
8a94dd60
#include
"or.h"
int
main
(
int
ac
,
char
**
av
)
{
or_options_t
options
;
int
argc
,
rtn_val
,
failures
,
total
;
char
fname
[
512
];
FILE
*
pipe
;
char
*
argv
[]
=
{
"or"
,
"-f"
,
fname
,
NULL
};
argc
=
4
;
failures
=
total
=
0
;
printf
(
"Config file test suite...
\n\n
"
);
pipe
=
popen
(
"ls -1 ../config/*orrc"
,
"r"
);
while
(
fgets
(
fname
,
sizeof
(
fname
),
pipe
)
)
{
fname
[
strlen
(
fname
)
-
1
]
=
'\0'
;
printf
(
"%s
\n
--------------------
\n
"
,
fname
);
rtn_val
=
getconfig
(
argc
,
argv
,
&
options
);
++
total
;
if
(
rtn_val
)
{
++
failures
;
printf
(
"Test failed!
\n\n
"
);
}
else
printf
(
"Test succeeded
\n\n
"
);
}
printf
(
"%6.2f percent. %d failures.
\n
"
,(
total
-
failures
)
*
100
/
(
float
)
total
,
failures
);
return
failures
;
}
This diff is collapsed.
Click to expand it.
src/or/test_onion.c
deleted
100644 → 0
+
0
−
177
View file @
8a94dd60
#include
"or.h"
int
main
(
int
argc
,
char
*
argv
[])
{
/* START VARIABLES */
unsigned
char
onion_plain
[
268
];
/* test onion */
/* onion_passx = ciphertext after x passes */
unsigned
char
onion_pass1
[
268
];
unsigned
char
onion_pass2
[
268
];
unsigned
char
onion_pass3
[
268
];
unsigned
char
onion_pass4
[
268
];
unsigned
char
onion_pass5
[
268
];
unsigned
char
onion_pass6
[
268
];
/* RSA keys for the six layers */
crypto_pk_env_t
*
key1
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
crypto_pk_env_t
*
key2
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
crypto_pk_env_t
*
key3
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
crypto_pk_env_t
*
key4
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
crypto_pk_env_t
*
key5
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
crypto_pk_env_t
*
key6
=
crypto_new_pk_env
(
CRYPTO_PK_RSA
);
/* END VARIABLES */
crypto_global_init
();
printf
(
"onion.c test suite ...
\n
"
);
printf
(
"
\n
Generating 6 RSA keys ...
\n
"
);
crypto_pk_generate_key
(
key1
);
crypto_pk_generate_key
(
key2
);
crypto_pk_generate_key
(
key3
);
crypto_pk_generate_key
(
key4
);
crypto_pk_generate_key
(
key5
);
crypto_pk_generate_key
(
key6
);
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Generating onion ...
\n
"
);
memset
((
void
*
)
onion_plain
,
1
,
28
);
memset
((
void
*
)(
onion_plain
+
28
),
2
,
28
);
memset
((
void
*
)(
onion_plain
+
56
),
3
,
28
);
memset
((
void
*
)(
onion_plain
+
84
),
4
,
28
);
memset
((
void
*
)(
onion_plain
+
112
),
5
,
28
);
memset
((
void
*
)(
onion_plain
+
140
),
6
,
28
);
memset
((
void
*
)(
onion_plain
+
168
),
9
,
100
);
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting first layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass1
,
(
void
*
)
onion_plain
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)(
onion_pass1
+
140
),
128
,
key1
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting second layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass2
,
(
void
*
)
onion_pass1
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)(
onion_pass2
+
112
),
156
,
key2
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting third layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass3
,
(
void
*
)
onion_pass2
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)(
onion_pass3
+
84
),
184
,
key3
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting fourth layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass4
,
(
void
*
)
onion_pass3
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)(
onion_pass4
+
56
),
212
,
key4
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting fifth layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass5
,
(
void
*
)
onion_pass4
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)(
onion_pass5
+
28
),
240
,
key5
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Encrypting sixth layer ...
\n
"
);
memcpy
((
void
*
)
onion_pass6
,
(
void
*
)
onion_pass5
,
268
);
if
(
!
encrypt_onion
((
onion_layer_t
*
)
onion_pass6
,
268
,
key6
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Decrypting sixth layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)
onion_pass6
,
268
,
key6
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)
onion_pass6
,
(
void
*
)
onion_pass5
,
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
printf
(
"
\n
Decrypting fifth layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)(
onion_pass5
+
28
),
240
,
key5
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)
onion_pass5
,
(
void
*
)
onion_pass4
,
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
printf
(
"
\n
Decrypting fourth layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)(
onion_pass4
+
56
),
212
,
key4
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)
onion_pass4
,
(
void
*
)
onion_pass3
,
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
printf
(
"
\n
Decrypting third layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)(
onion_pass3
+
84
),
184
,
key3
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)(
onion_pass3
),
(
void
*
)(
onion_pass2
),
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
printf
(
"
\n
Decrypting second layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)(
onion_pass2
+
112
),
156
,
key2
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)(
onion_pass1
),
(
void
*
)(
onion_pass2
),
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
printf
(
"
\n
Decrypting first layer ...
\n
"
);
if
(
!
decrypt_onion
((
onion_layer_t
*
)(
onion_pass1
+
140
),
128
,
key1
))
{
printf
(
"
\n
Failed!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
done.
\n
"
);
printf
(
"
\n
Checking validity ...
\n
"
);
if
(
memcmp
((
void
*
)(
onion_plain
),
(
void
*
)(
onion_pass1
),
268
))
{
printf
(
"
\n
TEST FAILED!
\n\n
"
);
exit
(
1
);
}
printf
(
"
\n
TEST PASSED.
\n
"
);
crypto_global_cleanup
();
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment