Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rust Openssl
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Public Repositories
Rust Openssl
Commits
7c8ae5f6
Commit
7c8ae5f6
authored
8 years ago
by
Steven Fackler
Browse files
Options
Downloads
Patches
Plain Diff
Better docs for AEAD tag
parent
aa7c2753
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
openssl/src/symm.rs
+10
-0
10 additions, 0 deletions
openssl/src/symm.rs
with
10 additions
and
0 deletions
openssl/src/symm.rs
+
10
−
0
View file @
7c8ae5f6
...
...
@@ -287,6 +287,10 @@ impl Crypter {
/// as AES GCM.
///
/// When encrypting data with an AEAD cipher, this must be called after `finalize`.
///
/// The size of the buffer indicates the required size of the tag. While some ciphers support a
/// range of tag sizes, it is recommended to pick the maximum size. For AES GCM, this is 16
/// bytes, for example.
pub
fn
get_tag
(
&
self
,
tag
:
&
mut
[
u8
])
->
Result
<
(),
ErrorStack
>
{
unsafe
{
assert!
(
tag
.len
()
<=
c_int
::
max_value
()
as
usize
);
...
...
@@ -370,6 +374,10 @@ pub fn encrypt_aead(t: Cipher,
///
/// Additional Authenticated Data can be provided in the `aad` field, and the authentication tag
/// should be provided in the `tag` field.
///
/// The size of the `tag` buffer indicates the required size of the tag. While some ciphers support
/// a range of tag sizes, it is recommended to pick the maximum size. For AES GCM, this is 16 bytes,
/// for example.
pub
fn
decrypt_aead
(
t
:
Cipher
,
key
:
&
[
u8
],
iv
:
Option
<&
[
u8
]
>
,
...
...
@@ -650,6 +658,8 @@ mod tests {
f4fc97416ee52abe"
;
let
tag
=
"e20b6655"
;
// this tag is smaller than you'd normally want, but I pulled this test from the part of
// the NIST test vectors that cover 4 byte tags.
let
mut
actual_tag
=
[
0
;
4
];
let
out
=
encrypt_aead
(
Cipher
::
aes_128_gcm
(),
&
key
.from_hex
()
.unwrap
(),
...
...
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