diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/evp_asn1.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/evp_asn1.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libcrypto/asn1/evp_asn1.c b/src/lib/libcrypto/asn1/evp_asn1.c index f3d9804860..631924f88e 100644 --- a/src/lib/libcrypto/asn1/evp_asn1.c +++ b/src/lib/libcrypto/asn1/evp_asn1.c | |||
| @@ -62,27 +62,27 @@ | |||
| 62 | #include <openssl/asn1_mac.h> | 62 | #include <openssl/asn1_mac.h> |
| 63 | 63 | ||
| 64 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len) | 64 | int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len) |
| 65 | { | 65 | { |
| 66 | ASN1_STRING *os; | 66 | ASN1_STRING *os; |
| 67 | 67 | ||
| 68 | if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0); | 68 | if ((os=M_ASN1_OCTET_STRING_new()) == NULL) return(0); |
| 69 | if (!M_ASN1_OCTET_STRING_set(os,data,len)) return(0); | 69 | if (!M_ASN1_OCTET_STRING_set(os,data,len)) return(0); |
| 70 | ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os); | 70 | ASN1_TYPE_set(a,V_ASN1_OCTET_STRING,os); |
| 71 | return(1); | 71 | return(1); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /* int max_len: for returned value */ | 74 | /* int max_len: for returned value */ |
| 75 | int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, | 75 | int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, |
| 76 | int max_len) | 76 | int max_len) |
| 77 | { | 77 | { |
| 78 | int ret,num; | 78 | int ret,num; |
| 79 | unsigned char *p; | 79 | unsigned char *p; |
| 80 | 80 | ||
| 81 | if ((a->type != V_ASN1_OCTET_STRING) || (a->value.octet_string == NULL)) | 81 | if ((a->type != V_ASN1_OCTET_STRING) || (a->value.octet_string == NULL)) |
| 82 | { | 82 | { |
| 83 | ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG); | 83 | ASN1err(ASN1_F_ASN1_TYPE_GET_OCTETSTRING,ASN1_R_DATA_IS_WRONG); |
| 84 | return(-1); | 84 | return(-1); |
| 85 | } | 85 | } |
| 86 | p=M_ASN1_STRING_data(a->value.octet_string); | 86 | p=M_ASN1_STRING_data(a->value.octet_string); |
| 87 | ret=M_ASN1_STRING_length(a->value.octet_string); | 87 | ret=M_ASN1_STRING_length(a->value.octet_string); |
| 88 | if (ret < max_len) | 88 | if (ret < max_len) |
| @@ -91,11 +91,11 @@ int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, | |||
| 91 | num=max_len; | 91 | num=max_len; |
| 92 | memcpy(data,p,num); | 92 | memcpy(data,p,num); |
| 93 | return(ret); | 93 | return(ret); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | 96 | int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, |
| 97 | int len) | 97 | int len) |
| 98 | { | 98 | { |
| 99 | int n,size; | 99 | int n,size; |
| 100 | ASN1_OCTET_STRING os,*osp; | 100 | ASN1_OCTET_STRING os,*osp; |
| 101 | ASN1_INTEGER in; | 101 | ASN1_INTEGER in; |
| @@ -116,10 +116,10 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | |||
| 116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); | 116 | if ((osp=ASN1_STRING_new()) == NULL) return(0); |
| 117 | /* Grow the 'string' */ | 117 | /* Grow the 'string' */ |
| 118 | if (!ASN1_STRING_set(osp,NULL,size)) | 118 | if (!ASN1_STRING_set(osp,NULL,size)) |
| 119 | { | 119 | { |
| 120 | ASN1_STRING_free(osp); | 120 | ASN1_STRING_free(osp); |
| 121 | return(0); | 121 | return(0); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | M_ASN1_STRING_length_set(osp, size); | 124 | M_ASN1_STRING_length_set(osp, size); |
| 125 | p=M_ASN1_STRING_data(osp); | 125 | p=M_ASN1_STRING_data(osp); |
| @@ -130,14 +130,14 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, | |||
| 130 | 130 | ||
| 131 | ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp); | 131 | ASN1_TYPE_set(a,V_ASN1_SEQUENCE,osp); |
| 132 | return(1); | 132 | return(1); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | /* we return the actual length..., num may be missing, in which | 135 | /* we return the actual length..., num may be missing, in which |
| 136 | * case, set it to zero */ | 136 | * case, set it to zero */ |
| 137 | /* int max_len: for returned value */ | 137 | /* int max_len: for returned value */ |
| 138 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, | 138 | int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, |
| 139 | int max_len) | 139 | int max_len) |
| 140 | { | 140 | { |
| 141 | int ret= -1,n; | 141 | int ret= -1,n; |
| 142 | ASN1_INTEGER *ai=NULL; | 142 | ASN1_INTEGER *ai=NULL; |
| 143 | ASN1_OCTET_STRING *os=NULL; | 143 | ASN1_OCTET_STRING *os=NULL; |
| @@ -146,9 +146,9 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, | |||
| 146 | ASN1_const_CTX c; | 146 | ASN1_const_CTX c; |
| 147 | 147 | ||
| 148 | if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) | 148 | if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) |
| 149 | { | 149 | { |
| 150 | goto err; | 150 | goto err; |
| 151 | } | 151 | } |
| 152 | p=M_ASN1_STRING_data(a->value.sequence); | 152 | p=M_ASN1_STRING_data(a->value.sequence); |
| 153 | length=M_ASN1_STRING_length(a->value.sequence); | 153 | length=M_ASN1_STRING_length(a->value.sequence); |
| 154 | 154 | ||
| @@ -178,12 +178,12 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, | |||
| 178 | if (data != NULL) | 178 | if (data != NULL) |
| 179 | memcpy(data,M_ASN1_STRING_data(os),n); | 179 | memcpy(data,M_ASN1_STRING_data(os),n); |
| 180 | if (0) | 180 | if (0) |
| 181 | { | 181 | { |
| 182 | err: | 182 | err: |
| 183 | ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,ASN1_R_DATA_IS_WRONG); | 183 | ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,ASN1_R_DATA_IS_WRONG); |
| 184 | } | 184 | } |
| 185 | if (os != NULL) M_ASN1_OCTET_STRING_free(os); | 185 | if (os != NULL) M_ASN1_OCTET_STRING_free(os); |
| 186 | if (ai != NULL) M_ASN1_INTEGER_free(ai); | 186 | if (ai != NULL) M_ASN1_INTEGER_free(ai); |
| 187 | return(ret); | 187 | return(ret); |
| 188 | } | 188 | } |
| 189 | 189 | ||
