projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add OSSL_NELEM macro.
[oweals/openssl.git]
/
crypto
/
asn1
/
a_bitstr.c
diff --git
a/crypto/asn1/a_bitstr.c
b/crypto/asn1/a_bitstr.c
index 1b2f608e60beba2177d84d6acb31daa37658afb4..60b6e6d40385e4c17399161854c75e7fc7e071cb 100644
(file)
--- a/
crypto/asn1/a_bitstr.c
+++ b/
crypto/asn1/a_bitstr.c
@@
-59,10
+59,11
@@
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/asn1.h>
+#include "asn1_locl.h"
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{
- return
M_ASN1_BIT
_STRING_set(x, d, len);
+ return
ASN1
_STRING_set(x, d, len);
}
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
}
int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
@@
-136,7
+137,7
@@
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
}
if ((a == NULL) || ((*a) == NULL)) {
}
if ((a == NULL) || ((*a) == NULL)) {
- if ((ret =
M_
ASN1_BIT_STRING_new()) == NULL)
+ if ((ret = ASN1_BIT_STRING_new()) == NULL)
return (NULL);
} else
ret = (*a);
return (NULL);
} else
ret = (*a);
@@
-155,7
+156,7
@@
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | i); /* set */
if (len-- > 1) { /* using one because of the bits left byte */
ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | i); /* set */
if (len-- > 1) { /* using one because of the bits left byte */
- s =
(unsigned char *)
OPENSSL_malloc((int)len);
+ s = OPENSSL_malloc((int)len);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
@@
-167,8
+168,7
@@
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
s = NULL;
ret->length = (int)len;
s = NULL;
ret->length = (int)len;
- if (ret->data != NULL)
- OPENSSL_free(ret->data);
+ OPENSSL_free(ret->data);
ret->data = s;
ret->type = V_ASN1_BIT_STRING;
if (a != NULL)
ret->data = s;
ret->type = V_ASN1_BIT_STRING;
if (a != NULL)
@@
-177,8
+177,8
@@
ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
return (ret);
err:
ASN1err(ASN1_F_C2I_ASN1_BIT_STRING, i);
return (ret);
err:
ASN1err(ASN1_F_C2I_ASN1_BIT_STRING, i);
- if ((
ret != NULL) && ((a == NULL) || (*a != ret)
))
-
M_
ASN1_BIT_STRING_free(ret);
+ if ((
a == NULL) || (*a != ret
))
+ ASN1_BIT_STRING_free(ret);
return (NULL);
}
return (NULL);
}
@@
-204,11
+204,7
@@
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
if ((a->length < (w + 1)) || (a->data == NULL)) {
if (!value)
return (1); /* Don't need to set */
if ((a->length < (w + 1)) || (a->data == NULL)) {
if (!value)
return (1); /* Don't need to set */
- if (a->data == NULL)
- c = (unsigned char *)OPENSSL_malloc(w + 1);
- else
- c = (unsigned char *)OPENSSL_realloc_clean(a->data,
- a->length, w + 1);
+ c = OPENSSL_realloc_clean(a->data, a->length, w + 1);
if (c == NULL) {
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE);
return 0;
if (c == NULL) {
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE);
return 0;