#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
#include <openssl/lhash.h>
#include <openssl/crypto.h>
#include <openssl/buffer.h>
{ERR_PACK(ERR_LIB_FIPS, 0, 0), "FIPS routines"},
{ERR_PACK(ERR_LIB_CMS, 0, 0), "CMS routines"},
{ERR_PACK(ERR_LIB_HMAC, 0, 0), "HMAC routines"},
+ {ERR_PACK(ERR_LIB_ASYNC, 0, 0), "ASYNC routines"},
{0, NULL},
};
int_error_hash = lh_ERR_STRING_DATA_new();
CRYPTO_pop_info();
}
- if (int_error_hash)
+ if (int_error_hash != NULL)
ret = int_error_hash;
if (lockit)
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
int_thread_hash = lh_ERR_STATE_new();
CRYPTO_pop_info();
}
- if (int_thread_hash) {
+ if (int_thread_hash != NULL) {
int_thread_hash_references++;
ret = int_thread_hash;
}
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
int_thread_release(&hash);
- if (p)
- ERR_STATE_free(p);
+ ERR_STATE_free(p);
}
#ifndef OPENSSL_NO_ERR
char (*dest)[LEN_SYS_STR_REASON] = &(strerror_tab[i - 1]);
char *src = strerror(i);
if (src != NULL) {
- strncpy(*dest, src, sizeof *dest);
- (*dest)[sizeof *dest - 1] = '\0';
+ strncpy(*dest, src, sizeof(*dest));
+ (*dest)[sizeof(*dest) - 1] = '\0';
str->string = *dest;
}
}
#define err_clear_data(p,i) \
do { \
- if (((p)->err_data[i] != NULL) && \
- (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
+ if ((p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
{ \
OPENSSL_free((p)->err_data[i]); \
(p)->err_data[i]=NULL; \
void ERR_free_strings(void)
{
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
- if (int_error_hash) {
- lh_ERR_STRING_DATA_free(int_error_hash);
- int_error_hash = NULL;
- }
+ lh_ERR_STRING_DATA_free(int_error_hash);
+ int_error_hash = NULL;
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
}
/* ret == the error state, if NULL, make a new one */
if (ret == NULL) {
- ret = OPENSSL_malloc(sizeof(ERR_STATE));
+ ret = OPENSSL_malloc(sizeof(*ret));
if (ret == NULL)
return (&fallback);
CRYPTO_THREADID_cpy(&ret->tid, &tid);
* If a race occurred in this function and we came second, tmpp is
* the first one that we just replaced.
*/
- if (tmpp)
- ERR_STATE_free(tmpp);
+ ERR_STATE_free(tmpp);
}
return ret;
}
if (p == NULL) {
OPENSSL_free(str);
return;
- } else
- str = p;
+ }
+ str = p;
}
BUF_strlcat(str, a, (size_t)s + 1);
}