New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: use check macros in CipherBase::SetAuthTag #9395

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@fanatid
Contributor

fanatid commented Nov 1, 2016

Checklist
  • commit message follows commit guidelines
Affected core subsystem(s)

crypto

Description of change

Use macros THROW_AND_RETURN_IF_NOT_BUFFER instead separate condition.

Show outdated Hide outdated src/node_crypto.cc
if (!buf->IsObject() || !Buffer::HasInstance(buf))
return env->ThrowTypeError("Auth tag must be a Buffer");
THROW_AND_RETURN_IF_NOT_BUFFER(args[0], "AAD");

This comment has been minimized.

@addaleax

addaleax Nov 1, 2016

Member

AAD? I guess this line is copypasted, maybe this should be tag or tagbuf?

@addaleax

addaleax Nov 1, 2016

Member

AAD? I guess this line is copypasted, maybe this should be tag or tagbuf?

This comment has been minimized.

@fanatid

fanatid Nov 1, 2016

Contributor

Fixed. Should be "Auth tag".
Thank you.

@fanatid

fanatid Nov 1, 2016

Contributor

Fixed. Should be "Auth tag".
Thank you.

@addaleax

LGTM

@addaleax addaleax added the crypto label Nov 1, 2016

@cjihrig

cjihrig approved these changes Nov 1, 2016

@jasnell jasnell added the semver-major label Nov 2, 2016

CipherBase* cipher;
ASSIGN_OR_RETURN_UNWRAP(&cipher, args.Holder());
if (!cipher->SetAuthTag(Buffer::Data(buf), Buffer::Length(buf)))

This comment has been minimized.

@jasnell

jasnell Nov 2, 2016

Member

Note that the SPREAD_BUFFER_ARG macro has been moved to util.h now and could likely be used to simplify this also.

@jasnell

jasnell Nov 2, 2016

Member

Note that the SPREAD_BUFFER_ARG macro has been moved to util.h now and could likely be used to simplify this also.

if (!buf->IsObject() || !Buffer::HasInstance(buf))
return env->ThrowTypeError("Auth tag must be a Buffer");
THROW_AND_RETURN_IF_NOT_BUFFER(args[0], "Auth tag");

This comment has been minimized.

@jasnell

jasnell Nov 2, 2016

Member

There is a very subtle change in the error message here given that Buffer is changed to buffer. Unfortunately this means this has to be treated as a semver-major because it's a change in the error message. whee!

@jasnell

jasnell Nov 2, 2016

Member

There is a very subtle change in the error message here given that Buffer is changed to buffer. Unfortunately this means this has to be treated as a semver-major because it's a change in the error message. whee!

@addaleax addaleax added this to the 8.0.0 milestone Nov 20, 2016

@jasnell

This comment has been minimized.

Show comment
Hide comment

jasnell added a commit that referenced this pull request Jan 11, 2017

crypto: use check macros in CipherBase::SetAuthTag
PR-URL: #9395
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Jan 11, 2017

Member

Landed in 1ef401c

Member

jasnell commented Jan 11, 2017

Landed in 1ef401c

@jasnell jasnell closed this Jan 11, 2017

@fanatid fanatid deleted the fanatid:crypto/SetAuthTag branch Jan 11, 2017

italoacasas added a commit to italoacasas/node that referenced this pull request Jan 18, 2017

crypto: use check macros in CipherBase::SetAuthTag
PR-URL: nodejs#9395
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@jasnell jasnell referenced this pull request Apr 4, 2017

Closed

8.0.0 Release Proposal #12220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment