A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/dd3c66be0a below:

AdditionalConfig · nodejs/node@dd3c66b · GitHub

@@ -476,83 +476,38 @@ Maybe<bool> AESCipherTraits::AdditionalConfig(

476 476

params->variant =

477 477

static_cast<AESKeyVariant>(args[offset].As<Uint32>()->Value());

478 478 479 +

AESCipherMode cipher_op_mode;

479 480

int cipher_nid;

480 481 482 +

#define V(name, _, mode, nid) \

483 +

case kKeyVariantAES_##name: { \

484 +

cipher_op_mode = mode; \

485 +

cipher_nid = nid; \

486 +

break; \

487 +

}

481 488

switch (params->variant) {

482 -

case kKeyVariantAES_CTR_128:

483 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

484 -

!ValidateCounter(env, args[offset + 2], params)) {

485 -

return Nothing<bool>();

486 -

}

487 -

cipher_nid = NID_aes_128_ctr;

488 -

break;

489 -

case kKeyVariantAES_CTR_192:

490 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

491 -

!ValidateCounter(env, args[offset + 2], params)) {

492 -

return Nothing<bool>();

493 -

}

494 -

cipher_nid = NID_aes_192_ctr;

495 -

break;

496 -

case kKeyVariantAES_CTR_256:

497 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

498 -

!ValidateCounter(env, args[offset + 2], params)) {

499 -

return Nothing<bool>();

500 -

}

501 -

cipher_nid = NID_aes_256_ctr;

502 -

break;

503 -

case kKeyVariantAES_CBC_128:

504 -

if (!ValidateIV(env, mode, args[offset + 1], params))

505 -

return Nothing<bool>();

506 -

cipher_nid = NID_aes_128_cbc;

507 -

break;

508 -

case kKeyVariantAES_CBC_192:

509 -

if (!ValidateIV(env, mode, args[offset + 1], params))

510 -

return Nothing<bool>();

511 -

cipher_nid = NID_aes_192_cbc;

512 -

break;

513 -

case kKeyVariantAES_CBC_256:

514 -

if (!ValidateIV(env, mode, args[offset + 1], params))

515 -

return Nothing<bool>();

516 -

cipher_nid = NID_aes_256_cbc;

517 -

break;

518 -

case kKeyVariantAES_KW_128:

519 -

UseDefaultIV(params);

520 -

cipher_nid = NID_id_aes128_wrap;

521 -

break;

522 -

case kKeyVariantAES_KW_192:

523 -

UseDefaultIV(params);

524 -

cipher_nid = NID_id_aes192_wrap;

525 -

break;

526 -

case kKeyVariantAES_KW_256:

527 -

UseDefaultIV(params);

528 -

cipher_nid = NID_id_aes256_wrap;

529 -

break;

530 -

case kKeyVariantAES_GCM_128:

531 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

532 -

!ValidateAuthTag(env, mode, cipher_mode, args[offset + 2], params) ||

533 -

!ValidateAdditionalData(env, mode, args[offset + 3], params)) {

534 -

return Nothing<bool>();

535 -

}

536 -

cipher_nid = NID_aes_128_gcm;

537 -

break;

538 -

case kKeyVariantAES_GCM_192:

539 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

540 -

!ValidateAuthTag(env, mode, cipher_mode, args[offset + 2], params) ||

541 -

!ValidateAdditionalData(env, mode, args[offset + 3], params)) {

489 +

VARIANTS(V)

490 +

default:

491 +

UNREACHABLE();

492 +

}

493 +

#undef V

494 + 495 +

if (cipher_op_mode != AESCipherMode::KW) {

496 +

if (!ValidateIV(env, mode, args[offset + 1], params)) {

497 +

return Nothing<bool>();

498 +

}

499 +

if (cipher_op_mode == AESCipherMode::CTR) {

500 +

if (!ValidateCounter(env, args[offset + 2], params)) {

542 501

return Nothing<bool>();

543 502

}

544 -

cipher_nid = NID_aes_192_gcm;

545 -

break;

546 -

case kKeyVariantAES_GCM_256:

547 -

if (!ValidateIV(env, mode, args[offset + 1], params) ||

548 -

!ValidateAuthTag(env, mode, cipher_mode, args[offset + 2], params) ||

503 +

} else if (cipher_op_mode == AESCipherMode::GCM) {

504 +

if (!ValidateAuthTag(env, mode, cipher_mode, args[offset + 2], params) ||

549 505

!ValidateAdditionalData(env, mode, args[offset + 3], params)) {

550 506

return Nothing<bool>();

551 507

}

552 -

cipher_nid = NID_aes_256_gcm;

553 -

break;

554 -

default:

555 -

UNREACHABLE();

508 +

}

509 +

} else {

510 +

UseDefaultIV(params);

556 511

}

557 512 558 513

params->cipher = EVP_get_cipherbynid(cipher_nid);

@@ -577,8 +532,8 @@ WebCryptoCipherStatus AESCipherTraits::DoCipher(

577 532

const AESCipherConfig& params,

578 533

const ByteSource& in,

579 534

ByteSource* out) {

580 -

#define V(name, fn) \

581 -

case kKeyVariantAES_ ## name: \

535 +

#define V(name, fn, _, __) \

536 +

case kKeyVariantAES_##name: \

582 537

return fn(env, key_data.get(), cipher_mode, params, in, out);

583 538

switch (params.variant) {

584 539

VARIANTS(V)

@@ -591,7 +546,7 @@ WebCryptoCipherStatus AESCipherTraits::DoCipher(

591 546

void AES::Initialize(Environment* env, Local<Object> target) {

592 547

AESCryptoJob::Initialize(env, target);

593 548 594 -

#define V(name, _) NODE_DEFINE_CONSTANT(target, kKeyVariantAES_ ## name);

549 +

#define V(name, _, __, ___) NODE_DEFINE_CONSTANT(target, kKeyVariantAES_##name);

595 550

VARIANTS(V)

596 551

#undef V

597 552

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4