| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium 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 #include "crypto/hmac.h" | 5 #include "crypto/hmac.h" |
| 6 | 6 |
| 7 #include <nss.h> | 7 #include <nss.h> |
| 8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (PK11_DigestBegin(context.get()) != SECSuccess) { | 95 if (PK11_DigestBegin(context.get()) != SECSuccess) { |
| 96 NOTREACHED(); | 96 NOTREACHED(); |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (PK11_DigestOp(context.get(), | 100 if (PK11_DigestOp(context.get(), |
| 101 reinterpret_cast<const unsigned char*>(data.data()), | 101 reinterpret_cast<const unsigned char*>(data.data()), |
| 102 data.length()) != SECSuccess) { | 102 data.length()) != SECSuccess) { |
| 103 LOG(WARNING) << "PK11_DigestOp failed, error " << PORT_GetError() | |
| 104 << ", slot name " << PK11_GetSlotName(plat_->slot_.get()) | |
| 105 << ", token name " << PK11_GetTokenName(plat_->slot_.get()); | |
| 106 NOTREACHED(); | 103 NOTREACHED(); |
| 107 return false; | 104 return false; |
| 108 } | 105 } |
| 109 | 106 |
| 110 unsigned int len = 0; | 107 unsigned int len = 0; |
| 111 if (PK11_DigestFinal(context.get(), | 108 if (PK11_DigestFinal(context.get(), |
| 112 digest, &len, digest_length) != SECSuccess) { | 109 digest, &len, digest_length) != SECSuccess) { |
| 113 NOTREACHED(); | 110 NOTREACHED(); |
| 114 return false; | 111 return false; |
| 115 } | 112 } |
| 116 | 113 |
| 117 return true; | 114 return true; |
| 118 } | 115 } |
| 119 | 116 |
| 120 } // namespace crypto | 117 } // namespace crypto |
| OLD | NEW |