projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add SHA for ARMv8.
[oweals/openssl.git]
/
crypto
/
asn1
/
evp_asn1.c
diff --git
a/crypto/asn1/evp_asn1.c
b/crypto/asn1/evp_asn1.c
index 8197fcd8f71a821be79b21c975d1f9d78c073620..f3d9804860ec31fc09d885f18f3c6e3e47ad00da 100644
(file)
--- a/
crypto/asn1/evp_asn1.c
+++ b/
crypto/asn1/evp_asn1.c
@@
-58,16
+58,16
@@
#include <stdio.h>
#include "cryptlib.h"
#include <stdio.h>
#include "cryptlib.h"
-#include
"asn1.h"
-#include
"asn1_mac.h"
+#include
<openssl/asn1.h>
+#include
<openssl/asn1_mac.h>
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
{
ASN1_STRING *os;
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
{
ASN1_STRING *os;
- if ((os=ASN1_OCTET_STRING_new()) == NULL) return(0);
- if (!ASN1_OCTET_STRING_set(os,data,len)) return(0);
- ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,
(char *)
os);
+ if ((os=
M_
ASN1_OCTET_STRING_new()) == NULL) return(0);
+ if (!
M_
ASN1_OCTET_STRING_set(os,data,len)) return(0);
+ ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os);
return(1);
}
return(1);
}
@@
-83,8
+83,8
@@
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
return(-1);
}
ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
return(-1);
}
- p=ASN1_STRING_data(a->value.octet_string);
- ret=ASN1_STRING_length(a->value.octet_string);
+ p=
M_
ASN1_STRING_data(a->value.octet_string);
+ ret=
M_
ASN1_STRING_length(a->value.octet_string);
if (ret < max_len)
num=ret;
else
if (ret < max_len)
num=ret;
else
@@
-115,16
+115,20
@@
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
if ((osp=ASN1_STRING_new()) == NULL) return(0);
/* Grow the 'string' */
if ((osp=ASN1_STRING_new()) == NULL) return(0);
/* Grow the 'string' */
- ASN1_STRING_set(osp,NULL,size);
+ if (!ASN1_STRING_set(osp,NULL,size))
+ {
+ ASN1_STRING_free(osp);
+ return(0);
+ }
-
ASN1_STRING_length(osp)=size
;
- p=ASN1_STRING_data(osp);
+
M_ASN1_STRING_length_set(osp, size)
;
+ p=
M_
ASN1_STRING_data(osp);
ASN1_put_object(&p,1,n,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
i2d_ASN1_INTEGER(&in,&p);
M_i2d_ASN1_OCTET_STRING(&os,&p);
ASN1_put_object(&p,1,n,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
i2d_ASN1_INTEGER(&in,&p);
M_i2d_ASN1_OCTET_STRING(&os,&p);
- ASN1_TYPE_set(a,V_ASN1_SEQUENCE,
(char *)
osp);
+ ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp);
return(1);
}
return(1);
}
@@
-137,16
+141,16
@@
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
int ret= -1,n;
ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL;
int ret= -1,n;
ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL;
- unsigned char *p;
+
const
unsigned char *p;
long length;
long length;
- ASN1_CTX c;
+ ASN1_
const_
CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
{
goto err;
}
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
{
goto err;
}
- p=ASN1_STRING_data(a->value.sequence);
- length=ASN1_STRING_length(a->value.sequence);
+ p=
M_
ASN1_STRING_data(a->value.sequence);
+ length=
M_
ASN1_STRING_length(a->value.sequence);
c.pp= &p;
c.p=p;
c.pp= &p;
c.p=p;
@@
-165,21
+169,21
@@
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
if (num != NULL)
*num=ASN1_INTEGER_get(ai);
if (num != NULL)
*num=ASN1_INTEGER_get(ai);
- ret=ASN1_STRING_length(os);
+ ret=
M_
ASN1_STRING_length(os);
if (max_len > ret)
n=ret;
else
n=max_len;
if (data != NULL)
if (max_len > ret)
n=ret;
else
n=max_len;
if (data != NULL)
- memcpy(data,ASN1_STRING_data(os),n);
+ memcpy(data,
M_
ASN1_STRING_data(os),n);
if (0)
{
err:
ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
}
if (0)
{
err:
ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
}
- if (os != NULL) ASN1_OCTET_STRING_free(os);
- if (ai != NULL) ASN1_INTEGER_free(ai);
+ if (os != NULL)
M_
ASN1_OCTET_STRING_free(os);
+ if (ai != NULL)
M_
ASN1_INTEGER_free(ai);
return(ret);
}
return(ret);
}