summaryrefslogtreecommitdiff
path: root/lib/libcrypto/asn1/evp_asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/asn1/evp_asn1.c')
-rw-r--r--lib/libcrypto/asn1/evp_asn1.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/libcrypto/asn1/evp_asn1.c b/lib/libcrypto/asn1/evp_asn1.c
index f3d9804860e..631924f88e8 100644
--- a/lib/libcrypto/asn1/evp_asn1.c
+++ b/lib/libcrypto/asn1/evp_asn1.c
@@ -62,27 +62,27 @@
#include <openssl/asn1_mac.h>
int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len)
- {
+{
ASN1_STRING *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);
- }
+}
/* int max_len: for returned value */
int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
int max_len)
- {
+{
int ret,num;
unsigned char *p;
if ((a->type != V_ASN1_OCTET_STRING) || (a->value.octet_string == NULL))
- {
+ {
ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG);
return(-1);
- }
+ }
p=M_ASN1_STRING_data(a->value.octet_string);
ret=M_ASN1_STRING_length(a->value.octet_string);
if (ret < max_len)
@@ -91,11 +91,11 @@ int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data,
num=max_len;
memcpy(data,p,num);
return(ret);
- }
+}
int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
int len)
- {
+{
int n,size;
ASN1_OCTET_STRING os,*osp;
ASN1_INTEGER in;
@@ -116,10 +116,10 @@ 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 (!ASN1_STRING_set(osp,NULL,size))
- {
+ {
ASN1_STRING_free(osp);
return(0);
- }
+ }
M_ASN1_STRING_length_set(osp, size);
p=M_ASN1_STRING_data(osp);
@@ -130,14 +130,14 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp);
return(1);
- }
+}
/* we return the actual length..., num may be missing, in which
* case, set it to zero */
/* int max_len: for returned value */
int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
int max_len)
- {
+{
int ret= -1,n;
ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL;
@@ -146,9 +146,9 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
ASN1_const_CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
- {
+ {
goto err;
- }
+ }
p=M_ASN1_STRING_data(a->value.sequence);
length=M_ASN1_STRING_length(a->value.sequence);
@@ -178,12 +178,12 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
if (data != NULL)
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 (os != NULL) M_ASN1_OCTET_STRING_free(os);
if (ai != NULL) M_ASN1_INTEGER_free(ai);
return(ret);
- }
+}