Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
76622bde
Commit
76622bde
authored
Feb 14, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing gcrypt initialization.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
1d703405
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
random.cc
src/random.cc
+21
-0
No files found.
src/random.cc
View file @
76622bde
...
...
@@ -10,6 +10,23 @@ using std::vector;
using
std
::
regex
;
using
std
::
regex_match
;
static
void
gcrypt_init
()
{
static
bool
init_ok
=
false
;
if
(
!
init_ok
)
{
if
(
!
gcry_check_version
(
GCRYPT_VERSION
))
{
fprintf
(
stderr
,
"audiowmark: libgcrypt version mismatch
\n
"
);
exit
(
1
);
}
init_ok
=
true
;
}
}
static
vector
<
unsigned
char
>
aes_key
(
16
);
// 128 bits
static
constexpr
auto
GCRY_CIPHER
=
GCRY_CIPHER_AES128
;
...
...
@@ -55,6 +72,8 @@ print (const string& label, const vector<unsigned char>& data)
Random
::
Random
(
uint64_t
seed
,
Stream
stream
)
{
gcrypt_init
();
vector
<
unsigned
char
>
ctr
=
get_start_counter
(
seed
,
stream
);
// print ("CTR", ctr);
...
...
@@ -201,6 +220,8 @@ Random::load_global_key (const string& key_file)
string
Random
::
gen_key
()
{
gcrypt_init
();
vector
<
unsigned
char
>
key
(
16
);
gcry_randomize
(
&
key
[
0
],
16
,
/* long term key material strength */
GCRY_VERY_STRONG_RANDOM
);
return
vec_to_hex_str
(
key
);
...
...
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