Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
9c7a001a
Commit
9c7a001a
authored
Aug 16, 2016
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
New pgp-encode helper function, write_string.
parent
96f1348e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+3
-0
3 additions, 0 deletions
ChangeLog
pgp-encode.c
+10
-6
10 additions, 6 deletions
pgp-encode.c
with
13 additions
and
6 deletions
ChangeLog
+
3
−
0
View file @
9c7a001a
2016-08-16 Niels Möller <nisse@lysator.liu.se>
* pgp-encode.c (write_string): New helper function, replacing...
(WRITE): ... deleted macro.
* examples/io.c (write_data): Renamed, and use const void * for
the input data. Updated all callers.
(write_string): ... old name.
...
...
This diff is collapsed.
Click to expand it.
pgp-encode.c
+
10
−
6
View file @
9c7a001a
...
...
@@ -339,7 +339,11 @@ pgp_crc24(unsigned length, const uint8_t *data)
}
#define WRITE(buffer, s) (nettle_buffer_write(buffer, strlen((s)), (s)))
static
int
write_string
(
struct
nettle_buffer
*
buffer
,
const
char
*
s
)
{
return
nettle_buffer_write
(
buffer
,
strlen
((
s
)),
(
const
uint8_t
*
)
(
s
));
}
/* 15 base 64 groups data per line */
#define BINARY_PER_LINE 45
...
...
@@ -357,9 +361,9 @@ pgp_armor(struct nettle_buffer *buffer,
base64_encode_init
(
&
ctx
);
if
(
!
(
WRITE
(
buffer
,
"BEGIN PGP "
)
&&
WRITE
(
buffer
,
tag
)
&&
WRITE
(
buffer
,
"
\n
Comment: Nettle
\n\n
"
)))
if
(
!
(
write_string
(
buffer
,
"BEGIN PGP "
)
&&
write_string
(
buffer
,
tag
)
&&
write_string
(
buffer
,
"
\n
Comment: Nettle
\n\n
"
)))
return
0
;
for
(;
...
...
@@ -414,7 +418,7 @@ pgp_armor(struct nettle_buffer *buffer,
base64_encode_group
(
p
,
crc
);
}
return
(
WRITE
(
buffer
,
"
\n
BEGIN PGP "
)
&&
WRITE
(
buffer
,
tag
)
return
(
write_string
(
buffer
,
"
\n
BEGIN PGP "
)
&&
write_string
(
buffer
,
tag
)
&&
NETTLE_BUFFER_PUTC
(
buffer
,
'\n'
));
}
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