Deleted Added
full compact
ts_rsp_sign.c (302408) ts_rsp_sign.c (331638)
1/* crypto/ts/ts_resp_sign.c */
2/*
3 * Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL project
4 * 2002.
5 */
6/* ====================================================================
1/* crypto/ts/ts_resp_sign.c */
2/*
3 * Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL project
4 * 2002.
5 */
6/* ====================================================================
7 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
7 * Copyright (c) 2006-2018 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *

--- 37 unchanged lines hidden (view full) ---

53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59
60#include "cryptlib.h"
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *

--- 37 unchanged lines hidden (view full) ---

53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59
60#include "cryptlib.h"
61#include "o_time.h"
61
62#if defined(OPENSSL_SYS_UNIX)
63# include <sys/time.h>
64#endif
65
66#include <openssl/objects.h>
67#include <openssl/ts.h>
68#include <openssl/pkcs7.h>

--- 874 unchanged lines hidden (view full) ---

943}
944
945static ASN1_GENERALIZEDTIME
946*TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time,
947 long sec, long usec, unsigned precision)
948{
949 time_t time_sec = (time_t)sec;
950 struct tm *tm = NULL;
62
63#if defined(OPENSSL_SYS_UNIX)
64# include <sys/time.h>
65#endif
66
67#include <openssl/objects.h>
68#include <openssl/ts.h>
69#include <openssl/pkcs7.h>

--- 874 unchanged lines hidden (view full) ---

944}
945
946static ASN1_GENERALIZEDTIME
947*TS_RESP_set_genTime_with_precision(ASN1_GENERALIZEDTIME *asn1_time,
948 long sec, long usec, unsigned precision)
949{
950 time_t time_sec = (time_t)sec;
951 struct tm *tm = NULL;
952 struct tm result = {0};
951 char genTime_str[17 + TS_MAX_CLOCK_PRECISION_DIGITS];
952 char *p = genTime_str;
953 char *p_end = genTime_str + sizeof(genTime_str);
954
955 if (precision > TS_MAX_CLOCK_PRECISION_DIGITS)
956 goto err;
957
953 char genTime_str[17 + TS_MAX_CLOCK_PRECISION_DIGITS];
954 char *p = genTime_str;
955 char *p_end = genTime_str + sizeof(genTime_str);
956
957 if (precision > TS_MAX_CLOCK_PRECISION_DIGITS)
958 goto err;
959
958 if (!(tm = gmtime(&time_sec)))
960 if (!(tm = OPENSSL_gmtime(&time_sec, &result)))
959 goto err;
960
961 /*
962 * Put "genTime_str" in GeneralizedTime format. We work around the
963 * restrictions imposed by rfc3280 (i.e. "GeneralizedTime values MUST
964 * NOT include fractional seconds") and OpenSSL related functions to
965 * meet the rfc3161 requirement: "GeneralizedTime syntax can include
966 * fraction-of-second details".

--- 54 unchanged lines hidden ---
961 goto err;
962
963 /*
964 * Put "genTime_str" in GeneralizedTime format. We work around the
965 * restrictions imposed by rfc3280 (i.e. "GeneralizedTime values MUST
966 * NOT include fractional seconds") and OpenSSL related functions to
967 * meet the rfc3161 requirement: "GeneralizedTime syntax can include
968 * fraction-of-second details".

--- 54 unchanged lines hidden ---