| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3db4354 commit c922578
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -524,11 +524,11 @@ WebCryptoKeyExportStatus DHKeyExportTraits::DoExport( | |||
| 524 | 524 | switch (format) { | |
| 525 | 525 | case kWebCryptoKeyFormatPKCS8: | |
| 526 | 526 | if (key_data->GetKeyType() != kKeyTypePrivate) | |
| 527 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 527 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 528 | 528 | return PKEY_PKCS8_Export(key_data.get(), out); | |
| 529 | 529 | case kWebCryptoKeyFormatSPKI: | |
| 530 | 530 | if (key_data->GetKeyType() != kKeyTypePublic) | |
| 531 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 531 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 532 | 532 | return PKEY_SPKI_Export(key_data.get(), out); | |
| 533 | 533 | default: | |
| 534 | 534 | UNREACHABLE(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,14 +113,14 @@ WebCryptoKeyExportStatus DSAKeyExportTraits::DoExport( | |||
| 113 | 113 | switch (format) { | |
| 114 | 114 | case kWebCryptoKeyFormatRaw: | |
| 115 | 115 | // Not supported for RSA keys of either type | |
| 116 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 116 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 117 | 117 | case kWebCryptoKeyFormatPKCS8: | |
| 118 | 118 | if (key_data->GetKeyType() != kKeyTypePrivate) | |
| 119 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 119 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 120 | 120 | return PKEY_PKCS8_Export(key_data.get(), out); | |
| 121 | 121 | case kWebCryptoKeyFormatSPKI: | |
| 122 | 122 | if (key_data->GetKeyType() != kKeyTypePublic) | |
| 123 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 123 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 124 | 124 | return PKEY_SPKI_Export(key_data.get(), out); | |
| 125 | 125 | default: | |
| 126 | 126 | UNREACHABLE(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -549,18 +549,18 @@ WebCryptoKeyExportStatus EC_Raw_Export( | |||
| 549 | 549 | // Get the allocated data size... | |
| 550 | 550 | size_t len = EC_POINT_point2oct(group, point, form, nullptr, 0, nullptr); | |
| 551 | 551 | if (len == 0) | |
| 552 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 552 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 553 | 553 | ||
| 554 | 554 | unsigned char* data = MallocOpenSSL<unsigned char>(len); | |
| 555 | 555 | size_t check_len = EC_POINT_point2oct(group, point, form, data, len, nullptr); | |
| 556 | 556 | if (check_len == 0) | |
| 557 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 557 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 558 | 558 | ||
| 559 | 559 | CHECK_EQ(len, check_len); | |
| 560 | 560 | ||
| 561 | 561 | *out = ByteSource::Allocated(reinterpret_cast<char*>(data), len); | |
| 562 | 562 | ||
| 563 | - return WebCryptoKeyExportStatus::ERR_OK; | ||
| 563 | + return WebCryptoKeyExportStatus::OK; | ||
| 564 | 564 | } | |
| 565 | 565 | } // namespace | |
| 566 | 566 | ||
@@ -581,15 +581,15 @@ WebCryptoKeyExportStatus ECKeyExportTraits::DoExport( | |||
| 581 | 581 | switch (format) { | |
| 582 | 582 | case kWebCryptoKeyFormatRaw: | |
| 583 | 583 | if (key_data->GetKeyType() != kKeyTypePublic) | |
| 584 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 584 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 585 | 585 | return EC_Raw_Export(key_data.get(), params, out); | |
| 586 | 586 | case kWebCryptoKeyFormatPKCS8: | |
| 587 | 587 | if (key_data->GetKeyType() != kKeyTypePrivate) | |
| 588 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 588 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 589 | 589 | return PKEY_PKCS8_Export(key_data.get(), out); | |
| 590 | 590 | case kWebCryptoKeyFormatSPKI: | |
| 591 | 591 | if (key_data->GetKeyType() != kKeyTypePublic) | |
| 592 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 592 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 593 | 593 | return PKEY_SPKI_Export(key_data.get(), out); | |
| 594 | 594 | default: | |
| 595 | 595 | UNREACHABLE(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1261,10 +1261,10 @@ WebCryptoKeyExportStatus PKEY_SPKI_Export( | |||
| 1261 | 1261 | CHECK_EQ(key_data->GetKeyType(), kKeyTypePublic); | |
| 1262 | 1262 | BIOPointer bio(BIO_new(BIO_s_mem())); | |
| 1263 | 1263 | if (!i2d_PUBKEY_bio(bio.get(), key_data->GetAsymmetricKey().get())) | |
| 1264 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 1264 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 1265 | 1265 | ||
| 1266 | 1266 | *out = ByteSource::FromBIO(bio); | |
| 1267 | - return WebCryptoKeyExportStatus::ERR_OK; | ||
| 1267 | + return WebCryptoKeyExportStatus::OK; | ||
| 1268 | 1268 | } | |
| 1269 | 1269 | ||
| 1270 | 1270 | WebCryptoKeyExportStatus PKEY_PKCS8_Export( | |
@@ -1274,10 +1274,10 @@ WebCryptoKeyExportStatus PKEY_PKCS8_Export( | |||
| 1274 | 1274 | BIOPointer bio(BIO_new(BIO_s_mem())); | |
| 1275 | 1275 | PKCS8Pointer p8inf(EVP_PKEY2PKCS8(key_data->GetAsymmetricKey().get())); | |
| 1276 | 1276 | if (!i2d_PKCS8_PRIV_KEY_INFO_bio(bio.get(), p8inf.get())) | |
| 1277 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 1277 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 1278 | 1278 | ||
| 1279 | 1279 | *out = ByteSource::FromBIO(bio); | |
| 1280 | - return WebCryptoKeyExportStatus::ERR_OK; | ||
| 1280 | + return WebCryptoKeyExportStatus::OK; | ||
| 1281 | 1281 | } | |
| 1282 | 1282 | ||
| 1283 | 1283 | namespace Keys { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -262,9 +262,9 @@ enum WebCryptoKeyFormat { | |||
| 262 | 262 | }; | |
| 263 | 263 | ||
| 264 | 264 | enum class WebCryptoKeyExportStatus { | |
| 265 | - ERR_OK, | ||
| 266 | - ERR_INVALID_KEY_TYPE, | ||
| 267 | - ERR_FAILED | ||
| 265 | + OK, | ||
| 266 | + INVALID_KEY_TYPE, | ||
| 267 | + FAILED | ||
| 268 | 268 | }; | |
| 269 | 269 | ||
| 270 | 270 | template <typename KeyExportTraits> | |
@@ -336,13 +336,13 @@ class KeyExportJob final : public CryptoJob<KeyExportTraits> { | |||
| 336 | 336 | format_, | |
| 337 | 337 | *CryptoJob<KeyExportTraits>::params(), | |
| 338 | 338 | &out_)) { | |
| 339 | - case WebCryptoKeyExportStatus::ERR_OK: | ||
| 339 | + case WebCryptoKeyExportStatus::OK: | ||
| 340 | 340 | // Success! | |
| 341 | 341 | break; | |
| 342 | - case WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE: | ||
| 342 | + case WebCryptoKeyExportStatus::INVALID_KEY_TYPE: | ||
| 343 | 343 | // Fall through | |
| 344 | 344 | // TODO(@jasnell): Separate error for this | |
| 345 | - case WebCryptoKeyExportStatus::ERR_FAILED: { | ||
| 345 | + case WebCryptoKeyExportStatus::FAILED: { | ||
| 346 | 346 | CryptoErrorVector* errors = CryptoJob<KeyExportTraits>::errors(); | |
| 347 | 347 | errors->Capture(); | |
| 348 | 348 | if (errors->empty()) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -179,7 +179,7 @@ WebCryptoKeyExportStatus RSA_JWK_Export( | |||
| 179 | 179 | KeyObjectData* key_data, | |
| 180 | 180 | const RSAKeyExportConfig& params, | |
| 181 | 181 | ByteSource* out) { | |
| 182 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 182 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 183 | 183 | } | |
| 184 | 184 | ||
| 185 | 185 | template <PublicKeyCipher::EVP_PKEY_cipher_init_t init, | |
@@ -268,16 +268,16 @@ WebCryptoKeyExportStatus RSAKeyExportTraits::DoExport( | |||
| 268 | 268 | switch (format) { | |
| 269 | 269 | case kWebCryptoKeyFormatRaw: | |
| 270 | 270 | // Not supported for RSA keys of either type | |
| 271 | - return WebCryptoKeyExportStatus::ERR_FAILED; | ||
| 271 | + return WebCryptoKeyExportStatus::FAILED; | ||
| 272 | 272 | case kWebCryptoKeyFormatJWK: | |
| 273 | 273 | return RSA_JWK_Export(key_data.get(), params, out); | |
| 274 | 274 | case kWebCryptoKeyFormatPKCS8: | |
| 275 | 275 | if (key_data->GetKeyType() != kKeyTypePrivate) | |
| 276 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 276 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 277 | 277 | return PKEY_PKCS8_Export(key_data.get(), out); | |
| 278 | 278 | case kWebCryptoKeyFormatSPKI: | |
| 279 | 279 | if (key_data->GetKeyType() != kKeyTypePublic) | |
| 280 | - return WebCryptoKeyExportStatus::ERR_INVALID_KEY_TYPE; | ||
| 280 | + return WebCryptoKeyExportStatus::INVALID_KEY_TYPE; | ||
| 281 | 281 | return PKEY_SPKI_Export(key_data.get(), out); | |
| 282 | 282 | default: | |
| 283 | 283 | UNREACHABLE(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments