diff options
author | Casey Bodley <cbodley@redhat.com> | 2018-08-20 17:05:39 +0200 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2018-08-20 17:05:51 +0200 |
commit | 82c26d6c440688393e1c89eb858afad445afee32 (patch) | |
tree | 5d4efe46d3dcf8eb6464fbf68ba0622679a25e03 /src/common/ceph_crypto.h | |
parent | Merge pull request #23639 from trociny/wip-24910 (diff) | |
download | ceph-82c26d6c440688393e1c89eb858afad445afee32.tar.xz ceph-82c26d6c440688393e1c89eb858afad445afee32.zip |
crypto: use ceph_assert_always for assertions
use ceph_assert_always() to enforce this comment in ceph_crypto.h:
This assert MUST NOT be compiled out, even on non-debug builds.
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | src/common/ceph_crypto.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h index a5d781eccbc..90904420801 100644 --- a/src/common/ceph_crypto.h +++ b/src/common/ceph_crypto.h @@ -33,7 +33,7 @@ namespace ceph { public: Digest (SECOidTag _type, size_t _digest_size) : digest_size(_digest_size) { ctx = PK11_CreateDigestContext(_type); - assert(ctx); + ceph_assert_always(ctx); Restart(); } ~Digest () { @@ -42,21 +42,21 @@ namespace ceph { void Restart() { SECStatus s; s = PK11_DigestBegin(ctx); - assert(s == SECSuccess); + ceph_assert_always(s == SECSuccess); } void Update (const unsigned char *input, size_t length) { if (length) { SECStatus s; s = PK11_DigestOp(ctx, input, length); - assert(s == SECSuccess); + ceph_assert_always(s == SECSuccess); } } void Final (unsigned char *digest) { SECStatus s; unsigned int dummy; s = PK11_DigestFinal(ctx, digest, &dummy, digest_size); - assert(s == SECSuccess); - assert(dummy == digest_size); + ceph_assert_always(s == SECSuccess); + ceph_assert_always(dummy == digest_size); Restart(); } }; @@ -85,39 +85,39 @@ namespace ceph { HMAC (CK_MECHANISM_TYPE cktype, unsigned int digestsize, const unsigned char *key, size_t length) { digest_size = digestsize; slot = PK11_GetBestSlot(cktype, NULL); - assert(slot); + ceph_assert_always(slot); SECItem keyItem; keyItem.type = siBuffer; keyItem.data = (unsigned char*)key; keyItem.len = length; symkey = PK11_ImportSymKey(slot, cktype, PK11_OriginUnwrap, CKA_SIGN, &keyItem, NULL); - assert(symkey); + ceph_assert_always(symkey); SECItem param; param.type = siBuffer; param.data = NULL; param.len = 0; ctx = PK11_CreateContextBySymKey(cktype, CKA_SIGN, symkey, ¶m); - assert(ctx); + ceph_assert_always(ctx); Restart(); } ~HMAC (); void Restart() { SECStatus s; s = PK11_DigestBegin(ctx); - assert(s == SECSuccess); + ceph_assert_always(s == SECSuccess); } void Update (const unsigned char *input, size_t length) { SECStatus s; s = PK11_DigestOp(ctx, input, length); - assert(s == SECSuccess); + ceph_assert_always(s == SECSuccess); } void Final (unsigned char *digest) { SECStatus s; unsigned int dummy; s = PK11_DigestFinal(ctx, digest, &dummy, digest_size); - assert(s == SECSuccess); - assert(dummy == digest_size); + ceph_assert_always(s == SECSuccess); + ceph_assert_always(dummy == digest_size); Restart(); } }; |