Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
e5a294ec
Commit
e5a294ec
authored
May 01, 2014
by
Frank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweetnacl integration
parent
49f18d55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
147 additions
and
9 deletions
+147
-9
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+24
-1
curve_client.cpp
src/curve_client.cpp
+0
-2
curve_client.hpp
src/curve_client.hpp
+6
-1
curve_server.cpp
src/curve_server.cpp
+0
-1
curve_server.hpp
src/curve_server.hpp
+6
-3
zmq_utils.cpp
src/zmq_utils.cpp
+6
-1
devurandom.c
tweetnacl/contrib/randombytes/devurandom.c
+34
-0
devurandom.h
tweetnacl/contrib/randombytes/devurandom.h
+24
-0
randombytes.h
tweetnacl/contrib/randombytes/randombytes.h
+5
-0
tweetnacl.c
tweetnacl/src/tweetnacl.c
+0
-0
tweetnacl.h
tweetnacl/src/tweetnacl.h
+0
-0
tweetnacl_base.h
tweetnacl/src/tweetnacl_base.h
+41
-0
No files found.
.gitignore
View file @
e5a294ec
...
...
@@ -123,3 +123,4 @@ foreign/openpgm/*
zeromq-*.tar.gz
zeromq-*.zip
core
build
CMakeLists.txt
View file @
e5a294ec
...
...
@@ -9,6 +9,25 @@ if(APPLE)
option
(
ZMQ_BUILD_FRAMEWORK
"Build as OS X framework"
ON
)
endif
()
option
(
WITH_TWEETNACL
"Build with tweetnacl"
ON
)
if
(
WITH_TWEETNACL
)
add_definitions
(
-DHAVE_TWEETNACL -DHAVE_LIBSODIUM
)
include_directories
(
tweetnacl/contrib/randombytes
tweetnacl/src
)
set
(
TWEETNACL_SOURCES
tweetnacl/src/tweetnacl.c
)
if
(
WIN32
)
else
()
list
(
APPEND TWEETNACL_SOURCES tweetnacl/contrib/randombytes/devurandom.c
)
endif
()
endif
()
set
(
POLLER
""
CACHE STRING
"Choose polling system. valid values are
kqueue, epoll, devpoll, poll or select [default=autodetect]"
)
...
...
@@ -469,6 +488,10 @@ foreach(source ${cxx-sources})
list
(
APPEND sources
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/
${
source
}
)
endforeach
()
foreach
(
source
${
TWEETNACL_SOURCES
}
)
list
(
APPEND sources
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
source
}
)
endforeach
()
foreach
(
source
${
rc-sources
}
)
list
(
APPEND sources
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
source
}
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/
${
source
}
.in
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
source
}
)
...
...
@@ -701,7 +724,7 @@ if(ZMQ_BUILD_TESTS)
target_link_libraries
(
${
test
}
libzmq
)
if
(
RT_LIBRARY
)
target_link_libraries
(
${
test
}
${
RT_LIBRARY
}
)
target_link_libraries
(
${
test
}
${
RT_LIBRARY
}
)
endif
()
if
(
WIN32
)
add_test
(
NAME
${
test
}
WORKING_DIRECTORY
${
LIBRARY_OUTPUT_PATH
}
COMMAND
${
test
}
)
...
...
src/curve_client.cpp
View file @
e5a294ec
...
...
@@ -21,8 +21,6 @@
#ifdef HAVE_LIBSODIUM
#include <sodium.h>
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#endif
...
...
src/curve_client.hpp
View file @
e5a294ec
...
...
@@ -23,7 +23,12 @@
#include "platform.hpp"
#ifdef HAVE_LIBSODIUM
#include <sodium.h>
#ifdef HAVE_TWEETNACL
#include "tweetnacl_base.h"
#include "randombytes.h"
#else
#include "sodium.h"
#endif
#if crypto_box_NONCEBYTES != 24 \
|| crypto_box_PUBLICKEYBYTES != 32 \
...
...
src/curve_server.cpp
View file @
e5a294ec
...
...
@@ -20,7 +20,6 @@
#include "platform.hpp"
#ifdef HAVE_LIBSODIUM
#include <sodium.h>
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
...
...
src/curve_server.hpp
View file @
e5a294ec
...
...
@@ -23,8 +23,12 @@
#include "platform.hpp"
#ifdef HAVE_LIBSODIUM
#include <sodium.h>
#ifdef HAVE_TWEETNACL
#include "tweetnacl_base.h"
#include "randombytes.h"
#else
#include "sodium.h"
#endif
#if crypto_box_NONCEBYTES != 24 \
|| crypto_box_PUBLICKEYBYTES != 32 \
|| crypto_box_SECRETKEYBYTES != 32 \
...
...
@@ -118,4 +122,3 @@ namespace zmq
#endif
#endif
src/zmq_utils.cpp
View file @
e5a294ec
...
...
@@ -30,8 +30,13 @@
#else
#include "windows.hpp"
#endif
#ifdef HAVE_LIBSODIUM
# include <sodium.h>
#ifdef HAVE_TWEETNACL
#include "tweetnacl_base.h"
#else
#include "sodium.h"
#endif
#endif
...
...
tweetnacl/contrib/randombytes/devurandom.c
0 → 100644
View file @
e5a294ec
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
/* it's really stupid that there isn't a syscall for this */
static
int
fd
=
-
1
;
void
randombytes
(
unsigned
char
*
x
,
unsigned
long
long
xlen
)
{
int
i
;
if
(
fd
==
-
1
)
{
for
(;;)
{
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd
!=
-
1
)
break
;
sleep
(
1
);
}
}
while
(
xlen
>
0
)
{
if
(
xlen
<
1048576
)
i
=
xlen
;
else
i
=
1048576
;
i
=
read
(
fd
,
x
,
i
);
if
(
i
<
1
)
{
sleep
(
1
);
continue
;
}
x
+=
i
;
xlen
-=
i
;
}
}
tweetnacl/contrib/randombytes/devurandom.h
0 → 100644
View file @
e5a294ec
/*
randombytes/devurandom.h version 20080713
D. J. Bernstein
Public domain.
*/
#ifndef randombytes_devurandom_H
#define randombytes_devurandom_H
#ifdef __cplusplus
extern
"C"
{
#endif
extern
void
randombytes
(
unsigned
char
*
,
unsigned
long
long
);
#ifdef __cplusplus
}
#endif
#ifndef randombytes_implementation
#define randombytes_implementation "devurandom"
#endif
#endif
tweetnacl/contrib/randombytes/randombytes.h
0 → 100644
View file @
e5a294ec
#ifndef randombytes_H
#define randombytes_H
#include "devurandom.h"
#endif
tweetnacl/src/tweetnacl.c
0 → 100644
View file @
e5a294ec
This diff is collapsed.
Click to expand it.
tweetnacl/src/tweetnacl.h
0 → 100644
View file @
e5a294ec
This diff is collapsed.
Click to expand it.
tweetnacl/src/tweetnacl_base.h
0 → 100644
View file @
e5a294ec
#ifndef TWEETNACL_BASE_H
#define TWEETNACL_BASE_H
/* the original file seems to be a compability layer for NaCL */
/* This here is for direct tweetnacl usage */
#define crypto_box_SECRETKEYBYTES 32
#define crypto_box_BOXZEROBYTES 16
#define crypto_box_NONCEBYTES 24
#define crypto_box_ZEROBYTES 32
#define crypto_box_PUBLICKEYBYTES 32
#define crypto_box_BEFORENMBYTES 32
#define crypto_secretbox_KEYBYTES 32
#define crypto_secretbox_NONCEBYTES 24
#define crypto_secretbox_ZEROBYTES 32
#define crypto_secretbox_BOXZEROBYTES 16
typedef
unsigned
char
u8
;
typedef
unsigned
long
u32
;
typedef
unsigned
long
long
u64
;
typedef
long
long
i64
;
typedef
i64
gf
[
16
];
#ifdef __cplusplus
extern
"C"
{
#endif
int
crypto_box_keypair
(
u8
*
y
,
u8
*
x
);
int
crypto_box_afternm
(
u8
*
c
,
const
u8
*
m
,
u64
d
,
const
u8
*
n
,
const
u8
*
k
);
int
crypto_box_open_afternm
(
u8
*
m
,
const
u8
*
c
,
u64
d
,
const
u8
*
n
,
const
u8
*
k
);
int
crypto_box
(
u8
*
c
,
const
u8
*
m
,
u64
d
,
const
u8
*
n
,
const
u8
*
y
,
const
u8
*
x
);
int
crypto_box_open
(
u8
*
m
,
const
u8
*
c
,
u64
d
,
const
u8
*
n
,
const
u8
*
y
,
const
u8
*
x
);
int
crypto_box_beforenm
(
u8
*
k
,
const
u8
*
y
,
const
u8
*
x
);
int
crypto_secretbox
(
u8
*
c
,
const
u8
*
m
,
u64
d
,
const
u8
*
n
,
const
u8
*
k
);
int
crypto_secretbox_open
(
u8
*
m
,
const
u8
*
c
,
u64
d
,
const
u8
*
n
,
const
u8
*
k
);
#ifdef __cplusplus
}
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment