aboutsummaryrefslogtreecommitdiffstats
path: root/libparc/parc/security
diff options
context:
space:
mode:
Diffstat (limited to 'libparc/parc/security')
-rw-r--r--libparc/parc/security/command-line/parc-publickey.c2
-rw-r--r--libparc/parc/security/command-line/parcPublicKey_About.c2
-rwxr-xr-xlibparc/parc/security/command-line/parcPublicKey_About.h2
-rw-r--r--libparc/parc/security/parc_CertificateFactory.c2
-rwxr-xr-xlibparc/parc/security/parc_CertificateType.c2
-rwxr-xr-xlibparc/parc/security/parc_ContainerEncoding.c2
-rwxr-xr-xlibparc/parc/security/parc_CryptoCache.c20
-rwxr-xr-xlibparc/parc/security/parc_CryptoHash.c10
-rw-r--r--libparc/parc/security/parc_CryptoHashType.c2
-rwxr-xr-xlibparc/parc/security/parc_CryptoHasher.c18
-rwxr-xr-xlibparc/parc/security/parc_CryptoSuite.c10
-rw-r--r--libparc/parc/security/parc_DiffieHellmanKeyShare.c2
-rwxr-xr-xlibparc/parc/security/parc_Identity.c8
-rw-r--r--libparc/parc/security/parc_IdentityFile.c2
-rw-r--r--libparc/parc/security/parc_InMemoryVerifier.c30
-rwxr-xr-xlibparc/parc/security/parc_Key.c34
-rwxr-xr-xlibparc/parc/security/parc_KeyId.c4
-rwxr-xr-xlibparc/parc/security/parc_KeyStore.c2
-rw-r--r--libparc/parc/security/parc_KeyType.c2
-rw-r--r--libparc/parc/security/parc_Pkcs12KeyStore.c32
-rw-r--r--libparc/parc/security/parc_PublicKeySigner.c32
-rw-r--r--libparc/parc/security/parc_SecureRandom.c8
-rw-r--r--libparc/parc/security/parc_Security.c19
-rwxr-xr-xlibparc/parc/security/parc_Signature.c16
-rw-r--r--libparc/parc/security/parc_Signer.c10
-rwxr-xr-xlibparc/parc/security/parc_Signer.h2
-rwxr-xr-xlibparc/parc/security/parc_SigningAlgorithm.c2
-rw-r--r--libparc/parc/security/parc_SymmetricKeySigner.c12
-rw-r--r--libparc/parc/security/parc_SymmetricKeyStore.c18
-rwxr-xr-xlibparc/parc/security/parc_Verifier.c24
-rw-r--r--libparc/parc/security/parc_Verifier.h2
-rw-r--r--libparc/parc/security/parc_X509Certificate.c28
-rw-r--r--libparc/parc/security/test/test_parc_SymmetricKeySigner.c2
33 files changed, 176 insertions, 187 deletions
diff --git a/libparc/parc/security/command-line/parc-publickey.c b/libparc/parc/security/command-line/parc-publickey.c
index 56d35935..6b0caa08 100644
--- a/libparc/parc/security/command-line/parc-publickey.c
+++ b/libparc/parc/security/command-line/parc-publickey.c
@@ -20,7 +20,7 @@
#include <string.h>
#include <errno.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_ArrayList.h>
#include <parc/security/parc_Security.h>
diff --git a/libparc/parc/security/command-line/parcPublicKey_About.c b/libparc/parc/security/command-line/parcPublicKey_About.c
index 6a242cf4..c992de22 100644
--- a/libparc/parc/security/command-line/parcPublicKey_About.c
+++ b/libparc/parc/security/command-line/parcPublicKey_About.c
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#include "parcPublicKey_About.h"
diff --git a/libparc/parc/security/command-line/parcPublicKey_About.h b/libparc/parc/security/command-line/parcPublicKey_About.h
index 64670ad8..fccb7b7d 100755
--- a/libparc/parc/security/command-line/parcPublicKey_About.h
+++ b/libparc/parc/security/command-line/parcPublicKey_About.h
@@ -1,5 +1,5 @@
// DO NOT EDIT THIS FILE. IT IS AUTOMATICALLY GENERATED.
-// longbow-generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
+// generate-about 1.0.20170206.46e2c73a 2017-02-06T08:50:09Z
#ifndef parcPublicKey_About_h
#define parcPublicKey_About_h
diff --git a/libparc/parc/security/parc_CertificateFactory.c b/libparc/parc/security/parc_CertificateFactory.c
index 52cef4af..c737e425 100644
--- a/libparc/parc/security/parc_CertificateFactory.c
+++ b/libparc/parc/security/parc_CertificateFactory.c
@@ -91,6 +91,8 @@ parcCertificateFactory_CreateSelfSignedCertificate(PARCCertificateFactory *facto
case PARCSigningAlgorithm_ECDSA:
certificate = parcX509Certificate_CreateSelfSignedCertificate(privateKey, subjectName, (int) keyLength, valdityDays, PARCKeyType_EC);
break;
+ default:
+ break;
}
// This may fail.
diff --git a/libparc/parc/security/parc_CertificateType.c b/libparc/parc/security/parc_CertificateType.c
index 9da557fd..86581675 100755
--- a/libparc/parc/security/parc_CertificateType.c
+++ b/libparc/parc/security/parc_CertificateType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CertificateType.h>
diff --git a/libparc/parc/security/parc_ContainerEncoding.c b/libparc/parc/security/parc_ContainerEncoding.c
index 8f51031a..3376e69a 100755
--- a/libparc/parc/security/parc_ContainerEncoding.c
+++ b/libparc/parc/security/parc_ContainerEncoding.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_ContainerEncoding.h>
diff --git a/libparc/parc/security/parc_CryptoCache.c b/libparc/parc/security/parc_CryptoCache.c
index a454819b..07caaed7 100755
--- a/libparc/parc/security/parc_CryptoCache.c
+++ b/libparc/parc/security/parc_CryptoCache.c
@@ -36,7 +36,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/security/parc_CryptoCache.h>
@@ -68,7 +68,7 @@ PARCCryptoCache *
parcCryptoCache_Create()
{
PARCCryptoCache *cache = parcMemory_AllocateAndClear(sizeof(PARCCryptoCache));
- assertNotNull(cache, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoCache));
+ parcAssertNotNull(cache, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoCache));
// KeyIdDestroyer is NULL because we get the keyid out of the key, and it will be destroyed
// when the key is destroyed.
@@ -88,8 +88,8 @@ parcCryptoCache_Create()
void
parcCryptoCache_Destroy(PARCCryptoCache **cryptoCachePtr)
{
- assertNotNull(cryptoCachePtr, "Parameter must be non-null double pointer");
- assertNotNull(*cryptoCachePtr, "Parameter must dereference to non-null pointer");
+ parcAssertNotNull(cryptoCachePtr, "Parameter must be non-null double pointer");
+ parcAssertNotNull(*cryptoCachePtr, "Parameter must dereference to non-null pointer");
PARCCryptoCache *cache = *cryptoCachePtr;
parcHashCodeTable_Destroy(&cache->keyid_table);
@@ -111,8 +111,8 @@ parcCryptoCache_Destroy(PARCCryptoCache **cryptoCachePtr)
bool
parcCryptoCache_AddKey(PARCCryptoCache *cache, PARCKey *original_key)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(original_key, "Parameter key must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(original_key, "Parameter key must be non-null");
PARCKey *key = parcKey_Copy(original_key);
PARCKeyId *keyid = parcKey_GetKeyId(key);
@@ -133,8 +133,8 @@ parcCryptoCache_AddKey(PARCCryptoCache *cache, PARCKey *original_key)
const PARCKey *
parcCryptoCache_GetKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
return parcHashCodeTable_Get(cache->keyid_table, keyid);
}
@@ -150,8 +150,8 @@ parcCryptoCache_GetKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
void
parcCryptoCache_RemoveKey(PARCCryptoCache *cache, const PARCKeyId *keyid)
{
- assertNotNull(cache, "Parameter cache must be non-null");
- assertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(cache, "Parameter cache must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
parcHashCodeTable_Del(cache->keyid_table, keyid);
}
diff --git a/libparc/parc/security/parc_CryptoHash.c b/libparc/parc/security/parc_CryptoHash.c
index 3fc40b16..d0f82af3 100755
--- a/libparc/parc/security/parc_CryptoHash.c
+++ b/libparc/parc/security/parc_CryptoHash.c
@@ -28,7 +28,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoHash.h>
#include <parc/algol/parc_Memory.h>
@@ -62,7 +62,7 @@ PARCCryptoHash *
parcCryptoHash_Create(PARCCryptoHashType digestType, const PARCBuffer *digestBuffer)
{
PARCCryptoHash *parcDigest = parcObject_CreateInstance(PARCCryptoHash);
- assertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
+ parcAssertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
parcDigest->type = digestType;
parcDigest->digestBuffer = parcBuffer_Acquire((PARCBuffer *) digestBuffer); // casting to un-const
@@ -82,7 +82,7 @@ PARCCryptoHash *
parcCryptoHash_CreateFromArray(PARCCryptoHashType digestType, const void *buffer, size_t length)
{
PARCCryptoHash *parcDigest = parcObject_CreateInstance(PARCCryptoHash);
- assertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
+ parcAssertNotNull(parcDigest, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHash));
parcDigest->type = digestType;
// create a reference counted copy
@@ -103,7 +103,7 @@ parcCryptoHash_CreateFromArray(PARCCryptoHashType digestType, const void *buffer
PARCCryptoHashType
parcCryptoHash_GetDigestType(const PARCCryptoHash *parcDigest)
{
- assertNotNull(parcDigest, "Parameter must be non-null");
+ parcAssertNotNull(parcDigest, "Parameter must be non-null");
return parcDigest->type;
}
@@ -129,6 +129,6 @@ parcCryptoHash_Equals(const PARCCryptoHash *a, const PARCCryptoHash *b)
PARCBuffer *
parcCryptoHash_GetDigest(const PARCCryptoHash *parcDigest)
{
- assertNotNull(parcDigest, "Parameter must be non-null");
+ parcAssertNotNull(parcDigest, "Parameter must be non-null");
return parcDigest->digestBuffer;
}
diff --git a/libparc/parc/security/parc_CryptoHashType.c b/libparc/parc/security/parc_CryptoHashType.c
index 78440f33..beacc3f4 100644
--- a/libparc/parc/security/parc_CryptoHashType.c
+++ b/libparc/parc/security/parc_CryptoHashType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoHashType.h>
diff --git a/libparc/parc/security/parc_CryptoHasher.c b/libparc/parc/security/parc_CryptoHasher.c
index f2c00967..a4d492ff 100755
--- a/libparc/parc/security/parc_CryptoHasher.c
+++ b/libparc/parc/security/parc_CryptoHasher.c
@@ -30,7 +30,7 @@
#include <parc/security/parc_CryptoHasher.h>
#include <parc/algol/parc_Buffer.h>
#include <parc/algol/parc_Memory.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#ifdef __APPLE__
@@ -137,7 +137,7 @@ PARCCryptoHasher *
parcCryptoHasher_Create(PARCCryptoHashType type)
{
PARCCryptoHasher *hasher = parcObject_CreateInstance(PARCCryptoHasher);
- assertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
+ parcAssertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
hasher->type = type;
@@ -156,7 +156,7 @@ parcCryptoHasher_Create(PARCCryptoHashType type)
default:
parcMemory_Deallocate((void **) &hasher);
- trapIllegalValue(type, "Unknown hasher type: %d", type);
+ parcTrapIllegalValue(type, "Unknown hasher type: %d", type);
}
hasher->hasher_ctx = hasher->functor.hasher_setup(hasher->functor.functor_env);
@@ -167,7 +167,7 @@ PARCCryptoHasher *
parcCryptoHasher_CustomHasher(PARCCryptoHashType type, PARCCryptoHasherInterface functor)
{
PARCCryptoHasher *hasher = parcObject_CreateInstance(PARCCryptoHasher);
- assertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
+ parcAssertNotNull(hasher, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(PARCCryptoHasher));
hasher->type = type;
hasher->functor = functor;
hasher->hasher_ctx = hasher->functor.hasher_setup(hasher->functor.functor_env);
@@ -186,7 +186,7 @@ parcCryptoHasher_CustomHasher(PARCCryptoHashType type, PARCCryptoHasherInterface
int
parcCryptoHasher_Init(PARCCryptoHasher *digester)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
int success = digester->functor.hasher_init(digester->hasher_ctx);
return (success == 1) ? 0 : -1;
@@ -195,7 +195,7 @@ parcCryptoHasher_Init(PARCCryptoHasher *digester)
int
parcCryptoHasher_UpdateBytes(PARCCryptoHasher *digester, const void *buffer, size_t length)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
int success = digester->functor.hasher_update(digester->hasher_ctx, buffer, length);
return (success == 1) ? 0 : -1;
}
@@ -203,7 +203,7 @@ parcCryptoHasher_UpdateBytes(PARCCryptoHasher *digester, const void *buffer, siz
int
parcCryptoHasher_UpdateBuffer(PARCCryptoHasher *digester, const PARCBuffer *buffer)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
PARCBuffer *buf = parcBuffer_Slice(buffer);
size_t length = parcBuffer_Limit(buf);
void *byteArray = parcBuffer_Overlay(buf, length);
@@ -216,7 +216,7 @@ parcCryptoHasher_UpdateBuffer(PARCCryptoHasher *digester, const PARCBuffer *buff
PARCCryptoHash *
parcCryptoHasher_Finalize(PARCCryptoHasher *digester)
{
- assertNotNull(digester, "Parameter must be non-null");
+ parcAssertNotNull(digester, "Parameter must be non-null");
PARCBuffer *digestBuffer = digester->functor.hasher_finalize(digester->hasher_ctx);
if (parcBuffer_Position(digestBuffer) != 0) {
@@ -486,7 +486,7 @@ static void *
_crc32_create(void *env __attribute__ ((unused)))
{
_CRC32CState *ctx = parcMemory_AllocateAndClear(sizeof(_CRC32CState));
- assertNotNull(ctx, "parcMemory_AllocateAndClear(%zu) returned NULL for _CRC32CState", sizeof(_CRC32CState));
+ parcAssertNotNull(ctx, "parcMemory_AllocateAndClear(%zu) returned NULL for _CRC32CState", sizeof(_CRC32CState));
// Now initialize it with our digest and key, so in hmac_init we can avoid using those
return ctx;
diff --git a/libparc/parc/security/parc_CryptoSuite.c b/libparc/parc/security/parc_CryptoSuite.c
index 43339121..b7e1938b 100755
--- a/libparc/parc/security/parc_CryptoSuite.c
+++ b/libparc/parc/security/parc_CryptoSuite.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_CryptoSuite.h>
#include <parc/security/parc_SigningAlgorithm.h>
@@ -40,7 +40,7 @@ parcCryptoSuite_GetCryptoHash(PARCCryptoSuite suite)
return PARCCryptoHashType_CRC32C;
default:
- trapIllegalValue(suite, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suite, "Unknown crypto suite: %d", suite);
}
}
@@ -65,7 +65,7 @@ parcCryptoSuite_GetSignatureSizeBytes(PARCCryptoSuite suite, int keyLengthBits)
return 4;
default:
- trapIllegalValue(suite, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suite, "Unknown crypto suite: %d", suite);
}
}
@@ -81,7 +81,7 @@ PARCCryptoSuite parcCryptoSuite_GetFromSigningHash(PARCSigningAlgorithm signAlgo
case PARCSigningAlgorithm_NULL:
return PARCCryptoSuite_NULL_CRC32C;
default:
- trapIllegalValue(suite, "Unknown signing algorithm suite: %d", signAlgo);
+ parcTrapIllegalValue(suite, "Unknown signing algorithm suite: %d", signAlgo);
}
}
@@ -106,6 +106,6 @@ parcCryptoSuite_GetSigningAlgorithm(PARCCryptoSuite suite)
return PARCSigningAlgorithm_NULL;
default:
- trapIllegalValue(suit, "Unknown crypto suite: %d", suite);
+ parcTrapIllegalValue(suit, "Unknown crypto suite: %d", suite);
}
}
diff --git a/libparc/parc/security/parc_DiffieHellmanKeyShare.c b/libparc/parc/security/parc_DiffieHellmanKeyShare.c
index 250e5664..313af4a3 100644
--- a/libparc/parc/security/parc_DiffieHellmanKeyShare.c
+++ b/libparc/parc/security/parc_DiffieHellmanKeyShare.c
@@ -130,7 +130,7 @@ parcDiffieHellmanKeyShare_Create(PARCDiffieHellmanGroup groupType)
}
if (keyShare->privateKey == NULL) {
- assertTrue(false, "Unable to instantiate a private key.");
+ parcAssertTrue(false, "Unable to instantiate a private key.");
parcDiffieHellmanKeyShare_Release(&keyShare);
}
}
diff --git a/libparc/parc/security/parc_Identity.c b/libparc/parc/security/parc_Identity.c
index b48046ba..daaf661d 100755
--- a/libparc/parc/security/parc_Identity.c
+++ b/libparc/parc/security/parc_Identity.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/security/parc_Identity.h>
@@ -53,13 +53,13 @@ parcIdentity_IsValid(const PARCIdentity *identity)
void
parcIdentity_AssertValid(const PARCIdentity *identity)
{
- trapInvalidValueIf(parcIdentity_IsValid(identity) == false, "PARCIdentity");
+ parcTrapInvalidValueIf(parcIdentity_IsValid(identity) == false, "PARCIdentity");
}
PARCIdentity *
parcIdentity_Create(PARCObject *instance, const PARCIdentityInterface *interface)
{
- assertNotNull(interface, "Got null interface in parcIdentity_Create");
+ parcAssertNotNull(interface, "Got null interface in parcIdentity_Create");
PARCIdentity *result = parcObject_CreateInstance(PARCIdentity);
@@ -107,7 +107,7 @@ parcIdentity_CreateSigner(const PARCIdentity *identity, PARCCryptoHashType hash)
void
parcIdentity_Display(const PARCIdentity *identity, int indentation)
{
- assertNotNull(identity->interface->Display, "Got null implementation in parcIdentity_Display");
+ parcAssertNotNull(identity->interface->Display, "Got null implementation in parcIdentity_Display");
parcDisplayIndented_PrintLine(indentation, "PARCIdentity@%p {", identity);
parcDisplayIndented_PrintLine(indentation, ".instance=");
diff --git a/libparc/parc/security/parc_IdentityFile.c b/libparc/parc/security/parc_IdentityFile.c
index 0d22a51e..8372a111 100644
--- a/libparc/parc/security/parc_IdentityFile.c
+++ b/libparc/parc/security/parc_IdentityFile.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/libparc/parc/security/parc_InMemoryVerifier.c b/libparc/parc/security/parc_InMemoryVerifier.c
index c3af4d7d..33f6fcfe 100644
--- a/libparc/parc/security/parc_InMemoryVerifier.c
+++ b/libparc/parc/security/parc_InMemoryVerifier.c
@@ -27,7 +27,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_InMemoryVerifier.h>
#include <parc/security/parc_CryptoHasher.h>
#include <parc/security/parc_CryptoCache.h>
@@ -88,7 +88,7 @@ _parcInMemoryVerifier_GetCryptoHasher(void *interfaceContext, PARCKeyId *keyid,
return false;
}
- assertFalse(parcKey_GetSigningAlgorithm(key) == PARCSigningAlgorithm_HMAC, "HMAC not supported yet");
+ parcAssertFalse(parcKey_GetSigningAlgorithm(key) == PARCSigningAlgorithm_HMAC, "HMAC not supported yet");
switch (hashType) {
case PARCCryptoHashType_SHA256:
@@ -98,7 +98,7 @@ _parcInMemoryVerifier_GetCryptoHasher(void *interfaceContext, PARCKeyId *keyid,
return verifier->hasher_sha512;
default:
- trapUnexpectedState("unsupported hash type: %d", hashType);
+ parcTrapUnexpectedState("unsupported hash type: %d", hashType);
}
}
@@ -154,7 +154,7 @@ _parcInMemoryVerifier_AllowedCryptoSuite(void *interfaceContext, PARCKeyId *keyi
break;
default:
- trapUnexpectedState("Unknown signing algorithm: %s",
+ parcTrapUnexpectedState("Unknown signing algorithm: %s",
parcSigningAlgorithm_ToString(parcKey_GetSigningAlgorithm(key)));
return false;
}
@@ -190,7 +190,7 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
return false;
}
- assertTrue(_parcInMemoryVerifier_AllowedCryptoSuite(interfaceContext, keyid, suite), "Invalid crypto suite for keyid");
+ parcAssertTrue(_parcInMemoryVerifier_AllowedCryptoSuite(interfaceContext, keyid, suite), "Invalid crypto suite for keyid");
if (parcKey_GetSigningAlgorithm(key) != parcSignature_GetSigningAlgorithm(objectSignature)) {
fprintf(stdout, "Signatured failed, signing algorithms do not match: key %s sig %s\n",
@@ -214,15 +214,15 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
return _parcInMemoryVerifier_ECDSAKey_Verify(verifier, locallyComputedHash, objectSignature, parcKey_GetKey(key));
case PARCSigningAlgorithm_DSA:
- trapNotImplemented("DSA not supported");
+ parcTrapNotImplemented("DSA not supported");
break;
case PARCSigningAlgorithm_HMAC:
- trapNotImplemented("HMAC not supported");
+ parcTrapNotImplemented("HMAC not supported");
break;
default:
- trapUnexpectedState("Unknown signing algorithm: %d", parcSignature_GetSigningAlgorithm(objectSignature));
+ parcTrapUnexpectedState("Unknown signing algorithm: %d", parcSignature_GetSigningAlgorithm(objectSignature));
}
@@ -232,19 +232,19 @@ _parcInMemoryVerifier_VerifyDigest(void *interfaceContext, PARCKeyId *keyid, PAR
static void
_parcInMemoryVerifier_AddKey(void *interfaceContext, PARCKey *key)
{
- assertNotNull(interfaceContext, "interfaceContext must be non-null");
- assertNotNull(key, "key must be non-null");
+ parcAssertNotNull(interfaceContext, "interfaceContext must be non-null");
+ parcAssertNotNull(key, "key must be non-null");
PARCInMemoryVerifier *verifier = (PARCInMemoryVerifier *) interfaceContext;
bool success = parcCryptoCache_AddKey(verifier->key_cache, key);
- assertTrue(success, "could not add key, it must be a duplicate");
+ parcAssertTrue(success, "could not add key, it must be a duplicate");
}
static void
_parcInMemoryVerifier_RemoveKeyId(void *interfaceContext, PARCKeyId *keyid)
{
- assertNotNull(interfaceContext, "interfaceContent must be non-null");
- assertNotNull(keyid, "key must be non-null");
+ parcAssertNotNull(interfaceContext, "interfaceContent must be non-null");
+ parcAssertNotNull(keyid, "key must be non-null");
PARCInMemoryVerifier *verifier = (PARCInMemoryVerifier *) interfaceContext;
parcCryptoCache_RemoveKey(verifier->key_cache, keyid);
@@ -293,7 +293,7 @@ _parcInMemoryVerifier_RSAKey_Verify(PARCInMemoryVerifier *verifier, PARCCryptoHa
openssl_digest_type = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(localHash)));
}
@@ -355,7 +355,7 @@ _parcInMemoryVerifier_ECDSAKey_Verify(PARCInMemoryVerifier *verifier, PARCCrypto
openssl_digest_type = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(localHash)));
}
diff --git a/libparc/parc/security/parc_Key.c b/libparc/parc/security/parc_Key.c
index 3802549e..82d21244 100755
--- a/libparc/parc/security/parc_Key.c
+++ b/libparc/parc/security/parc_Key.c
@@ -24,7 +24,7 @@
#include <parc/security/parc_Key.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
struct parc_key {
PARCKeyId *keyid;
@@ -62,8 +62,8 @@ _parcKey_Create()
PARCKey *
parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg, PARCBuffer *derEncodedKey)
{
- assertNotNull(keyid, "Parameter keyid must be non-null");
- assertNotNull(derEncodedKey, "Parameter derEncodedKey must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(derEncodedKey, "Parameter derEncodedKey must be non-null");
// Exclude the symmetric key algorithms
switch (signingAlg) {
@@ -73,11 +73,11 @@ parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm sig
break;
default:
- trapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
+ parcTrapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
}
PARCKey *key = _parcKey_Create();
- assertNotNull(key, "Unable to allocate memory for PARCKey");
+ parcAssertNotNull(key, "Unable to allocate memory for PARCKey");
key->key = parcBuffer_Acquire(derEncodedKey);
key->signingAlg = signingAlg;
@@ -95,8 +95,8 @@ parcKey_CreateFromDerEncodedPublicKey(PARCKeyId *keyid, PARCSigningAlgorithm sig
PARCKey *
parcKey_CreateFromSymmetricKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg, PARCBuffer *secretkey)
{
- assertNotNull(keyid, "Parameter keyid must be non-null");
- assertNotNull(secretkey, "Parameter derEncodedKey must be non-null");
+ parcAssertNotNull(keyid, "Parameter keyid must be non-null");
+ parcAssertNotNull(secretkey, "Parameter derEncodedKey must be non-null");
// Exclude the symmetric key algorithms
switch (signingAlg) {
@@ -104,11 +104,11 @@ parcKey_CreateFromSymmetricKey(PARCKeyId *keyid, PARCSigningAlgorithm signingAlg
break;
default:
- trapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
+ parcTrapIllegalValueIf(true, "Unknown key algorithm or symmetric key algorithm: %s\n", parcSigningAlgorithm_ToString(signingAlg));
}
PARCKey *key = _parcKey_Create();
- assertNotNull(key, "Unable to allocate memory for PARCKey");
+ parcAssertNotNull(key, "Unable to allocate memory for PARCKey");
key->key = parcBuffer_Acquire(secretkey);
key->signingAlg = signingAlg;
@@ -127,29 +127,29 @@ parcObject_ImplementRelease(parcKey, PARCKey);
void
parcKey_AssertValid(PARCKey *keyPtr)
{
- assertNotNull(keyPtr, "Parameter must be non-null double pointer");
- assertNotNull(keyPtr->key, "Parameter key must not be null");
- assertNotNull(keyPtr->keyid, "Parameter keyId must not be null");
+ parcAssertNotNull(keyPtr, "Parameter must be non-null double pointer");
+ parcAssertNotNull(keyPtr->key, "Parameter key must not be null");
+ parcAssertNotNull(keyPtr->keyid, "Parameter keyId must not be null");
}
PARCKeyId *
parcKey_GetKeyId(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->keyid;
}
PARCSigningAlgorithm
parcKey_GetSigningAlgorithm(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->signingAlg;
}
PARCBuffer *
parcKey_GetKey(const PARCKey *key)
{
- assertNotNull(key, "Parameter must be non-null");
+ parcAssertNotNull(key, "Parameter must be non-null");
return key->key;
}
@@ -183,7 +183,7 @@ PARCKey *
parcKey_Copy(const PARCKey *original)
{
PARCKey *newkey = _parcKey_Create();
- assertNotNull(newkey, "Unable to allocate memory for a new key");
+ parcAssertNotNull(newkey, "Unable to allocate memory for a new key");
newkey->key = parcBuffer_Copy(original->key);
newkey->keyid = parcKeyId_Copy(original->keyid);
newkey->signingAlg = original->signingAlg;
@@ -197,7 +197,7 @@ parcKey_ToString(const PARCKey *key)
int failure = asprintf(&string, "PARCKey {.KeyID=\"%s\", .SigningAlgorithm=\"%s\" }",
parcKeyId_ToString(key->keyid),
parcSigningAlgorithm_ToString(key->signingAlg));
- assertTrue(failure > -1, "Error asprintf");
+ parcAssertTrue(failure > -1, "Error asprintf");
char *result = parcMemory_StringDuplicate(string, strlen(string));
free(string);
diff --git a/libparc/parc/security/parc_KeyId.c b/libparc/parc/security/parc_KeyId.c
index 1dbd9512..45e7454b 100755
--- a/libparc/parc/security/parc_KeyId.c
+++ b/libparc/parc/security/parc_KeyId.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyId.h>
@@ -46,7 +46,7 @@ parcObject_ExtendPARCObject(PARCKeyId, _parcKeyId_Destroy, NULL, NULL, NULL, NUL
void
parcKeyId_AssertValid(const PARCKeyId *keyId)
{
- assertNotNull(keyId, "Pointer must be a non-null pointer to a PARCKeyId");
+ parcAssertNotNull(keyId, "Pointer must be a non-null pointer to a PARCKeyId");
}
PARCKeyId *
diff --git a/libparc/parc/security/parc_KeyStore.c b/libparc/parc/security/parc_KeyStore.c
index 753fe118..6d4a724a 100755
--- a/libparc/parc/security/parc_KeyStore.c
+++ b/libparc/parc/security/parc_KeyStore.c
@@ -17,7 +17,7 @@
*/
#include <config.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyStore.h>
#include <parc/algol/parc_Memory.h>
diff --git a/libparc/parc/security/parc_KeyType.c b/libparc/parc/security/parc_KeyType.c
index 62fc0000..695f4613 100644
--- a/libparc/parc/security/parc_KeyType.c
+++ b/libparc/parc/security/parc_KeyType.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_KeyType.h>
diff --git a/libparc/parc/security/parc_Pkcs12KeyStore.c b/libparc/parc/security/parc_Pkcs12KeyStore.c
index c0d673c4..f6c65e4f 100644
--- a/libparc/parc/security/parc_Pkcs12KeyStore.c
+++ b/libparc/parc/security/parc_Pkcs12KeyStore.c
@@ -23,8 +23,7 @@
#include <fcntl.h>
#include <unistd.h>
-#include <LongBow/runtime.h>
-#include <LongBow/longBow_Compiler.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
@@ -65,7 +64,7 @@ struct parc_pkcs12_keystore {
static bool
_parcPkcs12KeyStore_Finalize(PARCPkcs12KeyStore **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPkcs12KeyStore pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPkcs12KeyStore pointer.");
PARCPkcs12KeyStore *keystore = *instancePtr;
EVP_PKEY_free(keystore->private_key);
@@ -105,7 +104,7 @@ _parcPkcs12KeyStore_ParseFile(PARCPkcs12KeyStore *keystore, const char *filename
FILE *fp = fopen(filename, "rb");
- assertNotNull(fp, "Error opening %s: %s", filename, strerror(errno));
+ parcAssertNotNull(fp, "Error opening %s: %s", filename, strerror(errno));
if (fp == NULL) {
return -1;
}
@@ -149,10 +148,6 @@ _parcPkcs12KeyStore_ParseFile(PARCPkcs12KeyStore *keystore, const char *filename
return 0;
}
-// =============================================================
-LONGBOW_STOP_DEPRECATED_WARNINGS
-// =============================================================
-
PKCS12 *_createPkcs12KeyStore_RSA(
PARCBuffer *privateKeyBuffer,
PARCCertificate *certificate,
@@ -264,11 +259,11 @@ parcPkcs12KeyStore_CreateFile(
fclose(fp);
result = true;
} else {
- trapUnrecoverableState("Cannot fdopen(3) the file descriptor %d", fd);
+ parcTrapUnrecoverableState("Cannot fdopen(3) the file descriptor %d", fd);
}
close(fd);
} else {
- trapUnrecoverableState("Cannot open(2) the file '%s': %s", filename, strerror(errno));
+ parcTrapUnrecoverableState("Cannot open(2) the file '%s': %s", filename, strerror(errno));
}
PKCS12_free(pkcs12);
} else {
@@ -276,7 +271,7 @@ parcPkcs12KeyStore_CreateFile(
while ((errcode = ERR_get_error()) != 0) {
fprintf(stderr, "openssl error: %s\n", ERR_error_string(errcode, NULL));
}
- trapUnrecoverableState("PKCS12_create returned a NULL value.");
+ parcTrapUnrecoverableState("PKCS12_create returned a NULL value.");
}
}
@@ -313,7 +308,7 @@ _GetPublickKeyDigest(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
#if 0
if (keystore->public_key_digest == NULL) {
@@ -341,7 +336,7 @@ _GetPublickKeyDigest(PARCPkcs12KeyStore *keystore)
digestBuffer,
NULL);
if (result != 1) {
- assertTrue(0, "Could not compute digest over certificate public key");
+ parcAssertTrue(0, "Could not compute digest over certificate public key");
} else {
keystore->public_key_digest =
parcBuffer_PutArray(parcBuffer_Allocate(SHA256_DIGEST_LENGTH), SHA256_DIGEST_LENGTH, digestBuffer);
@@ -359,7 +354,7 @@ _GetCertificateDigest(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->certificate_digest == NULL) {
uint8_t digestBuffer[SHA256_DIGEST_LENGTH];
@@ -379,7 +374,7 @@ _GetDEREncodedCertificate(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->certificate_der == NULL) {
uint8_t *der = NULL;
@@ -401,7 +396,7 @@ _GetDEREncodedPublicKey(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->public_key_der == NULL) {
uint8_t *der = NULL;
@@ -423,7 +418,7 @@ _GetDEREncodedPrivateKey(PARCPkcs12KeyStore *keystore)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
+ parcAssertNotNull(keystore, "Parameter must be non-null PARCPkcs12KeyStore");
if (keystore->private_key_der == NULL) {
uint8_t *der = NULL;
@@ -449,6 +444,3 @@ PARCKeyStoreInterface *PARCPkcs12KeyStoreAsKeyStore = &(PARCKeyStoreInterface) {
.getSigningAlgorithm = (PARCKeyStoreGetSigningAlgorithm *) _GetSigningAlgorithm,
};
-// =============================================================
-LONGBOW_START_DEPRECATED_WARNINGS
-// =============================================================
diff --git a/libparc/parc/security/parc_PublicKeySigner.c b/libparc/parc/security/parc_PublicKeySigner.c
index 3c70a139..1297611e 100644
--- a/libparc/parc/security/parc_PublicKeySigner.c
+++ b/libparc/parc/security/parc_PublicKeySigner.c
@@ -41,7 +41,7 @@ struct PARCPublicKeySigner {
static bool
_parcPublicKeySigner_Finalize(PARCPublicKeySigner **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPublicKeySigner pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCPublicKeySigner pointer.");
PARCPublicKeySigner *instance = *instancePtr;
@@ -58,7 +58,7 @@ _parcPublicKeySigner_Finalize(PARCPublicKeySigner **instancePtr)
void
parcPublicKeySigner_AssertValid(const PARCPublicKeySigner *instance)
{
- assertTrue(parcPublicKeySigner_IsValid(instance), "PARCPublicKeySigner is not valid.");
+ parcAssertTrue(parcPublicKeySigner_IsValid(instance), "PARCPublicKeySigner is not valid.");
}
bool
@@ -140,28 +140,28 @@ parcPublicKeySigner_Create(PARCKeyStore *keyStore, PARCCryptoSuite suite)
static PARCSigningAlgorithm
_GetSigningAlgorithm(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->signingAlgorithm;
}
static PARCCryptoHashType
_GetCryptoHashType(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->hashType;
}
static PARCCryptoHasher *
_GetCryptoHasher(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->hasher;
}
static PARCKeyStore *
_GetKeyStore(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCCryptoHasher");
return signer->keyStore;
}
@@ -175,7 +175,7 @@ static inline int _SignDigestRSA(const PARCCryptoHash *digestToSign, PARCBuffer
RSA *rsa = EVP_PKEY_get1_RSA(privateKey);
*sig = parcMemory_Allocate(RSA_size(rsa));
- assertNotNull(*sig, "parcMemory_Allocate(%u) returned NULL", RSA_size(rsa));
+ parcAssertNotNull(*sig, "parcMemory_Allocate(%u) returned NULL", RSA_size(rsa));
*sigLength = 0;
PARCBuffer *bb_digest = parcCryptoHash_GetDigest(digestToSign);
@@ -185,7 +185,7 @@ static inline int _SignDigestRSA(const PARCCryptoHash *digestToSign, PARCBuffer
*sig,
sigLength,
rsa);
- assertTrue(result == 1, "Got error from RSA_sign: %d", result);
+ parcAssertTrue(result == 1, "Got error from RSA_sign: %d", result);
EVP_PKEY_free(privateKey);
RSA_free(rsa);
return result;
@@ -201,7 +201,7 @@ static inline int _SignDigestECDSA(const PARCCryptoHash *digestToSign, PARCBuffe
EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(privateKey);
*sig = parcMemory_Allocate(ECDSA_size(ec_key));
- assertNotNull(sig, "parcMemory_Allocate(%u) returned NULL", ECDSA_size(ec_key));
+ parcAssertNotNull(sig, "parcMemory_Allocate(%u) returned NULL", ECDSA_size(ec_key));
*sigLength = 0;
PARCBuffer *bb_digest = parcCryptoHash_GetDigest(digestToSign);
@@ -211,9 +211,9 @@ static inline int _SignDigestECDSA(const PARCCryptoHash *digestToSign, PARCBuffe
*sig,
sigLength,
ec_key);
- assertTrue(result == 1, "Got error from ECDSA_sign: %d", result);
+ parcAssertTrue(result == 1, "Got error from ECDSA_sign: %d", result);
EC_KEY_free(ec_key);
-
+ return result;
}
static PARCSignature *
@@ -221,8 +221,8 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
- assertNotNull(digestToSign, "Buffer to sign must not be null");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(digestToSign, "Buffer to sign must not be null");
// TODO: what is the best way to expose this?
PARCKeyStore *keyStore = signer->keyStore;
@@ -240,7 +240,7 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
opensslDigestType = NID_sha512;
break;
default:
- trapUnexpectedState("Unknown digest type: %s",
+ parcTrapUnexpectedState("Unknown digest type: %s",
parcCryptoHashType_ToString(parcCryptoHash_GetDigestType(digestToSign)));
}
@@ -272,7 +272,7 @@ _SignDigest(PARCPublicKeySigner *signer, const PARCCryptoHash *digestToSign)
static size_t
_GetSignatureSize(PARCPublicKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
// TODO: what is the best way to expose this?
PARCKeyStore *keyStore = signer->keyStore;
@@ -307,6 +307,8 @@ _GetSignatureSize(PARCPublicKeySigner *signer)
EVP_PKEY_free(privateKey);
break;
}
+ default:
+ break;
}
parcBuffer_Release(&privateKeyBuffer);
diff --git a/libparc/parc/security/parc_SecureRandom.c b/libparc/parc/security/parc_SecureRandom.c
index 8ebf7f0f..92c308c1 100644
--- a/libparc/parc/security/parc_SecureRandom.c
+++ b/libparc/parc/security/parc_SecureRandom.c
@@ -35,7 +35,7 @@ struct parc_securerandom {
static bool
_parcSecureRandom_Destructor(PARCSecureRandom **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSecureRandom pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSecureRandom pointer.");
PARCSecureRandom *instance = *instancePtr;
close(instance->randomfd);
@@ -51,7 +51,7 @@ parcObject_Override(PARCSecureRandom, PARCObject,
void
parcSecureRandom_AssertValid(const PARCSecureRandom *instance)
{
- assertTrue(parcSecureRandom_IsValid(instance),
+ parcAssertTrue(parcSecureRandom_IsValid(instance),
"PARCSecureRandom is not valid.");
}
@@ -77,7 +77,7 @@ static void
_parcSecureRandom_ReSeed(PARCSecureRandom *random, PARCBuffer *buffer)
{
size_t length = parcBuffer_Remaining(buffer);
- write(random->randomfd, parcBuffer_Overlay(buffer, length), length);
+ int wrote_bytes = write(random->randomfd, parcBuffer_Overlay(buffer, length), length);
}
PARCSecureRandom *
@@ -96,7 +96,7 @@ uint32_t
parcSecureRandom_Next(PARCSecureRandom *random)
{
uint32_t value;
- read(random->randomfd, &value, sizeof(value));
+ int read_bytes = read(random->randomfd, &value, sizeof(value));
return value;
}
diff --git a/libparc/parc/security/parc_Security.c b/libparc/parc/security/parc_Security.c
index 70731ba3..e5f7609d 100644
--- a/libparc/parc/security/parc_Security.c
+++ b/libparc/parc/security/parc_Security.c
@@ -26,7 +26,7 @@
#include <pthread.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_Security.h>
#include <parc/algol/parc_Memory.h>
@@ -50,7 +50,6 @@
#error OpenSSL version must be at least 0.9.8 release
#endif
-// Use the LongBow aids for this (case 999)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -77,7 +76,7 @@ _lockingCallback(int mode, int type, const char *file __attribute__((unused)), i
error = pthread_mutex_unlock(&(perThreadLocks[type]));
}
- assertTrue(error == 0, "Error in pthreads: (%d) %s", errno, strerror(errno));
+ parcAssertTrue(error == 0, "Error in pthreads: (%d) %s", errno, strerror(errno));
}
#if OPENSSL_VERSION_NUMBER < 0x1000005fL
@@ -92,7 +91,7 @@ _getThreadId(void)
#if defined(__APPLE__)
uint64_t threadid = 0;
int error = pthread_threadid_np(pthread_self(), &threadid);
- assertTrue(error == 0, "Error getting threadid");
+ parcAssertTrue(error == 0, "Error getting threadid");
return (unsigned long) threadid;
#elif defined(__linux__)
// linux (at least ubuntu and redhat) uses unsigned long int
@@ -131,7 +130,7 @@ static void
_initLocks(void)
{
perThreadLocks = parcMemory_AllocateAndClear(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
- assertNotNull(perThreadLocks, "parcMemory_AllocateAndClear(%zu) returned NULL",
+ parcAssertNotNull(perThreadLocks, "parcMemory_AllocateAndClear(%zu) returned NULL",
CRYPTO_num_locks() * sizeof(pthread_mutex_t));
for (int i = 0; i < CRYPTO_num_locks(); i++) {
@@ -161,14 +160,14 @@ _finiLocks(void)
void
parcSecurity_AssertIsInitialized(void)
{
- trapUnexpectedStateIf(parcSecurity_IsInitialized() == false, "PARC Security framework is not initialized. See parcSecurity_Init()");
+ parcTrapUnexpectedStateIf(parcSecurity_IsInitialized() == false, "PARC Security framework is not initialized. See parcSecurity_Init()");
}
void
parcSecurity_Init(void)
{
int lockSuccessful = pthread_mutex_lock(&parcSecurity_mutex) == 0;
- assertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
+ parcAssertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
if (!parcSecurity_initialized) {
_initLocks();
@@ -180,7 +179,7 @@ parcSecurity_Init(void)
parcSecurity_count++;
int unlockSuccessful = pthread_mutex_unlock(&parcSecurity_mutex) == 0;
- assertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
+ parcAssertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
}
bool
@@ -193,7 +192,7 @@ void
parcSecurity_Fini(void)
{
int lockSuccessful = pthread_mutex_lock(&parcSecurity_mutex) == 0;
- assertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
+ parcAssertTrue(lockSuccessful, "Unable to lock the PARC Security framework.");
parcSecurity_count--;
if (parcSecurity_count == 0) {
@@ -204,7 +203,7 @@ parcSecurity_Fini(void)
}
int unlockSuccessful = pthread_mutex_unlock(&parcSecurity_mutex) == 0;
- assertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
+ parcAssertTrue(unlockSuccessful, "Unable to unlock the PARC Security framework.");
}
#pragma GCC diagnostic pop
diff --git a/libparc/parc/security/parc_Signature.c b/libparc/parc/security/parc_Signature.c
index 1021b2a4..4b1abc06 100755
--- a/libparc/parc/security/parc_Signature.c
+++ b/libparc/parc/security/parc_Signature.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/security/parc_Signature.h>
@@ -42,10 +42,10 @@ parcObject_ExtendPARCObject(PARCSignature, _parcSignature_FinalRelease, NULL, NU
PARCSignature *
parcSignature_Create(PARCSigningAlgorithm signingAlgorithm, PARCCryptoHashType hashType, PARCBuffer *signatureBits)
{
- assertNotNull(signatureBits, "SignatureBits Parameter cannot be null");
+ parcAssertNotNull(signatureBits, "SignatureBits Parameter cannot be null");
PARCSignature *signature = parcObject_CreateInstance(PARCSignature);
- assertNotNull(signature, "parcObject_CreateInstance(%zu) returned NULL", sizeof(PARCSignature));
+ parcAssertNotNull(signature, "parcObject_CreateInstance(%zu) returned NULL", sizeof(PARCSignature));
signature->signingAlgorithm = signingAlgorithm;
signature->hashType = hashType;
@@ -62,28 +62,28 @@ parcObject_ImplementRelease(parcSignature, PARCSignature);
PARCSigningAlgorithm
parcSignature_GetSigningAlgorithm(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->signingAlgorithm;
}
PARCCryptoHashType
parcSignature_GetHashType(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->hashType;
}
PARCBuffer *
parcSignature_GetSignature(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be non-null");
+ parcAssertNotNull(signature, "Parameter must be non-null");
return signature->signatureBits;
}
char *
parcSignature_ToString(const PARCSignature *signature)
{
- assertNotNull(signature, "Parameter must be a non-null CCNxSignature pointer");
+ parcAssertNotNull(signature, "Parameter must be a non-null CCNxSignature pointer");
char *bits = parcBuffer_ToString(signature->signatureBits);
@@ -92,7 +92,7 @@ parcSignature_ToString(const PARCSignature *signature)
signature->signingAlgorithm,
signature->hashType,
bits);
- assertTrue(nwritten >= 0, "Error calling asprintf");
+ parcAssertTrue(nwritten >= 0, "Error calling asprintf");
parcMemory_Deallocate((void **) &bits);
diff --git a/libparc/parc/security/parc_Signer.c b/libparc/parc/security/parc_Signer.c
index 5287c97b..70b8f616 100644
--- a/libparc/parc/security/parc_Signer.c
+++ b/libparc/parc/security/parc_Signer.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Memory.h>
#include <parc/algol/parc_Object.h>
@@ -44,7 +44,7 @@ _parcSigner_FinalRelease(PARCSigner **signerPtr)
void
parcSigner_AssertValid(const PARCSigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null PARCSigner");
+ parcAssertNotNull(signer, "Parameter must be non-null PARCSigner");
}
parcObject_ImplementAcquire(parcSigner, PARCSigner);
@@ -56,7 +56,7 @@ parcObject_Override(PARCSigner, PARCObject,
PARCSigner *
parcSigner_Create(PARCObject *instance, PARCSigningInterface *interfaceContext)
{
- assertNotNull(interfaceContext, "Parameter must be non-null implementation pointer");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null implementation pointer");
PARCSigner *signer = parcObject_CreateInstance(PARCSigner);
if (signer != NULL) {
@@ -112,7 +112,7 @@ parcSigner_SignDigest(const PARCSigner *signer, const PARCCryptoHash *parcDigest
{
parcSigner_OptionalAssertValid(signer);
- assertNotNull(parcDigest, "parcDigest to sign must not be null");
+ parcAssertNotNull(parcDigest, "parcDigest to sign must not be null");
return signer->interface->SignDigest(signer->instance, parcDigest);
}
@@ -120,7 +120,7 @@ PARCSignature *
parcSigner_SignBuffer(const PARCSigner *signer, const PARCBuffer *buffer)
{
parcSigner_OptionalAssertValid(signer);
- assertNotNull(buffer, "buffer to sign must not be null");
+ parcAssertNotNull(buffer, "buffer to sign must not be null");
PARCCryptoHashType hashType = parcSigner_GetCryptoHashType(signer);
PARCCryptoHasher *hasher = parcCryptoHasher_Create(hashType);
diff --git a/libparc/parc/security/parc_Signer.h b/libparc/parc/security/parc_Signer.h
index 1e675c50..bee68fd2 100755
--- a/libparc/parc/security/parc_Signer.h
+++ b/libparc/parc/security/parc_Signer.h
@@ -129,7 +129,7 @@ typedef struct parc_signer_interface {
/**
* Assert that an instance of `PARCSigner` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its
* required current or future behaviour.
diff --git a/libparc/parc/security/parc_SigningAlgorithm.c b/libparc/parc/security/parc_SigningAlgorithm.c
index 5803f675..4d1765d7 100755
--- a/libparc/parc/security/parc_SigningAlgorithm.c
+++ b/libparc/parc/security/parc_SigningAlgorithm.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_SigningAlgorithm.h>
diff --git a/libparc/parc/security/parc_SymmetricKeySigner.c b/libparc/parc/security/parc_SymmetricKeySigner.c
index b06389dd..9f760326 100644
--- a/libparc/parc/security/parc_SymmetricKeySigner.c
+++ b/libparc/parc/security/parc_SymmetricKeySigner.c
@@ -68,13 +68,13 @@ _hmacCreate(void *env)
#else
// HMAC_Init_ex seems to overrun the size of HMAC_CTX, so make it bigger
HMAC_CTX *ctx = parcMemory_Allocate(sizeof(HMAC_CTX) * 2);
- assertNotNull(ctx, "parcMemory_Allocate(%zu) returned NULL for HMAC_CTX", sizeof(HMAC_CTX) * 2);
+ parcAssertNotNull(ctx, "parcMemory_Allocate(%zu) returned NULL for HMAC_CTX", sizeof(HMAC_CTX) * 2);
HMAC_CTX_init(ctx);
#endif
// Now initialize it with our digest and key, so in hmac_init we can avoid using those
PARCBuffer *secretKey = parcSymmetricKeyStore_GetKey(signer->keyStore);
- assertTrue(parcBuffer_Remaining(secretKey) < 512, "The keystore secret key cannot be longer than %d", 512);
+ parcAssertTrue(parcBuffer_Remaining(secretKey) < 512, "The keystore secret key cannot be longer than %d", 512);
HMAC_Init_ex(ctx, parcByteArray_Array(parcBuffer_Array(secretKey)), (int) parcBuffer_Remaining(secretKey), signer->opensslMd, NULL);
@@ -133,7 +133,7 @@ static PARCCryptoHasherInterface functor_hmac = {
static bool
_parcSymmetricKeySigner_Finalize(PARCSymmetricKeySigner **instancePtr)
{
- assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSymmetricKeySigner pointer.");
+ parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSymmetricKeySigner pointer.");
PARCSymmetricKeySigner *signer = (PARCSymmetricKeySigner *) *instancePtr;
if (signer->secretKeyHash != NULL) {
parcCryptoHash_Release(&signer->secretKeyHash);
@@ -161,7 +161,7 @@ parcObject_Override(PARCSymmetricKeySigner, PARCObject,
void
parcSymmetricKeySigner_AssertValid(const PARCSymmetricKeySigner *instance)
{
- assertTrue(parcSymmetricKeySigner_IsValid(instance),
+ parcAssertTrue(parcSymmetricKeySigner_IsValid(instance),
"PARCSymmetricKeySigner is not valid.");
}
@@ -185,7 +185,7 @@ parcSymmetricKeySigner_Create(PARCSymmetricKeyStore *keyStore, PARCCryptoHashTyp
default:
parcObject_Release((void **) &result);
- trapIllegalValue(hmacHashType, "Unknown HMAC hash type: %d", hmacHashType);
+ parcTrapIllegalValue(hmacHashType, "Unknown HMAC hash type: %d", hmacHashType);
}
// the signer key digest is SHA256, independent of the HMAC digest
@@ -243,7 +243,7 @@ _getKeyStore(PARCSymmetricKeySigner *signer)
static size_t
_GetSignatureSize(PARCSymmetricKeySigner *signer)
{
- assertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
+ parcAssertNotNull(signer, "Parameter must be non-null CCNxFileKeystore");
// TODO: what is the best way to expose this?
PARCSymmetricKeyStore *keyStore = signer->keyStore;
diff --git a/libparc/parc/security/parc_SymmetricKeyStore.c b/libparc/parc/security/parc_SymmetricKeyStore.c
index 38996dba..49d5055e 100644
--- a/libparc/parc/security/parc_SymmetricKeyStore.c
+++ b/libparc/parc/security/parc_SymmetricKeyStore.c
@@ -44,8 +44,7 @@
#include <openssl/aes.h>
#include <openssl/hmac.h>
-#include <LongBow/runtime.h>
-#include <LongBow/longBow_Compiler.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/algol/parc_Object.h>
#include <parc/algol/parc_Memory.h>
@@ -108,10 +107,6 @@ parcObject_ImplementRelease(parcSymmetricKeyStore, PARCSymmetricKeyStore);
parcObject_Override(PARCSymmetricKeyStore, PARCObject,
.destructor = (PARCObjectDestructor *) _parcSymmetricKeyStore_Finalize);
-// =============================================================
-LONGBOW_STOP_DEPRECATED_WARNINGS
-// =============================================================
-
/**
* The openssl ASN1 representation of the PARC symmetric key keystore.
* It will be written to disk in DER format with an i2d call
@@ -392,7 +387,7 @@ _AESKeyStoreInit(const char *filename, const char *password)
PARCBuffer *
parcSymmetricKeyStore_CreateKey(unsigned bits)
{
- assertTrue((bits & 0x07) == 0, "bits must be a multiple of 8");
+ parcAssertTrue((bits & 0x07) == 0, "bits must be a multiple of 8");
unsigned keylength = bits / 8;
uint8_t buffer[keylength];
@@ -427,7 +422,7 @@ parcSymmetricKeyStore_GetVerifierKeyDigest(PARCSymmetricKeyStore *keyStore)
bool
parcSymmetricKeyStore_CreateFile(const char *filename, const char *password, PARCBuffer *secret_key)
{
- assertTrue(parcBuffer_Remaining(secret_key) > 0, "The secret_key buffer is not flipped. See parcBuffer_Flip()");
+ parcAssertTrue(parcBuffer_Remaining(secret_key) > 0, "The secret_key buffer is not flipped. See parcBuffer_Flip()");
return _createKeyStore(filename, password, secret_key) == 0;
}
@@ -444,7 +439,7 @@ PARCSymmetricKeyStore *
parcSymmetricKeyStore_OpenFile(const char *filename, const char *password, PARCCryptoHashType hmacHashType)
{
PARCBuffer *secretKey = _AESKeyStoreInit(filename, password);
- assertNotNull(secretKey, "Could not read AES keystore %s", filename);
+ parcAssertNotNull(secretKey, "Could not read AES keystore %s", filename);
PARCSymmetricKeyStore *keyStore = parcSymmetricKeyStore_Create(secretKey);
parcBuffer_Release(&secretKey);
@@ -465,13 +460,10 @@ PARCSymmetricKeyStore *
parcSymmetricKeyStore_Create(PARCBuffer *secret_key)
{
PARCSymmetricKeyStore *keyStore = parcObject_CreateAndClearInstance(PARCSymmetricKeyStore);
- assertNotNull(keyStore, "parcObject_CreateAndClearInstance returned NULL, cannot allocate keystore");
+ parcAssertNotNull(keyStore, "parcObject_CreateAndClearInstance returned NULL, cannot allocate keystore");
keyStore->secretKey = parcBuffer_Acquire(secret_key);
return keyStore;
}
-// =============================================================
-LONGBOW_START_DEPRECATED_WARNINGS
-// =============================================================
diff --git a/libparc/parc/security/parc_Verifier.c b/libparc/parc/security/parc_Verifier.c
index 967356a5..75f99555 100755
--- a/libparc/parc/security/parc_Verifier.c
+++ b/libparc/parc/security/parc_Verifier.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <stdio.h>
-#include <LongBow/runtime.h>
+#include <parc/assert/parc_Assert.h>
#include <parc/security/parc_Verifier.h>
#include <parc/algol/parc_Memory.h>
@@ -41,7 +41,7 @@ _parcVerifier_FinalRelease(PARCVerifier **verifierPtr)
void
parcVerifier_AssertValid(const PARCVerifier *verifier)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
}
parcObject_ImplementAcquire(parcVerifier, PARCVerifier);
@@ -53,11 +53,11 @@ parcObject_Override(PARCVerifier, PARCObject,
PARCVerifier *
parcVerifier_Create(PARCObject *instance, PARCVerifierInterface *interfaceContext)
{
- assertNotNull(interfaceContext, "Parameter `interfaceContext` must be non-null interface pointer");
- assertNotNull(instance, "Parameter `instance` must be non-null PARCObject pointer");
+ parcAssertNotNull(interfaceContext, "Parameter `interfaceContext` must be non-null interface pointer");
+ parcAssertNotNull(instance, "Parameter `instance` must be non-null PARCObject pointer");
PARCVerifier *verifier = parcObject_CreateInstance(PARCVerifier);
- assertNotNull(verifier, "parcObject_CreateInstance returned NULL");
+ parcAssertNotNull(verifier, "parcObject_CreateInstance returned NULL");
verifier->instance = parcObject_Acquire(instance);
verifier->interface = interfaceContext;
@@ -69,9 +69,9 @@ bool
parcVerifier_VerifyDigestSignature(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoHash *locallyComputedHash,
PARCCryptoSuite suite, PARCSignature *signatureToVerify)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
- assertNotNull(locallyComputedHash, "cryptoHash to verify must not be null");
- assertNotNull(signatureToVerify, "Signature to verify must not be null");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(locallyComputedHash, "cryptoHash to verify must not be null");
+ parcAssertNotNull(signatureToVerify, "Signature to verify must not be null");
// null keyid is allowed now that we support CRCs, etc.
@@ -81,27 +81,27 @@ parcVerifier_VerifyDigestSignature(PARCVerifier *verifier, PARCKeyId *keyid, PAR
bool
parcVerifier_AllowedCryptoSuite(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoSuite suite)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
return verifier->interface->AllowedCryptoSuite(verifier->instance, keyid, suite);
}
PARCCryptoHasher*
parcVerifier_GetCryptoHasher(PARCVerifier *verifier, PARCKeyId *keyid, PARCCryptoHashType hashType)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
return verifier->interface->GetCryptoHasher(verifier->instance, keyid, hashType);
}
void
parcVerifier_AddKey(PARCVerifier *verifier, PARCKey *key)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
verifier->interface->AddKey(verifier->instance, key);
}
void
parcVerifier_RemoveKeyId(PARCVerifier *verifier, PARCKeyId *keyid)
{
- assertNotNull(verifier, "Parameter must be non-null PARCVerifier");
+ parcAssertNotNull(verifier, "Parameter must be non-null PARCVerifier");
verifier->interface->RemoveKeyId(verifier->instance, keyid);
}
diff --git a/libparc/parc/security/parc_Verifier.h b/libparc/parc/security/parc_Verifier.h
index 09e3640f..96232e93 100644
--- a/libparc/parc/security/parc_Verifier.h
+++ b/libparc/parc/security/parc_Verifier.h
@@ -76,7 +76,7 @@ PARCVerifier *parcVerifier_Create(PARCObject *instance, PARCVerifierInterface *i
/**
* Assert that an instance of `PARCVerifier` is valid.
*
- * If the instance is not valid, terminate via {@link trapIllegalValue}
+ * If the instance is not valid, terminate via {@link parcTrapIllegalValue}
*
* Valid means the internal state of the type is consistent with its
* required current or future behaviour.
diff --git a/libparc/parc/security/parc_X509Certificate.c b/libparc/parc/security/parc_X509Certificate.c
index 67ee6b2b..2c964ae7 100644
--- a/libparc/parc/security/parc_X509Certificate.c
+++ b/libparc/parc/security/parc_X509Certificate.c
@@ -79,7 +79,7 @@ _getPublicKeyDigest(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -103,7 +103,7 @@ _getCertificateDigest(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -126,7 +126,7 @@ _getDEREncodedCertificate(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -150,7 +150,7 @@ _getDEREncodedPublicKey(void *interfaceContext)
{
parcSecurity_AssertIsInitialized();
- assertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
+ parcAssertNotNull(interfaceContext, "Parameter must be non-null PARCX509Certificate");
PARCX509Certificate *certificate = (PARCX509Certificate *) interfaceContext;
@@ -222,7 +222,7 @@ _createEmptyCertificate()
cert->certificateDigest = NULL;
cert->derEncodedCertificate = NULL;
cert->derEncodedKey = NULL;
- assertNotNull(cert, "Failure allocating memory for a new PARCX509Certificate instance");
+ parcAssertNotNull(cert, "Failure allocating memory for a new PARCX509Certificate instance");
return cert;
}
@@ -288,7 +288,7 @@ _addSubjectName(X509 *cert, const char *subjectname)
{
// Set up the simple subject name and issuer name for the certificate.
X509_NAME *name = X509_get_subject_name(cert);
- assertNotNull(name, "Got null name from X509_get_subject_name");
+ parcAssertNotNull(name, "Got null name from X509_get_subject_name");
if (X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (unsigned char *) subjectname, -1, -1, 0)) {
if (X509_set_issuer_name(cert, name)) {
@@ -353,7 +353,7 @@ _parcX509Certificate_CreateFromPEMFile(const char *filename)
cert->certificateBIO = BIO_new(BIO_s_file());
size_t result = BIO_read_filename(cert->certificateBIO, filename);
- assertTrue(result == 1, "Unable to open the specified file");
+ parcAssertTrue(result == 1, "Unable to open the specified file");
cert->certificate = PEM_read_bio_X509(cert->certificateBIO, NULL, 0, NULL);
cert->publicKey = X509_get_pubkey(cert->certificate);
@@ -404,13 +404,13 @@ PARCX509Certificate * _createSelfSignedCertificate_RSA(PARCBuffer **privateKeyBu
parcSecurity_AssertIsInitialized();
RSA *rsa = RSA_new();
- assertNotNull(rsa, "RSA_new failed.");
+ parcAssertNotNull(rsa, "RSA_new failed.");
EVP_PKEY *privateKey = EVP_PKEY_new();
- assertNotNull(privateKey, "EVP_PKEY_new() failed.");
+ parcAssertNotNull(privateKey, "EVP_PKEY_new() failed.");
X509 *cert = X509_new();
- assertNotNull(cert, "X509_new() failed.");
+ parcAssertNotNull(cert, "X509_new() failed.");
int res;
BIGNUM *pub_exp;
@@ -518,15 +518,15 @@ PARCX509Certificate * _createSelfSignedCertificate_EC(PARCBuffer **privateKeyBuf
return NULL;
EC_KEY *ec_key = EC_KEY_new_by_curve_name(curve_params);
- assertNotNull(ec_key, "EC key creation failed.");
+ parcAssertNotNull(ec_key, "EC key creation failed.");
EC_KEY_set_asn1_flag(ec_key, OPENSSL_EC_NAMED_CURVE);
EVP_PKEY *pkey = EVP_PKEY_new();
- assertNotNull(pkey, "EVP_PKEY_new() failed.");
+ parcAssertNotNull(pkey, "EVP_PKEY_new() failed.");
X509 *cert = X509_new();
- assertNotNull(cert, "X509_new() failed.");
+ parcAssertNotNull(cert, "X509_new() failed.");
int res;
@@ -609,6 +609,8 @@ parcX509Certificate_CreateSelfSignedCertificate(PARCBuffer **privateKeyBuffer, c
return _createSelfSignedCertificate_RSA(privateKeyBuffer, subjectName, keyLength, validityDays);
case PARCKeyType_EC:
return _createSelfSignedCertificate_EC(privateKeyBuffer, subjectName, keyLength, validityDays);
+ default:
+ break;
}
return NULL;
diff --git a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
index 44b169eb..401e2517 100644
--- a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
+++ b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c
@@ -246,7 +246,7 @@ LONGBOW_TEST_CASE(Global, parcSymmetricSigner_SignatureSize)
PARCSigner *signer = parcSigner_Create(symmetricSigner, PARCSymmetricKeySignerAsSigner);
- assertTrue(parcSigner_GetSignatureSize(signer) == 32, "Key size unexpected %d ", parcSigner_GetSignatureSize(signer));
+ assertTrue(parcSigner_GetSignatureSize(signer) == 32, "Key size unexpected %zu ", parcSigner_GetSignatureSize(signer));
parcSigner_Release(&signer);
parcSymmetricKeySigner_Release(&symmetricSigner);
}