Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rust Openssl
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public Repositories
Rust Openssl
Commits
36a667be
Commit
36a667be
authored
9 years ago
by
Cody P Schafer
Browse files
Options
Downloads
Patches
Plain Diff
x509: impl Clone using references & CRYPTO_add()
parent
3c51f159
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
openssl/src/c_helpers.c
+4
-0
4 additions, 0 deletions
openssl/src/c_helpers.c
openssl/src/x509/mod.rs
+14
-0
14 additions, 0 deletions
openssl/src/x509/mod.rs
with
18 additions
and
0 deletions
openssl/src/c_helpers.c
+
4
−
0
View file @
36a667be
...
...
@@ -11,3 +11,7 @@ void rust_SSL_CTX_clone(SSL_CTX *ctx) {
void
rust_EVP_PKEY_clone
(
EVP_PKEY
*
pkey
)
{
CRYPTO_add
(
&
pkey
->
references
,
1
,
CRYPTO_LOCK_EVP_PKEY
);
}
void
rust_X509_clone
(
X509
*
x509
)
{
CRYPTO_add
(
&
x509
->
references
,
1
,
CRYPTO_LOCK_X509
);
}
This diff is collapsed.
Click to expand it.
openssl/src/x509/mod.rs
+
14
−
0
View file @
36a667be
...
...
@@ -507,6 +507,20 @@ impl<'ctx> X509<'ctx> {
}
}
extern
"C"
{
fn
rust_X509_clone
(
x509
:
*
mut
ffi
::
X509
);
}
impl
<
'ctx
>
Clone
for
X509
<
'ctx
>
{
fn
clone
(
&
self
)
->
X509
<
'ctx
>
{
unsafe
{
rust_X509_clone
(
self
.handle
)
}
/* FIXME: given that we now have refcounting control, 'owned' should be uneeded, the 'ctx
* is probably also uneeded. We can remove both to condense the x509 api quite a bit
*/
X509
::
new
(
self
.handle
,
true
)
}
}
impl
<
'ctx
>
Drop
for
X509
<
'ctx
>
{
fn
drop
(
&
mut
self
)
{
if
self
.owned
{
...
...
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