Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dap-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
8
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
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
dap
dap-sdk
Commits
6c4f4655
Commit
6c4f4655
authored
1 month ago
by
Roman Khlopkov
🔜
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' of gitlab.demlabs.net:dap/dap-sdk into develop
parents
ade50a7e
63da6a93
No related branches found
No related tags found
No related merge requests found
Pipeline
#51009
passed with stage
in 12 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
crypto/src/sphincsplus/randombytes.c
+19
-5
19 additions, 5 deletions
crypto/src/sphincsplus/randombytes.c
with
19 additions
and
5 deletions
crypto/src/sphincsplus/randombytes.c
+
19
−
5
View file @
6c4f4655
...
@@ -2,17 +2,31 @@
...
@@ -2,17 +2,31 @@
This code was taken from the SPHINCS reference implementation and is public domain.
This code was taken from the SPHINCS reference implementation and is public domain.
*/
*/
#include
<fcntl.h>
#if defined(_WIN32)
#include
<unistd.h>
#include
<windows.h>
#else
#include
<fcntl.h>
#include
<unistd.h>
#include
<pthread.h>
static
_Thread_local
int
fd
=
-
1
;
#endif
#include
"randombytes.h"
#include
"randombytes.h"
static
int
fd
=
-
1
;
void
randombytes
(
unsigned
char
*
x
,
unsigned
long
long
xlen
)
void
randombytes
(
unsigned
char
*
x
,
unsigned
long
long
xlen
)
{
{
#if defined(_WIN32)
HCRYPTPROV
p
;
if
(
CryptAcquireContext
(
&
p
,
NULL
,
NULL
,
PROV_RSA_FULL
,
CRYPT_VERIFYCONTEXT
)
==
FALSE
)
{
return
;
}
if
(
CryptGenRandom
(
p
,
xlen
,
(
BYTE
*
)
x
)
==
FALSE
)
{
return
;
}
CryptReleaseContext
(
p
,
0
);
#else
unsigned
long
long
i
;
unsigned
long
long
i
;
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
for
(;;)
{
for
(;;)
{
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
...
@@ -22,7 +36,6 @@ void randombytes(unsigned char *x, unsigned long long xlen)
...
@@ -22,7 +36,6 @@ void randombytes(unsigned char *x, unsigned long long xlen)
sleep
(
1
);
sleep
(
1
);
}
}
}
}
while
(
xlen
>
0
)
{
while
(
xlen
>
0
)
{
if
(
xlen
<
1048576
)
{
if
(
xlen
<
1048576
)
{
i
=
xlen
;
i
=
xlen
;
...
@@ -40,4 +53,5 @@ void randombytes(unsigned char *x, unsigned long long xlen)
...
@@ -40,4 +53,5 @@ void randombytes(unsigned char *x, unsigned long long xlen)
x
+=
i
;
x
+=
i
;
xlen
-=
i
;
xlen
-=
i
;
}
}
#endif
}
}
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