Apply upstream fixes for CVE-2017-3735, CVE-2017-3736, CVE-2017-3737, CVE-2017-3738, CVE-2018-0737, CVE-2018-0739. Regen. Requested by christos in ticket #774.diff -r1.2 -r1.2.6.1 src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1.h
(martin)
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/Attic/asn1.h 2016/10/14 16:23:18 1.2
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/Attic/asn1.h 2018/04/18 13:51:35 1.2.6.1
@@ -1355,26 +1355,27 @@ void ERR_load_ASN1_strings(void); | @@ -1355,26 +1355,27 @@ void ERR_load_ASN1_strings(void); | |||
1355 | # define ASN1_R_INVALID_UTF8STRING 134 | 1355 | # define ASN1_R_INVALID_UTF8STRING 134 | |
1356 | # define ASN1_R_IV_TOO_LARGE 135 | 1356 | # define ASN1_R_IV_TOO_LARGE 135 | |
1357 | # define ASN1_R_LENGTH_ERROR 136 | 1357 | # define ASN1_R_LENGTH_ERROR 136 | |
1358 | # define ASN1_R_LIST_ERROR 188 | 1358 | # define ASN1_R_LIST_ERROR 188 | |
1359 | # define ASN1_R_MIME_NO_CONTENT_TYPE 206 | 1359 | # define ASN1_R_MIME_NO_CONTENT_TYPE 206 | |
1360 | # define ASN1_R_MIME_PARSE_ERROR 207 | 1360 | # define ASN1_R_MIME_PARSE_ERROR 207 | |
1361 | # define ASN1_R_MIME_SIG_PARSE_ERROR 208 | 1361 | # define ASN1_R_MIME_SIG_PARSE_ERROR 208 | |
1362 | # define ASN1_R_MISSING_EOC 137 | 1362 | # define ASN1_R_MISSING_EOC 137 | |
1363 | # define ASN1_R_MISSING_SECOND_NUMBER 138 | 1363 | # define ASN1_R_MISSING_SECOND_NUMBER 138 | |
1364 | # define ASN1_R_MISSING_VALUE 189 | 1364 | # define ASN1_R_MISSING_VALUE 189 | |
1365 | # define ASN1_R_MSTRING_NOT_UNIVERSAL 139 | 1365 | # define ASN1_R_MSTRING_NOT_UNIVERSAL 139 | |
1366 | # define ASN1_R_MSTRING_WRONG_TAG 140 | 1366 | # define ASN1_R_MSTRING_WRONG_TAG 140 | |
1367 | # define ASN1_R_NESTED_ASN1_STRING 197 | 1367 | # define ASN1_R_NESTED_ASN1_STRING 197 | |
1368 | # define ASN1_R_NESTED_TOO_DEEP 219 | |||
1368 | # define ASN1_R_NON_HEX_CHARACTERS 141 | 1369 | # define ASN1_R_NON_HEX_CHARACTERS 141 | |
1369 | # define ASN1_R_NOT_ASCII_FORMAT 190 | 1370 | # define ASN1_R_NOT_ASCII_FORMAT 190 | |
1370 | # define ASN1_R_NOT_ENOUGH_DATA 142 | 1371 | # define ASN1_R_NOT_ENOUGH_DATA 142 | |
1371 | # define ASN1_R_NO_CONTENT_TYPE 209 | 1372 | # define ASN1_R_NO_CONTENT_TYPE 209 | |
1372 | # define ASN1_R_NO_DEFAULT_DIGEST 201 | 1373 | # define ASN1_R_NO_DEFAULT_DIGEST 201 | |
1373 | # define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 | 1374 | # define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 | |
1374 | # define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 | 1375 | # define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 | |
1375 | # define ASN1_R_NO_MULTIPART_BOUNDARY 211 | 1376 | # define ASN1_R_NO_MULTIPART_BOUNDARY 211 | |
1376 | # define ASN1_R_NO_SIG_CONTENT_TYPE 212 | 1377 | # define ASN1_R_NO_SIG_CONTENT_TYPE 212 | |
1377 | # define ASN1_R_NULL_IS_WRONG_LENGTH 144 | 1378 | # define ASN1_R_NULL_IS_WRONG_LENGTH 144 | |
1378 | # define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 | 1379 | # define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 | |
1379 | # define ASN1_R_ODD_NUMBER_OF_CHARS 145 | 1380 | # define ASN1_R_ODD_NUMBER_OF_CHARS 145 | |
1380 | # define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 | 1381 | # define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 |
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c 2015/03/23 08:28:38 1.1.1.7
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/asn1_err.c 2018/04/18 13:51:35 1.1.1.7.8.1
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | /* crypto/asn1/asn1_err.c */ | 1 | /* crypto/asn1/asn1_err.c */ | |
2 | /* ==================================================================== | 2 | /* ==================================================================== | |
3 | * Copyright (c) 1999-2014 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2018 The OpenSSL Project. All rights reserved. | |
4 | * | 4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | 7 | * are met: | |
8 | * | 8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | 11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in | |
14 | * the documentation and/or other materials provided with the | 14 | * the documentation and/or other materials provided with the | |
15 | * distribution. | 15 | * distribution. | |
16 | * | 16 | * | |
@@ -269,26 +269,27 @@ static ERR_STRING_DATA ASN1_str_reasons[ | @@ -269,26 +269,27 @@ static ERR_STRING_DATA ASN1_str_reasons[ | |||
269 | {ERR_REASON(ASN1_R_INVALID_UTF8STRING), "invalid utf8string"}, | 269 | {ERR_REASON(ASN1_R_INVALID_UTF8STRING), "invalid utf8string"}, | |
270 | {ERR_REASON(ASN1_R_IV_TOO_LARGE), "iv too large"}, | 270 | {ERR_REASON(ASN1_R_IV_TOO_LARGE), "iv too large"}, | |
271 | {ERR_REASON(ASN1_R_LENGTH_ERROR), "length error"}, | 271 | {ERR_REASON(ASN1_R_LENGTH_ERROR), "length error"}, | |
272 | {ERR_REASON(ASN1_R_LIST_ERROR), "list error"}, | 272 | {ERR_REASON(ASN1_R_LIST_ERROR), "list error"}, | |
273 | {ERR_REASON(ASN1_R_MIME_NO_CONTENT_TYPE), "mime no content type"}, | 273 | {ERR_REASON(ASN1_R_MIME_NO_CONTENT_TYPE), "mime no content type"}, | |
274 | {ERR_REASON(ASN1_R_MIME_PARSE_ERROR), "mime parse error"}, | 274 | {ERR_REASON(ASN1_R_MIME_PARSE_ERROR), "mime parse error"}, | |
275 | {ERR_REASON(ASN1_R_MIME_SIG_PARSE_ERROR), "mime sig parse error"}, | 275 | {ERR_REASON(ASN1_R_MIME_SIG_PARSE_ERROR), "mime sig parse error"}, | |
276 | {ERR_REASON(ASN1_R_MISSING_EOC), "missing eoc"}, | 276 | {ERR_REASON(ASN1_R_MISSING_EOC), "missing eoc"}, | |
277 | {ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER), "missing second number"}, | 277 | {ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER), "missing second number"}, | |
278 | {ERR_REASON(ASN1_R_MISSING_VALUE), "missing value"}, | 278 | {ERR_REASON(ASN1_R_MISSING_VALUE), "missing value"}, | |
279 | {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL), "mstring not universal"}, | 279 | {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL), "mstring not universal"}, | |
280 | {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG), "mstring wrong tag"}, | 280 | {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG), "mstring wrong tag"}, | |
281 | {ERR_REASON(ASN1_R_NESTED_ASN1_STRING), "nested asn1 string"}, | 281 | {ERR_REASON(ASN1_R_NESTED_ASN1_STRING), "nested asn1 string"}, | |
282 | {ERR_REASON(ASN1_R_NESTED_TOO_DEEP), "nested too deep"}, | |||
282 | {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS), "non hex characters"}, | 283 | {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS), "non hex characters"}, | |
283 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT), "not ascii format"}, | 284 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT), "not ascii format"}, | |
284 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA), "not enough data"}, | 285 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA), "not enough data"}, | |
285 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE), "no content type"}, | 286 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE), "no content type"}, | |
286 | {ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST), "no default digest"}, | 287 | {ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST), "no default digest"}, | |
287 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE), "no matching choice type"}, | 288 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE), "no matching choice type"}, | |
288 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE), | 289 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE), | |
289 | "no multipart body failure"}, | 290 | "no multipart body failure"}, | |
290 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY), "no multipart boundary"}, | 291 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY), "no multipart boundary"}, | |
291 | {ERR_REASON(ASN1_R_NO_SIG_CONTENT_TYPE), "no sig content type"}, | 292 | {ERR_REASON(ASN1_R_NO_SIG_CONTENT_TYPE), "no sig content type"}, | |
292 | {ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH), "null is wrong length"}, | 293 | {ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH), "null is wrong length"}, | |
293 | {ERR_REASON(ASN1_R_OBJECT_NOT_ASCII_FORMAT), "object not ascii format"}, | 294 | {ERR_REASON(ASN1_R_OBJECT_NOT_ASCII_FORMAT), "object not ascii format"}, | |
294 | {ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS), "odd number of chars"}, | 295 | {ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS), "odd number of chars"}, |
--- src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c 2016/10/14 16:23:18 1.6
+++ src/crypto/external/bsd/openssl/dist/crypto/asn1/tasn_dec.c 2018/04/18 13:51:35 1.6.6.1
@@ -55,47 +55,55 @@ | @@ -55,47 +55,55 @@ | |||
55 | * (eay@cryptsoft.com). This product includes software written by Tim | 55 | * (eay@cryptsoft.com). This product includes software written by Tim | |
56 | * Hudson (tjh@cryptsoft.com). | 56 | * Hudson (tjh@cryptsoft.com). | |
57 | * | 57 | * | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | #include <stddef.h> | 60 | #include <stddef.h> | |
61 | #include <string.h> | 61 | #include <string.h> | |
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> | |
63 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> | |
64 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> | |
65 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> | |
66 | #include <openssl/err.h> | 66 | #include <openssl/err.h> | |
67 | 67 | |||
68 | /* | |||
69 | * Constructed types with a recursive definition (such as can be found in PKCS7) | |||
70 | * could eventually exceed the stack given malicious input with excessive | |||
71 | * recursion. Therefore we limit the stack depth. This is the maximum number of | |||
72 | * recursive invocations of asn1_item_embed_d2i(). | |||
73 | */ | |||
74 | #define ASN1_MAX_CONSTRUCTED_NEST 30 | |||
75 | ||||
68 | static int asn1_check_eoc(const unsigned char **in, long len); | 76 | static int asn1_check_eoc(const unsigned char **in, long len); | |
69 | static int asn1_find_end(const unsigned char **in, long len, char inf); | 77 | static int asn1_find_end(const unsigned char **in, long len, char inf); | |
70 | 78 | |||
71 | static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, | 79 | static int asn1_collect(BUF_MEM *buf, const unsigned char **in, long len, | |
72 | char inf, int tag, int aclass, int depth); | 80 | char inf, int tag, int aclass, int depth); | |
73 | 81 | |||
74 | static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen); | 82 | static int collect_data(BUF_MEM *buf, const unsigned char **p, long plen); | |
75 | 83 | |||
76 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, | 84 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, | |
77 | char *inf, char *cst, | 85 | char *inf, char *cst, | |
78 | const unsigned char **in, long len, | 86 | const unsigned char **in, long len, | |
79 | int exptag, int expclass, char opt, ASN1_TLC *ctx); | 87 | int exptag, int expclass, char opt, ASN1_TLC *ctx); | |
80 | 88 | |||
81 | static int asn1_template_ex_d2i(ASN1_VALUE **pval, | 89 | static int asn1_template_ex_d2i(ASN1_VALUE **pval, | |
82 | const unsigned char **in, long len, | 90 | const unsigned char **in, long len, | |
83 | const ASN1_TEMPLATE *tt, char opt, | 91 | const ASN1_TEMPLATE *tt, char opt, | |
84 | ASN1_TLC *ctx); | 92 | ASN1_TLC *ctx, int depth); | |
85 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | 93 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |
86 | const unsigned char **in, long len, | 94 | const unsigned char **in, long len, | |
87 | const ASN1_TEMPLATE *tt, char opt, | 95 | const ASN1_TEMPLATE *tt, char opt, | |
88 | ASN1_TLC *ctx); | 96 | ASN1_TLC *ctx, int depth); | |
89 | static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | 97 | static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, | |
90 | const unsigned char **in, long len, | 98 | const unsigned char **in, long len, | |
91 | const ASN1_ITEM *it, | 99 | const ASN1_ITEM *it, | |
92 | int tag, int aclass, char opt, | 100 | int tag, int aclass, char opt, | |
93 | ASN1_TLC *ctx); | 101 | ASN1_TLC *ctx); | |
94 | 102 | |||
95 | /* Table to convert tags to bit values, used for MSTRING type */ | 103 | /* Table to convert tags to bit values, used for MSTRING type */ | |
96 | static const unsigned long tag2bit[32] = { | 104 | static const unsigned long tag2bit[32] = { | |
97 | /* tags 0 - 3 */ | 105 | /* tags 0 - 3 */ | |
98 | 0, 0, 0, B_ASN1_BIT_STRING, | 106 | 0, 0, 0, B_ASN1_BIT_STRING, | |
99 | /* tags 4- 7 */ | 107 | /* tags 4- 7 */ | |
100 | B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN, | 108 | B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN, | |
101 | /* tags 8-11 */ | 109 | /* tags 8-11 */ | |
@@ -144,77 +152,81 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **p | @@ -144,77 +152,81 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **p | |||
144 | pval = &ptmpval; | 152 | pval = &ptmpval; | |
145 | asn1_tlc_clear_nc(&c); | 153 | asn1_tlc_clear_nc(&c); | |
146 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) | 154 | if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) | |
147 | return *pval; | 155 | return *pval; | |
148 | return NULL; | 156 | return NULL; | |
149 | } | 157 | } | |
150 | 158 | |||
151 | int ASN1_template_d2i(ASN1_VALUE **pval, | 159 | int ASN1_template_d2i(ASN1_VALUE **pval, | |
152 | const unsigned char **in, long len, | 160 | const unsigned char **in, long len, | |
153 | const ASN1_TEMPLATE *tt) | 161 | const ASN1_TEMPLATE *tt) | |
154 | { | 162 | { | |
155 | ASN1_TLC c; | 163 | ASN1_TLC c; | |
156 | asn1_tlc_clear_nc(&c); | 164 | asn1_tlc_clear_nc(&c); | |
157 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); | 165 | return asn1_template_ex_d2i(pval, in, len, tt, 0, &c, 0); | |
158 | } | 166 | } | |
159 | 167 | |||
160 | /* | 168 | /* | |
161 | * Decode an item, taking care of IMPLICIT tagging, if any. If 'opt' set and | 169 | * Decode an item, taking care of IMPLICIT tagging, if any. If 'opt' set and | |
162 | * tag mismatch return -1 to handle OPTIONAL | 170 | * tag mismatch return -1 to handle OPTIONAL | |
163 | */ | 171 | */ | |
164 | 172 | static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, | ||
165 | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | 173 | long len, const ASN1_ITEM *it, int tag, int aclass, | |
166 | const ASN1_ITEM *it, | 174 | char opt, ASN1_TLC *ctx, int depth) | |
167 | int tag, int aclass, char opt, ASN1_TLC *ctx) | |||
168 | { | 175 | { | |
169 | const ASN1_TEMPLATE *tt, *errtt = NULL; | 176 | const ASN1_TEMPLATE *tt, *errtt = NULL; | |
170 | const ASN1_COMPAT_FUNCS *cf; | 177 | const ASN1_COMPAT_FUNCS *cf; | |
171 | const ASN1_EXTERN_FUNCS *ef; | 178 | const ASN1_EXTERN_FUNCS *ef; | |
172 | const ASN1_AUX *aux = it->funcs; | 179 | const ASN1_AUX *aux = it->funcs; | |
173 | ASN1_aux_cb *asn1_cb; | 180 | ASN1_aux_cb *asn1_cb; | |
174 | const unsigned char *p = NULL, *q; | 181 | const unsigned char *p = NULL, *q; | |
175 | unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */ | 182 | unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */ | |
176 | unsigned char imphack = 0, oclass; | 183 | unsigned char imphack = 0, oclass; | |
177 | char seq_eoc, seq_nolen, cst, isopt; | 184 | char seq_eoc, seq_nolen, cst, isopt; | |
178 | long tmplen; | 185 | long tmplen; | |
179 | int i; | 186 | int i; | |
180 | int otag; | 187 | int otag; | |
181 | int ret = 0; | 188 | int ret = 0; | |
182 | ASN1_VALUE **pchptr, *ptmpval; | 189 | ASN1_VALUE **pchptr, *ptmpval; | |
183 | int combine = aclass & ASN1_TFLG_COMBINE; | 190 | int combine = aclass & ASN1_TFLG_COMBINE; | |
184 | aclass &= ~ASN1_TFLG_COMBINE; | 191 | aclass &= ~ASN1_TFLG_COMBINE; | |
185 | if (!pval) | 192 | if (!pval) | |
186 | return 0; | 193 | return 0; | |
187 | if (aux && aux->asn1_cb) | 194 | if (aux && aux->asn1_cb) | |
188 | asn1_cb = aux->asn1_cb; | 195 | asn1_cb = aux->asn1_cb; | |
189 | else | 196 | else | |
190 | asn1_cb = 0; | 197 | asn1_cb = 0; | |
191 | 198 | |||
199 | if (++depth > ASN1_MAX_CONSTRUCTED_NEST) { | |||
200 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_NESTED_TOO_DEEP); | |||
201 | goto err; | |||
202 | } | |||
203 | ||||
192 | switch (it->itype) { | 204 | switch (it->itype) { | |
193 | case ASN1_ITYPE_PRIMITIVE: | 205 | case ASN1_ITYPE_PRIMITIVE: | |
194 | if (it->templates) { | 206 | if (it->templates) { | |
195 | /* | 207 | /* | |
196 | * tagging or OPTIONAL is currently illegal on an item template | 208 | * tagging or OPTIONAL is currently illegal on an item template | |
197 | * because the flags can't get passed down. In practice this | 209 | * because the flags can't get passed down. In practice this | |
198 | * isn't a problem: we include the relevant flags from the item | 210 | * isn't a problem: we include the relevant flags from the item | |
199 | * template in the template itself. | 211 | * template in the template itself. | |
200 | */ | 212 | */ | |
201 | if ((tag != -1) || opt) { | 213 | if ((tag != -1) || opt) { | |
202 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, | 214 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, | |
203 | ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE); | 215 | ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE); | |
204 | goto err; | 216 | goto err; | |
205 | } | 217 | } | |
206 | return asn1_template_ex_d2i(pval, in, len, | 218 | return asn1_template_ex_d2i(pval, in, len, | |
207 | it->templates, opt, ctx); | 219 | it->templates, opt, ctx, depth); | |
208 | } | 220 | } | |
209 | return asn1_d2i_ex_primitive(pval, in, len, it, | 221 | return asn1_d2i_ex_primitive(pval, in, len, it, | |
210 | tag, aclass, opt, ctx); | 222 | tag, aclass, opt, ctx); | |
211 | break; | 223 | break; | |
212 | 224 | |||
213 | case ASN1_ITYPE_MSTRING: | 225 | case ASN1_ITYPE_MSTRING: | |
214 | p = *in; | 226 | p = *in; | |
215 | /* Just read in tag and class */ | 227 | /* Just read in tag and class */ | |
216 | ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, | 228 | ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, | |
217 | &p, len, -1, 0, 1, ctx); | 229 | &p, len, -1, 0, 1, ctx); | |
218 | if (!ret) { | 230 | if (!ret) { | |
219 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 231 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | |
220 | goto err; | 232 | goto err; | |
@@ -316,27 +328,27 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | @@ -316,27 +328,27 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | |||
316 | asn1_set_choice_selector(pval, -1, it); | 328 | asn1_set_choice_selector(pval, -1, it); | |
317 | } | 329 | } | |
318 | } else if (!ASN1_item_ex_new(pval, it)) { | 330 | } else if (!ASN1_item_ex_new(pval, it)) { | |
319 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 331 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | |
320 | goto err; | 332 | goto err; | |
321 | } | 333 | } | |
322 | /* CHOICE type, try each possibility in turn */ | 334 | /* CHOICE type, try each possibility in turn */ | |
323 | p = *in; | 335 | p = *in; | |
324 | for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { | 336 | for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { | |
325 | pchptr = asn1_get_field_ptr(pval, tt); | 337 | pchptr = asn1_get_field_ptr(pval, tt); | |
326 | /* | 338 | /* | |
327 | * We mark field as OPTIONAL so its absence can be recognised. | 339 | * We mark field as OPTIONAL so its absence can be recognised. | |
328 | */ | 340 | */ | |
329 | ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx); | 341 | ret = asn1_template_ex_d2i(pchptr, &p, len, tt, 1, ctx, depth); | |
330 | /* If field not present, try the next one */ | 342 | /* If field not present, try the next one */ | |
331 | if (ret == -1) | 343 | if (ret == -1) | |
332 | continue; | 344 | continue; | |
333 | /* If positive return, read OK, break loop */ | 345 | /* If positive return, read OK, break loop */ | |
334 | if (ret > 0) | 346 | if (ret > 0) | |
335 | break; | 347 | break; | |
336 | /* Otherwise must be an ASN1 parsing error */ | 348 | /* Otherwise must be an ASN1 parsing error */ | |
337 | errtt = tt; | 349 | errtt = tt; | |
338 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 350 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | |
339 | goto err; | 351 | goto err; | |
340 | } | 352 | } | |
341 | 353 | |||
342 | /* Did we fall off the end without reading anything? */ | 354 | /* Did we fall off the end without reading anything? */ | |
@@ -434,27 +446,28 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | @@ -434,27 +446,28 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | |||
434 | * This determines the OPTIONAL flag value. The field cannot be | 446 | * This determines the OPTIONAL flag value. The field cannot be | |
435 | * omitted if it is the last of a SEQUENCE and there is still | 447 | * omitted if it is the last of a SEQUENCE and there is still | |
436 | * data to be read. This isn't strictly necessary but it | 448 | * data to be read. This isn't strictly necessary but it | |
437 | * increases efficiency in some cases. | 449 | * increases efficiency in some cases. | |
438 | */ | 450 | */ | |
439 | if (i == (it->tcount - 1)) | 451 | if (i == (it->tcount - 1)) | |
440 | isopt = 0; | 452 | isopt = 0; | |
441 | else | 453 | else | |
442 | isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL); | 454 | isopt = (char)(seqtt->flags & ASN1_TFLG_OPTIONAL); | |
443 | /* | 455 | /* | |
444 | * attempt to read in field, allowing each to be OPTIONAL | 456 | * attempt to read in field, allowing each to be OPTIONAL | |
445 | */ | 457 | */ | |
446 | 458 | |||
447 | ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx); | 459 | ret = asn1_template_ex_d2i(pseqval, &p, len, seqtt, isopt, ctx, | |
460 | depth); | |||
448 | if (!ret) { | 461 | if (!ret) { | |
449 | errtt = seqtt; | 462 | errtt = seqtt; | |
450 | goto err; | 463 | goto err; | |
451 | } else if (ret == -1) { | 464 | } else if (ret == -1) { | |
452 | /* | 465 | /* | |
453 | * OPTIONAL component absent. Free and zero the field. | 466 | * OPTIONAL component absent. Free and zero the field. | |
454 | */ | 467 | */ | |
455 | ASN1_template_free(pseqval, seqtt); | 468 | ASN1_template_free(pseqval, seqtt); | |
456 | continue; | 469 | continue; | |
457 | } | 470 | } | |
458 | /* Update length */ | 471 | /* Update length */ | |
459 | len -= p - q; | 472 | len -= p - q; | |
460 | } | 473 | } | |
@@ -504,35 +517,42 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | @@ -504,35 +517,42 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, | |||
504 | auxerr: | 517 | auxerr: | |
505 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR); | 518 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR); | |
506 | err: | 519 | err: | |
507 | if (combine == 0) | 520 | if (combine == 0) | |
508 | ASN1_item_ex_free(pval, it); | 521 | ASN1_item_ex_free(pval, it); | |
509 | if (errtt) | 522 | if (errtt) | |
510 | ERR_add_error_data(4, "Field=", errtt->field_name, | 523 | ERR_add_error_data(4, "Field=", errtt->field_name, | |
511 | ", Type=", it->sname); | 524 | ", Type=", it->sname); | |
512 | else | 525 | else | |
513 | ERR_add_error_data(2, "Type=", it->sname); | 526 | ERR_add_error_data(2, "Type=", it->sname); | |
514 | return 0; | 527 | return 0; | |
515 | } | 528 | } | |
516 | 529 | |||
530 | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
531 | const ASN1_ITEM *it, | |||
532 | int tag, int aclass, char opt, ASN1_TLC *ctx) | |||
533 | { | |||
534 | return asn1_item_ex_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0); | |||
535 | } | |||
536 | ||||
517 | /* | 537 | /* | |
518 | * Templates are handled with two separate functions. One handles any | 538 | * Templates are handled with two separate functions. One handles any | |
519 | * EXPLICIT tag and the other handles the rest. | 539 | * EXPLICIT tag and the other handles the rest. | |
520 | */ | 540 | */ | |
521 | 541 | |||
522 | static int asn1_template_ex_d2i(ASN1_VALUE **val, | 542 | static int asn1_template_ex_d2i(ASN1_VALUE **val, | |
523 | const unsigned char **in, long inlen, | 543 | const unsigned char **in, long inlen, | |
524 | const ASN1_TEMPLATE *tt, char opt, | 544 | const ASN1_TEMPLATE *tt, char opt, | |
525 | ASN1_TLC *ctx) | 545 | ASN1_TLC *ctx, int depth) | |
526 | { | 546 | { | |
527 | int flags, aclass; | 547 | int flags, aclass; | |
528 | int ret; | 548 | int ret; | |
529 | long len; | 549 | long len; | |
530 | const unsigned char *p, *q; | 550 | const unsigned char *p, *q; | |
531 | char exp_eoc; | 551 | char exp_eoc; | |
532 | if (!val) | 552 | if (!val) | |
533 | return 0; | 553 | return 0; | |
534 | flags = tt->flags; | 554 | flags = tt->flags; | |
535 | aclass = flags & ASN1_TFLG_TAG_CLASS; | 555 | aclass = flags & ASN1_TFLG_TAG_CLASS; | |
536 | 556 | |||
537 | p = *in; | 557 | p = *in; | |
538 | 558 | |||
@@ -547,64 +567,64 @@ static int asn1_template_ex_d2i(ASN1_VAL | @@ -547,64 +567,64 @@ static int asn1_template_ex_d2i(ASN1_VAL | |||
547 | &p, inlen, tt->tag, aclass, opt, ctx); | 567 | &p, inlen, tt->tag, aclass, opt, ctx); | |
548 | q = p; | 568 | q = p; | |
549 | if (!ret) { | 569 | if (!ret) { | |
550 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 570 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | |
551 | return 0; | 571 | return 0; | |
552 | } else if (ret == -1) | 572 | } else if (ret == -1) | |
553 | return -1; | 573 | return -1; | |
554 | if (!cst) { | 574 | if (!cst) { | |
555 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, | 575 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, | |
556 | ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED); | 576 | ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED); | |
557 | return 0; | 577 | return 0; | |
558 | } | 578 | } | |
559 | /* We've found the field so it can't be OPTIONAL now */ | 579 | /* We've found the field so it can't be OPTIONAL now */ | |
560 | ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx); | 580 | ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth); | |
561 | if (!ret) { | 581 | if (!ret) { | |
562 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 582 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | |
563 | return 0; | 583 | return 0; | |
564 | } | 584 | } | |
565 | /* We read the field in OK so update length */ | 585 | /* We read the field in OK so update length */ | |
566 | len -= p - q; | 586 | len -= p - q; | |
567 | if (exp_eoc) { | 587 | if (exp_eoc) { | |
568 | /* If NDEF we must have an EOC here */ | 588 | /* If NDEF we must have an EOC here */ | |
569 | if (!asn1_check_eoc(&p, len)) { | 589 | if (!asn1_check_eoc(&p, len)) { | |
570 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_MISSING_EOC); | 590 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_MISSING_EOC); | |
571 | goto err; | 591 | goto err; | |
572 | } | 592 | } | |
573 | } else { | 593 | } else { | |
574 | /* | 594 | /* | |
575 | * Otherwise we must hit the EXPLICIT tag end or its an error | 595 | * Otherwise we must hit the EXPLICIT tag end or its an error | |
576 | */ | 596 | */ | |
577 | if (len) { | 597 | if (len) { | |
578 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, | 598 | ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, | |
579 | ASN1_R_EXPLICIT_LENGTH_MISMATCH); | 599 | ASN1_R_EXPLICIT_LENGTH_MISMATCH); | |
580 | goto err; | 600 | goto err; | |
581 | } | 601 | } | |
582 | } | 602 | } | |
583 | } else | 603 | } else | |
584 | return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx); | 604 | return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth); | |
585 | 605 | |||
586 | *in = p; | 606 | *in = p; | |
587 | return 1; | 607 | return 1; | |
588 | 608 | |||
589 | err: | 609 | err: | |
590 | ASN1_template_free(val, tt); | 610 | ASN1_template_free(val, tt); | |
591 | return 0; | 611 | return 0; | |
592 | } | 612 | } | |
593 | 613 | |||
594 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | 614 | static int asn1_template_noexp_d2i(ASN1_VALUE **val, | |
595 | const unsigned char **in, long len, | 615 | const unsigned char **in, long len, | |
596 | const ASN1_TEMPLATE *tt, char opt, | 616 | const ASN1_TEMPLATE *tt, char opt, | |
597 | ASN1_TLC *ctx) | 617 | ASN1_TLC *ctx, int depth) | |
598 | { | 618 | { | |
599 | int flags, aclass; | 619 | int flags, aclass; | |
600 | int ret; | 620 | int ret; | |
601 | const unsigned char *p, *q; | 621 | const unsigned char *p, *q; | |
602 | if (!val) | 622 | if (!val) | |
603 | return 0; | 623 | return 0; | |
604 | flags = tt->flags; | 624 | flags = tt->flags; | |
605 | aclass = flags & ASN1_TFLG_TAG_CLASS; | 625 | aclass = flags & ASN1_TFLG_TAG_CLASS; | |
606 | 626 | |||
607 | p = *in; | 627 | p = *in; | |
608 | q = p; | 628 | q = p; | |
609 | 629 | |||
610 | if (flags & ASN1_TFLG_SK_MASK) { | 630 | if (flags & ASN1_TFLG_SK_MASK) { | |
@@ -655,56 +675,56 @@ static int asn1_template_noexp_d2i(ASN1_ | @@ -655,56 +675,56 @@ static int asn1_template_noexp_d2i(ASN1_ | |||
655 | q = p; | 675 | q = p; | |
656 | /* See if EOC found */ | 676 | /* See if EOC found */ | |
657 | if (asn1_check_eoc(&p, len)) { | 677 | if (asn1_check_eoc(&p, len)) { | |
658 | if (!sk_eoc) { | 678 | if (!sk_eoc) { | |
659 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | 679 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | |
660 | ASN1_R_UNEXPECTED_EOC); | 680 | ASN1_R_UNEXPECTED_EOC); | |
661 | goto err; | 681 | goto err; | |
662 | } | 682 | } | |
663 | len -= p - q; | 683 | len -= p - q; | |
664 | sk_eoc = 0; | 684 | sk_eoc = 0; | |
665 | break; | 685 | break; | |
666 | } | 686 | } | |
667 | skfield = NULL; | 687 | skfield = NULL; | |
668 | if (!ASN1_item_ex_d2i(&skfield, &p, len, | 688 | if (!asn1_item_ex_d2i(&skfield, &p, len, ASN1_ITEM_ptr(tt->item), | |
669 | ASN1_ITEM_ptr(tt->item), -1, 0, 0, ctx)) { | 689 | -1, 0, 0, ctx, depth)) { | |
670 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | 690 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, | |
671 | ERR_R_NESTED_ASN1_ERROR); | 691 | ERR_R_NESTED_ASN1_ERROR); | |
672 | goto err; | 692 | goto err; | |
673 | } | 693 | } | |
674 | len -= p - q; | 694 | len -= p - q; | |
675 | if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) { | 695 | if (!sk_ASN1_VALUE_push((STACK_OF(ASN1_VALUE) *)*val, skfield)) { | |
676 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE); | 696 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_MALLOC_FAILURE); | |
677 | goto err; | 697 | goto err; | |
678 | } | 698 | } | |
679 | } | 699 | } | |
680 | if (sk_eoc) { | 700 | if (sk_eoc) { | |
681 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ASN1_R_MISSING_EOC); | 701 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ASN1_R_MISSING_EOC); | |
682 | goto err; | 702 | goto err; | |
683 | } | 703 | } | |
684 | } else if (flags & ASN1_TFLG_IMPTAG) { | 704 | } else if (flags & ASN1_TFLG_IMPTAG) { | |
685 | /* IMPLICIT tagging */ | 705 | /* IMPLICIT tagging */ | |
686 | ret = ASN1_item_ex_d2i(val, &p, len, | 706 | ret = asn1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), tt->tag, | |
687 | ASN1_ITEM_ptr(tt->item), tt->tag, aclass, opt, | 707 | aclass, opt, ctx, depth); | |
688 | ctx); | |||
689 | if (!ret) { | 708 | if (!ret) { | |
690 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR); | 709 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR); | |
691 | goto err; | 710 | goto err; | |
692 | } else if (ret == -1) | 711 | } else if (ret == -1) | |
693 | return -1; | 712 | return -1; | |
694 | } else { | 713 | } else { | |
695 | /* Nothing special */ | 714 | /* Nothing special */ | |
696 | ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), | 715 | ret = asn1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item), | |
697 | -1, tt->flags & ASN1_TFLG_COMBINE, opt, ctx); | 716 | -1, tt->flags & ASN1_TFLG_COMBINE, opt, ctx, | |
717 | depth); | |||
698 | if (!ret) { | 718 | if (!ret) { | |
699 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR); | 719 | ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR); | |
700 | goto err; | 720 | goto err; | |
701 | } else if (ret == -1) | 721 | } else if (ret == -1) | |
702 | return -1; | 722 | return -1; | |
703 | } | 723 | } | |
704 | 724 | |||
705 | *in = p; | 725 | *in = p; | |
706 | return 1; | 726 | return 1; | |
707 | 727 | |||
708 | err: | 728 | err: | |
709 | ASN1_template_free(val, tt); | 729 | ASN1_template_free(val, tt); | |
710 | return 0; | 730 | return 0; |
--- src/crypto/external/bsd/openssl/dist/crypto/bn/asm/rsaz-avx2.pl 2016/10/14 16:03:22 1.1.1.1
+++ src/crypto/external/bsd/openssl/dist/crypto/bn/asm/rsaz-avx2.pl 2018/04/18 13:51:35 1.1.1.1.8.1
@@ -229,27 +229,27 @@ $code.=<<___; | @@ -229,27 +229,27 @@ $code.=<<___; | |||
229 | .Lsqr_1024_no_n_copy: | 229 | .Lsqr_1024_no_n_copy: | |
230 | and \$-1024, %rsp | 230 | and \$-1024, %rsp | |
231 | 231 | |||
232 | vmovdqu 32*1-128($ap), $ACC1 | 232 | vmovdqu 32*1-128($ap), $ACC1 | |
233 | vmovdqu 32*2-128($ap), $ACC2 | 233 | vmovdqu 32*2-128($ap), $ACC2 | |
234 | vmovdqu 32*3-128($ap), $ACC3 | 234 | vmovdqu 32*3-128($ap), $ACC3 | |
235 | vmovdqu 32*4-128($ap), $ACC4 | 235 | vmovdqu 32*4-128($ap), $ACC4 | |
236 | vmovdqu 32*5-128($ap), $ACC5 | 236 | vmovdqu 32*5-128($ap), $ACC5 | |
237 | vmovdqu 32*6-128($ap), $ACC6 | 237 | vmovdqu 32*6-128($ap), $ACC6 | |
238 | vmovdqu 32*7-128($ap), $ACC7 | 238 | vmovdqu 32*7-128($ap), $ACC7 | |
239 | vmovdqu 32*8-128($ap), $ACC8 | 239 | vmovdqu 32*8-128($ap), $ACC8 | |
240 | 240 | |||
241 | lea 192(%rsp), $tp0 # 64+128=192 | 241 | lea 192(%rsp), $tp0 # 64+128=192 | |
242 | vpbroadcastq .Land_mask(%rip), $AND_MASK | 242 | vmovdqu .Land_mask(%rip), $AND_MASK | |
243 | jmp .LOOP_GRANDE_SQR_1024 | 243 | jmp .LOOP_GRANDE_SQR_1024 | |
244 | 244 | |||
245 | .align 32 | 245 | .align 32 | |
246 | .LOOP_GRANDE_SQR_1024: | 246 | .LOOP_GRANDE_SQR_1024: | |
247 | lea 32*18+128(%rsp), $aap # size optimization | 247 | lea 32*18+128(%rsp), $aap # size optimization | |
248 | lea 448(%rsp), $tp1 # 64+128+256=448 | 248 | lea 448(%rsp), $tp1 # 64+128+256=448 | |
249 | 249 | |||
250 | # the squaring is performed as described in Variant B of | 250 | # the squaring is performed as described in Variant B of | |
251 | # "Speeding up Big-Number Squaring", so start by calculating | 251 | # "Speeding up Big-Number Squaring", so start by calculating | |
252 | # the A*2=A+A vector | 252 | # the A*2=A+A vector | |
253 | vpaddq $ACC1, $ACC1, $ACC1 | 253 | vpaddq $ACC1, $ACC1, $ACC1 | |
254 | vpbroadcastq 32*0-128($ap), $B1 | 254 | vpbroadcastq 32*0-128($ap), $B1 | |
255 | vpaddq $ACC2, $ACC2, $ACC2 | 255 | vpaddq $ACC2, $ACC2, $ACC2 | |
@@ -1060,43 +1060,45 @@ $code.=<<___; | @@ -1060,43 +1060,45 @@ $code.=<<___; | |||
1060 | vmovq $Bi, %rbx | 1060 | vmovq $Bi, %rbx | |
1061 | vpaddq $TEMP2,$ACC1,$ACC1 | 1061 | vpaddq $TEMP2,$ACC1,$ACC1 | |
1062 | vpmuludq 32*2-128($np),$Yi,$TEMP0 | 1062 | vpmuludq 32*2-128($np),$Yi,$TEMP0 | |
1063 | vpaddq $TEMP0,$ACC2,$ACC2 | 1063 | vpaddq $TEMP0,$ACC2,$ACC2 | |
1064 | vpmuludq 32*3-128($np),$Yi,$TEMP1 | 1064 | vpmuludq 32*3-128($np),$Yi,$TEMP1 | |
1065 | vpaddq $TEMP1,$ACC3,$ACC3 | 1065 | vpaddq $TEMP1,$ACC3,$ACC3 | |
1066 | vpmuludq 32*4-128($np),$Yi,$TEMP2 | 1066 | vpmuludq 32*4-128($np),$Yi,$TEMP2 | |
1067 | vpaddq $TEMP2,$ACC4,$ACC4 | 1067 | vpaddq $TEMP2,$ACC4,$ACC4 | |
1068 | vpmuludq 32*5-128($np),$Yi,$TEMP0 | 1068 | vpmuludq 32*5-128($np),$Yi,$TEMP0 | |
1069 | vpaddq $TEMP0,$ACC5,$ACC5 | 1069 | vpaddq $TEMP0,$ACC5,$ACC5 | |
1070 | vpmuludq 32*6-128($np),$Yi,$TEMP1 | 1070 | vpmuludq 32*6-128($np),$Yi,$TEMP1 | |
1071 | vpaddq $TEMP1,$ACC6,$ACC6 | 1071 | vpaddq $TEMP1,$ACC6,$ACC6 | |
1072 | vpmuludq 32*7-128($np),$Yi,$TEMP2 | 1072 | vpmuludq 32*7-128($np),$Yi,$TEMP2 | |
1073 | vpblendd \$3, $ZERO, $ACC9, $ACC9 # correct $ACC3 | 1073 | vpblendd \$3, $ZERO, $ACC9, $TEMP1 # correct $ACC3 | |
1074 | vpaddq $TEMP2,$ACC7,$ACC7 | 1074 | vpaddq $TEMP2,$ACC7,$ACC7 | |
1075 | vpmuludq 32*8-128($np),$Yi,$TEMP0 | 1075 | vpmuludq 32*8-128($np),$Yi,$TEMP0 | |
1076 | vpaddq $ACC9, $ACC3, $ACC3 # correct $ACC3 | 1076 | vpaddq $TEMP1, $ACC3, $ACC3 # correct $ACC3 | |
1077 | vpaddq $TEMP0,$ACC8,$ACC8 | 1077 | vpaddq $TEMP0,$ACC8,$ACC8 | |
1078 | 1078 | |||
1079 | mov %rbx, %rax | 1079 | mov %rbx, %rax | |
1080 | imulq -128($ap),%rax | 1080 | imulq -128($ap),%rax | |
1081 | add %rax,$r1 | 1081 | add %rax,$r1 | |
1082 | vmovdqu -8+32*1-128($ap),$TEMP1 | 1082 | vmovdqu -8+32*1-128($ap),$TEMP1 | |
1083 | mov %rbx, %rax | 1083 | mov %rbx, %rax | |
1084 | imulq 8-128($ap),%rax | 1084 | imulq 8-128($ap),%rax | |
1085 | add %rax,$r2 | 1085 | add %rax,$r2 | |
1086 | vmovdqu -8+32*2-128($ap),$TEMP2 | 1086 | vmovdqu -8+32*2-128($ap),$TEMP2 | |
1087 | 1087 | |||
1088 | mov $r1, %rax | 1088 | mov $r1, %rax | |
1089 | vpblendd \$0xfc, $ZERO, $ACC9, $ACC9 # correct $ACC3 | |||
1089 | imull $n0, %eax | 1090 | imull $n0, %eax | |
1091 | vpaddq $ACC9,$ACC4,$ACC4 # correct $ACC3 | |||
1090 | and \$0x1fffffff, %eax | 1092 | and \$0x1fffffff, %eax | |
1091 | 1093 | |||
1092 | imulq 16-128($ap),%rbx | 1094 | imulq 16-128($ap),%rbx | |
1093 | add %rbx,$r3 | 1095 | add %rbx,$r3 | |
1094 | vpmuludq $Bi,$TEMP1,$TEMP1 | 1096 | vpmuludq $Bi,$TEMP1,$TEMP1 | |
1095 | vmovd %eax, $Yi | 1097 | vmovd %eax, $Yi | |
1096 | vmovdqu -8+32*3-128($ap),$TEMP0 | 1098 | vmovdqu -8+32*3-128($ap),$TEMP0 | |
1097 | vpaddq $TEMP1,$ACC1,$ACC1 | 1099 | vpaddq $TEMP1,$ACC1,$ACC1 | |
1098 | vpmuludq $Bi,$TEMP2,$TEMP2 | 1100 | vpmuludq $Bi,$TEMP2,$TEMP2 | |
1099 | vpbroadcastq $Yi, $Yi | 1101 | vpbroadcastq $Yi, $Yi | |
1100 | vmovdqu -8+32*4-128($ap),$TEMP1 | 1102 | vmovdqu -8+32*4-128($ap),$TEMP1 | |
1101 | vpaddq $TEMP2,$ACC2,$ACC2 | 1103 | vpaddq $TEMP2,$ACC2,$ACC2 | |
1102 | vpmuludq $Bi,$TEMP0,$TEMP0 | 1104 | vpmuludq $Bi,$TEMP0,$TEMP0 | |
@@ -1312,35 +1314,32 @@ $code.=<<___; | @@ -1312,35 +1314,32 @@ $code.=<<___; | |||
1312 | vpmuludq $Yi,$TEMP2,$TEMP2 | 1314 | vpmuludq $Yi,$TEMP2,$TEMP2 | |
1313 | vmovq $r3, $TEMP1 | 1315 | vmovq $r3, $TEMP1 | |
1314 | vpaddq $TEMP2,$ACC9,$ACC8 | 1316 | vpaddq $TEMP2,$ACC9,$ACC8 | |
1315 | 1317 | |||
1316 | dec $i | 1318 | dec $i | |
1317 | jnz .Loop_mul_1024 | 1319 | jnz .Loop_mul_1024 | |
1318 | ___ | 1320 | ___ | |
1319 | 1321 | |||
1320 | # (*) Original implementation was correcting ACC1-ACC3 for overflow | 1322 | # (*) Original implementation was correcting ACC1-ACC3 for overflow | |
1321 | # after 7 loop runs, or after 28 iterations, or 56 additions. | 1323 | # after 7 loop runs, or after 28 iterations, or 56 additions. | |
1322 | # But as we underutilize resources, it's possible to correct in | 1324 | # But as we underutilize resources, it's possible to correct in | |
1323 | # each iteration with marginal performance loss. But then, as | 1325 | # each iteration with marginal performance loss. But then, as | |
1324 | # we do it in each iteration, we can correct less digits, and | 1326 | # we do it in each iteration, we can correct less digits, and | |
1325 | # avoid performance penalties completely. Also note that we | 1327 | # avoid performance penalties completely. | |
1326 | # correct only three digits out of four. This works because | |||
1327 | # most significant digit is subjected to less additions. | |||
1328 | 1328 | |||
1329 | $TEMP0 = $ACC9; | 1329 | $TEMP0 = $ACC9; | |
1330 | $TEMP3 = $Bi; | 1330 | $TEMP3 = $Bi; | |
1331 | $TEMP4 = $Yi; | 1331 | $TEMP4 = $Yi; | |
1332 | $code.=<<___; | 1332 | $code.=<<___; | |
1333 | vpermq \$0, $AND_MASK, $AND_MASK | |||
1334 | vpaddq (%rsp), $TEMP1, $ACC0 | 1333 | vpaddq (%rsp), $TEMP1, $ACC0 | |
1335 | 1334 | |||
1336 | vpsrlq \$29, $ACC0, $TEMP1 | 1335 | vpsrlq \$29, $ACC0, $TEMP1 | |
1337 | vpand $AND_MASK, $ACC0, $ACC0 | 1336 | vpand $AND_MASK, $ACC0, $ACC0 | |
1338 | vpsrlq \$29, $ACC1, $TEMP2 | 1337 | vpsrlq \$29, $ACC1, $TEMP2 | |
1339 | vpand $AND_MASK, $ACC1, $ACC1 | 1338 | vpand $AND_MASK, $ACC1, $ACC1 | |
1340 | vpsrlq \$29, $ACC2, $TEMP3 | 1339 | vpsrlq \$29, $ACC2, $TEMP3 | |
1341 | vpermq \$0x93, $TEMP1, $TEMP1 | 1340 | vpermq \$0x93, $TEMP1, $TEMP1 | |
1342 | vpand $AND_MASK, $ACC2, $ACC2 | 1341 | vpand $AND_MASK, $ACC2, $ACC2 | |
1343 | vpsrlq \$29, $ACC3, $TEMP4 | 1342 | vpsrlq \$29, $ACC3, $TEMP4 | |
1344 | vpermq \$0x93, $TEMP2, $TEMP2 | 1343 | vpermq \$0x93, $TEMP2, $TEMP2 | |
1345 | vpand $AND_MASK, $ACC3, $ACC3 | 1344 | vpand $AND_MASK, $ACC3, $ACC3 | |
1346 | 1345 | |||
@@ -1753,27 +1752,27 @@ $code.=<<___ if ($addx); | @@ -1753,27 +1752,27 @@ $code.=<<___ if ($addx); | |||
1753 | mov \$0,%edx | 1752 | mov \$0,%edx | |
1754 | and %eax,%ecx | 1753 | and %eax,%ecx | |
1755 | cmp \$`1<<8|1<<19`,%ecx # check for BMI2+AD*X | 1754 | cmp \$`1<<8|1<<19`,%ecx # check for BMI2+AD*X | |
1756 | cmove %edx,%eax | 1755 | cmove %edx,%eax | |
1757 | ___ | 1756 | ___ | |
1758 | $code.=<<___; | 1757 | $code.=<<___; | |
1759 | and \$`1<<5`,%eax | 1758 | and \$`1<<5`,%eax | |
1760 | shr \$5,%eax | 1759 | shr \$5,%eax | |
1761 | ret | 1760 | ret | |
1762 | .size rsaz_avx2_eligible,.-rsaz_avx2_eligible | 1761 | .size rsaz_avx2_eligible,.-rsaz_avx2_eligible | |
1763 | 1762 | |||
1764 | .align 64 | 1763 | .align 64 | |
1765 | .Land_mask: | 1764 | .Land_mask: | |
1766 | .quad 0x1fffffff,0x1fffffff,0x1fffffff,-1 | 1765 | .quad 0x1fffffff,0x1fffffff,0x1fffffff,0x1fffffff | |
1767 | .Lscatter_permd: | 1766 | .Lscatter_permd: | |
1768 | .long 0,2,4,6,7,7,7,7 | 1767 | .long 0,2,4,6,7,7,7,7 | |
1769 | .Lgather_permd: | 1768 | .Lgather_permd: | |
1770 | .long 0,7,1,7,2,7,3,7 | 1769 | .long 0,7,1,7,2,7,3,7 | |
1771 | .Linc: | 1770 | .Linc: | |
1772 | .long 0,0,0,0, 1,1,1,1 | 1771 | .long 0,0,0,0, 1,1,1,1 | |
1773 | .long 2,2,2,2, 3,3,3,3 | 1772 | .long 2,2,2,2, 3,3,3,3 | |
1774 | .long 4,4,4,4, 4,4,4,4 | 1773 | .long 4,4,4,4, 4,4,4,4 | |
1775 | .align 64 | 1774 | .align 64 | |
1776 | ___ | 1775 | ___ | |
1777 | 1776 | |||
1778 | if ($win64) { | 1777 | if ($win64) { | |
1779 | $rec="%rcx"; | 1778 | $rec="%rcx"; |
--- src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-mont5.pl 2017/01/27 22:55:23 1.1.1.7
+++ src/crypto/external/bsd/openssl/dist/crypto/bn/asm/x86_64-mont5.pl 2018/04/18 13:51:35 1.1.1.7.4.1
@@ -3080,31 +3080,39 @@ $code.=<<___; | @@ -3080,31 +3080,39 @@ $code.=<<___; | |||
3080 | adc 4*8($tptr),%r12 | 3080 | adc 4*8($tptr),%r12 | |
3081 | adc 5*8($tptr),%r13 | 3081 | adc 5*8($tptr),%r13 | |
3082 | adc 6*8($tptr),%r14 | 3082 | adc 6*8($tptr),%r14 | |
3083 | adc 7*8($tptr),%r15 | 3083 | adc 7*8($tptr),%r15 | |
3084 | lea 8*8($tptr),$tptr | 3084 | lea 8*8($tptr),$tptr | |
3085 | .byte 0x67 | 3085 | .byte 0x67 | |
3086 | sbb %rax,%rax # mov %cf,%rax | 3086 | sbb %rax,%rax # mov %cf,%rax | |
3087 | xor %ebx,%ebx # cf=0, of=0 | 3087 | xor %ebx,%ebx # cf=0, of=0 | |
3088 | mov %rax,16+8(%rsp) # offload carry | 3088 | mov %rax,16+8(%rsp) # offload carry | |
3089 | jmp .Lsqrx8x_loop | 3089 | jmp .Lsqrx8x_loop | |
3090 | 3090 | |||
3091 | .align 32 | 3091 | .align 32 | |
3092 | .Lsqrx8x_break: | 3092 | .Lsqrx8x_break: | |
3093 | sub 16+8(%rsp),%r8 # consume last carry | 3093 | xor $zero,$zero | |
3094 | sub 16+8(%rsp),%rbx # mov 16(%rsp),%cf | |||
3095 | adcx $zero,%r8 | |||
3094 | mov 24+8(%rsp),$carry # initial $tptr, borrow $carry | 3096 | mov 24+8(%rsp),$carry # initial $tptr, borrow $carry | |
3097 | adcx $zero,%r9 | |||
3095 | mov 0*8($aptr),%rdx # a[8], modulo-scheduled | 3098 | mov 0*8($aptr),%rdx # a[8], modulo-scheduled | |
3096 | xor %ebp,%ebp # xor $zero,$zero | 3099 | adc \$0,%r10 | |
3097 | mov %r8,0*8($tptr) | 3100 | mov %r8,0*8($tptr) | |
3101 | adc \$0,%r11 | |||
3102 | adc \$0,%r12 | |||
3103 | adc \$0,%r13 | |||
3104 | adc \$0,%r14 | |||
3105 | adc \$0,%r15 | |||
3098 | cmp $carry,$tptr # cf=0, of=0 | 3106 | cmp $carry,$tptr # cf=0, of=0 | |
3099 | je .Lsqrx8x_outer_loop | 3107 | je .Lsqrx8x_outer_loop | |
3100 | 3108 | |||
3101 | mov %r9,1*8($tptr) | 3109 | mov %r9,1*8($tptr) | |
3102 | mov 1*8($carry),%r9 | 3110 | mov 1*8($carry),%r9 | |
3103 | mov %r10,2*8($tptr) | 3111 | mov %r10,2*8($tptr) | |
3104 | mov 2*8($carry),%r10 | 3112 | mov 2*8($carry),%r10 | |
3105 | mov %r11,3*8($tptr) | 3113 | mov %r11,3*8($tptr) | |
3106 | mov 3*8($carry),%r11 | 3114 | mov 3*8($carry),%r11 | |
3107 | mov %r12,4*8($tptr) | 3115 | mov %r12,4*8($tptr) | |
3108 | mov 4*8($carry),%r12 | 3116 | mov 4*8($carry),%r12 | |
3109 | mov %r13,5*8($tptr) | 3117 | mov %r13,5*8($tptr) | |
3110 | mov 5*8($carry),%r13 | 3118 | mov 5*8($carry),%r13 |
--- src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c 2017/01/27 22:56:46 1.1.1.6
+++ src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c 2018/04/18 13:51:35 1.1.1.6.4.1
@@ -136,26 +136,29 @@ static int rsa_builtin_keygen(RSA *rsa, | @@ -136,26 +136,29 @@ static int rsa_builtin_keygen(RSA *rsa, | |||
136 | if (!rsa->q && ((rsa->q = BN_new()) == NULL)) | 136 | if (!rsa->q && ((rsa->q = BN_new()) == NULL)) | |
137 | goto err; | 137 | goto err; | |
138 | if (!rsa->dmp1 && ((rsa->dmp1 = BN_new()) == NULL)) | 138 | if (!rsa->dmp1 && ((rsa->dmp1 = BN_new()) == NULL)) | |
139 | goto err; | 139 | goto err; | |
140 | if (!rsa->dmq1 && ((rsa->dmq1 = BN_new()) == NULL)) | 140 | if (!rsa->dmq1 && ((rsa->dmq1 = BN_new()) == NULL)) | |
141 | goto err; | 141 | goto err; | |
142 | if (!rsa->iqmp && ((rsa->iqmp = BN_new()) == NULL)) | 142 | if (!rsa->iqmp && ((rsa->iqmp = BN_new()) == NULL)) | |
143 | goto err; | 143 | goto err; | |
144 | 144 | |||
145 | if (BN_copy(rsa->e, e_value) == NULL) | 145 | if (BN_copy(rsa->e, e_value) == NULL) | |
146 | goto err; | 146 | goto err; | |
147 | 147 | |||
148 | /* generate p and q */ | 148 | /* generate p and q */ | |
149 | BN_set_flags(rsa->p, BN_FLG_CONSTTIME); | |||
150 | BN_set_flags(rsa->q, BN_FLG_CONSTTIME); | |||
151 | BN_set_flags(r2, BN_FLG_CONSTTIME); | |||
149 | for (;;) { | 152 | for (;;) { | |
150 | if (!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb)) | 153 | if (!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb)) | |
151 | goto err; | 154 | goto err; | |
152 | if (!BN_sub(r2, rsa->p, BN_value_one())) | 155 | if (!BN_sub(r2, rsa->p, BN_value_one())) | |
153 | goto err; | 156 | goto err; | |
154 | if (!BN_gcd(r1, r2, rsa->e, ctx)) | 157 | if (!BN_gcd(r1, r2, rsa->e, ctx)) | |
155 | goto err; | 158 | goto err; | |
156 | if (BN_is_one(r1)) | 159 | if (BN_is_one(r1)) | |
157 | break; | 160 | break; | |
158 | if (!BN_GENCB_call(cb, 2, n++)) | 161 | if (!BN_GENCB_call(cb, 2, n++)) | |
159 | goto err; | 162 | goto err; | |
160 | } | 163 | } | |
161 | if (!BN_GENCB_call(cb, 3, 0)) | 164 | if (!BN_GENCB_call(cb, 3, 0)) |
--- src/crypto/external/bsd/openssl/dist/crypto/x509v3/Attic/v3_addr.c 2016/10/14 16:23:21 1.5
+++ src/crypto/external/bsd/openssl/dist/crypto/x509v3/Attic/v3_addr.c 2018/04/18 13:51:35 1.5.6.1
@@ -120,30 +120,32 @@ static int length_from_afi(const unsigne | @@ -120,30 +120,32 @@ static int length_from_afi(const unsigne | |||
120 | return 4; | 120 | return 4; | |
121 | case IANA_AFI_IPV6: | 121 | case IANA_AFI_IPV6: | |
122 | return 16; | 122 | return 16; | |
123 | default: | 123 | default: | |
124 | return 0; | 124 | return 0; | |
125 | } | 125 | } | |
126 | } | 126 | } | |
127 | 127 | |||
128 | /* | 128 | /* | |
129 | * Extract the AFI from an IPAddressFamily. | 129 | * Extract the AFI from an IPAddressFamily. | |
130 | */ | 130 | */ | |
131 | unsigned int v3_addr_get_afi(const IPAddressFamily *f) | 131 | unsigned int v3_addr_get_afi(const IPAddressFamily *f) | |
132 | { | 132 | { | |
133 | return ((f != NULL && | 133 | if (f == NULL | |
134 | f->addressFamily != NULL && f->addressFamily->data != NULL) | 134 | || f->addressFamily == NULL | |
135 | ? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1])) | 135 | || f->addressFamily->data == NULL | |
136 | : 0); | 136 | || f->addressFamily->length < 2) | |
137 | return 0; | |||
138 | return (f->addressFamily->data[0] << 8) | f->addressFamily->data[1]; | |||
137 | } | 139 | } | |
138 | 140 | |||
139 | /* | 141 | /* | |
140 | * Expand the bitstring form of an address into a raw byte array. | 142 | * Expand the bitstring form of an address into a raw byte array. | |
141 | * At the moment this is coded for simplicity, not speed. | 143 | * At the moment this is coded for simplicity, not speed. | |
142 | */ | 144 | */ | |
143 | static int addr_expand(unsigned char *addr, | 145 | static int addr_expand(unsigned char *addr, | |
144 | const ASN1_BIT_STRING *bs, | 146 | const ASN1_BIT_STRING *bs, | |
145 | const int length, const unsigned char fill) | 147 | const int length, const unsigned char fill) | |
146 | { | 148 | { | |
147 | if (bs->length < 0 || bs->length > length) | 149 | if (bs->length < 0 || bs->length > length) | |
148 | return 0; | 150 | return 0; | |
149 | if (bs->length > 0) { | 151 | if (bs->length > 0) { |
--- src/crypto/external/bsd/openssl/dist/ssl/Attic/ssl.h 2016/10/14 16:23:22 1.16
+++ src/crypto/external/bsd/openssl/dist/ssl/Attic/ssl.h 2018/04/18 13:51:36 1.16.6.1
@@ -1717,27 +1717,27 @@ extern "C" { | @@ -1717,27 +1717,27 @@ extern "C" { | |||
1717 | * indicate where we are up to in the SSL connection establishment. The | 1717 | * indicate where we are up to in the SSL connection establishment. The | |
1718 | * macros that follow are about the only things you should need to use and | 1718 | * macros that follow are about the only things you should need to use and | |
1719 | * even then, only when using non-blocking IO. It can also be useful to work | 1719 | * even then, only when using non-blocking IO. It can also be useful to work | |
1720 | * out where you were when the connection failed | 1720 | * out where you were when the connection failed | |
1721 | */ | 1721 | */ | |
1722 | 1722 | |||
1723 | # define SSL_ST_CONNECT 0x1000 | 1723 | # define SSL_ST_CONNECT 0x1000 | |
1724 | # define SSL_ST_ACCEPT 0x2000 | 1724 | # define SSL_ST_ACCEPT 0x2000 | |
1725 | # define SSL_ST_MASK 0x0FFF | 1725 | # define SSL_ST_MASK 0x0FFF | |
1726 | # define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) | 1726 | # define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) | |
1727 | # define SSL_ST_BEFORE 0x4000 | 1727 | # define SSL_ST_BEFORE 0x4000 | |
1728 | # define SSL_ST_OK 0x03 | 1728 | # define SSL_ST_OK 0x03 | |
1729 | # define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) | 1729 | # define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) | |
1730 | # define SSL_ST_ERR 0x05 | 1730 | # define SSL_ST_ERR (0x05|SSL_ST_INIT) | |
1731 | 1731 | |||
1732 | # define SSL_CB_LOOP 0x01 | 1732 | # define SSL_CB_LOOP 0x01 | |
1733 | # define SSL_CB_EXIT 0x02 | 1733 | # define SSL_CB_EXIT 0x02 | |
1734 | # define SSL_CB_READ 0x04 | 1734 | # define SSL_CB_READ 0x04 | |
1735 | # define SSL_CB_WRITE 0x08 | 1735 | # define SSL_CB_WRITE 0x08 | |
1736 | # define SSL_CB_ALERT 0x4000/* used in callback */ | 1736 | # define SSL_CB_ALERT 0x4000/* used in callback */ | |
1737 | # define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) | 1737 | # define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) | |
1738 | # define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) | 1738 | # define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) | |
1739 | # define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) | 1739 | # define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) | |
1740 | # define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) | 1740 | # define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) | |
1741 | # define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) | 1741 | # define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) | |
1742 | # define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) | 1742 | # define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) | |
1743 | # define SSL_CB_HANDSHAKE_START 0x10 | 1743 | # define SSL_CB_HANDSHAKE_START 0x10 |
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/rsaz-avx2.S 2017/01/08 01:59:43 1.2
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/rsaz-avx2.S 2018/04/18 13:51:36 1.2.6.1
@@ -57,27 +57,27 @@ rsaz_1024_sqr_avx2: | @@ -57,27 +57,27 @@ rsaz_1024_sqr_avx2: | |||
57 | .Lsqr_1024_no_n_copy: | 57 | .Lsqr_1024_no_n_copy: | |
58 | andq $-1024,%rsp | 58 | andq $-1024,%rsp | |
59 | 59 | |||
60 | vmovdqu 32-128(%rsi),%ymm1 | 60 | vmovdqu 32-128(%rsi),%ymm1 | |
61 | vmovdqu 64-128(%rsi),%ymm2 | 61 | vmovdqu 64-128(%rsi),%ymm2 | |
62 | vmovdqu 96-128(%rsi),%ymm3 | 62 | vmovdqu 96-128(%rsi),%ymm3 | |
63 | vmovdqu 128-128(%rsi),%ymm4 | 63 | vmovdqu 128-128(%rsi),%ymm4 | |
64 | vmovdqu 160-128(%rsi),%ymm5 | 64 | vmovdqu 160-128(%rsi),%ymm5 | |
65 | vmovdqu 192-128(%rsi),%ymm6 | 65 | vmovdqu 192-128(%rsi),%ymm6 | |
66 | vmovdqu 224-128(%rsi),%ymm7 | 66 | vmovdqu 224-128(%rsi),%ymm7 | |
67 | vmovdqu 256-128(%rsi),%ymm8 | 67 | vmovdqu 256-128(%rsi),%ymm8 | |
68 | 68 | |||
69 | leaq 192(%rsp),%rbx | 69 | leaq 192(%rsp),%rbx | |
70 | vpbroadcastq .Land_mask(%rip),%ymm15 | 70 | vmovdqu .Land_mask(%rip),%ymm15 | |
71 | jmp .LOOP_GRANDE_SQR_1024 | 71 | jmp .LOOP_GRANDE_SQR_1024 | |
72 | 72 | |||
73 | .align 32 | 73 | .align 32 | |
74 | .LOOP_GRANDE_SQR_1024: | 74 | .LOOP_GRANDE_SQR_1024: | |
75 | leaq 576+128(%rsp),%r9 | 75 | leaq 576+128(%rsp),%r9 | |
76 | leaq 448(%rsp),%r12 | 76 | leaq 448(%rsp),%r12 | |
77 | 77 | |||
78 | 78 | |||
79 | 79 | |||
80 | 80 | |||
81 | vpaddq %ymm1,%ymm1,%ymm1 | 81 | vpaddq %ymm1,%ymm1,%ymm1 | |
82 | vpbroadcastq 0-128(%rsi),%ymm10 | 82 | vpbroadcastq 0-128(%rsi),%ymm10 | |
83 | vpaddq %ymm2,%ymm2,%ymm2 | 83 | vpaddq %ymm2,%ymm2,%ymm2 | |
@@ -790,43 +790,45 @@ rsaz_1024_mul_avx2: | @@ -790,43 +790,45 @@ rsaz_1024_mul_avx2: | |||
790 | vmovq %xmm10,%rbx | 790 | vmovq %xmm10,%rbx | |
791 | vpaddq %ymm13,%ymm1,%ymm1 | 791 | vpaddq %ymm13,%ymm1,%ymm1 | |
792 | vpmuludq 64-128(%rcx),%ymm11,%ymm0 | 792 | vpmuludq 64-128(%rcx),%ymm11,%ymm0 | |
793 | vpaddq %ymm0,%ymm2,%ymm2 | 793 | vpaddq %ymm0,%ymm2,%ymm2 | |
794 | vpmuludq 96-128(%rcx),%ymm11,%ymm12 | 794 | vpmuludq 96-128(%rcx),%ymm11,%ymm12 | |
795 | vpaddq %ymm12,%ymm3,%ymm3 | 795 | vpaddq %ymm12,%ymm3,%ymm3 | |
796 | vpmuludq 128-128(%rcx),%ymm11,%ymm13 | 796 | vpmuludq 128-128(%rcx),%ymm11,%ymm13 | |
797 | vpaddq %ymm13,%ymm4,%ymm4 | 797 | vpaddq %ymm13,%ymm4,%ymm4 | |
798 | vpmuludq 160-128(%rcx),%ymm11,%ymm0 | 798 | vpmuludq 160-128(%rcx),%ymm11,%ymm0 | |
799 | vpaddq %ymm0,%ymm5,%ymm5 | 799 | vpaddq %ymm0,%ymm5,%ymm5 | |
800 | vpmuludq 192-128(%rcx),%ymm11,%ymm12 | 800 | vpmuludq 192-128(%rcx),%ymm11,%ymm12 | |
801 | vpaddq %ymm12,%ymm6,%ymm6 | 801 | vpaddq %ymm12,%ymm6,%ymm6 | |
802 | vpmuludq 224-128(%rcx),%ymm11,%ymm13 | 802 | vpmuludq 224-128(%rcx),%ymm11,%ymm13 | |
803 | vpblendd $3,%ymm14,%ymm9,%ymm9 | 803 | vpblendd $3,%ymm14,%ymm9,%ymm12 | |
804 | vpaddq %ymm13,%ymm7,%ymm7 | 804 | vpaddq %ymm13,%ymm7,%ymm7 | |
805 | vpmuludq 256-128(%rcx),%ymm11,%ymm0 | 805 | vpmuludq 256-128(%rcx),%ymm11,%ymm0 | |
806 | vpaddq %ymm9,%ymm3,%ymm3 | 806 | vpaddq %ymm12,%ymm3,%ymm3 | |
807 | vpaddq %ymm0,%ymm8,%ymm8 | 807 | vpaddq %ymm0,%ymm8,%ymm8 | |
808 | 808 | |||
809 | movq %rbx,%rax | 809 | movq %rbx,%rax | |
810 | imulq -128(%rsi),%rax | 810 | imulq -128(%rsi),%rax | |
811 | addq %rax,%r10 | 811 | addq %rax,%r10 | |
812 | vmovdqu -8+32-128(%rsi),%ymm12 | 812 | vmovdqu -8+32-128(%rsi),%ymm12 | |
813 | movq %rbx,%rax | 813 | movq %rbx,%rax | |
814 | imulq 8-128(%rsi),%rax | 814 | imulq 8-128(%rsi),%rax | |
815 | addq %rax,%r11 | 815 | addq %rax,%r11 | |
816 | vmovdqu -8+64-128(%rsi),%ymm13 | 816 | vmovdqu -8+64-128(%rsi),%ymm13 | |
817 | 817 | |||
818 | movq %r10,%rax | 818 | movq %r10,%rax | |
819 | vpblendd $0xfc,%ymm14,%ymm9,%ymm9 | |||
819 | imull %r8d,%eax | 820 | imull %r8d,%eax | |
821 | vpaddq %ymm9,%ymm4,%ymm4 | |||
820 | andl $0x1fffffff,%eax | 822 | andl $0x1fffffff,%eax | |
821 | 823 | |||
822 | imulq 16-128(%rsi),%rbx | 824 | imulq 16-128(%rsi),%rbx | |
823 | addq %rbx,%r12 | 825 | addq %rbx,%r12 | |
824 | vpmuludq %ymm10,%ymm12,%ymm12 | 826 | vpmuludq %ymm10,%ymm12,%ymm12 | |
825 | vmovd %eax,%xmm11 | 827 | vmovd %eax,%xmm11 | |
826 | vmovdqu -8+96-128(%rsi),%ymm0 | 828 | vmovdqu -8+96-128(%rsi),%ymm0 | |
827 | vpaddq %ymm12,%ymm1,%ymm1 | 829 | vpaddq %ymm12,%ymm1,%ymm1 | |
828 | vpmuludq %ymm10,%ymm13,%ymm13 | 830 | vpmuludq %ymm10,%ymm13,%ymm13 | |
829 | vpbroadcastq %xmm11,%ymm11 | 831 | vpbroadcastq %xmm11,%ymm11 | |
830 | vmovdqu -8+128-128(%rsi),%ymm12 | 832 | vmovdqu -8+128-128(%rsi),%ymm12 | |
831 | vpaddq %ymm13,%ymm2,%ymm2 | 833 | vpaddq %ymm13,%ymm2,%ymm2 | |
832 | vpmuludq %ymm10,%ymm0,%ymm0 | 834 | vpmuludq %ymm10,%ymm0,%ymm0 | |
@@ -1035,27 +1037,26 @@ rsaz_1024_mul_avx2: | @@ -1035,27 +1037,26 @@ rsaz_1024_mul_avx2: | |||
1035 | vpmuludq %ymm11,%ymm0,%ymm0 | 1037 | vpmuludq %ymm11,%ymm0,%ymm0 | |
1036 | vmovdqu -24+288-128(%rcx),%ymm13 | 1038 | vmovdqu -24+288-128(%rcx),%ymm13 | |
1037 | movq %r12,%r9 | 1039 | movq %r12,%r9 | |
1038 | vpaddq %ymm0,%ymm7,%ymm6 | 1040 | vpaddq %ymm0,%ymm7,%ymm6 | |
1039 | vpmuludq %ymm11,%ymm12,%ymm12 | 1041 | vpmuludq %ymm11,%ymm12,%ymm12 | |
1040 | addq (%rsp),%r9 | 1042 | addq (%rsp),%r9 | |
1041 | vpaddq %ymm12,%ymm8,%ymm7 | 1043 | vpaddq %ymm12,%ymm8,%ymm7 | |
1042 | vpmuludq %ymm11,%ymm13,%ymm13 | 1044 | vpmuludq %ymm11,%ymm13,%ymm13 | |
1043 | vmovq %r12,%xmm12 | 1045 | vmovq %r12,%xmm12 | |
1044 | vpaddq %ymm13,%ymm9,%ymm8 | 1046 | vpaddq %ymm13,%ymm9,%ymm8 | |
1045 | 1047 | |||
1046 | decl %r14d | 1048 | decl %r14d | |
1047 | jnz .Loop_mul_1024 | 1049 | jnz .Loop_mul_1024 | |
1048 | vpermq $0,%ymm15,%ymm15 | |||
1049 | vpaddq (%rsp),%ymm12,%ymm0 | 1050 | vpaddq (%rsp),%ymm12,%ymm0 | |
1050 | 1051 | |||
1051 | vpsrlq $29,%ymm0,%ymm12 | 1052 | vpsrlq $29,%ymm0,%ymm12 | |
1052 | vpand %ymm15,%ymm0,%ymm0 | 1053 | vpand %ymm15,%ymm0,%ymm0 | |
1053 | vpsrlq $29,%ymm1,%ymm13 | 1054 | vpsrlq $29,%ymm1,%ymm13 | |
1054 | vpand %ymm15,%ymm1,%ymm1 | 1055 | vpand %ymm15,%ymm1,%ymm1 | |
1055 | vpsrlq $29,%ymm2,%ymm10 | 1056 | vpsrlq $29,%ymm2,%ymm10 | |
1056 | vpermq $0x93,%ymm12,%ymm12 | 1057 | vpermq $0x93,%ymm12,%ymm12 | |
1057 | vpand %ymm15,%ymm2,%ymm2 | 1058 | vpand %ymm15,%ymm2,%ymm2 | |
1058 | vpsrlq $29,%ymm3,%ymm11 | 1059 | vpsrlq $29,%ymm3,%ymm11 | |
1059 | vpermq $0x93,%ymm13,%ymm13 | 1060 | vpermq $0x93,%ymm13,%ymm13 | |
1060 | vpand %ymm15,%ymm3,%ymm3 | 1061 | vpand %ymm15,%ymm3,%ymm3 | |
1061 | 1062 | |||
@@ -1675,23 +1676,23 @@ rsaz_avx2_eligible: | @@ -1675,23 +1676,23 @@ rsaz_avx2_eligible: | |||
1675 | movl OPENSSL_ia32cap_P+8(%rip),%eax | 1676 | movl OPENSSL_ia32cap_P+8(%rip),%eax | |
1676 | movl $524544,%ecx | 1677 | movl $524544,%ecx | |
1677 | movl $0,%edx | 1678 | movl $0,%edx | |
1678 | andl %eax,%ecx | 1679 | andl %eax,%ecx | |
1679 | cmpl $524544,%ecx | 1680 | cmpl $524544,%ecx | |
1680 | cmovel %edx,%eax | 1681 | cmovel %edx,%eax | |
1681 | andl $32,%eax | 1682 | andl $32,%eax | |
1682 | shrl $5,%eax | 1683 | shrl $5,%eax | |
1683 | .byte 0xf3,0xc3 | 1684 | .byte 0xf3,0xc3 | |
1684 | .size rsaz_avx2_eligible,.-rsaz_avx2_eligible | 1685 | .size rsaz_avx2_eligible,.-rsaz_avx2_eligible | |
1685 | 1686 | |||
1686 | .align 64 | 1687 | .align 64 | |
1687 | .Land_mask: | 1688 | .Land_mask: | |
1688 | .quad 0x1fffffff,0x1fffffff,0x1fffffff,-1 | 1689 | .quad 0x1fffffff,0x1fffffff,0x1fffffff,0x1fffffff | |
1689 | .Lscatter_permd: | 1690 | .Lscatter_permd: | |
1690 | .long 0,2,4,6,7,7,7,7 | 1691 | .long 0,2,4,6,7,7,7,7 | |
1691 | .Lgather_permd: | 1692 | .Lgather_permd: | |
1692 | .long 0,7,1,7,2,7,3,7 | 1693 | .long 0,7,1,7,2,7,3,7 | |
1693 | .Linc: | 1694 | .Linc: | |
1694 | .long 0,0,0,0, 1,1,1,1 | 1695 | .long 0,0,0,0, 1,1,1,1 | |
1695 | .long 2,2,2,2, 3,3,3,3 | 1696 | .long 2,2,2,2, 3,3,3,3 | |
1696 | .long 4,4,4,4, 4,4,4,4 | 1697 | .long 4,4,4,4, 4,4,4,4 | |
1697 | .align 64 | 1698 | .align 64 |
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/x86_64-mont5.S 2017/01/27 23:00:46 1.5
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/x86_64/x86_64-mont5.S 2018/04/18 13:51:36 1.5.4.1
@@ -3066,31 +3066,39 @@ __bn_sqrx8x_internal: | @@ -3066,31 +3066,39 @@ __bn_sqrx8x_internal: | |||
3066 | adcq 32(%rdi),%r12 | 3066 | adcq 32(%rdi),%r12 | |
3067 | adcq 40(%rdi),%r13 | 3067 | adcq 40(%rdi),%r13 | |
3068 | adcq 48(%rdi),%r14 | 3068 | adcq 48(%rdi),%r14 | |
3069 | adcq 56(%rdi),%r15 | 3069 | adcq 56(%rdi),%r15 | |
3070 | leaq 64(%rdi),%rdi | 3070 | leaq 64(%rdi),%rdi | |
3071 | .byte 0x67 | 3071 | .byte 0x67 | |
3072 | sbbq %rax,%rax | 3072 | sbbq %rax,%rax | |
3073 | xorl %ebx,%ebx | 3073 | xorl %ebx,%ebx | |
3074 | movq %rax,16+8(%rsp) | 3074 | movq %rax,16+8(%rsp) | |
3075 | jmp .Lsqrx8x_loop | 3075 | jmp .Lsqrx8x_loop | |
3076 | 3076 | |||
3077 | .align 32 | 3077 | .align 32 | |
3078 | .Lsqrx8x_break: | 3078 | .Lsqrx8x_break: | |
3079 | subq 16+8(%rsp),%r8 | 3079 | xorq %rbp,%rbp | |
3080 | subq 16+8(%rsp),%rbx | |||
3081 | adcxq %rbp,%r8 | |||
3080 | movq 24+8(%rsp),%rcx | 3082 | movq 24+8(%rsp),%rcx | |
3083 | adcxq %rbp,%r9 | |||
3081 | movq 0(%rsi),%rdx | 3084 | movq 0(%rsi),%rdx | |
3082 | xorl %ebp,%ebp | 3085 | adcq $0,%r10 | |
3083 | movq %r8,0(%rdi) | 3086 | movq %r8,0(%rdi) | |
3087 | adcq $0,%r11 | |||
3088 | adcq $0,%r12 | |||
3089 | adcq $0,%r13 | |||
3090 | adcq $0,%r14 | |||
3091 | adcq $0,%r15 | |||
3084 | cmpq %rcx,%rdi | 3092 | cmpq %rcx,%rdi | |
3085 | je .Lsqrx8x_outer_loop | 3093 | je .Lsqrx8x_outer_loop | |
3086 | 3094 | |||
3087 | movq %r9,8(%rdi) | 3095 | movq %r9,8(%rdi) | |
3088 | movq 8(%rcx),%r9 | 3096 | movq 8(%rcx),%r9 | |
3089 | movq %r10,16(%rdi) | 3097 | movq %r10,16(%rdi) | |
3090 | movq 16(%rcx),%r10 | 3098 | movq 16(%rcx),%r10 | |
3091 | movq %r11,24(%rdi) | 3099 | movq %r11,24(%rdi) | |
3092 | movq 24(%rcx),%r11 | 3100 | movq 24(%rcx),%r11 | |
3093 | movq %r12,32(%rdi) | 3101 | movq %r12,32(%rdi) | |
3094 | movq 32(%rcx),%r12 | 3102 | movq 32(%rcx),%r12 | |
3095 | movq %r13,40(%rdi) | 3103 | movq %r13,40(%rdi) | |
3096 | movq 40(%rcx),%r13 | 3104 | movq 40(%rcx),%r13 |