Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
cae37c5e
Commit
cae37c5e
authored
11 years ago
by
Donald Stufft
Browse files
Options
Downloads
Patches
Plain Diff
Use sodium_init to optimize and ensure thread safety
parent
5bb13a1a
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/nacl/_lib/sodium_core.h
+16
-0
16 additions, 0 deletions
src/nacl/_lib/sodium_core.h
src/nacl/c/__init__.py
+6
-0
6 additions, 0 deletions
src/nacl/c/__init__.py
src/nacl/c/sodium_core.py
+26
-0
26 additions, 0 deletions
src/nacl/c/sodium_core.py
with
48 additions
and
0 deletions
src/nacl/_lib/sodium_core.h
0 → 100644
+
16
−
0
View file @
cae37c5e
/* Copyright 2013 Donald Stufft and individual contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
int
sodium_init
();
This diff is collapsed.
Click to expand it.
src/nacl/c/__init__.py
+
6
−
0
View file @
cae37c5e
...
...
@@ -39,6 +39,7 @@ from nacl.c.crypto_sign import (
crypto_sign
,
crypto_sign_open
,
)
from
nacl.c.randombytes
import
randombytes
from
nacl.c.sodium_core
import
sodium_init
__all__
=
[
...
...
@@ -84,4 +85,9 @@ __all__ = [
"
crypto_sign_open
"
,
"
randombytes
"
,
"
sodium_init
"
,
]
# Initialize Sodium
sodium_init
()
This diff is collapsed.
Click to expand it.
src/nacl/c/sodium_core.py
0 → 100644
+
26
−
0
View file @
cae37c5e
# Copyright 2013 Donald Stufft and individual contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
__future__
import
absolute_import
,
division
,
print_function
from
nacl._lib
import
lib
from
nacl.exceptions
import
CryptoError
def
sodium_init
():
"""
Initializes sodium, picking the best implementations available for this
machine.
"""
if
lib
.
sodium_init
()
!=
0
:
raise
CryptoError
(
"
Could not initialize sodium
"
)
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