Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Benjamin J. Thompson
Tor
Commits
0ab38b93
Commit
0ab38b93
authored
11 years ago
by
Arlo Breault
Committed by
Nick Mathewson
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove PK_PKCS1_PADDING
See #8792
parent
95c34399
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/common/crypto.c
+0
-2
0 additions, 2 deletions
src/common/crypto.c
src/common/crypto.h
+0
-4
0 additions, 4 deletions
src/common/crypto.h
src/test/test_crypto.c
+11
-14
11 additions, 14 deletions
src/test/test_crypto.c
with
11 additions
and
20 deletions
src/common/crypto.c
+
0
−
2
View file @
0ab38b93
...
...
@@ -114,7 +114,6 @@ crypto_get_rsa_padding_overhead(int padding)
switch
(
padding
)
{
case
RSA_PKCS1_OAEP_PADDING
:
return
PKCS1_OAEP_PADDING_OVERHEAD
;
case
RSA_PKCS1_PADDING
:
return
PKCS1_PADDING_OVERHEAD
;
default:
tor_assert
(
0
);
return
-
1
;
}
}
...
...
@@ -126,7 +125,6 @@ crypto_get_rsa_padding(int padding)
{
switch
(
padding
)
{
case
PK_PKCS1_PADDING
:
return
RSA_PKCS1_PADDING
;
case
PK_PKCS1_OAEP_PADDING
:
return
RSA_PKCS1_OAEP_PADDING
;
default:
tor_assert
(
0
);
return
-
1
;
}
...
...
This diff is collapsed.
Click to expand it.
src/common/crypto.h
+
0
−
4
View file @
0ab38b93
...
...
@@ -69,13 +69,9 @@
* signs removed. */
#define BASE64_DIGEST256_LEN 43
/** Constant used to indicate PKCS1 padding for public-key encryption */
#define PK_PKCS1_PADDING 60001
/** Constant used to indicate OAEP padding for public-key encryption */
#define PK_PKCS1_OAEP_PADDING 60002
/** Number of bytes added for PKCS1 padding. */
#define PKCS1_PADDING_OVERHEAD 11
/** Number of bytes added for PKCS1-OAEP padding. */
#define PKCS1_OAEP_PADDING_OVERHEAD 42
...
...
This diff is collapsed.
Click to expand it.
src/test/test_crypto.c
+
11
−
14
View file @
0ab38b93
...
...
@@ -394,7 +394,7 @@ test_crypto_pk(void)
char
*
encoded
=
NULL
;
char
data1
[
1024
],
data2
[
1024
],
data3
[
1024
];
size_t
size
;
int
i
,
j
,
p
,
len
;
int
i
,
len
;
/* Public-key ciphers */
pk1
=
pk_generate
(
0
);
...
...
@@ -478,19 +478,16 @@ test_crypto_pk(void)
/* Try with hybrid encryption wrappers. */
crypto_rand
(
data1
,
1024
);
for
(
i
=
0
;
i
<
2
;
++
i
)
{
for
(
j
=
85
;
j
<
140
;
++
j
)
{
memset
(
data2
,
0
,
1024
);
memset
(
data3
,
0
,
1024
);
p
=
(
i
==
0
)
?
PK_PKCS1_PADDING
:
PK_PKCS1_OAEP_PADDING
;
len
=
crypto_pk_public_hybrid_encrypt
(
pk1
,
data2
,
sizeof
(
data2
),
data1
,
j
,
p
,
0
);
test_assert
(
len
>=
0
);
len
=
crypto_pk_private_hybrid_decrypt
(
pk1
,
data3
,
sizeof
(
data3
),
data2
,
len
,
p
,
1
);
test_eq
(
len
,
j
);
test_memeq
(
data1
,
data3
,
j
);
}
for
(
i
=
85
;
i
<
140
;
++
i
)
{
memset
(
data2
,
0
,
1024
);
memset
(
data3
,
0
,
1024
);
len
=
crypto_pk_public_hybrid_encrypt
(
pk1
,
data2
,
sizeof
(
data2
),
data1
,
i
,
PK_PKCS1_OAEP_PADDING
,
0
);
test_assert
(
len
>=
0
);
len
=
crypto_pk_private_hybrid_decrypt
(
pk1
,
data3
,
sizeof
(
data3
),
data2
,
len
,
PK_PKCS1_OAEP_PADDING
,
1
);
test_eq
(
len
,
i
);
test_memeq
(
data1
,
data3
,
i
);
}
/* Try copy_full */
...
...
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