X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/e3d460c9de4426da6c630c3ae3f46173a99f82d8..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_asn1/lib/secasn1e.c?ds=sidebyside diff --git a/OSX/libsecurity_asn1/lib/secasn1e.c b/OSX/libsecurity_asn1/lib/secasn1e.c index 5f383ade..e695972f 100644 --- a/OSX/libsecurity_asn1/lib/secasn1e.c +++ b/OSX/libsecurity_asn1/lib/secasn1e.c @@ -40,8 +40,6 @@ #include "secasn1.h" -#include - typedef enum { beforeHeader, duringContents, @@ -1343,16 +1341,13 @@ SEC_ASN1EncoderStart (const void *src, const SecAsn1Template *theTemplate, SEC_ASN1EncoderContext *cx; our_pool = PORT_NewArena (SEC_ASN1_DEFAULT_ARENA_SIZE); - if (our_pool == NULL) { - syslog(LOG_ERR,"SEC_ASN1EncoderStart: failed to create new arena"); - return NULL; - } + if (our_pool == NULL) + return NULL; cx = (SEC_ASN1EncoderContext*)PORT_ArenaZAlloc (our_pool, sizeof(*cx)); if (cx == NULL) { - syslog(LOG_ERR,"SEC_ASN1EncoderStart: failed to alloc"); - PORT_FreeArena (our_pool, PR_FALSE); - return NULL; + PORT_FreeArena (our_pool, PR_FALSE); + return NULL; } cx->our_pool = our_pool; @@ -1367,9 +1362,8 @@ SEC_ASN1EncoderStart (const void *src, const SecAsn1Template *theTemplate, * Trouble initializing (probably due to failed allocations) * requires that we just give up. */ - syslog(LOG_ERR, "SEC_ASN1EncoderStart: unable to initialize state"); - PORT_FreeArena (our_pool, PR_FALSE); - return NULL; + PORT_FreeArena (our_pool, PR_FALSE); + return NULL; } return cx; @@ -1469,9 +1463,6 @@ SEC_ASN1Encode (const void *src, const SecAsn1Template *theTemplate, rv = SEC_ASN1EncoderUpdate (ecx, NULL, 0); - if (rv != SECSuccess) - syslog(LOG_ERR,"SEC_ASN1Encode: encode failure"); - SEC_ASN1EncoderFinish (ecx); return rv; } @@ -1573,23 +1564,17 @@ SEC_ASN1EncodeItem (PRArenaPool *poolp, SecAsn1Item *dest, const void *src, encoding_length = 0; rv = SEC_ASN1Encode (src, theTemplate, sec_asn1e_encode_item_count, &encoding_length); - if (rv != SECSuccess) { - syslog(LOG_ERR, "SEC_ASN1EncodeItem: Encode failed %d", rv); - return NULL; - } + if (rv != SECSuccess) + return NULL; dest = sec_asn1e_allocate_item (poolp, dest, encoding_length); - if (dest == NULL) { - syslog(LOG_ERR, "SEC_ASN1EncodeItem: allocate failure"); - return NULL; - } + if (dest == NULL) + return NULL; /* XXX necessary? This really just checks for a bug in the allocate fn */ PORT_Assert (dest->Data != NULL); - if (dest->Data == NULL) { - syslog(LOG_ERR, "SEC_ASN1EncodeItem: data allocate failure"); - return NULL; - } + if (dest->Data == NULL) + return NULL; dest->Length = 0; (void) SEC_ASN1Encode (src, theTemplate, sec_asn1e_encode_item_store, dest);