Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions interface/gridsite.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ char *GRSThttpUrlEncode(char *);
/* #define GACLmildUrlEncode(x) GRSThttpMildUrlEncode((x)) */
char *GRSThttpUrlMildencode(char *);

int GRSTx509NameCmp(char *, char *);
int GRSTx509NameCmp(const char *, const char *);

#ifndef GRST_NO_OPENSSL
int GRSTx509KnownCriticalExts(X509 *);
Expand Down Expand Up @@ -450,13 +450,13 @@ int GRSThttpPrintHeader(GRSThttpBody *, char *);
int GRSThttpPrintFooter(GRSThttpBody *, char *);
char *GRSThttpGetCGI(char *);

time_t GRSTasn1TimeToTimeT(char *, size_t);
time_t GRSTasn1TimeToTimeT(const unsigned char *, size_t);
int GRSTasn1SearchTaglist(struct GRSTasn1TagList taglist[], int, char *);
#ifndef GRST_NO_OPENSSL
int GRSTasn1ParseDump(BIO *, const unsigned char *, long,
struct GRSTasn1TagList taglist[], int, int *);
#endif
int GRSTasn1GetX509Name(char *, int, char *, char *,
int GRSTasn1GetX509Name(char *, int, char *, const unsigned char *,
struct GRSTasn1TagList taglist[], int);

int GRSThtcpNOPrequestMake(char **, int *, unsigned int);
Expand Down
40 changes: 20 additions & 20 deletions src/grst_asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
* necessary)
*/

time_t GRSTasn1TimeToTimeT(char *asn1time, size_t len)
time_t GRSTasn1TimeToTimeT(const unsigned char *asn1time, size_t len)
{
char zone;
struct tm time_tm;

if (len == 0) len = strlen(asn1time);
if (len == 0) len = strlen((const char *) asn1time);

if ((len != 13) && (len != 15)) return 0; /* dont understand */

if ((len == 13) &&
((sscanf(asn1time, "%02d%02d%02d%02d%02d%02d%c",
((sscanf((const char *) asn1time, "%02d%02d%02d%02d%02d%02d%c",
&(time_tm.tm_year),
&(time_tm.tm_mon),
&(time_tm.tm_mday),
Expand All @@ -41,7 +41,7 @@ time_t GRSTasn1TimeToTimeT(char *asn1time, size_t len)
&zone) != 7) || (zone != 'Z'))) return 0; /* dont understand */

if ((len == 15) &&
((sscanf(asn1time, "20%02d%02d%02d%02d%02d%02d%c",
((sscanf((const char *) asn1time, "20%02d%02d%02d%02d%02d%02d%c",
&(time_tm.tm_year),
&(time_tm.tm_mon),
&(time_tm.tm_mday),
Expand Down Expand Up @@ -134,7 +134,7 @@ static int GRSTasn1PrintPrintable(BIO *bp, const unsigned char *str, int length)
int ret = 0;
char *dup, *p;

dup = strndup(str, length);
dup = strndup((const char *) str, length);

for (p=dup; *p != '\0'; ++p) if ((*p < ' ') || (*p > '~')) *p = '.';

Expand Down Expand Up @@ -323,17 +323,17 @@ static int GRSTasn1Parse2(BIO *bp, const unsigned char **pp, long length, int of
os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl);
if (os != NULL)
{
opp=os->data;
opp = ASN1_STRING_get0_data(os);

if (os->length > 0)
if (ASN1_STRING_length(os) > 0)
{
if ((bp != NULL) &&
(BIO_write(bp,":",1) <= 0))
goto end;
if ((bp != NULL) &&
(GRSTasn1PrintPrintable(bp,
opp,
os->length) <= 0))
ASN1_STRING_length(os)) <= 0))
goto end;
}

Expand All @@ -352,18 +352,18 @@ static int GRSTasn1Parse2(BIO *bp, const unsigned char **pp, long length, int of
{
if ((bp != NULL) &&
(BIO_write(bp,":",1) <= 0)) goto end;
if (bs->type == V_ASN1_NEG_INTEGER)
if (ASN1_STRING_type(bs) == V_ASN1_NEG_INTEGER)
if ((bp != NULL) &&
(BIO_write(bp,"-",1) <= 0))
goto end;
for (i=0; i<bs->length; i++)
for (i=0; i < ASN1_STRING_length(bs); i++)
{
if ((bp != NULL) &&
(BIO_printf(bp,"%02X",
bs->data[i]) <= 0))
ASN1_STRING_get0_data(bs)[i]) <= 0))
goto end;
}
if (bs->length == 0)
if (ASN1_STRING_length(bs) == 0)
{
if ((bp != NULL) &&
(BIO_write(bp,"00",2) <= 0))
Expand All @@ -389,18 +389,18 @@ static int GRSTasn1Parse2(BIO *bp, const unsigned char **pp, long length, int of
{
if ((bp != NULL) &&
(BIO_write(bp,":",1) <= 0)) goto end;
if (bs->type == V_ASN1_NEG_ENUMERATED)
if (ASN1_STRING_type(bs) == V_ASN1_NEG_ENUMERATED)
if ((bp != NULL) &&
(BIO_write(bp,"-",1) <= 0))
goto end;
for (i=0; i<bs->length; i++)
for (i=0; i < ASN1_STRING_length(bs); i++)
{
if ((bp != NULL) &&
(BIO_printf(bp,"%02X",
bs->data[i]) <= 0))
ASN1_STRING_get0_data(bs)[i]) <= 0))
goto end;
}
if (bs->length == 0)
if (ASN1_STRING_length(bs) == 0)
{
if ((bp != NULL) &&
(BIO_write(bp,"00",2) <= 0))
Expand Down Expand Up @@ -463,7 +463,7 @@ int GRSTasn1ParseDump(BIO *bp, const unsigned char *pp, long len,
}

int
GRSTasn1GetField(int index, char *coords, char *asn1string,
GRSTasn1GetField(int index, char *coords, const unsigned char *asn1string,
struct GRSTasn1TagList taglist[], int lasttag,
ASN1_OBJECT **field_obj, int *field_index)
{
Expand All @@ -482,7 +482,7 @@ GRSTasn1GetField(int index, char *coords, char *asn1string,
if (ival < 0)
return GRST_RET_FAILED;

q = (unsigned char *) &asn1string[taglist[iobj].start];
q = &asn1string[taglist[iobj].start];
obj = d2i_ASN1_OBJECT(NULL, &q,
taglist[iobj].length + taglist[iobj].headerlength);
if (obj == NULL)
Expand All @@ -495,7 +495,7 @@ GRSTasn1GetField(int index, char *coords, char *asn1string,
}

int GRSTasn1GetX509Name(char *x509name, int maxlength, char *coords,
char *asn1string,
const unsigned char *asn1string,
struct GRSTasn1TagList taglist[], int lasttag)
{
int i, istr, n, len = 0;
Expand Down Expand Up @@ -533,7 +533,7 @@ int GRSTasn1GetX509Name(char *x509name, int maxlength, char *coords,

int
GRSTasn1FindField(const char *oid, char *coords,
char *asn1string,
const unsigned char *asn1string,
struct GRSTasn1TagList taglist[], int lasttag,
int *result)
{
Expand Down
Loading