diff options
author | beck <> | 2016-11-04 18:07:24 +0000 |
---|---|---|
committer | beck <> | 2016-11-04 18:07:24 +0000 |
commit | 3b8a78795bef4ca09dc876e28a533d702bf5275d (patch) | |
tree | 19909c3874aacc91f295043d55b118a7fe7567e8 /src/lib | |
parent | 145c17d7875703f3317c0294c215fc4aa38911a8 (diff) | |
download | openbsd-3b8a78795bef4ca09dc876e28a533d702bf5275d.tar.gz openbsd-3b8a78795bef4ca09dc876e28a533d702bf5275d.tar.bz2 openbsd-3b8a78795bef4ca09dc876e28a533d702bf5275d.zip |
make public ASN1_time_parse and ASN1_time_tm_cmp to replace former hidden
functions.. document with a man page.
bump majors on libtls, libssl, libcrypto
ok jsing@ guenther@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/asn1/a_time_tm.c | 24 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/ASN1_time_parse.3 | 94 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/ocsp/ocsp_cl.c | 17 | ||||
-rw-r--r-- | src/lib/libcrypto/shlib_version | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/vpm_int.h | 0 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_lcl.h | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/shlib_version | 4 | ||||
-rw-r--r-- | src/lib/libtls/shlib_version | 4 | ||||
-rw-r--r-- | src/lib/libtls/tls_conninfo.c | 6 | ||||
-rw-r--r-- | src/lib/libtls/tls_internal.h | 4 | ||||
-rw-r--r-- | src/lib/libtls/tls_ocsp.c | 3 |
14 files changed, 133 insertions, 43 deletions
diff --git a/src/lib/libcrypto/asn1/a_time_tm.c b/src/lib/libcrypto/asn1/a_time_tm.c index aa3cb9994c..fcd3acf9c8 100644 --- a/src/lib/libcrypto/asn1/a_time_tm.c +++ b/src/lib/libcrypto/asn1/a_time_tm.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_time_tm.c,v 1.9 2015/12/12 21:02:59 beck Exp $ */ | 1 | /* $OpenBSD: a_time_tm.c,v 1.10 2016/11/04 18:07:23 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -30,7 +30,7 @@ | |||
30 | #define UTCTIME_LENGTH 13 | 30 | #define UTCTIME_LENGTH 13 |
31 | 31 | ||
32 | int | 32 | int |
33 | asn1_tm_cmp(struct tm *tm1, struct tm *tm2) { | 33 | ASN1_time_tm_cmp(struct tm *tm1, struct tm *tm2) { |
34 | if (tm1->tm_year < tm2->tm_year) | 34 | if (tm1->tm_year < tm2->tm_year) |
35 | return (-1); | 35 | return (-1); |
36 | if (tm1->tm_year > tm2->tm_year) | 36 | if (tm1->tm_year > tm2->tm_year) |
@@ -117,8 +117,8 @@ rfc5280_string_from_tm(struct tm *tm) | |||
117 | * Parse an RFC 5280 format ASN.1 time string. | 117 | * Parse an RFC 5280 format ASN.1 time string. |
118 | * | 118 | * |
119 | * mode must be: | 119 | * mode must be: |
120 | * 0 if we expect to parse a time as specified in RFC 5280 from an X509 object. | 120 | * 0 if we expect to parse a time as specified in RFC 5280 for an X509 object. |
121 | * V_ASN1_UTCTIME if we wish to parse on RFC5280 format UTC time. | 121 | * V_ASN1_UTCTIME if we wish to parse an RFC5280 format UTC time. |
122 | * V_ASN1_GENERALIZEDTIME if we wish to parse an RFC5280 format Generalized time. | 122 | * V_ASN1_GENERALIZEDTIME if we wish to parse an RFC5280 format Generalized time. |
123 | * | 123 | * |
124 | * Returns: | 124 | * Returns: |
@@ -130,7 +130,7 @@ rfc5280_string_from_tm(struct tm *tm) | |||
130 | */ | 130 | */ |
131 | #define ATOI2(ar) ((ar) += 2, ((ar)[-2] - '0') * 10 + ((ar)[-1] - '0')) | 131 | #define ATOI2(ar) ((ar) += 2, ((ar)[-2] - '0') * 10 + ((ar)[-1] - '0')) |
132 | int | 132 | int |
133 | asn1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode) | 133 | ASN1_time_parse(const char *bytes, size_t len, struct tm *tm, int mode) |
134 | { | 134 | { |
135 | size_t i; | 135 | size_t i; |
136 | int type = 0; | 136 | int type = 0; |
@@ -218,7 +218,7 @@ ASN1_TIME_set_string_internal(ASN1_TIME *s, const char *str, int mode) | |||
218 | int type; | 218 | int type; |
219 | char *tmp; | 219 | char *tmp; |
220 | 220 | ||
221 | if ((type = asn1_time_parse(str, strlen(str), NULL, mode)) == -1) | 221 | if ((type = ASN1_time_parse(str, strlen(str), NULL, mode)) == -1) |
222 | return (0); | 222 | return (0); |
223 | if (mode != 0 && mode != type) | 223 | if (mode != 0 && mode != type) |
224 | return (0); | 224 | return (0); |
@@ -315,7 +315,7 @@ ASN1_TIME_check(ASN1_TIME *t) | |||
315 | { | 315 | { |
316 | if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME) | 316 | if (t->type != V_ASN1_GENERALIZEDTIME && t->type != V_ASN1_UTCTIME) |
317 | return (0); | 317 | return (0); |
318 | return (t->type == asn1_time_parse(t->data, t->length, NULL, t->type)); | 318 | return (t->type == ASN1_time_parse(t->data, t->length, NULL, t->type)); |
319 | } | 319 | } |
320 | 320 | ||
321 | ASN1_GENERALIZEDTIME * | 321 | ASN1_GENERALIZEDTIME * |
@@ -329,7 +329,7 @@ ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) | |||
329 | return (NULL); | 329 | return (NULL); |
330 | 330 | ||
331 | memset(&tm, 0, sizeof(tm)); | 331 | memset(&tm, 0, sizeof(tm)); |
332 | if (t->type != asn1_time_parse(t->data, t->length, &tm, t->type)) | 332 | if (t->type != ASN1_time_parse(t->data, t->length, &tm, t->type)) |
333 | return (NULL); | 333 | return (NULL); |
334 | if ((str = gentime_string_from_tm(&tm)) == NULL) | 334 | if ((str = gentime_string_from_tm(&tm)) == NULL) |
335 | return (NULL); | 335 | return (NULL); |
@@ -364,7 +364,7 @@ ASN1_UTCTIME_check(ASN1_UTCTIME *d) | |||
364 | { | 364 | { |
365 | if (d->type != V_ASN1_UTCTIME) | 365 | if (d->type != V_ASN1_UTCTIME) |
366 | return (0); | 366 | return (0); |
367 | return (d->type == asn1_time_parse(d->data, d->length, NULL, d->type)); | 367 | return (d->type == ASN1_time_parse(d->data, d->length, NULL, d->type)); |
368 | } | 368 | } |
369 | 369 | ||
370 | int | 370 | int |
@@ -402,13 +402,13 @@ ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t2) | |||
402 | * The danger is that users of this function will not | 402 | * The danger is that users of this function will not |
403 | * differentiate the -2 failure case from t1 < t2. | 403 | * differentiate the -2 failure case from t1 < t2. |
404 | */ | 404 | */ |
405 | if (asn1_time_parse(s->data, s->length, &tm1, V_ASN1_UTCTIME) == -1) | 405 | if (ASN1_time_parse(s->data, s->length, &tm1, V_ASN1_UTCTIME) == -1) |
406 | return (-2); /* XXX */ | 406 | return (-2); /* XXX */ |
407 | 407 | ||
408 | if (gmtime_r(&t2, &tm2) == NULL) | 408 | if (gmtime_r(&t2, &tm2) == NULL) |
409 | return (-2); /* XXX */ | 409 | return (-2); /* XXX */ |
410 | 410 | ||
411 | return asn1_tm_cmp(&tm1, &tm2); | 411 | return ASN1_time_tm_cmp(&tm1, &tm2); |
412 | } | 412 | } |
413 | 413 | ||
414 | /* | 414 | /* |
@@ -420,7 +420,7 @@ ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | |||
420 | { | 420 | { |
421 | if (d->type != V_ASN1_GENERALIZEDTIME) | 421 | if (d->type != V_ASN1_GENERALIZEDTIME) |
422 | return (0); | 422 | return (0); |
423 | return (d->type == asn1_time_parse(d->data, d->length, NULL, d->type)); | 423 | return (d->type == ASN1_time_parse(d->data, d->length, NULL, d->type)); |
424 | } | 424 | } |
425 | 425 | ||
426 | int | 426 | int |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index c5d9b55e40..72fdc72881 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1.h,v 1.34 2015/10/13 16:31:08 jsing Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.35 2016/11/04 18:07:23 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1357,6 +1357,9 @@ void ERR_load_ASN1_strings(void); | |||
1357 | #define ASN1_R_WRONG_TAG 168 | 1357 | #define ASN1_R_WRONG_TAG 168 |
1358 | #define ASN1_R_WRONG_TYPE 169 | 1358 | #define ASN1_R_WRONG_TYPE 169 |
1359 | 1359 | ||
1360 | |||
1361 | int ASN1_time_parse(const char *_bytes, size_t _len, struct tm *_tm, int _mode); | ||
1362 | int ASN1_time_tm_cmp(struct tm *_tm1, struct tm *_tm2); | ||
1360 | #ifdef __cplusplus | 1363 | #ifdef __cplusplus |
1361 | } | 1364 | } |
1362 | #endif | 1365 | #endif |
diff --git a/src/lib/libcrypto/man/ASN1_time_parse.3 b/src/lib/libcrypto/man/ASN1_time_parse.3 new file mode 100644 index 0000000000..e70a292f6d --- /dev/null +++ b/src/lib/libcrypto/man/ASN1_time_parse.3 | |||
@@ -0,0 +1,94 @@ | |||
1 | .\" $OpenBSD: ASN1_time_parse.3,v 1.1 2016/11/04 18:07:23 beck Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2016 Bob Beck <beck@@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: November 4 2016 $ | ||
18 | .Dt ASN1_TIME_PARSE 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm ASN1_time_parse, | ||
22 | .Nm ASN1_time_tm_cmp | ||
23 | .Nd LibreSSL utilities for asn1 format time. | ||
24 | .Sh SYNOPSIS | ||
25 | .In asn1.h | ||
26 | .Ft "int" | ||
27 | .Fn ASN1_time_parse "const char *bytes" "size_t len" "struct tm *tm" "int mode | ||
28 | .Ft "int" | ||
29 | .Fn ASN1_time_tm_cmp "struct tm *tm1" "struct tm *tm2" | ||
30 | .Sh DESCRIPTION | ||
31 | The | ||
32 | .Nm ASN1_time_parse | ||
33 | function parses an asn1 time string of | ||
34 | .Ar len | ||
35 | bytes starting at | ||
36 | .Ar bytes . | ||
37 | The resulting time is stored in | ||
38 | .Ar tm | ||
39 | if | ||
40 | .Ar tm | ||
41 | is non NULL. | ||
42 | .Pp | ||
43 | The | ||
44 | .Ar mode | ||
45 | parameter must be one of | ||
46 | .Bl -bullet -offset four | ||
47 | .It | ||
48 | .Ar 0 | ||
49 | to parse a time as specified in RFC 5280 for an X509 object, | ||
50 | which may be either a UTC time or a Generalized time. | ||
51 | .It | ||
52 | .Ar V_ASN1_UTCTIME | ||
53 | to parse an RFC 5280 format UTC time. | ||
54 | .It | ||
55 | .Ar V_ASN1_GENERALIZEDTIME | ||
56 | to parse an RFC 5280 format Generalized time. | ||
57 | .El | ||
58 | .Pp | ||
59 | The | ||
60 | .Nm ASN1_time_tm_cmp | ||
61 | function compares two times in | ||
62 | .Ar tm1 | ||
63 | and | ||
64 | .Ar tm2 | ||
65 | .Sh RETURN VALUES | ||
66 | .Nm ASN1_parse_time | ||
67 | returns | ||
68 | .Bl -bullet -offset four | ||
69 | .It | ||
70 | .Ar -1 | ||
71 | if the string was invalid for the | ||
72 | .Ar mode | ||
73 | specified | ||
74 | .It | ||
75 | .Ar V_ASN1_UTCTIME | ||
76 | if the string parsed as a valid UTC time. | ||
77 | .It : | ||
78 | .Ar V_ASN1_GENERALIZEDTIME | ||
79 | if the string parsed as a valid Generalized time. | ||
80 | .El | ||
81 | .Pp | ||
82 | .Nm ASN1_time_tm_cmp | ||
83 | returns | ||
84 | .Bl -bullet -offset four | ||
85 | .It | ||
86 | .Ar -1 | ||
87 | if tm1 is less than tm2. | ||
88 | .It | ||
89 | .Ar 1 | ||
90 | if tm1 is greater than tm2. | ||
91 | .It | ||
92 | .Ar 0 | ||
93 | if tm1 is the same as tm2. | ||
94 | .El | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index a76a03c78a..7819029ff6 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.46 2016/11/04 15:29:03 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.47 2016/11/04 18:07:23 beck Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
4 | 4 | ||
@@ -11,6 +11,7 @@ MAN= \ | |||
11 | ASN1_STRING_new.3 \ | 11 | ASN1_STRING_new.3 \ |
12 | ASN1_STRING_print_ex.3 \ | 12 | ASN1_STRING_print_ex.3 \ |
13 | ASN1_generate_nconf.3 \ | 13 | ASN1_generate_nconf.3 \ |
14 | ASN1_time_parse.3 \ | ||
14 | BF_set_key.3 \ | 15 | BF_set_key.3 \ |
15 | BIO.3 \ | 16 | BIO.3 \ |
16 | BIO_ctrl.3 \ | 17 | BIO_ctrl.3 \ |
diff --git a/src/lib/libcrypto/ocsp/ocsp_cl.c b/src/lib/libcrypto/ocsp/ocsp_cl.c index 86baed8724..40417973f5 100644 --- a/src/lib/libcrypto/ocsp/ocsp_cl.c +++ b/src/lib/libcrypto/ocsp/ocsp_cl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ocsp_cl.c,v 1.11 2016/07/16 16:14:28 beck Exp $ */ | 1 | /* $OpenBSD: ocsp_cl.c,v 1.12 2016/11/04 18:07:23 beck Exp $ */ |
2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL | 2 | /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL |
3 | * project. */ | 3 | * project. */ |
4 | 4 | ||
@@ -71,9 +71,6 @@ | |||
71 | #include <openssl/x509.h> | 71 | #include <openssl/x509.h> |
72 | #include <openssl/x509v3.h> | 72 | #include <openssl/x509v3.h> |
73 | 73 | ||
74 | int asn1_time_parse(const char *, size_t, struct tm *, int); | ||
75 | int asn1_tm_cmp(struct tm *, struct tm *); | ||
76 | |||
77 | /* Utility functions related to sending OCSP requests and extracting | 74 | /* Utility functions related to sending OCSP requests and extracting |
78 | * relevant information from the response. | 75 | * relevant information from the response. |
79 | */ | 76 | */ |
@@ -342,7 +339,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
342 | */ | 339 | */ |
343 | 340 | ||
344 | /* Check thisUpdate is valid and not more than nsec in the future */ | 341 | /* Check thisUpdate is valid and not more than nsec in the future */ |
345 | if (asn1_time_parse(thisupd->data, thisupd->length, &tm_this, | 342 | if (ASN1_time_parse(thisupd->data, thisupd->length, &tm_this, |
346 | V_ASN1_GENERALIZEDTIME) != V_ASN1_GENERALIZEDTIME) { | 343 | V_ASN1_GENERALIZEDTIME) != V_ASN1_GENERALIZEDTIME) { |
347 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 344 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
348 | OCSP_R_ERROR_IN_THISUPDATE_FIELD); | 345 | OCSP_R_ERROR_IN_THISUPDATE_FIELD); |
@@ -351,7 +348,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
351 | t_tmp = t_now + nsec; | 348 | t_tmp = t_now + nsec; |
352 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) | 349 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) |
353 | return 0; | 350 | return 0; |
354 | if (asn1_tm_cmp(&tm_this, &tm_tmp) > 0) { | 351 | if (ASN1_time_tm_cmp(&tm_this, &tm_tmp) > 0) { |
355 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 352 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
356 | OCSP_R_STATUS_NOT_YET_VALID); | 353 | OCSP_R_STATUS_NOT_YET_VALID); |
357 | return 0; | 354 | return 0; |
@@ -365,7 +362,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
365 | t_tmp = t_now - maxsec; | 362 | t_tmp = t_now - maxsec; |
366 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) | 363 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) |
367 | return 0; | 364 | return 0; |
368 | if (asn1_tm_cmp(&tm_this, &tm_tmp) < 0) { | 365 | if (ASN1_time_tm_cmp(&tm_this, &tm_tmp) < 0) { |
369 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 366 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
370 | OCSP_R_STATUS_TOO_OLD); | 367 | OCSP_R_STATUS_TOO_OLD); |
371 | return 0; | 368 | return 0; |
@@ -377,7 +374,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
377 | return 1; | 374 | return 1; |
378 | 375 | ||
379 | /* Check nextUpdate is valid and not more than nsec in the past */ | 376 | /* Check nextUpdate is valid and not more than nsec in the past */ |
380 | if (asn1_time_parse(nextupd->data, nextupd->length, &tm_next, | 377 | if (ASN1_time_parse(nextupd->data, nextupd->length, &tm_next, |
381 | V_ASN1_GENERALIZEDTIME) != V_ASN1_GENERALIZEDTIME) { | 378 | V_ASN1_GENERALIZEDTIME) != V_ASN1_GENERALIZEDTIME) { |
382 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 379 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
383 | OCSP_R_ERROR_IN_NEXTUPDATE_FIELD); | 380 | OCSP_R_ERROR_IN_NEXTUPDATE_FIELD); |
@@ -386,7 +383,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
386 | t_tmp = t_now - nsec; | 383 | t_tmp = t_now - nsec; |
387 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) | 384 | if (gmtime_r(&t_tmp, &tm_tmp) == NULL) |
388 | return 0; | 385 | return 0; |
389 | if (asn1_tm_cmp(&tm_next, &tm_tmp) < 0) { | 386 | if (ASN1_time_tm_cmp(&tm_next, &tm_tmp) < 0) { |
390 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 387 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
391 | OCSP_R_STATUS_EXPIRED); | 388 | OCSP_R_STATUS_EXPIRED); |
392 | return 0; | 389 | return 0; |
@@ -394,7 +391,7 @@ OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, | |||
394 | } | 391 | } |
395 | 392 | ||
396 | /* Also don't allow nextUpdate to precede thisUpdate */ | 393 | /* Also don't allow nextUpdate to precede thisUpdate */ |
397 | if (asn1_tm_cmp(&tm_next, &tm_this) < 0) { | 394 | if (ASN1_time_tm_cmp(&tm_next, &tm_this) < 0) { |
398 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, | 395 | OCSPerr(OCSP_F_OCSP_CHECK_VALIDITY, |
399 | OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE); | 396 | OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE); |
400 | return 0; | 397 | return 0; |
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version index cf69944b9d..77935fe957 100644 --- a/src/lib/libcrypto/shlib_version +++ b/src/lib/libcrypto/shlib_version | |||
@@ -1,3 +1,3 @@ | |||
1 | # Don't forget to give libssl and libtls the same type of bump! | 1 | # Don't forget to give libssl and libtls the same type of bump! |
2 | major=38 | 2 | major=39 |
3 | minor=1 | 3 | minor=0 |
diff --git a/src/lib/libcrypto/x509/vpm_int.h b/src/lib/libcrypto/x509/vpm_int.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/lib/libcrypto/x509/vpm_int.h | |||
diff --git a/src/lib/libcrypto/x509/x509_lcl.h b/src/lib/libcrypto/x509/x509_lcl.h index 9ffdd01e61..b16df78ad7 100644 --- a/src/lib/libcrypto/x509/x509_lcl.h +++ b/src/lib/libcrypto/x509/x509_lcl.h | |||
@@ -57,5 +57,3 @@ | |||
57 | */ | 57 | */ |
58 | 58 | ||
59 | int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet); | 59 | int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet); |
60 | int asn1_time_parse(const char *, size_t, struct tm *, int); | ||
61 | int asn1_tm_cmp(struct tm *tm1, struct tm *tm2); | ||
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index a9330e1c03..7a6d272023 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.c,v 1.50 2016/10/02 20:45:04 guenther Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.51 2016/11/04 18:07:23 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -1658,7 +1658,7 @@ X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) | |||
1658 | 1658 | ||
1659 | memset(&tm1, 0, sizeof(tm1)); | 1659 | memset(&tm1, 0, sizeof(tm1)); |
1660 | 1660 | ||
1661 | type = asn1_time_parse(ctm->data, ctm->length, &tm1, ctm->type); | 1661 | type = ASN1_time_parse(ctm->data, ctm->length, &tm1, ctm->type); |
1662 | if (type == -1) | 1662 | if (type == -1) |
1663 | goto out; /* invalid time */ | 1663 | goto out; /* invalid time */ |
1664 | 1664 | ||
@@ -1679,7 +1679,7 @@ X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) | |||
1679 | if (gmtime_r(&time2, &tm2) == NULL) | 1679 | if (gmtime_r(&time2, &tm2) == NULL) |
1680 | goto out; | 1680 | goto out; |
1681 | 1681 | ||
1682 | ret = asn1_tm_cmp(&tm1, &tm2); | 1682 | ret = ASN1_time_tm_cmp(&tm1, &tm2); |
1683 | if (ret == 0) | 1683 | if (ret == 0) |
1684 | ret = -1; /* 0 is used for error, so map same to less than */ | 1684 | ret = -1; /* 0 is used for error, so map same to less than */ |
1685 | out: | 1685 | out: |
diff --git a/src/lib/libssl/shlib_version b/src/lib/libssl/shlib_version index 9149d47732..51f4d897f8 100644 --- a/src/lib/libssl/shlib_version +++ b/src/lib/libssl/shlib_version | |||
@@ -1,3 +1,3 @@ | |||
1 | # Don't forget to give libtls the same type of bump! | 1 | # Don't forget to give libtls the same type of bump! |
2 | major=39 | 2 | major=40 |
3 | minor=1 | 3 | minor=0 |
diff --git a/src/lib/libtls/shlib_version b/src/lib/libtls/shlib_version index faa53892ba..56246d02b2 100644 --- a/src/lib/libtls/shlib_version +++ b/src/lib/libtls/shlib_version | |||
@@ -1,2 +1,2 @@ | |||
1 | major=11 | 1 | major=12 |
2 | minor=6 | 2 | minor=0 |
diff --git a/src/lib/libtls/tls_conninfo.c b/src/lib/libtls/tls_conninfo.c index 5882a19cee..1bf4b2285b 100644 --- a/src/lib/libtls/tls_conninfo.c +++ b/src/lib/libtls/tls_conninfo.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_conninfo.c,v 1.11 2016/08/22 17:12:35 jsing Exp $ */ | 1 | /* $OpenBSD: tls_conninfo.c,v 1.12 2016/11/04 18:07:24 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
4 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2015 Bob Beck <beck@openbsd.org> |
@@ -136,9 +136,9 @@ tls_get_peer_cert_times(struct tls *ctx, time_t *notbefore, | |||
136 | goto err; | 136 | goto err; |
137 | if ((after = X509_get_notAfter(ctx->ssl_peer_cert)) == NULL) | 137 | if ((after = X509_get_notAfter(ctx->ssl_peer_cert)) == NULL) |
138 | goto err; | 138 | goto err; |
139 | if (asn1_time_parse(before->data, before->length, &before_tm, 0) == -1) | 139 | if (ASN1_time_parse(before->data, before->length, &before_tm, 0) == -1) |
140 | goto err; | 140 | goto err; |
141 | if (asn1_time_parse(after->data, after->length, &after_tm, 0) == -1) | 141 | if (ASN1_time_parse(after->data, after->length, &after_tm, 0) == -1) |
142 | goto err; | 142 | goto err; |
143 | if ((*notbefore = timegm(&before_tm)) == -1) | 143 | if ((*notbefore = timegm(&before_tm)) == -1) |
144 | goto err; | 144 | goto err; |
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index 0112ceedb9..7b07c96c86 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.46 2016/11/04 05:13:13 beck Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.47 2016/11/04 18:07:24 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -209,6 +209,4 @@ int tls_ocsp_verify_cb(SSL *ssl, void *arg); | |||
209 | void tls_ocsp_ctx_free(struct tls_ocsp_ctx *ctx); | 209 | void tls_ocsp_ctx_free(struct tls_ocsp_ctx *ctx); |
210 | struct tls_ocsp_ctx *tls_ocsp_setup_from_peer(struct tls *ctx); | 210 | struct tls_ocsp_ctx *tls_ocsp_setup_from_peer(struct tls *ctx); |
211 | 211 | ||
212 | int asn1_time_parse(const char *, size_t, struct tm *, int); | ||
213 | |||
214 | #endif /* HEADER_TLS_INTERNAL_H */ | 212 | #endif /* HEADER_TLS_INTERNAL_H */ |
diff --git a/src/lib/libtls/tls_ocsp.c b/src/lib/libtls/tls_ocsp.c index af65771f7c..52e90364a7 100644 --- a/src/lib/libtls/tls_ocsp.c +++ b/src/lib/libtls/tls_ocsp.c | |||
@@ -63,7 +63,7 @@ tls_ocsp_asn1_parse_time(struct tls *ctx, ASN1_GENERALIZEDTIME *gt, time_t *gt_t | |||
63 | if (gt == NULL) | 63 | if (gt == NULL) |
64 | return -1; | 64 | return -1; |
65 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ | 65 | /* RFC 6960 specifies that all times in OCSP must be GENERALIZEDTIME */ |
66 | if (asn1_time_parse(gt->data, gt->length, &tm, | 66 | if (ASN1_time_parse(gt->data, gt->length, &tm, |
67 | V_ASN1_GENERALIZEDTIME) == -1) | 67 | V_ASN1_GENERALIZEDTIME) == -1) |
68 | return -1; | 68 | return -1; |
69 | if ((*gt_time = timegm(&tm)) == -1) | 69 | if ((*gt_time = timegm(&tm)) == -1) |
@@ -258,7 +258,6 @@ tls_ocsp_verify_response(struct tls *ctx, OCSP_RESPONSE *resp) | |||
258 | OCSP_crl_reason_str(crl_reason)); | 258 | OCSP_crl_reason_str(crl_reason)); |
259 | goto error; | 259 | goto error; |
260 | } | 260 | } |
261 | |||
262 | ret = 0; | 261 | ret = 0; |
263 | 262 | ||
264 | error: | 263 | error: |