OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fdrm/crypto/fx_crypt.h" | 7 #include "core/fdrm/crypto/fx_crypt.h" |
8 | 8 |
9 #ifdef __cplusplus | 9 #ifdef __cplusplus |
10 extern "C" { | 10 extern "C" { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 if (i) { | 377 if (i) { |
378 ret <<= 4; | 378 ret <<= 4; |
379 } | 379 } |
380 if (str[i] >= '0' && str[i] <= '9') { | 380 if (str[i] >= '0' && str[i] <= '9') { |
381 ret |= (str[i] - '0') & 0xFF; | 381 ret |= (str[i] - '0') & 0xFF; |
382 } else if (str[i] >= 'a' && str[i] <= 'f') { | 382 } else if (str[i] >= 'a' && str[i] <= 'f') { |
383 ret |= (str[i] - 'a' + 10) & 0xFF; | 383 ret |= (str[i] - 'a' + 10) & 0xFF; |
384 } else if (str[i] >= 'A' && str[i] <= 'F') { | 384 } else if (str[i] >= 'A' && str[i] <= 'F') { |
385 ret |= (str[i] - 'A' + 10) & 0xFF; | 385 ret |= (str[i] - 'A' + 10) & 0xFF; |
386 } else { | 386 } else { |
387 ASSERT(FALSE); | 387 ASSERT(false); |
388 } | 388 } |
389 } | 389 } |
390 return ret; | 390 return ret; |
391 } | 391 } |
392 void CRYPT_SHA384Start(void* context) { | 392 void CRYPT_SHA384Start(void* context) { |
393 if (!context) { | 393 if (!context) { |
394 return; | 394 return; |
395 } | 395 } |
396 sha384_context* ctx = (sha384_context*)context; | 396 sha384_context* ctx = (sha384_context*)context; |
397 FXSYS_memset(ctx, 0, sizeof(sha384_context)); | 397 FXSYS_memset(ctx, 0, sizeof(sha384_context)); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 uint32_t size, | 648 uint32_t size, |
649 uint8_t digest[64]) { | 649 uint8_t digest[64]) { |
650 sha384_context context; | 650 sha384_context context; |
651 CRYPT_SHA512Start(&context); | 651 CRYPT_SHA512Start(&context); |
652 CRYPT_SHA512Update(&context, data, size); | 652 CRYPT_SHA512Update(&context, data, size); |
653 CRYPT_SHA512Finish(&context, digest); | 653 CRYPT_SHA512Finish(&context, digest); |
654 } | 654 } |
655 #ifdef __cplusplus | 655 #ifdef __cplusplus |
656 }; | 656 }; |
657 #endif | 657 #endif |
OLD | NEW |