char *make_revocation_str(int rev_type, char *rev_arg)
	{
	char *reason = NULL, *other = NULL, *str;
	ASN1_OBJECT *otmp;
	ASN1_UTCTIME *revtm = NULL;
	int i;
	switch (rev_type)
		{
	case REV_NONE:
		break;
	case REV_CRL_REASON:
		for (i = 0; i < 8; i++)
			{
			if (!strcasecmp(rev_arg, crl_reasons[i]))
				{
				reason = crl_reasons[i];
				break;
				}
			}
		if (reason == NULL)
			{
			BIO_printf(bio_err, "Unknown CRL reason %s\n", rev_arg);
			return NULL;
			}
		break;
	case REV_HOLD:
		otmp = OBJ_txt2obj(rev_arg, 0);
		ASN1_OBJECT_free(otmp);
		if (otmp == NULL)
			{
			BIO_printf(bio_err, "Invalid object identifier %s\n", rev_arg);
			return NULL;
			}
		reason = "holdInstruction";
		other = rev_arg;
		break;
	case REV_KEY_COMPROMISE:
	case REV_CA_COMPROMISE:
		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
			{
			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);
			return NULL;
			}
		other = rev_arg;
		if (rev_type == REV_KEY_COMPROMISE)
			reason = "keyTime";
		else
			reason = "CAkeyTime";
		break;
		}
	revtm = X509_gmtime_adj(NULL, 0);
	i = revtm->length + 1;
	if (reason) i += strlen(reason) + 1;
	if (other) i += strlen(other) + 1;
	str = OPENSSL_malloc(i);
	if (!str) return NULL;
	strcpy(str, (char *)revtm->data);
	if (reason)
		{
		strcat(str, ",");
		strcat(str, reason);
		}
	if (other)
		{
		strcat(str, ",");
		strcat(str, other);
		}
	ASN1_UTCTIME_free(revtm);
	return str;
	}
['char *make_revocation_str(int rev_type, char *rev_arg)\n\t{\n\tchar *reason = NULL, *other = NULL, *str;\n\tASN1_OBJECT *otmp;\n\tASN1_UTCTIME *revtm = NULL;\n\tint i;\n\tswitch (rev_type)\n\t\t{\n\tcase REV_NONE:\n\t\tbreak;\n\tcase REV_CRL_REASON:\n\t\tfor (i = 0; i < 8; i++)\n\t\t\t{\n\t\t\tif (!strcasecmp(rev_arg, crl_reasons[i]))\n\t\t\t\t{\n\t\t\t\treason = crl_reasons[i];\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tif (reason == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Unknown CRL reason %s\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tbreak;\n\tcase REV_HOLD:\n\t\totmp = OBJ_txt2obj(rev_arg, 0);\n\t\tASN1_OBJECT_free(otmp);\n\t\tif (otmp == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Invalid object identifier %s\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\treason = "holdInstruction";\n\t\tother = rev_arg;\n\t\tbreak;\n\tcase REV_KEY_COMPROMISE:\n\tcase REV_CA_COMPROMISE:\n\t\tif (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tother = rev_arg;\n\t\tif (rev_type == REV_KEY_COMPROMISE)\n\t\t\treason = "keyTime";\n\t\telse\n\t\t\treason = "CAkeyTime";\n\t\tbreak;\n\t\t}\n\trevtm = X509_gmtime_adj(NULL, 0);\n\ti = revtm->length + 1;\n\tif (reason) i += strlen(reason) + 1;\n\tif (other) i += strlen(other) + 1;\n\tstr = OPENSSL_malloc(i);\n\tif (!str) return NULL;\n\tstrcpy(str, (char *)revtm->data);\n\tif (reason)\n\t\t{\n\t\tstrcat(str, ",");\n\t\tstrcat(str, reason);\n\t\t}\n\tif (other)\n\t\t{\n\t\tstrcat(str, ",");\n\t\tstrcat(str, other);\n\t\t}\n\tASN1_UTCTIME_free(revtm);\n\treturn str;\n\t}', 'int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)\n\t{\n\tASN1_GENERALIZEDTIME t;\n\tt.type=V_ASN1_GENERALIZEDTIME;\n\tt.length=strlen(str);\n\tt.data=(unsigned char *)str;\n\tif (ASN1_GENERALIZEDTIME_check(&t))\n\t\t{\n\t\tif (s != NULL)\n\t\t\t{\n\t\t\tASN1_STRING_set((ASN1_STRING *)s,\n\t\t\t\t(unsigned char *)str,t.length);\n\t\t\ts->type=V_ASN1_GENERALIZEDTIME;\n\t\t\t}\n\t\treturn(1);\n\t\t}\n\telse\n\t\treturn(0);\n\t}', 'ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)\n{\n\treturn X509_time_adj(s, adj, NULL);\n}', 'ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)\n\t{\n\ttime_t t;\n\tint type = -1;\n\tif (in_tm) t = *in_tm;\n\telse time(&t);\n\tt+=adj;\n\tif (s) type = s->type;\n\tif (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);\n\tif (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);\n\treturn ASN1_TIME_set(s, t);\n\t}', 'ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)\n\t{\n\tstruct tm *ts;\n\tstruct tm data;\n\tts=OPENSSL_gmtime(&t,&data);\n\tif (ts == NULL)\n\t\treturn NULL;\n\tif((ts->tm_year >= 50) && (ts->tm_year < 150))\n\t\t\t\t\treturn ASN1_UTCTIME_set(s, t);\n\treturn ASN1_GENERALIZEDTIME_set(s,t);\n\t}']